From eff531df7584ba9c92bea8a0b833573564494920 Mon Sep 17 00:00:00 2001 From: EvolveArt Date: Fri, 7 Jul 2023 20:23:07 +0000 Subject: [PATCH] deploy: 2aee82567510954e35c042621a78ed18ae05e1e8 --- mc_rpc/index.html | 2 +- mc_rpc/struct.Starknet.html | 16 +++++++-------- mc_rpc/trait.StarknetRpcApiServer.html | 2 +- src/mc_rpc/lib.rs.html | 28 +++++++++++++++++--------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/mc_rpc/index.html b/mc_rpc/index.html index 72b732284f..8633356d75 100644 --- a/mc_rpc/index.html +++ b/mc_rpc/index.html @@ -1,4 +1,4 @@ -mc_rpc - Rust

Crate mc_rpc

source ·
Expand description

Starknet RPC server API implementation

+mc_rpc - Rust

Crate mc_rpc

source ·
Expand description

Starknet RPC server API implementation

It uses the madara client and backend in order to answer queries.

Structs

  • A Starknet RPC server for Madara

Traits

Functions

\ No newline at end of file diff --git a/mc_rpc/struct.Starknet.html b/mc_rpc/struct.Starknet.html index ceb117c1df..3f947156fa 100644 --- a/mc_rpc/struct.Starknet.html +++ b/mc_rpc/struct.Starknet.html @@ -43,7 +43,7 @@

Arguments

StarknetRuntimeApi<B> + ConvertTransactionRuntimeApi<B>, BE: Backend<B>, - H: HasherT + ThreadSafeCopy,
source

pub fn current_block_hash(&self) -> Result<H256, ApiError>

Trait Implementations§

source§

impl<A, B, BE, C, P, H> StarknetRpcApiServer for Starknet<A, B, BE, C, P, H>where + H: HasherT + ThreadSafeCopy,

source

pub fn current_block_hash(&self) -> Result<H256, ApiError>

Trait Implementations§

source§

impl<A, B, BE, C, P, H> StarknetRpcApiServer for Starknet<A, B, BE, C, P, H>where A: ChainApi<Block = B> + 'static, B: BlockT, P: TransactionPool<Block = B> + 'static, @@ -141,19 +141,19 @@
Returns
&self, block_id: BlockId ) -> RpcResult<MaybePendingBlockWithTxs>

Get block information with full transactions given the block id

-
source§

fn get_state_update(&self, block_id: BlockId) -> RpcResult<StateUpdate>

Get the information about the result of executing the requested block

-
source§

fn pending_transactions<'life0, 'async_trait>( +

source§

fn get_state_update(&self, block_id: BlockId) -> RpcResult<StateUpdate>

Get the information about the result of executing the requested block

+
source§

fn pending_transactions<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = RpcResult<Vec<Transaction>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the transactions in the transaction pool, recognized by this sequencer

-
source§

fn get_events<'life0, 'async_trait>( +

source§

fn get_events<'life0, 'async_trait>( &'life0 self, filter: EventFilterWithPage ) -> Pin<Box<dyn Future<Output = RpcResult<EventsPage>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns all events matching the given filter

-
source§

fn add_declare_transaction<'life0, 'async_trait>( +

source§

fn add_declare_transaction<'life0, 'async_trait>( &'life0 self, declare_transaction: BroadcastedDeclareTransaction ) -> Pin<Box<dyn Future<Output = RpcResult<DeclareTransactionResult>> + Send + 'async_trait>>where @@ -167,7 +167,7 @@
Returns
  • declare_transaction_result - the result of the declare transaction
-

source§

fn get_transaction_by_hash( +

source§

fn get_transaction_by_hash( &self, transaction_hash: FieldElement ) -> RpcResult<Transaction>

Returns a transaction details from it’s hash.

@@ -178,7 +178,7 @@
Arguments
  • transaction_hash - Transaction hash corresponding to the transaction.
-
source§

fn get_transaction_receipt( +

source§

fn get_transaction_receipt( &self, transaction_hash: FieldElement ) -> RpcResult<MaybePendingTransactionReceipt>

Returns the receipt of a transaction by transaction hash.

@@ -186,7 +186,7 @@
Arguments
  • transaction_hash - Transaction hash corresponding to the transaction.
-
source§

fn get_proof( +

source§

fn get_proof( &self, get_proof_input: RpcGetProofInput ) -> RpcResult<RpcGetProofOutput>

This endpoint aims to do the same as EIP-1186 diff --git a/mc_rpc/trait.StarknetRpcApiServer.html b/mc_rpc/trait.StarknetRpcApiServer.html index f6506b188a..0b285712ec 100644 --- a/mc_rpc/trait.StarknetRpcApiServer.html +++ b/mc_rpc/trait.StarknetRpcApiServer.html @@ -214,7 +214,7 @@ ) -> Result<RpcGetProofOutput, Error>

Returns all the necessary data to trustlessly verify storage slots for a particular contract.

Provided Methods§

source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

-

Implementors§

source§

impl<A, B, BE, C, P, H> StarknetRpcApiServer for Starknet<A, B, BE, C, P, H>where +

Implementors§

source§

impl<A, B, BE, C, P, H> StarknetRpcApiServer for Starknet<A, B, BE, C, P, H>where A: ChainApi<Block = B> + 'static, B: BlockT, P: TransactionPool<Block = B> + 'static, diff --git a/src/mc_rpc/lib.rs.html b/src/mc_rpc/lib.rs.html index 6e5d28482f..02095bc17f 100644 --- a/src/mc_rpc/lib.rs.html +++ b/src/mc_rpc/lib.rs.html @@ -1027,6 +1027,10 @@ 1027 1028 1029 +1030 +1031 +1032 +1033
//! Starknet RPC server API implementation
 //!
 //! It uses the madara client and backend in order to answer queries.
@@ -1651,21 +1655,25 @@
 
         let block = get_block_by_block_hash(self.client.as_ref(), substrate_block_hash).unwrap_or_default();
 
-        let parent_block_hash = (TryInto::<FieldElement>::try_into(block.header().parent_block_hash)).unwrap();
-
-        let substrate_parent_block_hash =
-            self.substrate_block_hash_from_starknet_block(BlockId::Hash(parent_block_hash)).map_err(|e| {
-                error!("'{e}'");
-                StarknetRpcApiError::BlockNotFound
-            })?;
+        let old_root = if block.header().block_number > 0 {
+            let parent_block_hash = (TryInto::<FieldElement>::try_into(block.header().parent_block_hash)).unwrap();
+            let substrate_parent_block_hash =
+                self.substrate_block_hash_from_starknet_block(BlockId::Hash(parent_block_hash)).map_err(|e| {
+                    error!("'{e}'");
+                    StarknetRpcApiError::BlockNotFound
+                })?;
 
-        let parent_block =
-            get_block_by_block_hash(self.client.as_ref(), substrate_parent_block_hash).unwrap_or_default();
+            let parent_block =
+                get_block_by_block_hash(self.client.as_ref(), substrate_parent_block_hash).unwrap_or_default();
+            parent_block.header().global_state_root.into()
+        } else {
+            FieldElement::default()
+        };
 
         Ok(StateUpdate {
             block_hash: block.header().hash(*self.hasher).into(),
             new_root: block.header().global_state_root.into(),
-            old_root: parent_block.header().global_state_root.into(),
+            old_root,
             state_diff: StateDiff {
                 storage_diffs: Vec::new(),
                 deprecated_declared_classes: Vec::new(),