From e969a9a01fd0345e51039ae04c6c8a86178a391f Mon Sep 17 00:00:00 2001 From: Pia Date: Thu, 5 Sep 2024 17:43:05 +0900 Subject: [PATCH] test case for storage proof --- hdp/src/provider/starknet/rpc.rs | 16 +++++++++++----- hdp/src/provider/starknet/types.rs | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hdp/src/provider/starknet/rpc.rs b/hdp/src/provider/starknet/rpc.rs index 542f65ac..a0c5c432 100644 --- a/hdp/src/provider/starknet/rpc.rs +++ b/hdp/src/provider/starknet/rpc.rs @@ -170,6 +170,7 @@ async fn pathfinder_get_proof( let response = provider.post(url).json(&request).send().await?; let response_json = serde_json::from_str::(&response.text().await?)?["result"].clone(); + println!("response_json: {:?}", response_json); let get_proof_output: GetProofOutput = serde_json::from_value(response_json)?; Ok(get_proof_output) } @@ -206,16 +207,21 @@ 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 = 156600; - let target_block_end = 156700; + let target_block_start = 56400; + let target_block_end = 56401; let target_block_range = (target_block_start..=target_block_end).collect::>(); let provider = test_provider(); let proof = provider .get_storage_proofs( target_block_range.clone(), - Felt::from_str("0x23371b227eaecd8e8920cd429d2cd0f3fee6abaacca08d3ab82a7cdd") - .unwrap(), - Felt::from_str("0x2").unwrap(), + Felt::from_str( + "0x017E2D0662675DD83B4B58A0A659EAFA131FDD01FA6DABD5002D8815DD2D17A5", + ) + .unwrap(), + Felt::from_str( + "0x004C4FB1AB068F6039D5780C68DD0FA2F8742CCEB3426D19667778CA7F3518A9", + ) + .unwrap(), ) .await .unwrap(); diff --git a/hdp/src/provider/starknet/types.rs b/hdp/src/provider/starknet/types.rs index 3ff53a26..557ac85a 100644 --- a/hdp/src/provider/starknet/types.rs +++ b/hdp/src/provider/starknet/types.rs @@ -25,6 +25,8 @@ 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.