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

v0_8 get_storage_proof returning proofs out of order #2458

Open
GMKrieger opened this issue Dec 23, 2024 · 0 comments
Open

v0_8 get_storage_proof returning proofs out of order #2458

GMKrieger opened this issue Dec 23, 2024 · 0 comments

Comments

@GMKrieger
Copy link

GMKrieger commented Dec 23, 2024

The methods get_class_proofs, get_contract_proofs and get_contract_storage_proofs methods inside get_storage_proof are returning the proofs out of order and flattened into a single Vec. This bug occurs on this snippets of code:

let nodes: Vec<NodeHashToNodeMapping> =
ClassCommitmentTree::get_proofs(tx, block_number, class_hashes, class_root_idx)?
.into_iter()
.flatten()
.map(|(node, node_hash)| NodeHashToNodeMapping {
node_hash,
node: ProofNode(node),
})
.collect::<HashSet<_>>()
.into_iter()
.collect();
let classes_proof = NodeHashToNodeMappings(nodes);

let nodes =
StorageCommitmentTree::get_proofs(tx, block_number, contract_addresses, storage_root_idx)?
.into_iter()
.flatten()
.map(|(node, node_hash)| NodeHashToNodeMapping {
node_hash,
node: ProofNode(node),
})
.collect::<HashSet<_>>()
.into_iter()
.collect();

let nodes: Vec<NodeHashToNodeMapping> = ContractsStorageTree::get_proofs(
&tx,
csk.contract_address,
block_number,
&csk.storage_keys,
root,
)?
.into_iter()
.flatten()
.map(|(node, node_hash)| NodeHashToNodeMapping {
node_hash,
node: ProofNode(node),
})
.collect::<HashSet<_>>()
.into_iter()
.collect();
proofs.push(NodeHashToNodeMappings(nodes));

@GMKrieger GMKrieger changed the title v0_8 get_storage_proof returning contracts and contract storage proofs out of order v0_8 get_storage_proof returning proofs out of order Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant