From 8d4f258646658054907b6e73e4138c0ed005e382 Mon Sep 17 00:00:00 2001 From: Pia Date: Mon, 9 Sep 2024 17:33:05 +0900 Subject: [PATCH] wip --- src/lib.rs | 3 +++ src/starknet/rpc.rs | 1 - src/starknet/tx_trie.rs | 10 +++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ae8c593..1a47555 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,9 @@ pub enum SnTrieError { #[error("Invalid transaction index")] InvalidTxIndex, + + #[error("Invalid commit")] + InvalidCommitment, } #[derive(Error, Debug)] diff --git a/src/starknet/rpc.rs b/src/starknet/rpc.rs index 7b0b3e5..9e69872 100644 --- a/src/starknet/rpc.rs +++ b/src/starknet/rpc.rs @@ -67,7 +67,6 @@ impl GatewayProvider { if response.status().is_success() { let block_data: Value = response.json().await.unwrap(); - println!("block_data: {}", block_data); let block_data: &Value = &block_data["transaction_commitment"]; Ok(block_data.to_string()) } else { diff --git a/src/starknet/tx_trie.rs b/src/starknet/tx_trie.rs index d2b20b1..c2fa23d 100644 --- a/src/starknet/tx_trie.rs +++ b/src/starknet/tx_trie.rs @@ -57,13 +57,9 @@ impl<'a> TxsMptHandler<'a> { } let (root, root_idx) = tree.commit().unwrap(); - println!("expected root: {:?}", expected_commit); - println!("root: {:?}", expected_commit); - - // assert_eq!( - // root, - // Felt::from_bytes_be_slice(hex::decode(expected_commit).unwrap().as_slice()) - // ); + // TODO: Slightly root value is different huh + println!("root: {:?}", root); + println!("expected_commit: {:?}", expected_commit); let result_mpt = TxsMpt { trie: tree,