diff --git a/bridges/bin/node/node/Cargo.toml b/bridges/bin/node/node/Cargo.toml index 78bd8b6107..a593d5ce9c 100644 --- a/bridges/bin/node/node/Cargo.toml +++ b/bridges/bin/node/node/Cargo.toml @@ -19,100 +19,100 @@ bridge-node-runtime = { version = "0.1.0", path = "../runtime" } sp-bridge-eth-poa = { version = "0.1.0", path = "../../../primitives/ethereum-poa" } [dependencies.sc-cli] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-rpc] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-core] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-executor] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-service] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-inherents] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-transaction-pool] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-transaction-pool] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-network] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-consensus-aura] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-consensus-aura] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-consensus] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.grandpa] package = "sc-finality-grandpa" -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.grandpa-primitives] package = "sp-finality-grandpa" -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" +git = "https://github.com/paritytech/substrate.git" + +[dependencies.sc-consensus] +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-client-api] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" -git = "https://github.com/paritytech/substrate.git" - -[dependencies.sc-client] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sc-basic-authorship] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.substrate-frame-rpc-system] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [build-dependencies] @@ -120,6 +120,6 @@ vergen = "3.1.0" [build-dependencies.build-script-utils] package = "substrate-build-script-utils" -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" diff --git a/bridges/bin/node/node/src/service.rs b/bridges/bin/node/node/src/service.rs index 82bd60c11a..736cab5198 100644 --- a/bridges/bin/node/node/src/service.rs +++ b/bridges/bin/node/node/src/service.rs @@ -17,9 +17,9 @@ //! Service and ServiceFactory implementation. Specialized wrapper over substrate service. use bridge_node_runtime::{self, opaque::Block, RuntimeApi}; -use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider}; -use sc_client::LongestChain; +use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, StorageAndProofProvider}; use sc_client_api::ExecutorProvider; +use sc_consensus::LongestChain; use sc_executor::native_executor_instance; pub use sc_executor::NativeExecutor; use sc_service::{error::Error as ServiceError, AbstractService, Configuration, ServiceBuilder}; @@ -51,7 +51,7 @@ macro_rules! new_full_start { bridge_node_runtime::RuntimeApi, crate::service::Executor, >($config)? - .with_select_chain(|_config, backend| Ok(sc_client::LongestChain::new(backend.clone())))? + .with_select_chain(|_config, backend| Ok(sc_consensus::LongestChain::new(backend.clone())))? .with_transaction_pool(|config, client, _fetcher, prometheus_registry| { let pool_api = sc_transaction_pool::FullChainApi::new(client.clone()); Ok(sc_transaction_pool::BasicPool::new( @@ -60,32 +60,36 @@ macro_rules! new_full_start { prometheus_registry, )) })? - .with_import_queue(|_config, client, mut select_chain, _transaction_pool| { - let select_chain = select_chain - .take() - .ok_or_else(|| sc_service::Error::SelectChainRequired)?; + .with_import_queue( + |_config, client, mut select_chain, _transaction_pool, spawn_task_handle, registry| { + let select_chain = select_chain + .take() + .ok_or_else(|| sc_service::Error::SelectChainRequired)?; - let (grandpa_block_import, grandpa_link) = - grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?; + let (grandpa_block_import, grandpa_link) = + grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?; - let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( - grandpa_block_import.clone(), - client.clone(), - ); + let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( + grandpa_block_import.clone(), + client.clone(), + ); - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>( - sc_consensus_aura::slot_duration(&*client)?, - aura_block_import, - Some(Box::new(grandpa_block_import.clone())), - None, - client, - inherent_data_providers.clone(), - )?; + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( + sc_consensus_aura::slot_duration(&*client)?, + aura_block_import, + Some(Box::new(grandpa_block_import.clone())), + None, + client, + inherent_data_providers.clone(), + spawn_task_handle, + registry, + )?; - import_setup = Some((grandpa_block_import, grandpa_link)); + import_setup = Some((grandpa_block_import, grandpa_link)); - Ok(import_queue) - })? + Ok(import_queue) + }, + )? .with_rpc_extensions(|builder| -> Result, _> { use substrate_frame_rpc_system::{FullSystem, SystemApi}; @@ -122,7 +126,11 @@ pub fn new_full(config: Configuration) -> Result Result Result), - Arc::new(fetch_checker), - )?; - let finality_proof_import = grandpa_block_import.clone(); - let finality_proof_request_builder = finality_proof_import.create_finality_proof_request_builder(); + .with_import_queue_and_fprb( + |_config, client, backend, fetcher, _select_chain, _tx_pool, spawn_task_handle, prometheus_registry| { + let fetch_checker = fetcher + .map(|fetcher| fetcher.checker().clone()) + .ok_or_else(|| "Trying to start light import queue without active fetch checker")?; + let grandpa_block_import = grandpa::light_block_import( + client.clone(), + backend, + &(client.clone() as Arc<_>), + Arc::new(fetch_checker), + )?; + let finality_proof_import = grandpa_block_import.clone(); + let finality_proof_request_builder = finality_proof_import.create_finality_proof_request_builder(); - let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>( - sc_consensus_aura::slot_duration(&*client)?, - grandpa_block_import, - None, - Some(Box::new(finality_proof_import)), - client, - inherent_data_providers.clone(), - )?; + let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( + sc_consensus_aura::slot_duration(&*client)?, + grandpa_block_import, + None, + Some(Box::new(finality_proof_import)), + client, + inherent_data_providers.clone(), + spawn_task_handle, + prometheus_registry, + )?; - Ok((import_queue, finality_proof_request_builder)) - })? + Ok((import_queue, finality_proof_request_builder)) + }, + )? .with_finality_proof_provider(|client, backend| { let provider = client as Arc>; Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) diff --git a/bridges/bin/node/runtime/Cargo.toml b/bridges/bin/node/runtime/Cargo.toml index 92351e0c44..d8e5a8a92a 100644 --- a/bridges/bin/node/runtime/Cargo.toml +++ b/bridges/bin/node/runtime/Cargo.toml @@ -22,15 +22,15 @@ features = ["derive"] # Substrate Dependencies [dependencies.pallet-aura] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-balances] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-bridge-eth-poa] @@ -39,76 +39,76 @@ default-features = false path = "../../../modules/ethereum" [dependencies.frame-support] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-grandpa] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-randomness-collective-flip] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-sudo] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-session] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.frame-system] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.frame-system-rpc-runtime-api] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-timestamp] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-transaction-payment] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.frame-executive] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" # Substrate Primitives [dependencies.sp-api] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-block-builder] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-bridge-eth-poa] @@ -117,75 +117,75 @@ default-features = false path = "../../../primitives/ethereum-poa" [dependencies.sp-consensus-aura] -version = "0.8.0-alpha.6" +version = "0.8.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-core] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-inherents] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-io] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-offchain] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-session] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-staking] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-std] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-transaction-pool] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-version] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [build-dependencies.wasm-builder-runner] version = "1.0.5" package = "substrate-wasm-builder-runner" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [features] diff --git a/bridges/bin/node/runtime/src/lib.rs b/bridges/bin/node/runtime/src/lib.rs index ff4d796cf9..d02d108d51 100644 --- a/bridges/bin/node/runtime/src/lib.rs +++ b/bridges/bin/node/runtime/src/lib.rs @@ -27,13 +27,12 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod kovan; use codec::{Decode, Encode}; -use pallet_grandpa::fg_primitives; -use pallet_grandpa::AuthorityList as GrandpaAuthorityList; +use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_core::OpaqueMetadata; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::traits::{ - BlakeTwo256, Block as BlockT, ConvertInto, IdentifyAccount, IdentityLookup, OpaqueKeys, Verify, + BlakeTwo256, Block as BlockT, IdentifyAccount, IdentityLookup, NumberFor, OpaqueKeys, Saturating, Verify, }; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, @@ -48,8 +47,8 @@ use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, parameter_types, - traits::Randomness, - weights::{RuntimeDbWeight, Weight}, + traits::{KeyOwnerProofSystem, Randomness}, + weights::{IdentityFee, RuntimeDbWeight, Weight}, StorageValue, }; pub use pallet_balances::Call as BalancesCall; @@ -143,6 +142,9 @@ parameter_types! { pub const MaximumBlockWeight: Weight = 2_000_000_000_000; pub const ExtrinsicBaseWeight: Weight = 10_000_000; pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); + /// Assume 10% of weight for average on_initialize calls. + pub const MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() + .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; pub const Version: RuntimeVersion = VERSION; pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { @@ -184,6 +186,10 @@ impl frame_system::Trait for Runtime { /// The base weight of any extrinsic processed by the runtime, independent of the /// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...) type ExtrinsicBaseWeight = ExtrinsicBaseWeight; + /// The maximum weight that a single extrinsic of `Normal` dispatch class can have, + /// idependent of the logic of that extrinsics. (Roughly max block weight - average on + /// initialize cost). + type MaximumExtrinsicWeight = MaximumExtrinsicWeight; /// Maximum size of all encoded transactions (in bytes) that are allowed in one block. type MaximumBlockLength = MaximumBlockLength; /// Portion of the block weight that is available to all normal transactions. @@ -219,6 +225,16 @@ impl pallet_bridge_eth_poa::Trait for Runtime { impl pallet_grandpa::Trait for Runtime { type Event = Event; + type Call = Call; + + type KeyOwnerProofSystem = (); + + type KeyOwnerProof = >::Proof; + + type KeyOwnerIdentification = + >::IdentificationTuple; + + type HandleEquivocation = (); } parameter_types! { @@ -255,7 +271,7 @@ impl pallet_transaction_payment::Trait for Runtime { type Currency = pallet_balances::Module; type OnTransactionPayment = (); type TransactionByteFee = TransactionByteFee; - type WeightToFee = ConvertInto; + type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); } @@ -363,7 +379,8 @@ pub type SignedBlock = generic::SignedBlock; pub type BlockId = generic::BlockId; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( - frame_system::CheckVersion, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, frame_system::CheckGenesis, frame_system::CheckEra, frame_system::CheckNonce, @@ -487,6 +504,26 @@ impl_runtime_apis! { fn grandpa_authorities() -> GrandpaAuthorityList { Grandpa::grandpa_authorities() } + + fn submit_report_equivocation_extrinsic( + _equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + NumberFor, + >, + _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + None + } + + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + _authority_id: GrandpaId, + ) -> Option { + // NOTE: this is the only implementation possible since we've + // defined our key owner proof type as a bottom type (i.e. a type + // with no values). + None + } } } diff --git a/bridges/modules/ethereum-contract/builtin/Cargo.toml b/bridges/modules/ethereum-contract/builtin/Cargo.toml index 864d0fbbde..4d36fa98fb 100644 --- a/bridges/modules/ethereum-contract/builtin/Cargo.toml +++ b/bridges/modules/ethereum-contract/builtin/Cargo.toml @@ -11,35 +11,36 @@ edition = "2018" codec = { package = "parity-scale-codec", version = "1.0.0" } ethereum-types = "0.9.2" +finality-grandpa = "0.12.3" # Runtime/chain specific dependencies bridge-node-runtime = { path = "../../../bin/node/runtime" } [dependencies.sp-blockchain] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-finality-grandpa] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sc-finality-grandpa] version = "0.8.0-dev" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dev-dependencies] hex = "0.4" [dev-dependencies.sp-core] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" diff --git a/bridges/modules/ethereum-contract/builtin/src/lib.rs b/bridges/modules/ethereum-contract/builtin/src/lib.rs index 739e14d69e..2f4200f344 100644 --- a/bridges/modules/ethereum-contract/builtin/src/lib.rs +++ b/bridges/modules/ethereum-contract/builtin/src/lib.rs @@ -17,6 +17,7 @@ use bridge_node_runtime::{Block, BlockNumber, Hash, Header as RuntimeHeader}; use codec::{Decode, Encode}; use ethereum_types::U256; +use finality_grandpa::voter_set::VoterSet; use sp_blockchain::Error as ClientError; use sp_finality_grandpa::{AuthorityList, ConsensusLog, GRANDPA_ENGINE_ID}; @@ -29,6 +30,8 @@ pub enum Error { HeaderDecode(codec::Error), /// Failed to decode best voters set. BestSetDecode(codec::Error), + /// Best voters set is invalid. + InvalidBestSet, /// Failed to decode finality proof. FinalityProofDecode(codec::Error), /// Failed to verify justification. @@ -108,12 +111,14 @@ pub fn verify_substrate_finality_proof( raw_best_set: &[u8], raw_finality_proof: &[u8], ) -> Result<(), Error> { - let best_set = AuthorityList::decode(&mut &raw_best_set[..]).map_err(Error::BestSetDecode)?; + let best_set = AuthorityList::decode(&mut &raw_best_set[..]) + .map_err(Error::BestSetDecode) + .and_then(|authorities| VoterSet::new(authorities.into_iter()).ok_or(Error::InvalidBestSet))?; sc_finality_grandpa::GrandpaJustification::::decode_and_verify_finalizes( &raw_finality_proof, (finality_target_hash, finality_target_number), best_set_id, - &best_set.into_iter().collect(), + &best_set, ) .map_err(Error::JustificationVerify) .map(|_| ()) diff --git a/bridges/modules/ethereum/Cargo.toml b/bridges/modules/ethereum/Cargo.toml index 96024f0ac7..667abe8d97 100644 --- a/bridges/modules/ethereum/Cargo.toml +++ b/bridges/modules/ethereum/Cargo.toml @@ -12,33 +12,33 @@ primitives = { package = "sp-bridge-eth-poa", path = "../../primitives/ethereum- # Substrate Based Dependencies [dependencies.frame-support] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.frame-system] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-std] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-io] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" # Dev Dependencies diff --git a/bridges/modules/ethereum/src/lib.rs b/bridges/modules/ethereum/src/lib.rs index ba6c02c7d5..232f89d9c3 100644 --- a/bridges/modules/ethereum/src/lib.rs +++ b/bridges/modules/ethereum/src/lib.rs @@ -673,7 +673,7 @@ impl Storage for BridgeStorage { }; let last_signal_block = header.context.last_signal_block().cloned(); - HeadersByNumber::append_or_insert(header.header.number, vec![header.hash]); + HeadersByNumber::append(header.header.number, header.hash); Headers::::insert( &header.hash, StoredHeader { diff --git a/bridges/modules/ethereum/src/mock.rs b/bridges/modules/ethereum/src/mock.rs index 6624b149a9..44213813fe 100644 --- a/bridges/modules/ethereum/src/mock.rs +++ b/bridges/modules/ethereum/src/mock.rs @@ -59,6 +59,7 @@ impl frame_system::Trait for TestRuntime { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); type AvailableBlockRatio = AvailableBlockRatio; type MaximumBlockLength = MaximumBlockLength; type Version = (); diff --git a/bridges/modules/substrate/Cargo.toml b/bridges/modules/substrate/Cargo.toml index a62ee1a57e..4f5f91c05b 100644 --- a/bridges/modules/substrate/Cargo.toml +++ b/bridges/modules/substrate/Cargo.toml @@ -13,57 +13,57 @@ hash-db = { version = "0.15.2", default-features = false } # Substrate Based Dependencies [dependencies.frame-support] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.frame-system] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-session] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-core] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-finality-grandpa] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-trie] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" # Dev Dependencies [dev-dependencies.sp-io] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dev-dependencies.sp-state-machine] -version = "0.8.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "0.8.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [features] diff --git a/bridges/modules/substrate/src/lib.rs b/bridges/modules/substrate/src/lib.rs index cb6142e426..148ebd5ef9 100644 --- a/bridges/modules/substrate/src/lib.rs +++ b/bridges/modules/substrate/src/lib.rs @@ -265,6 +265,7 @@ mod tests { type DbWeight = (); type BlockExecutionWeight = (); type ExtrinsicBaseWeight = (); + type MaximumExtrinsicWeight = (); type AvailableBlockRatio = (); type MaximumBlockLength = (); type Version = (); diff --git a/bridges/primitives/ethereum-poa/Cargo.toml b/bridges/primitives/ethereum-poa/Cargo.toml index dca0750b3a..32ac689bb9 100644 --- a/bridges/primitives/ethereum-poa/Cargo.toml +++ b/bridges/primitives/ethereum-poa/Cargo.toml @@ -22,27 +22,27 @@ plain_hasher = { version = "0.2.2", default-features = false } # Substrate Based Dependencies [dependencies.sp-api] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-std] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-io] -version = "2.0.0-alpha.6" +version = "2.0.0-rc1" default-features = false -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [features] diff --git a/bridges/relays/ethereum/Cargo.toml b/bridges/relays/ethereum/Cargo.toml index 05553d8bb5..d3e6770fc5 100644 --- a/bridges/relays/ethereum/Cargo.toml +++ b/bridges/relays/ethereum/Cargo.toml @@ -33,36 +33,36 @@ web3 = { git = "https://github.com/tomusdrw/rust-web3" } # Substrate Based Dependencies [dependencies.frame-system] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.pallet-transaction-payment] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" # I think this is used for sr-io and stuff [dependencies.node-primitives] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" # Branch used for keccack256 hasher code # Could probably move the keccack hasher stuff to our own primitives [dependencies.sp-core] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-keyring] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" [dependencies.sp-runtime] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate.git" # This should get moved to our `bin` folder diff --git a/bridges/relays/ethereum/src/substrate_client.rs b/bridges/relays/ethereum/src/substrate_client.rs index ec7c36443f..0319c0b5ac 100644 --- a/bridges/relays/ethereum/src/substrate_client.rs +++ b/bridges/relays/ethereum/src/substrate_client.rs @@ -391,7 +391,8 @@ fn create_signed_submit_transaction( let extra = |i: node_primitives::Index, f: node_primitives::Balance| { ( - frame_system::CheckVersion::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), frame_system::CheckGenesis::::new(), frame_system::CheckEra::::from(sp_runtime::generic::Era::Immortal), frame_system::CheckNonce::::from(i), @@ -403,7 +404,8 @@ fn create_signed_submit_transaction( function, extra(index, 0), ( - bridge_node_runtime::VERSION.spec_version as u32, + bridge_node_runtime::VERSION.spec_version, + bridge_node_runtime::VERSION.transaction_version, genesis_hash, genesis_hash, (), diff --git a/bridges/relays/substrate/Cargo.toml b/bridges/relays/substrate/Cargo.toml index 7f151e55a4..9cfeec3613 100644 --- a/bridges/relays/substrate/Cargo.toml +++ b/bridges/relays/substrate/Cargo.toml @@ -17,16 +17,16 @@ serde_json = "1.0.53" url = "2.1.0" [dependencies.sp-core] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.sp-rpc] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/" [dependencies.node-primitives] -version = "2.0.0-alpha.6" -rev = "c13ad41634d0bd7cf07897c2aa062b917d520520" +version = "2.0.0-rc1" +rev = "599ba75bc2b5acd238c21c5c7efe8e2ad8d401ee" git = "https://github.com/paritytech/substrate/"