From 237019dcdb6490db9fc8659ffa7c1f3d98389d54 Mon Sep 17 00:00:00 2001 From: Yogalholic Date: Tue, 21 Nov 2023 11:18:41 +0100 Subject: [PATCH] move StarknetRuntimeApi trait definition in its own crate --- Cargo.lock | 58 ++++++++ Cargo.toml | 4 +- .../client/commitment-state-diff/Cargo.toml | 1 + .../client/commitment-state-diff/src/lib.rs | 2 +- crates/client/mapping-sync/Cargo.toml | 1 + crates/client/mapping-sync/src/lib.rs | 2 +- crates/client/mapping-sync/src/sync_blocks.rs | 2 +- crates/client/rpc/Cargo.toml | 1 + crates/client/rpc/src/errors.rs | 2 +- crates/client/rpc/src/events/mod.rs | 2 +- crates/client/rpc/src/lib.rs | 2 +- crates/client/storage/Cargo.toml | 1 + crates/client/storage/src/lib.rs | 2 +- crates/client/storage/src/overrides/mod.rs | 2 +- crates/node/Cargo.toml | 1 + crates/node/src/rpc/mod.rs | 4 +- crates/pallets/starknet/src/lib.rs | 2 - crates/pallets/starknet/src/runtime_api.rs | 139 ------------------ crates/runtime/Cargo.toml | 1 + crates/runtime/src/lib.rs | 8 +- 20 files changed, 81 insertions(+), 156 deletions(-) delete mode 100644 crates/pallets/starknet/src/runtime_api.rs diff --git a/Cargo.lock b/Cargo.lock index a74ac0d8d0..75cde02542 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6425,6 +6425,7 @@ dependencies = [ "mp-felt", "mp-sequencer-address", "pallet-starknet", + "pallet-starknet-runtime-api", "reqwest", "sc-basic-authorship", "sc-cli", @@ -6486,6 +6487,7 @@ dependencies = [ "pallet-aura", "pallet-grandpa", "pallet-starknet", + "pallet-starknet-runtime-api", "pallet-timestamp", "parity-scale-codec", "scale-info", @@ -6570,6 +6572,7 @@ dependencies = [ "mp-hashers", "mp-storage", "pallet-starknet", + "pallet-starknet-runtime-api", "sc-client-api", "sp-api", "sp-blockchain", @@ -6641,6 +6644,7 @@ dependencies = [ "mp-hashers", "mp-transactions", "pallet-starknet", + "pallet-starknet-runtime-api", "sc-client-api", "sp-api", "sp-blockchain", @@ -6666,6 +6670,7 @@ dependencies = [ "mp-hashers", "mp-transactions", "pallet-starknet", + "pallet-starknet-runtime-api", "pretty_assertions", "rstest", "sc-client-api", @@ -6726,6 +6731,7 @@ dependencies = [ "madara-runtime", "mp-storage", "pallet-starknet", + "pallet-starknet-runtime-api", "parity-scale-codec", "sc-client-api", "sp-api", @@ -7854,6 +7860,58 @@ dependencies = [ "test-case", ] +[[package]] +name = "pallet-starknet-runtime-api" +version = "0.1.0" +dependencies = [ + "assert_matches", + "blockifier", + "cairo-lang-casm-contract-class", + "derive_more", + "frame-benchmarking", + "frame-support", + "frame-system", + "hashbrown 0.14.2", + "hex", + "hexlit", + "indexmap 2.0.0-pre", + "lazy_static", + "log", + "mp-block", + "mp-chain-id", + "mp-commitments", + "mp-digest-log", + "mp-fee", + "mp-felt", + "mp-hashers", + "mp-sequencer-address", + "mp-state", + "mp-storage", + "mp-transactions", + "pallet-timestamp", + "parity-scale-codec", + "pretty_assertions", + "project-root", + "reqwest", + "sc-cli", + "scale-info", + "serde", + "serde_json", + "serde_with", + "sp-api", + "sp-arithmetic 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0)", + "sp-core 21.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0)", + "sp-inherents", + "sp-io 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0)", + "sp-runtime 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0)", + "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0)", + "starknet-core", + "starknet-crypto 0.6.1", + "starknet-ff", + "starknet_api", + "test-case", +] + [[package]] name = "pallet-timestamp" version = "4.0.0-dev" diff --git a/Cargo.toml b/Cargo.toml index fae493be5a..085ded80db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ resolver = "2" members = [ "crates/node", "crates/runtime", + "crates/pallets/starknet/runtime_api/", "crates/pallets/starknet", "crates/primitives/digest-log", "crates/primitives/transactions", @@ -28,6 +29,7 @@ members = [ default-members = [ "crates/node", "crates/runtime", + "crates/pallets/starknet/runtime_api/", "crates/pallets/starknet", "crates/primitives/digest-log", "crates/primitives/transactions", @@ -147,7 +149,7 @@ pallet-timestamp = { default-features = false, git = "https://github.com/parityt # Madara pallets pallet-starknet = { path = "crates/pallets/starknet", default-features = false } - +pallet-starknet-runtime-api = { path = "crates/pallets/starknet/runtime_api", default-features = false } # Madara primtitives mp-digest-log = { path = "crates/primitives/digest-log", default-features = false } mp-block = { path = "crates/primitives/block", default-features = false } diff --git a/crates/client/commitment-state-diff/Cargo.toml b/crates/client/commitment-state-diff/Cargo.toml index 1ce70587d7..aebe99b095 100644 --- a/crates/client/commitment-state-diff/Cargo.toml +++ b/crates/client/commitment-state-diff/Cargo.toml @@ -17,6 +17,7 @@ mp-digest-log = { workspace = true, default-features = true } mp-hashers = { workspace = true, default-features = true } mp-storage = { workspace = true, default-features = true } pallet-starknet = { workspace = true } +pallet-starknet-runtime-api = { workspace = true, default-features = true } # Starknet blockifier = { workspace = true, default-features = true } diff --git a/crates/client/commitment-state-diff/src/lib.rs b/crates/client/commitment-state-diff/src/lib.rs index a00aad4ec1..4f74cbaf97 100644 --- a/crates/client/commitment-state-diff/src/lib.rs +++ b/crates/client/commitment-state-diff/src/lib.rs @@ -9,7 +9,7 @@ use futures::{Stream, StreamExt}; use indexmap::IndexMap; use mp_hashers::HasherT; use mp_storage::{SN_COMPILED_CLASS_HASH_PREFIX, SN_CONTRACT_CLASS_HASH_PREFIX, SN_NONCE_PREFIX, SN_STORAGE_PREFIX}; -use pallet_starknet::runtime_api::StarknetRuntimeApi; +use pallet_starknet_runtime_api::StarknetRuntimeApi; use sc_client_api::client::BlockchainEvents; use sc_client_api::{StorageEventStream, StorageNotification}; use sp_api::ProvideRuntimeApi; diff --git a/crates/client/mapping-sync/Cargo.toml b/crates/client/mapping-sync/Cargo.toml index cdd0b2ea3d..e914efac76 100644 --- a/crates/client/mapping-sync/Cargo.toml +++ b/crates/client/mapping-sync/Cargo.toml @@ -23,6 +23,7 @@ mp-digest-log = { workspace = true } mp-hashers = { workspace = true } mp-transactions = { workspace = true } pallet-starknet = { workspace = true } +pallet-starknet-runtime-api = { workspace = true } sc-client-api = { workspace = true } sp-api = { workspace = true } sp-blockchain = { workspace = true } diff --git a/crates/client/mapping-sync/src/lib.rs b/crates/client/mapping-sync/src/lib.rs index 724be1eea2..1134f73da8 100644 --- a/crates/client/mapping-sync/src/lib.rs +++ b/crates/client/mapping-sync/src/lib.rs @@ -20,7 +20,7 @@ use futures::task::{Context, Poll}; use futures_timer::Delay; use log::debug; use mp_hashers::HasherT; -use pallet_starknet::runtime_api::StarknetRuntimeApi; +use pallet_starknet_runtime_api::StarknetRuntimeApi; use sc_client_api::backend::{Backend, StorageProvider}; use sc_client_api::client::ImportNotifications; use sp_api::ProvideRuntimeApi; diff --git a/crates/client/mapping-sync/src/sync_blocks.rs b/crates/client/mapping-sync/src/sync_blocks.rs index f9ddfbbaf5..e15f372f7f 100644 --- a/crates/client/mapping-sync/src/sync_blocks.rs +++ b/crates/client/mapping-sync/src/sync_blocks.rs @@ -2,7 +2,7 @@ use mc_rpc_core::utils::get_block_by_block_hash; use mp_digest_log::{find_starknet_block, FindLogError}; use mp_hashers::HasherT; use mp_transactions::compute_hash::ComputeTransactionHash; -use pallet_starknet::runtime_api::StarknetRuntimeApi; +use pallet_starknet_runtime_api::StarknetRuntimeApi; use sc_client_api::backend::{Backend, StorageProvider}; use sp_api::ProvideRuntimeApi; use sp_blockchain::{Backend as _, HeaderBackend}; diff --git a/crates/client/rpc/Cargo.toml b/crates/client/rpc/Cargo.toml index 1a2542f1cc..e425d67a42 100644 --- a/crates/client/rpc/Cargo.toml +++ b/crates/client/rpc/Cargo.toml @@ -18,6 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # Madara runtime pallet-starknet = { workspace = true, default-features = true } +pallet-starknet-runtime-api = { workspace = true, default-features = true } # Madara client mc-db = { workspace = true } mc-rpc-core = { workspace = true } diff --git a/crates/client/rpc/src/errors.rs b/crates/client/rpc/src/errors.rs index 2b0345fd33..86787f3cf0 100644 --- a/crates/client/rpc/src/errors.rs +++ b/crates/client/rpc/src/errors.rs @@ -1,5 +1,5 @@ use jsonrpsee::types::error::{CallError, ErrorObject}; -use pallet_starknet::runtime_api::StarknetTransactionExecutionError; +use pallet_starknet_runtime_api::StarknetTransactionExecutionError; // Comes from the RPC Spec: // https://github.com/starkware-libs/starknet-specs/blob/0e859ff905795f789f1dfd6f7340cdaf5015acc8/api/starknet_write_api.json#L227 diff --git a/crates/client/rpc/src/events/mod.rs b/crates/client/rpc/src/events/mod.rs index 0ed82bcca4..96e80c63fb 100644 --- a/crates/client/rpc/src/events/mod.rs +++ b/crates/client/rpc/src/events/mod.rs @@ -9,7 +9,7 @@ use log::error; use mc_rpc_core::utils::get_block_by_block_hash; use mp_felt::Felt252Wrapper; use mp_hashers::HasherT; -use pallet_starknet::runtime_api::{ConvertTransactionRuntimeApi, StarknetRuntimeApi}; +use pallet_starknet_runtime_api::{ConvertTransactionRuntimeApi, StarknetRuntimeApi}; use sc_client_api::backend::{Backend, StorageProvider}; use sc_client_api::BlockBackend; use sc_transaction_pool::ChainApi; diff --git a/crates/client/rpc/src/lib.rs b/crates/client/rpc/src/lib.rs index 24064a07c3..a8d0601c10 100644 --- a/crates/client/rpc/src/lib.rs +++ b/crates/client/rpc/src/lib.rs @@ -24,7 +24,7 @@ use mp_hashers::HasherT; use mp_transactions::compute_hash::ComputeTransactionHash; use mp_transactions::to_starknet_core_transaction::to_starknet_core_tx; use mp_transactions::UserTransaction; -use pallet_starknet::runtime_api::{ConvertTransactionRuntimeApi, StarknetRuntimeApi}; +use pallet_starknet_runtime_api::{ConvertTransactionRuntimeApi, StarknetRuntimeApi}; use sc_client_api::backend::{Backend, StorageProvider}; use sc_client_api::BlockBackend; use sc_network_sync::SyncingService; diff --git a/crates/client/storage/Cargo.toml b/crates/client/storage/Cargo.toml index 9a6037b197..7652f5f001 100644 --- a/crates/client/storage/Cargo.toml +++ b/crates/client/storage/Cargo.toml @@ -20,6 +20,7 @@ frame-system = { workspace = true, features = ["std"] } madara-runtime = { workspace = true, features = ["std"] } mp-storage = { workspace = true, features = ["std"] } pallet-starknet = { workspace = true, features = ["std"] } +pallet-starknet-runtime-api = { workspace = true, features = ["std"] } sc-client-api = { workspace = true } scale-codec = { workspace = true, features = ["std"] } sp-api = { workspace = true, features = ["std"] } diff --git a/crates/client/storage/src/lib.rs b/crates/client/storage/src/lib.rs index 33ceaa1d98..14da745ab8 100644 --- a/crates/client/storage/src/lib.rs +++ b/crates/client/storage/src/lib.rs @@ -13,7 +13,7 @@ use std::sync::Arc; use mp_storage::{StarknetStorageSchemaVersion, PALLET_STARKNET_SCHEMA}; pub use overrides::*; -use pallet_starknet::runtime_api::StarknetRuntimeApi; +use pallet_starknet_runtime_api::StarknetRuntimeApi; use sc_client_api::backend::{Backend, StorageProvider}; use scale_codec::Decode; use sp_api::ProvideRuntimeApi; diff --git a/crates/client/storage/src/overrides/mod.rs b/crates/client/storage/src/overrides/mod.rs index 5c4ab67860..c44ec524c0 100644 --- a/crates/client/storage/src/overrides/mod.rs +++ b/crates/client/storage/src/overrides/mod.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use blockifier::execution::contract_class::ContractClass; use frame_support::{Identity, StorageHasher}; use mp_storage::StarknetStorageSchemaVersion; -use pallet_starknet::runtime_api::StarknetRuntimeApi; +use pallet_starknet_runtime_api::StarknetRuntimeApi; use sc_client_api::{Backend, HeaderBackend, StorageProvider}; use sp_api::ProvideRuntimeApi; use sp_io::hashing::twox_128; diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index 5ea3936584..7593440aac 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -86,6 +86,7 @@ mc-mapping-sync = { workspace = true } mc-rpc = { workspace = true } mc-storage = { workspace = true } pallet-starknet = { workspace = true } +pallet-starknet-runtime-api = { workspace = true } starknet-core = { workspace = true } # Primitives diff --git a/crates/node/src/rpc/mod.rs b/crates/node/src/rpc/mod.rs index dc4802763e..7086411804 100644 --- a/crates/node/src/rpc/mod.rs +++ b/crates/node/src/rpc/mod.rs @@ -53,8 +53,8 @@ where C: Send + Sync + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, - C::Api: pallet_starknet::runtime_api::StarknetRuntimeApi - + pallet_starknet::runtime_api::ConvertTransactionRuntimeApi, + C::Api: pallet_starknet_runtime_api::StarknetRuntimeApi + + pallet_starknet_runtime_api::ConvertTransactionRuntimeApi, P: TransactionPool + 'static, BE: Backend + 'static, { diff --git a/crates/pallets/starknet/src/lib.rs b/crates/pallets/starknet/src/lib.rs index 4a556051ad..6b699a81cf 100644 --- a/crates/pallets/starknet/src/lib.rs +++ b/crates/pallets/starknet/src/lib.rs @@ -45,8 +45,6 @@ pub mod blockifier_state_adapter; pub mod genesis_loader; /// The implementation of the message type. pub mod message; -/// The Starknet pallet's runtime API -pub mod runtime_api; /// Transaction validation logic. pub mod transaction_validation; /// The Starknet pallet's runtime custom types. diff --git a/crates/pallets/starknet/src/runtime_api.rs b/crates/pallets/starknet/src/runtime_api.rs deleted file mode 100644 index 81137fad02..0000000000 --- a/crates/pallets/starknet/src/runtime_api.rs +++ /dev/null @@ -1,139 +0,0 @@ -//! Definition of the runtime API for the StarkNet pallet. - -// Adding allow unused type parameters to avoid clippy errors -// generated by the `decl_runtime_apis` macro. -// Specifically, the macro generates a trait (`StarknetRuntimeApi`) with unused type parameters. -#![allow(clippy::extra_unused_type_parameters)] - -use alloc::sync::Arc; - -use blockifier::execution::contract_class::ContractClass; -use mp_felt::Felt252Wrapper; -use mp_transactions::{Transaction, UserTransaction}; -use sp_api::BlockT; -pub extern crate alloc; -use alloc::string::String; -use alloc::vec::Vec; - -use sp_runtime::DispatchError; -use starknet_api::api_core::{ChainId, ClassHash, ContractAddress, EntryPointSelector, Nonce}; -use starknet_api::block::{BlockNumber, BlockTimestamp}; -use starknet_api::hash::StarkFelt; -use starknet_api::state::StorageKey; -use starknet_api::transaction::{Calldata, Event as StarknetEvent, TransactionHash}; - -#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, scale_info::TypeInfo)] -pub enum StarknetTransactionExecutionError { - ContractNotFound, - ClassAlreadyDeclared, - ClassHashNotFound, - InvalidContractClass, - ContractError, -} - -sp_api::decl_runtime_apis! { - pub trait StarknetRuntimeApi { - /// Returns the nonce associated with the given address in the given block - fn nonce(contract_address: ContractAddress) -> Nonce; - /// Returns a storage slot value - fn get_storage_at(address: ContractAddress, key: StorageKey) -> Result; - /// Returns a `Call` response. - fn call(address: ContractAddress, function_selector: EntryPointSelector, calldata: Calldata) -> Result, DispatchError>; - /// Returns the contract class hash at the given address. - fn contract_class_hash_by_address(address: ContractAddress) -> ClassHash; - /// Returns the contract class for the given class hash. - fn contract_class_by_class_hash(class_hash: ClassHash) -> Option; - /// Returns the chain id. - fn chain_id() -> Felt252Wrapper; - /// Returns fee estimate - fn estimate_fee(transactions: Vec) -> Result, DispatchError>; - /// Filters extrinsic transactions to return only Starknet transactions - /// - /// To support runtime upgrades, the client must be unaware of the specific extrinsic - /// details. To achieve this, the client uses an OpaqueExtrinsic type to represent and - /// manipulate extrinsics. However, the client cannot decode and filter extrinsics due to - /// this limitation. The solution is to offload decoding and filtering to the RuntimeApi in - /// the runtime itself, accomplished through the extrinsic_filter method. This enables the - /// client to operate seamlessly while abstracting the extrinsic complexity. - fn extrinsic_filter(xts: Vec<::Extrinsic>) -> Vec; - fn get_index_and_tx_for_tx_hash(xts: Vec<::Extrinsic>, chain_id: Felt252Wrapper, tx_hash: Felt252Wrapper) -> Option<(u32, Transaction)>; - /// Returns events, call with index from get_index_and_tx_for_tx_hash method - fn get_events_for_tx_by_index(tx_index: u32) -> Option>; - - /// Return the list of StarknetEvent evmitted during this block, along with the hash of the starknet transaction they bellong to - /// - /// `block_extrinsics` is the list of all the extrinsic executed during this block, it is used in order to match - fn get_starknet_events_and_their_associated_tx_hash(block_extrinsics: Vec<::Extrinsic>, chain_id: Felt252Wrapper) -> Vec<(Felt252Wrapper, StarknetEvent)>; - /// Return the outcome of the tx execution - fn get_tx_execution_outcome(tx_hash: TransactionHash) -> Option>; - /// Return the block context - fn get_block_context() -> BlockContext; - /// Return is fee disabled in state - fn is_transaction_fee_disabled() -> bool; - } - - pub trait ConvertTransactionRuntimeApi { - /// Converts the transaction to an UncheckedExtrinsic for submission to the pool. - fn convert_transaction(transaction: UserTransaction) -> Result<::Extrinsic, DispatchError>; - /// Converts the DispatchError to an understandable error for the client - fn convert_error(error: DispatchError) -> StarknetTransactionExecutionError; - } -} - -#[derive(Clone, Debug, parity_scale_codec::Encode, parity_scale_codec::Decode, scale_info::TypeInfo)] -pub struct BlockContext { - pub chain_id: String, - pub block_number: u64, - pub block_timestamp: u64, - - // Fee-related. - pub sequencer_address: ContractAddress, - pub fee_token_address: ContractAddress, - pub vm_resource_fee_cost: Vec<(String, sp_arithmetic::fixed_point::FixedU128)>, - pub gas_price: u128, // In wei. - - // Limits. - pub invoke_tx_max_n_steps: u32, - pub validate_max_n_steps: u32, - pub max_recursion_depth: u32, -} - -#[cfg(feature = "std")] -use std::collections::HashMap; - -#[cfg(not(feature = "std"))] -use hashbrown::HashMap; - -impl From for blockifier::block_context::BlockContext { - fn from(value: BlockContext) -> Self { - Self { - chain_id: ChainId(value.chain_id), - block_number: BlockNumber(value.block_number), - block_timestamp: BlockTimestamp(value.block_timestamp), - sequencer_address: value.sequencer_address, - fee_token_address: value.fee_token_address, - vm_resource_fee_cost: Arc::new(HashMap::from_iter(value.vm_resource_fee_cost)), - gas_price: value.gas_price, - invoke_tx_max_n_steps: value.invoke_tx_max_n_steps, - validate_max_n_steps: value.validate_max_n_steps, - max_recursion_depth: value.max_recursion_depth, - } - } -} - -impl From for BlockContext { - fn from(value: blockifier::block_context::BlockContext) -> Self { - Self { - chain_id: value.chain_id.0, - block_number: value.block_number.0, - block_timestamp: value.block_timestamp.0, - sequencer_address: value.sequencer_address, - fee_token_address: value.fee_token_address, - vm_resource_fee_cost: Vec::from_iter(value.vm_resource_fee_cost.iter().map(|(k, v)| (k.clone(), *v))), - gas_price: value.gas_price, - invoke_tx_max_n_steps: value.invoke_tx_max_n_steps, - validate_max_n_steps: value.validate_max_n_steps, - max_recursion_depth: value.max_recursion_depth, - } - } -} diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml index 9b8c242cf3..52a6db7375 100644 --- a/crates/runtime/Cargo.toml +++ b/crates/runtime/Cargo.toml @@ -50,6 +50,7 @@ frame-system-benchmarking = { workspace = true, optional = true } # Madara Local Dependencies # Madara Pallets pallet-starknet = { workspace = true } +pallet-starknet-runtime-api = { workspace = true } # Madara Primitives mp-chain-id = { workspace = true } diff --git a/crates/runtime/src/lib.rs b/crates/runtime/src/lib.rs index dbff920204..93088bbf2c 100644 --- a/crates/runtime/src/lib.rs +++ b/crates/runtime/src/lib.rs @@ -34,7 +34,7 @@ use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as G /// Import the StarkNet pallet. pub use pallet_starknet; use pallet_starknet::pallet::Error as PalletError; -use pallet_starknet::runtime_api::StarknetTransactionExecutionError; +use pallet_starknet_runtime_api::StarknetTransactionExecutionError; use pallet_starknet::Call::{consume_l1_message, declare, deploy_account, invoke}; use pallet_starknet::{Config, Event}; pub use pallet_timestamp::Call as TimestampCall; @@ -232,7 +232,7 @@ impl_runtime_apis! { } } - impl pallet_starknet::runtime_api::StarknetRuntimeApi for Runtime { + impl pallet_starknet_runtime_api::StarknetRuntimeApi for Runtime { fn get_storage_at(address: ContractAddress, key: StorageKey) -> Result { Starknet::get_storage_at(address, key) @@ -362,12 +362,12 @@ impl_runtime_apis! { Starknet::tx_revert_error(tx_hash).map(|s| s.into_bytes()) } - fn get_block_context() -> pallet_starknet::runtime_api::BlockContext { + fn get_block_context() -> pallet_starknet_runtime_api::BlockContext { Starknet::get_block_context().into() } } - impl pallet_starknet::runtime_api::ConvertTransactionRuntimeApi for Runtime { + impl pallet_starknet_runtime_api::ConvertTransactionRuntimeApi for Runtime { fn convert_transaction(transaction: UserTransaction) -> Result { let call = match transaction { UserTransaction::Declare(tx, contract_class) => {