Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3,500 changes: 1,671 additions & 1,829 deletions operator/Cargo.lock

Large diffs are not rendered by default.

354 changes: 178 additions & 176 deletions operator/Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion operator/benchmarking/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
use core::marker::PhantomData;

/// Weights for `{{pallet}}`.
pub struct WeightInfo<T>(PhantomData<T>);
Expand Down
2 changes: 2 additions & 0 deletions operator/node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pub fn create_benchmark_extrinsic<RuntimeApi>(
frame_system::CheckWeight::<runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(false),
frame_system::WeightReclaim::<runtime::Runtime>::new(),
);

let raw_payload = runtime::SignedPayload::from_raw(
Expand All @@ -162,6 +163,7 @@ pub fn create_benchmark_extrinsic<RuntimeApi>(
(),
(),
None,
(),
),
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));
Expand Down
130 changes: 62 additions & 68 deletions operator/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,78 +427,72 @@ pub fn run() -> sc_cli::Result<()> {
};

match config.network.network_backend {
// TODO: Litep2p becomes standard with Polkadot SDK stable2412-7 (should move None to other arm)
// cfr. https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2412-7
Some(sc_network::config::NetworkBackendType::Libp2p) | None => {
match config.chain_spec {
ref spec if spec.is_mainnet() => {
service::new_full::<
datahaven_mainnet_runtime::Runtime,
datahaven_mainnet_runtime::RuntimeApi,
sc_network::NetworkWorker<_, _>,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
ref spec if spec.is_testnet() => {
service::new_full::<
datahaven_testnet_runtime::Runtime,
datahaven_testnet_runtime::RuntimeApi,
sc_network::NetworkWorker<_, _>,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
_ => {
service::new_full::<
datahaven_stagenet_runtime::Runtime,
datahaven_stagenet_runtime::RuntimeApi,
sc_network::NetworkWorker<_, _>,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
sc_network::config::NetworkBackendType::Libp2p => match config.chain_spec {
ref spec if spec.is_mainnet() => {
service::new_full::<
datahaven_mainnet_runtime::Runtime,
datahaven_mainnet_runtime::RuntimeApi,
sc_network::NetworkWorker<_, _>,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
ref spec if spec.is_testnet() => {
service::new_full::<
datahaven_testnet_runtime::Runtime,
datahaven_testnet_runtime::RuntimeApi,
sc_network::NetworkWorker<_, _>,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
_ => {
service::new_full::<
datahaven_stagenet_runtime::Runtime,
datahaven_stagenet_runtime::RuntimeApi,
sc_network::NetworkWorker<_, _>,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
.map_err(sc_cli::Error::Service)
}
Some(sc_network::config::NetworkBackendType::Litep2p) => {
match config.chain_spec {
ref spec if spec.is_mainnet() => {
service::new_full::<
datahaven_mainnet_runtime::Runtime,
datahaven_mainnet_runtime::RuntimeApi,
sc_network::Litep2pNetworkBackend,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
ref spec if spec.is_testnet() => {
service::new_full::<
datahaven_testnet_runtime::Runtime,
datahaven_testnet_runtime::RuntimeApi,
sc_network::Litep2pNetworkBackend,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
_ => {
service::new_full::<
datahaven_stagenet_runtime::Runtime,
datahaven_stagenet_runtime::RuntimeApi,
sc_network::Litep2pNetworkBackend,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
.map_err(sc_cli::Error::Service),
sc_network::config::NetworkBackendType::Litep2p => match config.chain_spec {
ref spec if spec.is_mainnet() => {
service::new_full::<
datahaven_mainnet_runtime::Runtime,
datahaven_mainnet_runtime::RuntimeApi,
sc_network::Litep2pNetworkBackend,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
ref spec if spec.is_testnet() => {
service::new_full::<
datahaven_testnet_runtime::Runtime,
datahaven_testnet_runtime::RuntimeApi,
sc_network::Litep2pNetworkBackend,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
_ => {
service::new_full::<
datahaven_stagenet_runtime::Runtime,
datahaven_stagenet_runtime::RuntimeApi,
sc_network::Litep2pNetworkBackend,
>(
config, cli.eth, role_options, indexer_options, sealing_mode
)
.await
}
.map_err(sc_cli::Error::Service)
}
.map_err(sc_cli::Error::Service),
}
})
}
Expand Down
20 changes: 10 additions & 10 deletions operator/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use sc_consensus_beefy::communication::notification::{
};
use sc_consensus_manual_seal::rpc::{EngineCommand, ManualSeal, ManualSealApiServer};
use sc_network_sync::SyncingService;
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool::ChainApi;
use sc_transaction_pool_api::TransactionPool;
use shc_client::types::FileStorageT;
use shc_common::traits::StorageEnableRuntime;
Expand All @@ -54,7 +54,7 @@ use shc_rpc::StorageHubClientRpcConfig;
use sp_consensus_babe::{BabeApi, SlotDuration};
use sp_consensus_beefy::AuthorityIdBound;
use sp_core::H256;
use sp_runtime::traits::BlakeTwo256;
use sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT};
use std::collections::BTreeMap;
use std::sync::Arc;

Expand All @@ -69,9 +69,10 @@ pub struct BeefyDeps<AuthorityId: AuthorityIdBound> {
}

/// Full client dependencies.
pub struct FullDeps<P, B, AuthorityId: AuthorityIdBound, A: ChainApi, FL, FS, Runtime>
pub struct FullDeps<P, B, AuthorityId: AuthorityIdBound, FL, FS, Runtime>
where
Runtime: StorageEnableRuntime,
FS: ForestStorageHandler<Runtime> + Clone + Send + Sync + 'static,
{
/// The client instance to use.
pub client: Arc<StorageHubClient<Runtime::RuntimeApi>>,
Expand All @@ -80,7 +81,7 @@ where
/// BEEFY dependencies.
pub beefy: BeefyDeps<AuthorityId>,
/// Graph pool instance.
pub graph: Arc<Pool<A>>,
pub graph: Arc<P>,
/// Backend used by the node.
pub backend: Arc<B>,
/// Network service
Expand Down Expand Up @@ -112,8 +113,8 @@ where
}

/// Instantiate all full RPC extensions.
pub fn create_full<P, BE, AuthorityId, A, FL, FSH, Runtime>(
deps: FullDeps<P, BE, AuthorityId, A, FL, FSH, Runtime>,
pub fn create_full<P, BE, AuthorityId, FL, FSH, Runtime>(
deps: FullDeps<P, BE, AuthorityId, FL, FSH, Runtime>,
subscription_task_executor: sc_rpc::SubscriptionTaskExecutor,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
Expand All @@ -122,11 +123,10 @@ pub fn create_full<P, BE, AuthorityId, A, FL, FSH, Runtime>(
>,
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
where
P: TransactionPool<Block = Block> + 'static,
P: TransactionPool<Block = Block, Hash = <Block as BlockT>::Hash> + 'static,
BE: Backend<Block> + Send + Sync + 'static,
BE::State: StateBackend<BlakeTwo256>,
AuthorityId: AuthorityIdBound,
A: ChainApi<Block = Block> + 'static,
Runtime: StorageEnableRuntime,
Runtime::RuntimeApi: StorageEnableRuntimeApi<
RuntimeApi: mmr_rpc::MmrRuntimeApi<
Expand All @@ -139,7 +139,7 @@ where
>,
StorageHubClient<Runtime::RuntimeApi>: StorageProvider<Block, BE>,
FL: FileStorageT,
FSH: ForestStorageHandler<Runtime> + Send + Sync + 'static,
FSH: ForestStorageHandler<Runtime> + Clone + Send + Sync + 'static,
{
use mmr_rpc::{Mmr, MmrApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
Expand Down Expand Up @@ -225,7 +225,7 @@ where
};

module.merge(
Eth::<_, _, _, _, _, _, _, DefaultEthConfig<StorageHubClient<Runtime::RuntimeApi>, BE>>::new(
Eth::<_, _, _, _, _, _, DefaultEthConfig<StorageHubClient<Runtime::RuntimeApi>, BE>>::new(
Arc::clone(&client),
Arc::clone(&pool),
graph.clone(),
Expand Down
6 changes: 2 additions & 4 deletions operator/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ where
Vec::default(),
));

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
Expand Down Expand Up @@ -698,7 +698,7 @@ where
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: pool.clone(),
graph: pool.pool().clone(),
graph: pool.clone(),
beefy: BeefyDeps::<BeefyId> {
beefy_finality_proof_stream: beefy_rpc_links
.from_voter_justif_stream
Expand Down Expand Up @@ -996,7 +996,6 @@ where
.await?;
}

network_starter.start_network();
Ok(task_manager)
}

Expand Down Expand Up @@ -1375,7 +1374,6 @@ where
.with_blockchain(
client.clone(),
keystore.clone(),
Arc::new(rpc_handlers),
rocks_db_path.clone(),
maintenance_mode,
)
Expand Down
2 changes: 0 additions & 2 deletions operator/pallets/datahaven-native-transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

snowbridge-core = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
Expand Down Expand Up @@ -48,7 +47,6 @@ std = [
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"xcm/std",
"xcm-builder/std",
"pallet-balances/std",
Expand Down
3 changes: 2 additions & 1 deletion operator/pallets/datahaven-native-transfer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
//! It uses a dedicated Ethereum sovereign account to hold locked tokens during transfers.

#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;

use alloc::vec;
use frame_support::{
pallet_prelude::*,
traits::{
Expand All @@ -41,7 +43,6 @@ use snowbridge_core::TokenId;
use snowbridge_outbound_queue_primitives::v2::{Command, Message as OutboundMessage, SendMessage};
use sp_core::{H160, H256};
use sp_runtime::{traits::Saturating, BoundedVec};
use sp_std::vec;

pub use pallet::*;

Expand Down
9 changes: 6 additions & 3 deletions operator/pallets/datahaven-native-transfer/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
(BOB, INITIAL_BALANCE),
(CHARLIE, INITIAL_BALANCE),
];
pallet_balances::GenesisConfig::<Test> { balances }
.assimilate_storage(&mut t)
.unwrap();
pallet_balances::GenesisConfig::<Test> {
balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.unwrap();

let mut ext: sp_io::TestExternalities = t.into();
ext.execute_with(|| {
Expand Down
2 changes: 0 additions & 2 deletions operator/pallets/ethereum-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ frame-system = { workspace = true }
sp-core = { workspace = true }
sp-io = { optional = true, workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

pallet-timestamp = { optional = true, workspace = true }
snowbridge-beacon-primitives = { workspace = true }
Expand Down Expand Up @@ -77,7 +76,6 @@ std = [
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
'frame-benchmarking/std',
]
try-runtime = [
Expand Down
2 changes: 0 additions & 2 deletions operator/pallets/ethereum-client/fixtures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
sp-core = { workspace = true }
sp-std = { workspace = true }

[features]
default = ["std"]
Expand All @@ -33,5 +32,4 @@ std = [
"snowbridge-core/std",
"snowbridge-inbound-queue-primitives/std",
"sp-core/std",
"sp-std/std",
]
3 changes: 2 additions & 1 deletion operator/pallets/ethereum-client/fixtures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// Generated, do not edit!
// See README.md for instructions to generate
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;

use alloc::{boxed::Box, vec};
use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, NextSyncCommitteeUpdate,
SyncAggregate, SyncCommittee, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use sp_core::U256;
use sp_std::{boxed::Box, vec};

const SC_SIZE: usize = 512;
const SC_BITS_SIZE: usize = 64;
Expand Down
3 changes: 2 additions & 1 deletion operator/pallets/ethereum-client/src/benchmarking/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
use crate::{
decompress_sync_committee_bits, Config, CurrentSyncCommittee, Pallet as EthereumBeaconClient,
Update, ValidatorsRoot, Vec,
Update, ValidatorsRoot,
};
use alloc::vec::Vec;
use snowbridge_beacon_primitives::PublicKeyPrepared;
use sp_core::H256;

Expand Down
1 change: 1 addition & 0 deletions operator/pallets/ethereum-client/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use super::*;
use frame_support::ensure;
use snowbridge_beacon_primitives::ExecutionProof;

use alloc::vec::Vec;
use snowbridge_beacon_primitives::merkle_proof::{generalized_index_length, subtree_index};
use snowbridge_ethereum::Receipt;
use snowbridge_inbound_queue_primitives::{
Expand Down
Loading
Loading