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

Commit

Permalink
Companion for paritytech/substrate#12451 & fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Guantong committed Jan 28, 2023
1 parent 3abfbce commit 2808531
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

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

12 changes: 7 additions & 5 deletions modules/dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ scale-info = { version = "2.1", default-features = false, features = ["derive"]
bp-message-dispatch = { default-features = false, path = "../../primitives/message-dispatch" }
bp-runtime = { default-features = false, path = "../../primitives/runtime" }
# paritytech
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
pallet-root-testing = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
Expand All @@ -35,6 +36,7 @@ std = [
# paritytech
"frame-support/std",
"frame-system/std",
"pallet-root-testing/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
Expand Down
8 changes: 6 additions & 2 deletions modules/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ mod tests {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
RootTesting: pallet_root_testing,
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Dispatch: call_dispatch::{Pallet, Call, Event<T>},
}
Expand All @@ -554,6 +555,8 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}

impl pallet_root_testing::Config for TestRuntime {}

impl frame_system::Config for TestRuntime {
type AccountData = ();
type AccountId = AccountId;
Expand Down Expand Up @@ -581,6 +584,7 @@ mod tests {
type Version = ();
}


impl Config for TestRuntime {
type AccountIdConverter = AccountIdConverter;
type BridgeMessageId = BridgeMessageId;
Expand Down Expand Up @@ -618,7 +622,7 @@ mod tests {
call: &RuntimeCall,
) -> Result<(), TransactionValidityError> {
match call {
RuntimeCall::System(frame_system::Call::fill_block { .. }) =>
RuntimeCall::RootTesting(pallet_root_testing::Call::fill_block { .. }) =>
Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
_ => Ok(()),
}
Expand Down Expand Up @@ -887,7 +891,7 @@ mod tests {
let id = [0; 4];
let relayer_account = 1;

let call = RuntimeCall::System(frame_system::Call::fill_block {
let call = RuntimeCall::RootTesting(pallet_root_testing::Call::fill_block {
ratio: Perbill::from_percent(75),
});
let weight = call.get_dispatch_info().weight;
Expand Down
2 changes: 1 addition & 1 deletion modules/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use frame_support::{
weights::Weight,
};
use frame_system::mocking::*;
use sp_core::sr25519::Signature;
use sp_core::{sr25519::Signature, ConstU64};
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, IdentityLookup},
Expand Down
1 change: 1 addition & 0 deletions modules/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use bp_runtime::Chain;
// paritytech
use frame_support::{traits::IsInVec, weights::Weight};
use frame_system::mocking::*;
use sp_core::ConstU32;
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, Header as HeaderT, IdentityLookup},
Expand Down

0 comments on commit 2808531

Please sign in to comment.