Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
move StarknetRuntimeApi trait definition in its own crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogalholic authored and tdelabro committed Nov 21, 2023
1 parent 3f36345 commit 237019d
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 156 deletions.
58 changes: 58 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions crates/client/commitment-state-diff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/client/commitment-state-diff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/client/mapping-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/client/mapping-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/client/mapping-sync/src/sync_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 1 addition & 0 deletions crates/client/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/client/rpc/src/errors.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/client/rpc/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/client/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/client/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/client/storage/src/overrides/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/node/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ where
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
C::Api: BlockBuilder<Block>,
C::Api: pallet_starknet::runtime_api::StarknetRuntimeApi<Block>
+ pallet_starknet::runtime_api::ConvertTransactionRuntimeApi<Block>,
C::Api: pallet_starknet_runtime_api::StarknetRuntimeApi<Block>
+ pallet_starknet_runtime_api::ConvertTransactionRuntimeApi<Block>,
P: TransactionPool<Block = Block> + 'static,
BE: Backend<Block> + 'static,
{
Expand Down
2 changes: 0 additions & 2 deletions crates/pallets/starknet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 237019d

Please sign in to comment.