Update to latest substrate (#723)

* Bump substrate deps.

* Bump scale.

* Bump ethabi.

* Remove inherent from aura.

* Migrate to construct_runtime

* cargo fmt --all
This commit is contained in:
Tomasz Drwięga
2021-02-16 07:10:01 +01:00
committed by Bastian Köcher
parent 32342bf6e5
commit 7aa51f8d30
41 changed files with 198 additions and 160 deletions
-1
View File
@@ -38,7 +38,6 @@ sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "m
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
+5 -8
View File
@@ -35,7 +35,6 @@ pub use sc_executor::NativeExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::TelemetrySpan;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use sp_inherents::InherentDataProviders;
use std::sync::Arc;
@@ -71,7 +70,6 @@ pub fn new_partial(
AuraPair,
>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
Option<TelemetrySpan>,
),
>,
ServiceError,
@@ -81,7 +79,7 @@ pub fn new_partial(
}
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
let (client, backend, keystore_container, task_manager, telemetry_span) =
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
let client = Arc::new(client);
@@ -89,6 +87,7 @@ pub fn new_partial(
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_handle(),
client.clone(),
@@ -120,7 +119,7 @@ pub fn new_partial(
select_chain,
transaction_pool,
inherent_data_providers,
other: (aura_block_import, grandpa_link, telemetry_span),
other: (aura_block_import, grandpa_link),
})
}
@@ -142,7 +141,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
select_chain,
transaction_pool,
inherent_data_providers,
other: (block_import, grandpa_link, telemetry_span),
other: (block_import, grandpa_link),
} = new_partial(&config)?;
if let Some(url) = &config.keystore_remote {
@@ -276,7 +275,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
network_status_sinks,
system_rpc_tx,
config,
telemetry_span,
})?;
if role.is_authority() {
@@ -356,7 +354,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
/// Builds a new service for a light client.
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
config
@@ -425,7 +423,6 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
network,
network_status_sinks,
system_rpc_tx,
telemetry_span,
})?;
network_starter.start_network();
+1 -1
View File
@@ -8,7 +8,7 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
hex-literal = "0.3"
serde = { version = "1.0.123", optional = true, features = ["derive"] }
+1 -1
View File
@@ -373,7 +373,7 @@ construct_runtime!(
System: frame_system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Aura: pallet_aura::{Module, Config<T>, Inherent},
Aura: pallet_aura::{Module, Config<T>},
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
+5 -8
View File
@@ -35,7 +35,6 @@ pub use sc_executor::NativeExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::TelemetrySpan;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use sp_inherents::InherentDataProviders;
use std::sync::Arc;
@@ -71,7 +70,6 @@ pub fn new_partial(
AuraPair,
>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
Option<TelemetrySpan>,
),
>,
ServiceError,
@@ -81,7 +79,7 @@ pub fn new_partial(
}
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
let (client, backend, keystore_container, task_manager, telemetry_span) =
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
let client = Arc::new(client);
@@ -89,6 +87,7 @@ pub fn new_partial(
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_handle(),
client.clone(),
@@ -120,7 +119,7 @@ pub fn new_partial(
select_chain,
transaction_pool,
inherent_data_providers,
other: (aura_block_import, grandpa_link, telemetry_span),
other: (aura_block_import, grandpa_link),
})
}
@@ -142,7 +141,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
select_chain,
transaction_pool,
inherent_data_providers,
other: (block_import, grandpa_link, telemetry_span),
other: (block_import, grandpa_link),
} = new_partial(&config)?;
if let Some(url) = &config.keystore_remote {
@@ -276,7 +275,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
network_status_sinks,
system_rpc_tx,
config,
telemetry_span,
})?;
if role.is_authority() {
@@ -356,7 +354,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
/// Builds a new service for a light client.
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
config
@@ -425,7 +423,6 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
network,
network_status_sinks,
system_rpc_tx,
telemetry_span,
})?;
network_starter.start_network();
+1 -1
View File
@@ -8,7 +8,7 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
hex-literal = "0.3"
libsecp256k1 = { version = "0.3.4", optional = true, default-features = false, features = ["hmac"] }
serde = { version = "1.0.123", optional = true, features = ["derive"] }
+1 -1
View File
@@ -484,7 +484,7 @@ construct_runtime!(
System: frame_system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Aura: pallet_aura::{Module, Config<T>, Inherent},
Aura: pallet_aura::{Module, Config<T>},
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
+1 -1
View File
@@ -8,7 +8,7 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
ed25519-dalek = { version = "1.0", default-features = false, optional = true }
hash-db = { version = "0.15.2", default-features = false }
+2 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
# Bridge dependencies
@@ -24,6 +24,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "ma
[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
serde = "1.0"
[features]
default = ["std"]
+40 -36
View File
@@ -395,7 +395,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use frame_support::{impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types, weights::Weight};
use frame_support::{parameter_types, weights::Weight};
use frame_system::{EventRecord, Phase};
use sp_core::H256;
use sp_runtime::{
@@ -405,9 +405,6 @@ mod tests {
};
type AccountId = u64;
type CallDispatch = Module<TestRuntime>;
type System = frame_system::Module<TestRuntime>;
type MessageId = [u8; 4];
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq)]
@@ -440,28 +437,19 @@ mod tests {
}
}
#[derive(Clone, Eq, PartialEq)]
pub struct TestRuntime;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
mod call_dispatch {
pub use crate::Event;
}
use crate as call_dispatch;
impl_outer_event! {
pub enum TestEvent for TestRuntime {
frame_system<T>,
call_dispatch<T>,
}
}
impl_outer_origin! {
pub enum Origin for TestRuntime where system = frame_system {}
}
impl_outer_dispatch! {
pub enum Call for TestRuntime where origin: Origin {
frame_system::System,
call_dispatch::CallDispatch,
frame_support::construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
CallDispatch: call_dispatch::{Module, Call, Event<T>},
}
}
@@ -482,10 +470,10 @@ mod tests {
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = TestEvent;
type Event = Event;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -498,7 +486,7 @@ mod tests {
}
impl Config for TestRuntime {
type Event = TestEvent;
type Event = Event;
type MessageId = MessageId;
type SourceChainAccountId = AccountId;
type TargetChainAccountPublic = TestAccountPublic;
@@ -586,7 +574,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageVersionSpecMismatch(
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageVersionSpecMismatch(
bridge,
id,
TEST_SPEC_VERSION,
@@ -614,7 +602,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageWeightMismatch(
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
bridge, id, 1973000, 0,
)),
topics: vec![],
@@ -642,7 +630,9 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageSignatureMismatch(bridge, id)),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageSignatureMismatch(
bridge, id
)),
topics: vec![],
}],
);
@@ -662,7 +652,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageRejected(bridge, id)),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageRejected(bridge, id)),
topics: vec![],
}],
);
@@ -686,7 +676,9 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageCallDecodeFailed(bridge, id)),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageCallDecodeFailed(
bridge, id
)),
topics: vec![],
}],
);
@@ -711,7 +703,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageCallRejected(bridge, id)),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageCallRejected(bridge, id)),
topics: vec![],
}],
);
@@ -732,7 +724,11 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageDispatched(bridge, id, Ok(()))),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
bridge,
id,
Ok(())
)),
topics: vec![],
}],
);
@@ -755,7 +751,11 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageDispatched(bridge, id, Ok(()))),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
bridge,
id,
Ok(())
)),
topics: vec![],
}],
);
@@ -778,7 +778,11 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::call_dispatch(Event::<TestRuntime>::MessageDispatched(bridge, id, Ok(()))),
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
bridge,
id,
Ok(())
)),
topics: vec![],
}],
);
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
serde = { version = "1.0", optional = true }
# Bridge dependencies
+15 -9
View File
@@ -212,7 +212,7 @@ fn prepare_deposit_details<T: Config<I>, I: Instance>(
mod tests {
use super::*;
use bp_currency_exchange::LockFundsTransaction;
use frame_support::{assert_noop, assert_ok, impl_outer_origin, parameter_types, weights::Weight};
use frame_support::{assert_noop, assert_ok, construct_runtime, parameter_types, weights::Weight};
use sp_core::H256;
use sp_runtime::{
testing::Header,
@@ -313,11 +313,19 @@ mod tests {
}
}
#[derive(Clone, Eq, PartialEq)]
pub struct TestRuntime;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
use crate as pallet_bridge_currency_exchange;
impl_outer_origin! {
pub enum Origin for TestRuntime where system = frame_system {}
construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Exchange: pallet_bridge_currency_exchange::{Module},
}
}
parameter_types! {
@@ -330,7 +338,7 @@ mod tests {
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type Index = u64;
type Call = ();
type Call = Call;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
@@ -340,7 +348,7 @@ mod tests {
type Event = ();
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -362,8 +370,6 @@ mod tests {
type DepositInto = DummyDepositInto;
}
type Exchange = Module<TestRuntime>;
fn new_test_ext() -> sp_io::TestExternalities {
let t = frame_system::GenesisConfig::default()
.build_storage::<TestRuntime>()
@@ -7,9 +7,9 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
ethereum-types = "0.11.0"
finality-grandpa = "0.12.3"
finality-grandpa = "0.13.0"
hex = "0.4"
log = "0.4.14"
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"], optional = true }
serde = { version = "1.0", optional = true }
+19 -10
View File
@@ -18,9 +18,9 @@ pub use crate::test_utils::{insert_header, validator_utils::*, validators_change
pub use bp_eth_poa::signatures::secret_to_address;
use crate::validators::{ValidatorsConfiguration, ValidatorsSource};
use crate::{AuraConfiguration, ChainTime, Config, GenesisConfig, PruningStrategy};
use crate::{AuraConfiguration, ChainTime, Config, GenesisConfig as CrateGenesisConfig, PruningStrategy};
use bp_eth_poa::{Address, AuraHeader, H256, U256};
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
use frame_support::{parameter_types, weights::Weight};
use secp256k1::SecretKey;
use sp_runtime::{
testing::Header as SubstrateHeader,
@@ -30,11 +30,20 @@ use sp_runtime::{
pub type AccountId = u64;
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct TestRuntime;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
impl_outer_origin! {
pub enum Origin for TestRuntime where system = frame_system {}
use crate as pallet_ethereum;
frame_support::construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Ethereum: pallet_ethereum::{Module, Call},
}
}
parameter_types! {
@@ -47,17 +56,17 @@ parameter_types! {
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type Index = u64;
type Call = ();
type Call = Call;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = SubstrateHeader;
type Event = ();
type Event = Event;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -134,7 +143,7 @@ pub fn run_test_with_genesis<T>(
let validators = validators(total_validators);
let addresses = validators_addresses(total_validators);
sp_io::TestExternalities::new(
GenesisConfig {
CrateGenesisConfig {
initial_header: genesis.clone(),
initial_difficulty: 0.into(),
initial_validators: addresses.clone(),
+2 -2
View File
@@ -8,8 +8,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
finality-grandpa = { version = "0.12.3", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
finality-grandpa = { version = "0.13.0", default-features = false }
serde = { version = "1.0", optional = true }
# Bridge Dependencies
+19 -9
View File
@@ -16,7 +16,7 @@
use crate::pallet::{BridgedHeader, Config};
use bp_runtime::{BlockNumberOf, Chain};
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
use frame_support::{construct_runtime, parameter_types, weights::Weight};
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, IdentityLookup},
@@ -27,11 +27,21 @@ pub type AccountId = u64;
pub type TestHeader = BridgedHeader<TestRuntime>;
pub type TestNumber = BlockNumberOf<<TestRuntime as Config>::BridgedChain>;
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct TestRuntime;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
impl_outer_origin! {
pub enum Origin for TestRuntime where system = frame_system {}
use crate as finality_verifier;
construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Bridge: pallet_substrate_bridge::{Module},
FinalityVerifier: finality_verifier::{Module},
}
}
parameter_types! {
@@ -44,7 +54,7 @@ parameter_types! {
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type Index = u64;
type Call = ();
type Call = Call;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
@@ -54,7 +64,7 @@ impl frame_system::Config for TestRuntime {
type Event = ();
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -74,9 +84,9 @@ parameter_types! {
pub const MaxRequests: u32 = 2;
}
impl crate::pallet::Config for TestRuntime {
impl finality_verifier::Config for TestRuntime {
type BridgedChain = TestBridgedChain;
type HeaderChain = pallet_substrate_bridge::Module<TestRuntime>;
type HeaderChain = pallet_substrate_bridge::Module<Self>;
type AncestryProof = Vec<<Self::BridgedChain as Chain>::Header>;
type AncestryChecker = Checker<<Self::BridgedChain as Chain>::Header, Self::AncestryProof>;
type MaxRequests = MaxRequests;
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
num-traits = { version = "0.2", default-features = false }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
+5 -5
View File
@@ -821,9 +821,9 @@ fn verify_and_decode_messages_proof<Chain: SourceHeaderChain<Fee>, Fee, Dispatch
mod tests {
use super::*;
use crate::mock::{
message, run_test, Origin, TestEvent, TestMessageDeliveryAndDispatchPayment, TestMessagesDeliveryProof,
TestMessagesProof, TestPayload, TestRuntime, PAYLOAD_REJECTED_BY_TARGET_CHAIN, REGULAR_PAYLOAD, TEST_LANE_ID,
TEST_RELAYER_A, TEST_RELAYER_B,
message, run_test, Event as TestEvent, Origin, TestMessageDeliveryAndDispatchPayment,
TestMessagesDeliveryProof, TestMessagesProof, TestPayload, TestRuntime, PAYLOAD_REJECTED_BY_TARGET_CHAIN,
REGULAR_PAYLOAD, TEST_LANE_ID, TEST_RELAYER_A, TEST_RELAYER_B,
};
use bp_message_lane::UnrewardedRelayersState;
use frame_support::{assert_noop, assert_ok};
@@ -847,7 +847,7 @@ mod tests {
System::<TestRuntime>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::message_lane(RawEvent::MessageAccepted(TEST_LANE_ID, 1)),
event: TestEvent::pallet_message_lane(RawEvent::MessageAccepted(TEST_LANE_ID, 1)),
topics: vec![],
}],
);
@@ -876,7 +876,7 @@ mod tests {
System::<TestRuntime>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::message_lane(RawEvent::MessagesDelivered(TEST_LANE_ID, 1, 1)),
event: TestEvent::pallet_message_lane(RawEvent::MessagesDelivered(TEST_LANE_ID, 1, 1)),
topics: vec![],
}],
);
+18 -20
View File
@@ -25,7 +25,7 @@ use bp_message_lane::{
};
use bp_runtime::Size;
use codec::{Decode, Encode};
use frame_support::{impl_outer_event, impl_outer_origin, parameter_types, weights::Weight};
use frame_support::{parameter_types, weights::Weight};
use sp_core::H256;
use sp_runtime::{
testing::Header as SubstrateHeader,
@@ -49,25 +49,23 @@ impl sp_runtime::traits::Convert<H256, AccountId> for AccountIdConverter {
}
}
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct TestRuntime;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
mod message_lane {
pub use crate::Event;
}
use crate as pallet_message_lane;
impl_outer_event! {
pub enum TestEvent for TestRuntime {
frame_system<T>,
pallet_balances<T>,
message_lane<T>,
frame_support::construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Module, Call, Event<T>},
MessageLane: pallet_message_lane::{Module, Call, Event<T>},
}
}
impl_outer_origin! {
pub enum Origin for TestRuntime where system = frame_system {}
}
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = 1024;
@@ -78,17 +76,17 @@ parameter_types! {
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type Index = u64;
type Call = ();
type Call = Call;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = SubstrateHeader;
type Event = TestEvent;
type Event = Event;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -108,7 +106,7 @@ impl pallet_balances::Config for TestRuntime {
type MaxLocks = ();
type Balance = Balance;
type DustRemoval = ();
type Event = TestEvent;
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Module<TestRuntime>;
type WeightInfo = ();
@@ -121,7 +119,7 @@ parameter_types! {
}
impl Config for TestRuntime {
type Event = TestEvent;
type Event = Event;
type WeightInfo = ();
type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce;
type MaxUnrewardedRelayerEntriesAtInboundLane = MaxUnrewardedRelayerEntriesAtInboundLane;
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
# Substrate Dependencies
@@ -20,6 +20,7 @@ sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "master
[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
serde = "1.0"
[features]
default = ["std"]
@@ -93,16 +93,23 @@ mod tests {
traits::{BlakeTwo256, ConvertInto, IdentityLookup},
Perbill, RuntimeAppPublic,
};
use frame_support::{impl_outer_origin, parameter_types, weights::Weight, BasicExternalities};
use frame_support::{parameter_types, weights::Weight, BasicExternalities};
use sp_core::H256;
type AccountId = u64;
#[derive(Clone, Eq, PartialEq)]
pub struct TestRuntime;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
impl_outer_origin! {
pub enum Origin for TestRuntime {}
frame_support::construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Session: pallet_session::{Module},
}
}
parameter_types! {
@@ -115,7 +122,7 @@ mod tests {
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type Index = u64;
type Call = ();
type Call = Call;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
@@ -125,7 +132,7 @@ mod tests {
type Event = ();
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
+2 -2
View File
@@ -8,8 +8,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
finality-grandpa = { version = "0.12.3", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
finality-grandpa = { version = "0.13.0", default-features = false }
hash-db = { version = "0.15.2", default-features = false }
serde = { version = "1.0", optional = true }
+16 -7
View File
@@ -22,7 +22,7 @@
use crate::{BridgedBlockHash, BridgedBlockNumber, BridgedHeader, Config};
use bp_runtime::Chain;
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
use frame_support::{parameter_types, weights::Weight};
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, IdentityLookup},
@@ -34,11 +34,20 @@ pub type TestHeader = BridgedHeader<TestRuntime>;
pub type TestNumber = BridgedBlockNumber<TestRuntime>;
pub type TestHash = BridgedBlockHash<TestRuntime>;
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct TestRuntime;
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
impl_outer_origin! {
pub enum Origin for TestRuntime where system = frame_system {}
use crate as pallet_substrate;
frame_support::construct_runtime! {
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Substrate: pallet_substrate::{Module, Call},
}
}
parameter_types! {
@@ -51,7 +60,7 @@ parameter_types! {
impl frame_system::Config for TestRuntime {
type Origin = Origin;
type Index = u64;
type Call = ();
type Call = Call;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
@@ -61,7 +70,7 @@ impl frame_system::Config for TestRuntime {
type Event = ();
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
# Substrate Dependencies
+2 -2
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
ethbloom = { version = "0.10.0", default-features = false, features = ["rlp"] }
fixed-hash = { version = "0.7", default-features = false }
hash-db = { version = "0.15.2", default-features = false }
@@ -16,7 +16,7 @@ impl-serde = { version = "0.3.1", optional = true }
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] }
parity-bytes = { version = "0.1", default-features = false }
plain_hasher = { version = "0.2.2", default-features = false }
primitive-types = { version = "0.8", default-features = false, features = ["codec", "rlp"] }
primitive-types = { version = "0.9", default-features = false, features = ["codec", "rlp"] }
rlp = { version = "0.5", default-features = false }
serde = { version = "1.0", optional = true }
serde-big-array = { version = "0.2", optional = true }
+2 -2
View File
@@ -7,8 +7,8 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
finality-grandpa = { version = "0.12.3", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
finality-grandpa = { version = "0.13.0", default-features = false }
serde = { version = "1.0", optional = true }
# Substrate Dependencies
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
bp-runtime = { path = "../runtime", default-features = false }
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
[features]
default = ["std"]
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
# Bridge dependencies
+2 -2
View File
@@ -14,9 +14,9 @@ bp-message-lane = { path = "../message-lane", default-features = false }
bp-runtime = { path = "../runtime", default-features = false }
fixed-hash = { version = "0.7.0", default-features = false }
hash256-std-hasher = { version = "0.15.2", default-features = false }
impl-codec = { version = "0.4.2", default-features = false }
impl-codec = { version = "0.5.0", default-features = false }
impl-serde = { version = "0.3.1", optional = true }
parity-util-mem = { version = "0.8.0", default-features = false, features = ["primitive-types"] }
parity-util-mem = { version = "0.9.0", default-features = false, features = ["primitive-types"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
# Substrate Based Dependencies
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
num-traits = { version = "0.2", default-features = false }
# Substrate Dependencies
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
finality-grandpa = { version = "0.12.3" }
finality-grandpa = { version = "0.13.0" }
bp-header-chain = { path = "../header-chain" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
+2 -2
View File
@@ -7,11 +7,11 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
bp-eth-poa = { path = "../../primitives/ethereum-poa" }
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
headers-relay = { path = "../headers-relay" }
hex-literal = "0.3"
jsonrpsee = { git = "https://github.com/svyatonik/jsonrpsee.git", branch = "shared-client-in-rpc-api", default-features = false, features = ["http"] }
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] }
log = "0.4.11"
relay-utils = { path = "../utils" }
web3 = { version = "0.15", default-features = false }
web3 = { version = "0.15", git = "https://github.com/tomusdrw/rust-web3.git", branch ="td-ethabi", default-features = false }
+4 -4
View File
@@ -10,11 +10,11 @@ ansi_term = "0.12"
async-std = "1.9.0"
async-trait = "0.1.42"
clap = { version = "2.33.3", features = ["yaml"] }
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
env_logger = "0.8.2"
ethabi = "13.0"
ethabi-contract = "11.0"
ethabi-derive = "13.0"
ethabi = { git = "https://github.com/paritytech/ethabi.git", branch = "td-eth-types-11" }
ethabi-contract = { git = "https://github.com/paritytech/ethabi.git", branch = "td-eth-types-11" }
ethabi-derive = { git = "https://github.com/paritytech/ethabi.git", branch = "td-eth-types-11" }
futures = "0.3.12"
hex = "0.4"
hex-literal = "0.3"
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
headers-relay = { path = "../headers-relay" }
relay-substrate-client = { path = "../substrate-client" }
relay-utils = { path = "../utils" }
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
headers-relay = { path = "../headers-relay" }
relay-substrate-client = { path = "../substrate-client" }
relay-utils = { path = "../utils" }
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
headers-relay = { path = "../headers-relay" }
relay-substrate-client = { path = "../substrate-client" }
relay-utils = { path = "../utils" }
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
headers-relay = { path = "../headers-relay" }
relay-substrate-client = { path = "../substrate-client" }
relay-utils = { path = "../utils" }
+1 -1
View File
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
async-std = "1.6.5"
async-trait = "0.1.40"
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
jsonrpsee = { git = "https://github.com/svyatonik/jsonrpsee.git", branch = "shared-client-in-rpc-api", default-features = false, features = ["ws"] }
log = "0.4.11"
num-traits = "0.2"
+1 -1
View File
@@ -78,7 +78,7 @@ impl ToString for Error {
match self {
Self::WsConnectionError(e) => e.to_string(),
Self::Request(e) => e.to_string(),
Self::ResponseParseFailed(e) => e.what().to_string(),
Self::ResponseParseFailed(e) => e.to_string(),
Self::UninitializedBridgePallet => "The Substrate bridge pallet has not been initialized yet.".into(),
Self::AccountDoesNotExist => "Account does not exist on the chain".into(),
Self::ClientNotSynced(health) => format!("Substrate client is not synced: {}", health),
+1 -1
View File
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
async-std = "1.9.0"
async-trait = "0.1.42"
codec = { package = "parity-scale-codec", version = "1.3.4" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
futures = "0.3.12"
hex = "0.4"
log = "0.4.14"