Skip to content
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

forest value should be u64 instead of usize (in MmrPeaks, Mmr, etc) #229

Open
Tracked by #194
plafer opened this issue Nov 28, 2023 · 1 comment
Open
Tracked by #194

forest value should be u64 instead of usize (in MmrPeaks, Mmr, etc) #229

plafer opened this issue Nov 28, 2023 · 1 comment
Milestone

Comments

@plafer
Copy link
Contributor

plafer commented Nov 28, 2023

We currently use usize for the value of forest, which extends to many other places (such as MmrPeaks::num_leaves).

The size of usize is dependent on the hardware it's being run on. This is not exactly the behavior we want; abstractly, the VM can manipulate an Mmr with up to 2^64 - 2^32 leaves. Thus, a better choice would be to use u64, which converts naturally to/from a Felt.

It will also make the Mmr nicer to work with:

// before
let forest = Felt::from(mmr.forest() as u64);

// after
let forest: Felt = mmr.forest().into();
@bobbinth
Copy link
Contributor

I would probably address this in the context of #196.

@bobbinth bobbinth added this to the v0.8 milestone Jan 5, 2024
@bobbinth bobbinth modified the milestones: v0.8, v0.9 Feb 13, 2024
@bobbinth bobbinth modified the milestones: v0.9, v0.10.0 Mar 24, 2024
@bobbinth bobbinth modified the milestones: v0.10.0, v0.11.0 Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants