Skip to content

Consider storing the sum tree as a dynamic array #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Stebalien opened this issue Apr 17, 2025 · 1 comment
Open

Consider storing the sum tree as a dynamic array #153

Stebalien opened this issue Apr 17, 2025 · 1 comment

Comments

@Stebalien
Copy link
Collaborator

Right now, it's stored as a mapping. Unfortunately, that means:

  1. We waste a hash syscall every time we do a lookup (not huge).
  2. Every step will access a random slot which will lead to an IPLD load.

If we switch to a dynamic array, I think the last 5 steps (once we're within 5 bits of the target) should all fall within 1-2 IPLD nodes so we should save 4-5 IPLD loads every time we search.

@rjan90
Copy link
Contributor

rjan90 commented Apr 21, 2025

We are keeping this around as an informational issue about potential future gas savings.

@rjan90 rjan90 removed the status in PDP Apr 21, 2025
@rjan90 rjan90 moved this to 🐱 Todo in PDP May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🐱 Todo
Development

No branches or pull requests

2 participants