-
Notifications
You must be signed in to change notification settings - Fork 38
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
Compute chain MMR root #71
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left just a few nits inline.
let prev_hash = witness.prev_header.prev_hash(); | ||
let block_num = witness.prev_header.block_num(); | ||
let prev_hash = witness.prev_header.hash(); | ||
let block_num = witness.prev_header.block_num() + Felt::ONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: instead of using Felt::ONE
we usually just use constant ONE
(can be imported from miden base, i believe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done (also changed the Felt::ZERO
to ZERO
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left a few minor comments inline.
pub struct BlockWitness { | ||
pub(super) updated_accounts: BTreeMap<AccountId, AccountUpdate>, | ||
/// (batch_index, created_notes_root) for batches that contain notes | ||
pub(super) batch_created_notes_roots: Vec<(usize, Digest)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a benefit to using Vec<(usize, Digest)>
instead of BTreeMap<usize, Digest>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to BTreeMap
to be consistent with updated_accounts
, but I think Vec
would be better (for both) than BTreeMap
, since it's more cache efficient (everything's in the same chunk of memory as opposed to be more spread out with the BTreeMap
), and we don't actually need any operations from the BTreeMap
.
But this is a minor detail and BTreeMap
is fine for now
Closes: #68
Builds on: #64
Left to do:
BlockWitness
ToAdviceInputs
forMmrPeaks
when ExposeToAdviceInputs
miden-base#333 is merged