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

Prefer commitment over root #1069

Open
Mirko-von-Leipzig opened this issue Jan 16, 2025 · 1 comment
Open

Prefer commitment over root #1069

Mirko-von-Leipzig opened this issue Jan 16, 2025 · 1 comment
Milestone

Comments

@Mirko-von-Leipzig
Copy link
Contributor

Originally raised as a concern in 0xPolygonMiden/miden-node#620 (comment).

Consider changing various xxx_root and xxx_hash fields into xxx_commitment where applicable e.g. in the block header.

Ideally root should only be used to describe fields representing the root of some tree. Take into account potential future changes e.g. just because the commitment is currently the root of some tree, does not mean it will always be. Commitments often change to encompass other tree roots, or combine other hashes which results in api churn and breaking changes.

Some of these changes could be contested, so I suggest submitting a list of proposed fields before embarking on a wider refactor.

@PhilippGackstatter
Copy link
Contributor

Fully agree!

Adding AccountHeader to the list which uses root for the vault but commitment for storage and code:

pub struct AccountHeader {
id: AccountId,
nonce: Felt,
vault_root: Digest,
storage_commitment: Digest,
code_commitment: Digest,

But the method on the vault to get the "root" is called AssetVault::commitment, leading to assigning a commitment to a root which feels inconsistent:

impl From<&Account> for AccountHeader {
fn from(account: &Account) -> Self {
Self {
id: account.id(),
nonce: account.nonce(),
vault_root: account.vault().commitment(),
storage_commitment: account.storage().commitment(),
code_commitment: account.code().commitment(),
}
}
}

This could be made more consistent by using commitment.

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

3 participants