-
Notifications
You must be signed in to change notification settings - Fork 229
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
feat(proof): pathfinder_getClassProof endpoint #2179
base: main
Are you sure you want to change the base?
feat(proof): pathfinder_getClassProof endpoint #2179
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.
I see nothing objectionable, but @kkovaacs is our trie expert.
Also not sure if something like this will be in the v0.8 spec maybe, so this endpoint won't be necessary anymore. There's a PR open for this in the specs repo. (I understand you may already be aware of this.)
fn leaf(&self, path: &BitSlice<u8, Msb0>) -> anyhow::Result<Option<Felt>> { | ||
assert!(path.len() == 251); | ||
|
||
let Some(block) = self.block else { | ||
return Ok(None); | ||
}; | ||
|
||
let sierra = | ||
ClassHash(Felt::from_bits(path).context("Mapping leaf path to contract address")?); | ||
|
||
let casm = self | ||
.tx | ||
.casm_hash_at(block.into(), sierra) | ||
.context("Querying CASM hash")?; | ||
let Some(casm) = casm else { | ||
return Ok(None); | ||
}; | ||
|
||
let value = self.tx.class_commitment_leaf(block, &casm)?.map(|x| x.0); | ||
|
||
Ok(value) | ||
} |
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.
Hmm, this seems a bit strange. How is this actually different from ClassStorage::leaf()
?
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.
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.
It's not, it's an artifact from earlier attempts. Will remove it.
Added a new endpoint
pathfinder/v0.1/pathfinder_getClassProof
that returns the Merkle proof of any class hash in the class trie.This new endpoint is necessary to run the Starknet OS to completion as we need the full class commitment as input of the OS.