diff --git a/hdp/src/provider/starknet/rpc.rs b/hdp/src/provider/starknet/rpc.rs index a0c5c432..bfa6f75a 100644 --- a/hdp/src/provider/starknet/rpc.rs +++ b/hdp/src/provider/starknet/rpc.rs @@ -206,9 +206,8 @@ mod tests { #[tokio::test] async fn test_get_100_range_storage_with_proof() { - // TODO: why the storage proof returns same value as account proof let target_block_start = 56400; - let target_block_end = 56401; + let target_block_end = 56500; let target_block_range = (target_block_start..=target_block_end).collect::>(); let provider = test_provider(); let proof = provider @@ -228,22 +227,25 @@ mod tests { assert_eq!(proof.len(), target_block_range.len()); let output = proof.get(&target_block_start).unwrap(); - println!("Proof: {:?}", output); + assert_eq!( output.state_commitment.unwrap(), - Felt::from_str("0x26da0f5f0849cf69b4872ef5dced3ec68ce28c5e3f53207280113abb7feb158") + Felt::from_str("0x598cf91d9a3a7176d01926e8442b8bd83299168f723cb2d52080e895400d9a1") .unwrap() ); - assert_eq!(output.contract_proof.len(), 23); + assert_eq!(output.contract_proof.len(), 17); assert_eq!( output.class_commitment.unwrap(), - Felt::from_str("0x46c1a0374b8ccf8d928e62ef40974304732c8a28f10b2c494adfabfcff0fa0a") + Felt::from_str("0x324d06b207f2891ef395ba1e7a0ef92b61a5772a294a289362dc37b0469c453") .unwrap() ); - assert!(output.contract_data.is_none()); + assert_eq!( + output.contract_data.clone().unwrap().storage_proofs[0].len(), + 5 + ); } #[tokio::test] diff --git a/hdp/src/provider/starknet/types.rs b/hdp/src/provider/starknet/types.rs index 557ac85a..33180733 100644 --- a/hdp/src/provider/starknet/types.rs +++ b/hdp/src/provider/starknet/types.rs @@ -6,7 +6,7 @@ use starknet_types_core::{felt::Felt, hash::StarkHash}; /// Holds the membership/non-membership of a contract and its associated /// contract contract if the contract exists. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[skip_serializing_none] pub struct GetProofOutput { /// The global state commitment for Starknet 0.11.0 blocks onwards, if @@ -25,8 +25,6 @@ pub struct GetProofOutput { /// Additional contract data if it exists. pub contract_data: Option, - - pub storage_proofs: Option>>, } /// A node in a Starknet patricia-merkle trie. @@ -65,7 +63,7 @@ impl TrieNode { } /// Holds the data and proofs for a specific contract. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct ContractData { /// Required to verify the contract state hash to contract root calculation. class_hash: Felt, @@ -80,5 +78,5 @@ pub struct ContractData { contract_state_hash_version: Felt, /// The proofs associated with the queried storage values - storage_proofs: Vec>, + pub storage_proofs: Vec>, }