Skip to content

Commit

Permalink
handle empty contract_proof
Browse files Browse the repository at this point in the history
  • Loading branch information
ftheirs committed Nov 22, 2024
1 parent 51c5693 commit 5a2a3f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions crates/bin/prove_block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,15 @@ pub async fn prove_block(
let updated_root = block_hash_storage_proof.class_commitment.unwrap_or(Felt::ZERO);
let previous_root = previous_block_hash_storage_proof.class_commitment.unwrap_or(Felt::ZERO);

let previous_contract_trie_root = previous_block_hash_storage_proof.contract_proof[0].hash::<PedersenHash>();
let current_contract_trie_root = block_hash_storage_proof.contract_proof[0].hash::<PedersenHash>();
// TODO: explain this
let previous_contract_trie_root = match previous_block_hash_storage_proof.contract_proof.first() {
Some(proof) => proof.hash::<PedersenHash>(),
None => Felt252::ZERO,
};
let current_contract_trie_root = match block_hash_storage_proof.contract_proof.first() {
Some(proof) => proof.hash::<PedersenHash>(),
None => Felt252::ZERO,
};

let previous_contract_proofs: Vec<_> =
previous_storage_proofs.values().map(|proof| proof.contract_proof.clone()).collect();
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-client/src/pathfinder/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl ContractData {

#[derive(Debug, Clone, Deserialize)]
pub struct PathfinderProof {
pub state_commitment: Felt,
pub state_commitment: Option<Felt>,
pub class_commitment: Option<Felt>,
pub contract_proof: Vec<TrieNode>,
pub contract_data: Option<ContractData>,
Expand Down

0 comments on commit 5a2a3f7

Please sign in to comment.