BREAKING: Rename Call & Event (#11981)

* rename Event to RuntimeEvent

* rename Call

* rename in runtimes

* small fix

* rename Event

* small fix & rename RuntimeCall back to Call for now

* small fixes

* more renaming

* a bit more renaming

* fmt

* small fix

* commit

* prep for renaming associated types

* fix

* rename associated Event type

* rename to RuntimeEvent

* commit

* merge conflict fixes & fmt

* additional renaming

* fix.

* fix decl_event

* rename in tests

* remove warnings

* remove accidental rename

* .

* commit

* update .stderr

* fix in test

* update .stderr

* TRYBUILD=overwrite

* docs

* fmt

* small change in docs

* rename PalletEvent to Event

* rename Call to RuntimeCall

* renamed at wrong places :P

* rename Call

* rename

* rename associated type

* fix

* fix & fmt

* commit

* frame-support-test

* passing tests

* update docs

* rustdoc fix

* update .stderr

* wrong code in docs

* merge fix

* fix in error message

* update .stderr

* docs & error message

* .

* merge fix

* merge fix

* fmt

* fmt

* merge fix

* more fixing

* fmt

* remove unused

* fmt

* fix

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Sergej Sakac
2022-09-13 00:03:31 +02:00
committed by GitHub
parent 472b5746e5
commit 6e8795afe6
228 changed files with 1791 additions and 1672 deletions
@@ -119,7 +119,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
pub fn create_benchmark_extrinsic(
client: &FullClient,
sender: sp_core::sr25519::Pair,
call: runtime::Call,
call: runtime::RuntimeCall,
nonce: u32,
) -> runtime::UncheckedExtrinsic {
let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
@@ -27,7 +27,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an event.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
// The pallet's runtime storage items.
@@ -28,7 +28,7 @@ impl system::Config for Test {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -36,7 +36,7 @@ impl system::Config for Test {
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -50,7 +50,7 @@ impl system::Config for Test {
}
impl pallet_template::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
}
// Build genesis storage according to the mock runtime.
+15 -14
View File
@@ -158,7 +158,7 @@ impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
type RuntimeCall = RuntimeCall;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The index type for storing how many extrinsics an account has signed.
@@ -172,7 +172,7 @@ impl frame_system::Config for Runtime {
/// The header type.
type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// The ubiquitous event type.
type Event = Event;
type RuntimeEvent = RuntimeEvent;
/// The ubiquitous origin type.
type Origin = Origin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
@@ -209,8 +209,7 @@ impl pallet_aura::Config for Runtime {
}
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type KeyOwnerProofSystem = ();
@@ -246,7 +245,7 @@ impl pallet_balances::Config for Runtime {
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
type AccountStore = System;
@@ -258,7 +257,7 @@ parameter_types! {
}
impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<Balance>;
@@ -267,13 +266,13 @@ impl pallet_transaction_payment::Config for Runtime {
}
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
}
/// Configure the pallet-template in pallets/template.
impl pallet_template::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
}
// Create the runtime by composing the FRAME pallets that were previously configured.
@@ -314,10 +313,12 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
@@ -473,17 +474,17 @@ impl_runtime_apis! {
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime
{
fn query_call_info(
call: Call,
call: RuntimeCall,
len: u32,
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len)
}
fn query_call_fee_details(
call: Call,
call: RuntimeCall,
len: u32,
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len)
@@ -122,7 +122,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
fn extrinsic_set_time(now: u64) -> OpaqueExtrinsic {
kitchensink_runtime::UncheckedExtrinsic {
signature: None,
function: kitchensink_runtime::Call::Timestamp(pallet_timestamp::Call::set { now }),
function: kitchensink_runtime::RuntimeCall::Timestamp(pallet_timestamp::Call::set { now }),
}
.into()
}
+6 -4
View File
@@ -69,7 +69,7 @@ pub fn fetch_nonce(client: &FullClient, account: sp_core::sr25519::Pair) -> u32
pub fn create_extrinsic(
client: &FullClient,
sender: sp_core::sr25519::Pair,
function: impl Into<kitchensink_runtime::Call>,
function: impl Into<kitchensink_runtime::RuntimeCall>,
nonce: Option<u32>,
) -> kitchensink_runtime::UncheckedExtrinsic {
let function = function.into();
@@ -570,7 +570,7 @@ mod tests {
use codec::Encode;
use kitchensink_runtime::{
constants::{currency::CENTS, time::SLOT_DURATION},
Address, BalancesCall, Call, UncheckedExtrinsic,
Address, BalancesCall, RuntimeCall, UncheckedExtrinsic,
};
use node_primitives::{Block, DigestItem, Signature};
use sc_client_api::BlockBackend;
@@ -759,8 +759,10 @@ mod tests {
};
let signer = charlie.clone();
let function =
Call::Balances(BalancesCall::transfer { dest: to.into(), value: amount });
let function = RuntimeCall::Balances(BalancesCall::transfer {
dest: to.into(),
value: amount,
});
let check_non_zero_sender = frame_system::CheckNonZeroSender::new();
let check_spec_version = frame_system::CheckSpecVersion::new();
+4 -4
View File
@@ -19,8 +19,8 @@ use codec::{Decode, Encode};
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use frame_support::Hashable;
use kitchensink_runtime::{
constants::currency::*, Block, BuildStorage, Call, CheckedExtrinsic, GenesisConfig, Header,
UncheckedExtrinsic,
constants::currency::*, Block, BuildStorage, CheckedExtrinsic, GenesisConfig, Header,
RuntimeCall, UncheckedExtrinsic,
};
use node_executor::ExecutorDispatch;
use node_primitives::{BlockNumber, Hash};
@@ -141,11 +141,11 @@ fn test_blocks(
let mut test_ext = new_test_ext(genesis_config);
let mut block1_extrinsics = vec![CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: 0 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: 0 }),
}];
block1_extrinsics.extend((0..20).map(|i| CheckedExtrinsic {
signed: Some((alice(), signed_extra(i, 0))),
function: Call::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: bob().into(),
value: 1 * DOLLARS,
}),
+50 -44
View File
@@ -28,8 +28,8 @@ use sp_runtime::{
use kitchensink_runtime::{
constants::{currency::*, time::SLOT_DURATION},
Balances, Call, CheckedExtrinsic, Event, Header, Runtime, System, TransactionPayment,
UncheckedExtrinsic,
Balances, CheckedExtrinsic, Header, Runtime, RuntimeCall, RuntimeEvent, System,
TransactionPayment, UncheckedExtrinsic,
};
use node_primitives::{Balance, Hash};
use node_testing::keyring::*;
@@ -67,7 +67,7 @@ fn transfer_fee<E: Encode>(extrinsic: &E) -> Balance {
fn xt() -> UncheckedExtrinsic {
sign(CheckedExtrinsic {
signed: Some((alice(), signed_extra(0, 0))),
function: Call::Balances(default_transfer_call()),
function: RuntimeCall::Balances(default_transfer_call()),
})
}
@@ -84,11 +84,11 @@ fn changes_trie_block() -> (Vec<u8>, Hash) {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time }),
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(0, 0))),
function: Call::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: bob().into(),
value: 69 * DOLLARS,
}),
@@ -111,11 +111,11 @@ fn blocks() -> ((Vec<u8>, Hash), (Vec<u8>, Hash)) {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time1 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time1 }),
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(0, 0))),
function: Call::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: bob().into(),
value: 69 * DOLLARS,
}),
@@ -131,18 +131,18 @@ fn blocks() -> ((Vec<u8>, Hash), (Vec<u8>, Hash)) {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time2 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time2 }),
},
CheckedExtrinsic {
signed: Some((bob(), signed_extra(0, 0))),
function: Call::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: alice().into(),
value: 5 * DOLLARS,
}),
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(1, 0))),
function: Call::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: bob().into(),
value: 15 * DOLLARS,
}),
@@ -166,11 +166,11 @@ fn block_with_size(time: u64, nonce: u32, size: usize) -> (Vec<u8>, Hash) {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time * 1000 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time * 1000 }),
},
CheckedExtrinsic {
signed: Some((alice(), signed_extra(nonce, 0))),
function: Call::System(frame_system::Call::remark { remark: vec![0; size] }),
function: RuntimeCall::System(frame_system::Call::remark { remark: vec![0; size] }),
},
],
(time * 1000 / SLOT_DURATION).into(),
@@ -324,7 +324,7 @@ fn full_native_block_import_works() {
let events = vec![
EventRecord {
phase: Phase::ApplyExtrinsic(0),
event: Event::System(frame_system::Event::ExtrinsicSuccess {
event: RuntimeEvent::System(frame_system::Event::ExtrinsicSuccess {
dispatch_info: DispatchInfo {
weight: timestamp_weight,
class: DispatchClass::Mandatory,
@@ -335,7 +335,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Balances(pallet_balances::Event::Withdraw {
event: RuntimeEvent::Balances(pallet_balances::Event::Withdraw {
who: alice().into(),
amount: fees,
}),
@@ -343,7 +343,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: alice().into(),
to: bob().into(),
amount: 69 * DOLLARS,
@@ -352,7 +352,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Balances(pallet_balances::Event::Deposit {
event: RuntimeEvent::Balances(pallet_balances::Event::Deposit {
who: pallet_treasury::Pallet::<Runtime>::account_id(),
amount: fees * 8 / 10,
}),
@@ -360,12 +360,14 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Treasury(pallet_treasury::Event::Deposit { value: fees * 8 / 10 }),
event: RuntimeEvent::Treasury(pallet_treasury::Event::Deposit {
value: fees * 8 / 10,
}),
topics: vec![],
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::TransactionPayment(
event: RuntimeEvent::TransactionPayment(
pallet_transaction_payment::Event::TransactionFeePaid {
who: alice().into(),
actual_fee: fees,
@@ -376,7 +378,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::System(frame_system::Event::ExtrinsicSuccess {
event: RuntimeEvent::System(frame_system::Event::ExtrinsicSuccess {
dispatch_info: DispatchInfo { weight: transfer_weight, ..Default::default() },
}),
topics: vec![],
@@ -398,7 +400,7 @@ fn full_native_block_import_works() {
let events = vec![
EventRecord {
phase: Phase::ApplyExtrinsic(0),
event: Event::System(frame_system::Event::ExtrinsicSuccess {
event: RuntimeEvent::System(frame_system::Event::ExtrinsicSuccess {
dispatch_info: DispatchInfo {
weight: timestamp_weight,
class: DispatchClass::Mandatory,
@@ -409,7 +411,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Balances(pallet_balances::Event::Withdraw {
event: RuntimeEvent::Balances(pallet_balances::Event::Withdraw {
who: bob().into(),
amount: fees,
}),
@@ -417,7 +419,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: bob().into(),
to: alice().into(),
amount: 5 * DOLLARS,
@@ -426,7 +428,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Balances(pallet_balances::Event::Deposit {
event: RuntimeEvent::Balances(pallet_balances::Event::Deposit {
who: pallet_treasury::Pallet::<Runtime>::account_id(),
amount: fees * 8 / 10,
}),
@@ -434,12 +436,14 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::Treasury(pallet_treasury::Event::Deposit { value: fees * 8 / 10 }),
event: RuntimeEvent::Treasury(pallet_treasury::Event::Deposit {
value: fees * 8 / 10,
}),
topics: vec![],
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::TransactionPayment(
event: RuntimeEvent::TransactionPayment(
pallet_transaction_payment::Event::TransactionFeePaid {
who: bob().into(),
actual_fee: fees,
@@ -450,14 +454,14 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::System(frame_system::Event::ExtrinsicSuccess {
event: RuntimeEvent::System(frame_system::Event::ExtrinsicSuccess {
dispatch_info: DispatchInfo { weight: transfer_weight, ..Default::default() },
}),
topics: vec![],
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::Balances(pallet_balances::Event::Withdraw {
event: RuntimeEvent::Balances(pallet_balances::Event::Withdraw {
who: alice().into(),
amount: fees,
}),
@@ -465,7 +469,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: alice().into(),
to: bob().into(),
amount: 15 * DOLLARS,
@@ -474,7 +478,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::Balances(pallet_balances::Event::Deposit {
event: RuntimeEvent::Balances(pallet_balances::Event::Deposit {
who: pallet_treasury::Pallet::<Runtime>::account_id(),
amount: fees * 8 / 10,
}),
@@ -482,12 +486,14 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::Treasury(pallet_treasury::Event::Deposit { value: fees * 8 / 10 }),
event: RuntimeEvent::Treasury(pallet_treasury::Event::Deposit {
value: fees * 8 / 10,
}),
topics: vec![],
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::TransactionPayment(
event: RuntimeEvent::TransactionPayment(
pallet_transaction_payment::Event::TransactionFeePaid {
who: alice().into(),
actual_fee: fees,
@@ -498,7 +504,7 @@ fn full_native_block_import_works() {
},
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::System(frame_system::Event::ExtrinsicSuccess {
event: RuntimeEvent::System(frame_system::Event::ExtrinsicSuccess {
dispatch_info: DispatchInfo { weight: transfer_weight, ..Default::default() },
}),
topics: vec![],
@@ -648,24 +654,24 @@ fn deploying_wasm_contract_should_work() {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time }),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(0, 0))),
function: Call::Contracts(
pallet_contracts::Call::instantiate_with_code::<Runtime> {
value: 0,
gas_limit: Weight::from_ref_time(500_000_000),
storage_deposit_limit: None,
code: transfer_code,
data: Vec::new(),
salt: Vec::new(),
},
),
function: RuntimeCall::Contracts(pallet_contracts::Call::instantiate_with_code::<
Runtime,
> {
value: 0,
gas_limit: Weight::from_ref_time(500_000_000),
storage_deposit_limit: None,
code: transfer_code,
data: Vec::new(),
salt: Vec::new(),
}),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(1, 0))),
function: Call::Contracts(pallet_contracts::Call::call::<Runtime> {
function: RuntimeCall::Contracts(pallet_contracts::Call::call::<Runtime> {
dest: sp_runtime::MultiAddress::Id(addr.clone()),
value: 10,
gas_limit: Weight::from_ref_time(500_000_000),
+14 -11
View File
@@ -22,7 +22,8 @@ use frame_support::{
};
use kitchensink_runtime::{
constants::{currency::*, time::SLOT_DURATION},
Balances, Call, CheckedExtrinsic, Multiplier, Runtime, TransactionByteFee, TransactionPayment,
Balances, CheckedExtrinsic, Multiplier, Runtime, RuntimeCall, TransactionByteFee,
TransactionPayment,
};
use node_primitives::Balance;
use node_testing::keyring::*;
@@ -53,12 +54,12 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time1 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time1 }),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(0, 0))),
function: Call::Sudo(pallet_sudo::Call::sudo {
call: Box::new(Call::System(frame_system::Call::fill_block {
function: RuntimeCall::Sudo(pallet_sudo::Call::sudo {
call: Box::new(RuntimeCall::System(frame_system::Call::fill_block {
ratio: Perbill::from_percent(60),
})),
}),
@@ -76,11 +77,11 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time2 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time2 }),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(1, 0))),
function: Call::System(frame_system::Call::remark { remark: vec![0; 1] }),
function: RuntimeCall::System(frame_system::Call::remark { remark: vec![0; 1] }),
},
],
(time2 / SLOT_DURATION).into(),
@@ -146,7 +147,7 @@ fn transaction_fee_is_correct() {
let tip = 1_000_000;
let xt = sign(CheckedExtrinsic {
signed: Some((alice(), signed_extra(0, tip))),
function: Call::Balances(default_transfer_call()),
function: RuntimeCall::Balances(default_transfer_call()),
});
let r =
@@ -212,7 +213,7 @@ fn block_weight_capacity_report() {
let mut xts = (0..num_transfers)
.map(|i| CheckedExtrinsic {
signed: Some((charlie(), signed_extra(nonce + i as Index, 0))),
function: Call::Balances(pallet_balances::Call::transfer {
function: RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: bob().into(),
value: 0,
}),
@@ -223,7 +224,7 @@ fn block_weight_capacity_report() {
0,
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time * 1000 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set { now: time * 1000 }),
},
);
@@ -286,11 +287,13 @@ fn block_length_capacity_report() {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set { now: time * 1000 }),
function: RuntimeCall::Timestamp(pallet_timestamp::Call::set {
now: time * 1000,
}),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(nonce, 0))),
function: Call::System(frame_system::Call::remark {
function: RuntimeCall::System(frame_system::Call::remark {
remark: vec![0u8; (block_number * factor) as usize],
}),
},
+5 -4
View File
@@ -18,7 +18,8 @@
//! Some configurable implementations as associated type for the substrate runtime.
use crate::{
AccountId, AllianceMotion, Assets, Authorship, Balances, Call, Hash, NegativeImbalance, Runtime,
AccountId, AllianceMotion, Assets, Authorship, Balances, Hash, NegativeImbalance, Runtime,
RuntimeCall,
};
use frame_support::{
pallet_prelude::*,
@@ -77,11 +78,11 @@ impl IdentityVerifier<AccountId> for AllianceIdentityVerifier {
}
pub struct AllianceProposalProvider;
impl ProposalProvider<AccountId, Hash, Call> for AllianceProposalProvider {
impl ProposalProvider<AccountId, Hash, RuntimeCall> for AllianceProposalProvider {
fn propose_proposal(
who: AccountId,
threshold: u32,
proposal: Box<Call>,
proposal: Box<RuntimeCall>,
length_bound: u32,
) -> Result<(u32, u32), DispatchError> {
AllianceMotion::do_propose_proposed(who, threshold, proposal, length_bound)
@@ -109,7 +110,7 @@ impl ProposalProvider<AccountId, Hash, Call> for AllianceProposalProvider {
AllianceMotion::do_close(proposal_hash, proposal_index, proposal_weight_bound, length_bound)
}
fn proposal_of(proposal_hash: Hash) -> Option<Call> {
fn proposal_of(proposal_hash: Hash) -> Option<RuntimeCall> {
AllianceMotion::proposal_of(proposal_hash)
}
}
+96 -92
View File
@@ -205,7 +205,7 @@ impl frame_system::Config for Runtime {
type BlockLength = RuntimeBlockLength;
type DbWeight = RocksDbWeight;
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = Index;
type BlockNumber = BlockNumber;
type Hash = Hash;
@@ -213,7 +213,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId;
type Lookup = Indices;
type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = Version;
type PalletInfo = PalletInfo;
@@ -229,8 +229,8 @@ impl frame_system::Config for Runtime {
impl pallet_randomness_collective_flip::Config for Runtime {}
impl pallet_utility::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller;
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
}
@@ -243,8 +243,8 @@ parameter_types! {
}
impl pallet_multisig::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
@@ -286,25 +286,28 @@ impl Default for ProxyType {
Self::Any
}
}
impl InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool {
impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &RuntimeCall) -> bool {
match self {
ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(
c,
Call::Balances(..) |
Call::Assets(..) | Call::Uniques(..) |
Call::Vesting(pallet_vesting::Call::vested_transfer { .. }) |
Call::Indices(pallet_indices::Call::transfer { .. })
RuntimeCall::Balances(..) |
RuntimeCall::Assets(..) |
RuntimeCall::Uniques(..) |
RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) |
RuntimeCall::Indices(pallet_indices::Call::transfer { .. })
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..) |
Call::Council(..) | Call::Society(..) |
Call::TechnicalCommittee(..) |
Call::Elections(..) | Call::Treasury(..)
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) |
RuntimeCall::Society(..) |
RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::Elections(..) |
RuntimeCall::Treasury(..)
),
ProxyType::Staking => matches!(c, Call::Staking(..)),
ProxyType::Staking => matches!(c, RuntimeCall::Staking(..)),
}
}
fn is_superset(&self, o: &Self) -> bool {
@@ -319,8 +322,8 @@ impl InstanceFilter<Call> for ProxyType {
}
impl pallet_proxy::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
@@ -341,10 +344,10 @@ parameter_types! {
}
impl pallet_scheduler::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
type Call = Call;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = ConstU32<50>;
@@ -363,7 +366,7 @@ parameter_types! {
impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type MaxSize = PreimageMaxSize;
@@ -413,7 +416,7 @@ impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex;
type Currency = Balances;
type Deposit = IndexDeposit;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_indices::weights::SubstrateWeight<Runtime>;
}
@@ -431,7 +434,7 @@ impl pallet_balances::Config for Runtime {
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Pallet<Runtime>;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
@@ -446,7 +449,7 @@ parameter_types! {
}
impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = IdentityFee<Balance>;
@@ -456,7 +459,7 @@ impl pallet_transaction_payment::Config for Runtime {
}
impl pallet_asset_tx_payment::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Fungibles = Assets;
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
@@ -496,7 +499,7 @@ impl_opaque_keys! {
}
impl pallet_session::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe;
@@ -546,7 +549,7 @@ impl pallet_staking::Config for Runtime {
type UnixTime = Timestamp;
type CurrencyToVote = U128CurrencyToVote;
type RewardRemainder = Treasury;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Slash = Treasury; // send the slashed funds to the treasury.
type Reward = (); // rewards are minted from the void
type SessionsPerEra = SessionsPerEra;
@@ -686,7 +689,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
}
impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type EstimateCallFee = TransactionPayment;
type SignedPhase = SignedPhase;
@@ -721,7 +724,7 @@ parameter_types! {
}
impl pallet_bags_list::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ScoreProvider = Staking;
type WeightInfo = pallet_bags_list::weights::SubstrateWeight<Runtime>;
type BagThresholds = BagThresholds;
@@ -750,7 +753,7 @@ impl Convert<sp_core::U256, Balance> for U256ToBalance {
impl pallet_nomination_pools::Config for Runtime {
type WeightInfo = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyBalance = Balance;
type RewardCounter = FixedU128;
@@ -770,7 +773,7 @@ parameter_types! {
impl pallet_conviction_voting::Config for Runtime {
type WeightInfo = pallet_conviction_voting::weights::SubstrateWeight<Self>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type VoteLockingPeriod = VoteLockingPeriod;
type MaxVotes = ConstU32<512>;
@@ -827,8 +830,8 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
impl pallet_referenda::Config for Runtime {
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Self>;
type Call = Call;
type Event = Event;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
type Currency = pallet_balances::Pallet<Self>;
type SubmitOrigin = EnsureSigned<AccountId>;
@@ -846,8 +849,8 @@ impl pallet_referenda::Config for Runtime {
impl pallet_referenda::Config<pallet_referenda::Instance2> for Runtime {
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Self>;
type Call = Call;
type Event = Event;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
type Currency = pallet_balances::Pallet<Self>;
type SubmitOrigin = EnsureSigned<AccountId>;
@@ -865,7 +868,7 @@ impl pallet_referenda::Config<pallet_referenda::Instance2> for Runtime {
impl pallet_ranked_collective::Config for Runtime {
type WeightInfo = pallet_ranked_collective::weights::SubstrateWeight<Self>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type PromoteOrigin = EnsureRootWithSuccess<AccountId, ConstU16<65535>>;
type DemoteOrigin = EnsureRootWithSuccess<AccountId, ConstU16<65535>>;
type Polls = RankedPolls;
@@ -875,7 +878,7 @@ impl pallet_ranked_collective::Config for Runtime {
impl pallet_remark::Config for Runtime {
type WeightInfo = pallet_remark::weights::SubstrateWeight<Self>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
}
parameter_types! {
@@ -889,8 +892,8 @@ parameter_types! {
}
impl pallet_democracy::Config for Runtime {
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod;
type LaunchPeriod = LaunchPeriod;
@@ -948,8 +951,8 @@ parameter_types! {
type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers;
@@ -975,7 +978,7 @@ parameter_types! {
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type PalletId = ElectionsPhragmenPalletId;
type Currency = Balances;
type ChangeMembers = Council;
@@ -1005,8 +1008,8 @@ parameter_types! {
type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers;
@@ -1019,7 +1022,7 @@ type EnsureRootOrHalfCouncil = EitherOfDiverse<
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>;
impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrHalfCouncil;
type RemoveOrigin = EnsureRootOrHalfCouncil;
type SwapOrigin = EnsureRootOrHalfCouncil;
@@ -1056,7 +1059,7 @@ impl pallet_treasury::Config for Runtime {
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
@@ -1082,7 +1085,7 @@ parameter_types! {
}
impl pallet_bounties::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = BountyDepositBase;
type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
type BountyUpdatePeriod = BountyUpdatePeriod;
@@ -1101,14 +1104,14 @@ parameter_types! {
}
impl pallet_child_bounties::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = ConstU32<5>;
type ChildBountyValueMinimum = ChildBountyValueMinimum;
type WeightInfo = pallet_child_bounties::weights::SubstrateWeight<Runtime>;
}
impl pallet_tips::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DataDepositPerByte = DataDepositPerByte;
type MaximumReasonLength = MaximumReasonLength;
type Tippers = Elections;
@@ -1136,8 +1139,8 @@ impl pallet_contracts::Config for Runtime {
type Time = Timestamp;
type Randomness = RandomnessCollectiveFlip;
type Currency = Balances;
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
/// The safest default is to allow no calls at all.
///
/// Runtimes should whitelist dispatchables that are allowed to be called from contracts
@@ -1162,8 +1165,8 @@ impl pallet_contracts::Config for Runtime {
}
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
}
parameter_types! {
@@ -1178,14 +1181,14 @@ parameter_types! {
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
call: RuntimeCall,
public: <Signature as traits::Verify>::Signer,
account: AccountId,
nonce: Index,
) -> Option<(Call, <UncheckedExtrinsic as traits::Extrinsic>::SignaturePayload)> {
) -> Option<(RuntimeCall, <UncheckedExtrinsic as traits::Extrinsic>::SignaturePayload)> {
let tip = 0;
// take the biggest period possible.
let period =
@@ -1225,15 +1228,15 @@ impl frame_system::offchain::SigningTypes for Runtime {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where
Call: From<C>,
RuntimeCall: From<C>,
{
type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
}
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type NextSessionRotation = Babe;
type ValidatorSet = Historical;
type ReportUnresponsiveness = Offences;
@@ -1245,7 +1248,7 @@ impl pallet_im_online::Config for Runtime {
}
impl pallet_offences::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
}
@@ -1255,8 +1258,7 @@ impl pallet_authority_discovery::Config for Runtime {
}
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type KeyOwnerProofSystem = Historical;
@@ -1288,7 +1290,7 @@ parameter_types! {
}
impl pallet_identity::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit;
@@ -1310,9 +1312,9 @@ parameter_types! {
}
impl pallet_recovery::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_recovery::weights::SubstrateWeight<Runtime>;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor;
@@ -1333,7 +1335,7 @@ parameter_types! {
}
impl pallet_society::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type PalletId = SocietyPalletId;
type Currency = Balances;
type Randomness = RandomnessCollectiveFlip;
@@ -1356,7 +1358,7 @@ parameter_types! {
}
impl pallet_vesting::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
@@ -1383,10 +1385,10 @@ parameter_types! {
impl pallet_lottery::Config for Runtime {
type PalletId = LotteryPalletId;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type Randomness = RandomnessCollectiveFlip;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ManagerOrigin = EnsureRoot<AccountId>;
type MaxCalls = MaxCalls;
type ValidateCall = Lottery;
@@ -1403,7 +1405,7 @@ parameter_types! {
}
impl pallet_assets::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Balance = u128;
type AssetId = u32;
type Currency = Balances;
@@ -1431,7 +1433,7 @@ parameter_types! {
}
impl pallet_gilt::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyBalance = Balance;
type AdminOrigin = frame_system::EnsureRoot<AccountId>;
@@ -1456,7 +1458,7 @@ parameter_types! {
}
impl pallet_uniques::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type CollectionId = u32;
type ItemId = u32;
type Currency = Balances;
@@ -1477,9 +1479,9 @@ impl pallet_uniques::Config for Runtime {
}
impl pallet_transaction_storage::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type Call = Call;
type RuntimeCall = RuntimeCall;
type FeeDestination = ();
type WeightInfo = pallet_transaction_storage::weights::SubstrateWeight<Runtime>;
type MaxBlockTransactions =
@@ -1489,8 +1491,8 @@ impl pallet_transaction_storage::Config for Runtime {
}
impl pallet_whitelist::Config for Runtime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WhitelistOrigin = EnsureRoot<AccountId>;
type DispatchWhitelistedOrigin = EnsureRoot<AccountId>;
type PreimageProvider = Preimage;
@@ -1504,7 +1506,7 @@ parameter_types! {
}
impl pallet_state_trie_migration::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ControlOrigin = EnsureRoot<AccountId>;
type Currency = Balances;
type MaxKeyLen = MigrationMaxKeyLen;
@@ -1529,8 +1531,8 @@ parameter_types! {
type AllianceCollective = pallet_collective::Instance3;
impl pallet_collective::Config<AllianceCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = AllianceMotionDuration;
type MaxProposals = AllianceMaxProposals;
type MaxMembers = AllianceMaxMembers;
@@ -1547,8 +1549,8 @@ parameter_types! {
}
impl pallet_alliance::Config for Runtime {
type Event = Event;
type Proposal = Call;
type RuntimeEvent = RuntimeEvent;
type Proposal = RuntimeCall;
type AdminOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, AllianceCollective, 2, 3>,
@@ -1673,12 +1675,14 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
@@ -1977,13 +1981,13 @@ impl_runtime_apis! {
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call>
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime
{
fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len)
}
fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance> {
fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len)
}
}
@@ -2178,7 +2182,7 @@ mod tests {
fn validate_transaction_submitter_bounds() {
fn is_submit_signed_transaction<T>()
where
T: CreateSignedTransaction<Call>,
T: CreateSignedTransaction<RuntimeCall>,
{
}
@@ -2198,11 +2202,11 @@ mod tests {
#[test]
fn call_size() {
let size = core::mem::size_of::<Call>();
let size = core::mem::size_of::<RuntimeCall>();
assert!(
size <= 208,
"size of Call {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the
size of Call.
"size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the
size of RuntimeCall.
If the limit is too strong, maybe consider increase the limit to 300.",
size,
);
+6 -5
View File
@@ -35,8 +35,8 @@ use crate::{
use codec::{Decode, Encode};
use futures::executor;
use kitchensink_runtime::{
constants::currency::DOLLARS, AccountId, BalancesCall, Call, CheckedExtrinsic, MinimumPeriod,
Signature, SystemCall, UncheckedExtrinsic,
constants::currency::DOLLARS, AccountId, BalancesCall, CheckedExtrinsic, MinimumPeriod,
RuntimeCall, Signature, SystemCall, UncheckedExtrinsic,
};
use node_primitives::Block;
use sc_block_builder::BlockBuilderProvider;
@@ -308,12 +308,12 @@ impl<'a> Iterator for BlockContentIterator<'a> {
)),
function: match self.content.block_type {
BlockType::RandomTransfersKeepAlive =>
Call::Balances(BalancesCall::transfer_keep_alive {
RuntimeCall::Balances(BalancesCall::transfer_keep_alive {
dest: sp_runtime::MultiAddress::Id(receiver),
value: kitchensink_runtime::ExistentialDeposit::get() + 1,
}),
BlockType::RandomTransfersReaping => {
Call::Balances(BalancesCall::transfer {
RuntimeCall::Balances(BalancesCall::transfer {
dest: sp_runtime::MultiAddress::Id(receiver),
// Transfer so that ending balance would be 1 less than existential
// deposit so that we kill the sender account.
@@ -321,7 +321,8 @@ impl<'a> Iterator for BlockContentIterator<'a> {
(kitchensink_runtime::ExistentialDeposit::get() - 1),
})
},
BlockType::Noop => Call::System(SystemCall::remark { remark: Vec::new() }),
BlockType::Noop =>
RuntimeCall::System(SystemCall::remark { remark: Vec::new() }),
},
},
self.runtime_version.spec_version,
+1 -1
View File
@@ -148,7 +148,7 @@ And update the overall definition for weights on frame and a few related types a
+ type BlockLength = RuntimeBlockLength;
+ type DbWeight = RocksDbWeight;
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = Index;
@@ -171,25 +198,19 @@ impl frame_system::Trait for Runtime {
type Header = generic::Header<BlockNumber, BlakeTwo256>;
+1 -1
View File
@@ -35,7 +35,7 @@ const SEED: u32 = 0;
const MAX_BYTES: u32 = 1_024;
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
+3 -2
View File
@@ -240,7 +240,8 @@ pub mod pallet {
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The outer call dispatch type.
type Proposal: Parameter
@@ -249,7 +250,7 @@ pub mod pallet {
+ From<Call<Self, I>>
+ GetDispatchInfo
+ IsSubType<Call<Self, I>>
+ IsType<<Self as frame_system::Config>::Call>;
+ IsType<<Self as frame_system::Config>::RuntimeCall>;
/// Origin for admin-level operations, like setting the Alliance's rules.
type AdminOrigin: EnsureOrigin<Self::Origin>;
+18 -18
View File
@@ -48,7 +48,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = BlockNumber;
type Hash = H256;
@@ -56,7 +56,7 @@ impl frame_system::Config for Test {
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
type Version = ();
@@ -77,7 +77,7 @@ parameter_types! {
impl pallet_balances::Config for Test {
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
@@ -96,8 +96,8 @@ parameter_types! {
type AllianceCollective = pallet_collective::Instance1;
impl pallet_collective::Config<AllianceCollective> for Test {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = MotionDuration;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
@@ -124,7 +124,7 @@ type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<One, u64>
type EnsureTwoOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Two, u64>>;
impl pallet_identity::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit;
@@ -162,11 +162,11 @@ impl IdentityVerifier<u64> for AllianceIdentityVerifier {
}
pub struct AllianceProposalProvider;
impl ProposalProvider<u64, H256, Call> for AllianceProposalProvider {
impl ProposalProvider<u64, H256, RuntimeCall> for AllianceProposalProvider {
fn propose_proposal(
who: u64,
threshold: u32,
proposal: Box<Call>,
proposal: Box<RuntimeCall>,
length_bound: u32,
) -> Result<(u32, u32), DispatchError> {
AllianceMotion::do_propose_proposed(who, threshold, proposal, length_bound)
@@ -194,7 +194,7 @@ impl ProposalProvider<u64, H256, Call> for AllianceProposalProvider {
AllianceMotion::do_close(proposal_hash, proposal_index, proposal_weight_bound, length_bound)
}
fn proposal_of(proposal_hash: H256) -> Option<Call> {
fn proposal_of(proposal_hash: H256) -> Option<RuntimeCall> {
AllianceMotion::proposal_of(proposal_hash)
}
}
@@ -207,8 +207,8 @@ parameter_types! {
pub const RetirementPeriod: BlockNumber = MOTION_DURATION_IN_BLOCKS + 1;
}
impl Config for Test {
type Event = Event;
type Proposal = Call;
type RuntimeEvent = RuntimeEvent;
type Proposal = RuntimeCall;
type AdminOrigin = EnsureSignedBy<One, u64>;
type MembershipManager = EnsureSignedBy<Two, u64>;
type AnnouncementOrigin = EnsureSignedBy<Three, u64>;
@@ -380,19 +380,19 @@ pub fn test_cid() -> Cid {
Cid::new_v0(&*result)
}
pub fn make_remark_proposal(value: u64) -> (Call, u32, H256) {
make_proposal(Call::System(frame_system::Call::remark { remark: value.encode() }))
pub fn make_remark_proposal(value: u64) -> (RuntimeCall, u32, H256) {
make_proposal(RuntimeCall::System(frame_system::Call::remark { remark: value.encode() }))
}
pub fn make_set_rule_proposal(rule: Cid) -> (Call, u32, H256) {
make_proposal(Call::Alliance(pallet_alliance::Call::set_rule { rule }))
pub fn make_set_rule_proposal(rule: Cid) -> (RuntimeCall, u32, H256) {
make_proposal(RuntimeCall::Alliance(pallet_alliance::Call::set_rule { rule }))
}
pub fn make_kick_member_proposal(who: u64) -> (Call, u32, H256) {
make_proposal(Call::Alliance(pallet_alliance::Call::kick_member { who }))
pub fn make_kick_member_proposal(who: u64) -> (RuntimeCall, u32, H256) {
make_proposal(RuntimeCall::Alliance(pallet_alliance::Call::kick_member { who }))
}
pub fn make_proposal(proposal: Call) -> (Call, u32, H256) {
pub fn make_proposal(proposal: RuntimeCall) -> (RuntimeCall, u32, H256) {
let len: u32 = proposal.using_encoded(|p| p.len() as u32);
let hash = BlakeTwo256::hash_of(&proposal);
(proposal, len, hash)
+26 -24
View File
@@ -63,7 +63,7 @@ fn init_members_works() {
// assert a retiring member from previous Alliance not removed
assert!(Alliance::is_member_of(&2, MemberRole::Retiring));
System::assert_last_event(mock::Event::Alliance(crate::Event::MembersInitialized {
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::MembersInitialized {
founders: vec![5, 8],
fellows: vec![4],
allies: vec![2],
@@ -117,7 +117,7 @@ fn disband_works() {
// deposit unreserved
assert_eq!(Balances::free_balance(9), 40);
System::assert_last_event(mock::Event::Alliance(crate::Event::AllianceDisbanded {
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::AllianceDisbanded {
voting_members: 2,
ally_members: 1,
unreserved: 1,
@@ -154,7 +154,7 @@ fn propose_works() {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
event: mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
@@ -182,13 +182,13 @@ fn vote_works() {
assert_eq!(
System::events(),
vec![
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
@@ -236,19 +236,19 @@ fn veto_works() {
assert_eq!(
System::events(),
vec![
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Proposed {
account: 1,
proposal_index: 1,
proposal_hash: vetoable_hash,
threshold: 3
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Disapproved {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Disapproved {
proposal_hash: vetoable_hash
})),
]
@@ -276,42 +276,42 @@ fn close_works() {
assert_eq!(
System::events(),
vec![
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0,
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0,
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Voted {
account: 3,
proposal_hash: hash,
voted: true,
yes: 3,
no: 0,
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Closed {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Closed {
proposal_hash: hash,
yes: 3,
no: 0,
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Approved {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Approved {
proposal_hash: hash
})),
record(mock::Event::AllianceMotion(AllianceMotionEvent::Executed {
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Executed {
proposal_hash: hash,
result: Err(DispatchError::BadOrigin),
}))
@@ -327,7 +327,9 @@ fn set_rule_works() {
assert_ok!(Alliance::set_rule(Origin::signed(1), cid.clone()));
assert_eq!(Alliance::rule(), Some(cid.clone()));
System::assert_last_event(mock::Event::Alliance(crate::Event::NewRuleSet { rule: cid }));
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::NewRuleSet {
rule: cid,
}));
});
}
@@ -341,7 +343,7 @@ fn announce_works() {
assert_ok!(Alliance::announce(Origin::signed(3), cid.clone()));
assert_eq!(Alliance::announcements(), vec![cid.clone()]);
System::assert_last_event(mock::Event::Alliance(crate::Event::Announced {
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::Announced {
announcement: cid,
}));
});
@@ -353,7 +355,7 @@ fn remove_announcement_works() {
let cid = test_cid();
assert_ok!(Alliance::announce(Origin::signed(3), cid.clone()));
assert_eq!(Alliance::announcements(), vec![cid.clone()]);
System::assert_last_event(mock::Event::Alliance(crate::Event::Announced {
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::Announced {
announcement: cid.clone(),
}));
@@ -361,9 +363,9 @@ fn remove_announcement_works() {
assert_ok!(Alliance::remove_announcement(Origin::signed(3), cid.clone()));
assert_eq!(Alliance::announcements(), vec![]);
System::assert_last_event(mock::Event::Alliance(crate::Event::AnnouncementRemoved {
announcement: cid,
}));
System::assert_last_event(mock::RuntimeEvent::Alliance(
crate::Event::AnnouncementRemoved { announcement: cid },
));
});
}
@@ -498,7 +500,7 @@ fn give_retirement_notice_work() {
assert_ok!(Alliance::give_retirement_notice(Origin::signed(3)));
assert_eq!(Alliance::members(MemberRole::Fellow), Vec::<u64>::new());
assert_eq!(Alliance::members(MemberRole::Retiring), vec![3]);
System::assert_last_event(mock::Event::Alliance(
System::assert_last_event(mock::RuntimeEvent::Alliance(
crate::Event::MemberRetirementPeriodStarted { member: (3) },
));
@@ -531,7 +533,7 @@ fn retire_works() {
System::set_block_number(System::block_number() + RetirementPeriod::get());
assert_ok!(Alliance::retire(Origin::signed(3)));
assert_eq!(Alliance::members(MemberRole::Fellow), Vec::<u64>::new());
System::assert_last_event(mock::Event::Alliance(crate::Event::MemberRetired {
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::MemberRetired {
member: (3),
unreserved: None,
}));
@@ -585,7 +587,7 @@ fn kick_member_works() {
assert_ok!(Alliance::kick_member(Origin::signed(2), 2));
assert_eq!(Alliance::members(MemberRole::Founder), vec![1]);
assert_eq!(<DepositOf<Test, ()>>::get(2), None);
System::assert_last_event(mock::Event::Alliance(crate::Event::MemberKicked {
System::assert_last_event(mock::RuntimeEvent::Alliance(crate::Event::MemberKicked {
member: (2),
slashed: Some(25),
}));
+2 -2
View File
@@ -140,11 +140,11 @@ fn add_approvals<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
}
}
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
fn assert_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
fn assert_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_has_event(generic_event.into());
}
+2 -1
View File
@@ -180,7 +180,8 @@ pub mod pallet {
/// The module configuration trait.
pub trait Config<I: 'static = ()>: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The units in which we record balances.
type Balance: Member
+4 -4
View File
@@ -50,7 +50,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -58,7 +58,7 @@ impl frame_system::Config for Test {
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
@@ -75,7 +75,7 @@ impl frame_system::Config for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
@@ -85,7 +85,7 @@ impl pallet_balances::Config for Test {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Balance = u64;
type AssetId = u32;
type Currency = Balances;
+1 -1
View File
@@ -166,7 +166,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Swap action.
type SwapAction: SwapAction<Self::AccountId, Self> + Parameter + MaxEncodedLen;
/// Limit of proof size.
+4 -4
View File
@@ -41,12 +41,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -65,14 +65,14 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type SwapAction = BalanceSwapAction<u64, Balances>;
type ProofLimit = ConstU32<1024>;
}
+2 -2
View File
@@ -59,13 +59,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -209,7 +209,7 @@ mod tests {
type Keys = UintAuthorityId;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type SessionHandler = TestSessionHandler;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = AuthorityId;
type ValidatorIdOf = ConvertInto;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
@@ -238,13 +238,13 @@ mod tests {
type Origin = Origin;
type Index = u64;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AuthorityId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
+2 -2
View File
@@ -471,13 +471,13 @@ mod tests {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
+9 -9
View File
@@ -77,14 +77,14 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Version = ();
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = DummyValidatorId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u128>;
@@ -98,10 +98,10 @@ impl frame_system::Config for Test {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where
Call: From<C>,
RuntimeCall: From<C>,
{
type OverarchingCall = Call;
type Extrinsic = TestXt<Call, ()>;
type OverarchingCall = RuntimeCall;
type Extrinsic = TestXt<RuntimeCall, ()>;
}
impl_opaque_keys! {
@@ -111,7 +111,7 @@ impl_opaque_keys! {
}
impl pallet_session::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe;
@@ -147,7 +147,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type Balance = u128;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU128<1>;
type AccountStore = System;
type WeightInfo = ();
@@ -184,7 +184,7 @@ impl pallet_staking::Config for Test {
type MaxNominations = ConstU32<16>;
type RewardRemainder = ();
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
type Slash = ();
@@ -209,7 +209,7 @@ impl pallet_staking::Config for Test {
}
impl pallet_offences::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
}
+2 -1
View File
@@ -105,7 +105,8 @@ pub mod pallet {
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: weights::WeightInfo;
+3 -3
View File
@@ -52,13 +52,13 @@ impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type DbWeight = ();
type BlockLength = ();
@@ -78,7 +78,7 @@ parameter_types! {
}
impl bags_list::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type BagThresholds = BagThresholds;
type ScoreProvider = StakingMock;
+2 -1
View File
@@ -218,7 +218,8 @@ pub mod pallet {
type DustRemoval: OnUnbalanced<NegativeImbalance<Self, I>>;
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The minimum amount required to keep an account open.
#[pallet::constant]
+22 -22
View File
@@ -38,15 +38,15 @@ macro_rules! decl_tests {
const ID_1: LockIdentifier = *b"1 ";
const ID_2: LockIdentifier = *b"2 ";
pub const CALL: &<$test as frame_system::Config>::Call =
&Call::Balances(pallet_balances::Call::transfer { dest: 0, value: 0 });
pub const CALL: &<$test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(pallet_balances::Call::transfer { dest: 0, value: 0 });
/// create a transaction info struct from weight. Handy to avoid building the whole struct.
pub fn info_from_weight(w: Weight) -> DispatchInfo {
DispatchInfo { weight: w, ..Default::default() }
}
fn events() -> Vec<Event> {
fn events() -> Vec<RuntimeEvent> {
let evt = System::events().into_iter().map(|evt| evt.event).collect::<Vec<_>>();
System::reset_events();
@@ -314,7 +314,7 @@ macro_rules! decl_tests {
<$ext_builder>::default().monied(true).build().execute_with(|| {
assert_eq!(Balances::total_balance(&1), 10);
assert_ok!(Balances::deposit_into_existing(&1, 10).map(drop));
System::assert_last_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 10 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Deposit { who: 1, amount: 10 }));
assert_eq!(Balances::total_balance(&1), 20);
assert_eq!(<TotalIssuance<$test>>::get(), 120);
});
@@ -342,7 +342,7 @@ macro_rules! decl_tests {
fn balance_works() {
<$ext_builder>::default().build().execute_with(|| {
let _ = Balances::deposit_creating(&1, 42);
System::assert_has_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 42 }));
System::assert_has_event(RuntimeEvent::Balances(crate::Event::Deposit { who: 1, amount: 42 }));
assert_eq!(Balances::free_balance(1), 42);
assert_eq!(Balances::reserved_balance(1), 0);
assert_eq!(Balances::total_balance(&1), 42);
@@ -444,7 +444,7 @@ macro_rules! decl_tests {
let _ = Balances::withdraw(
&2, 11, WithdrawReasons::TRANSFER, ExistenceRequirement::KeepAlive
);
System::assert_last_event(Event::Balances(crate::Event::Withdraw { who: 2, amount: 11 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Withdraw { who: 2, amount: 11 }));
assert_eq!(Balances::free_balance(2), 100);
assert_eq!(<TotalIssuance<$test>>::get(), 100);
});
@@ -505,7 +505,7 @@ macro_rules! decl_tests {
assert_ok!(Balances::reserve(&1, 110));
assert_ok!(Balances::repatriate_reserved(&1, &2, 41, Status::Free), 0);
System::assert_last_event(
Event::Balances(crate::Event::ReserveRepatriated { from: 1, to: 2, amount: 41, destination_status: Status::Free })
RuntimeEvent::Balances(crate::Event::ReserveRepatriated { from: 1, to: 2, amount: 41, destination_status: Status::Free })
);
assert_eq!(Balances::reserved_balance(1), 69);
assert_eq!(Balances::free_balance(1), 0);
@@ -740,18 +740,18 @@ macro_rules! decl_tests {
System::set_block_number(2);
assert_ok!(Balances::reserve(&1, 10));
System::assert_last_event(Event::Balances(crate::Event::Reserved { who: 1, amount: 10 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Reserved { who: 1, amount: 10 }));
System::set_block_number(3);
assert!(Balances::unreserve(&1, 5).is_zero());
System::assert_last_event(Event::Balances(crate::Event::Unreserved { who: 1, amount: 5 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Unreserved { who: 1, amount: 5 }));
System::set_block_number(4);
assert_eq!(Balances::unreserve(&1, 6), 1);
// should only unreserve 5
System::assert_last_event(Event::Balances(crate::Event::Unreserved { who: 1, amount: 5 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Unreserved { who: 1, amount: 5 }));
});
}
@@ -766,9 +766,9 @@ macro_rules! decl_tests {
assert_eq!(
events(),
[
Event::System(system::Event::NewAccount { account: 1 }),
Event::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
Event::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
RuntimeEvent::System(system::Event::NewAccount { account: 1 }),
RuntimeEvent::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
RuntimeEvent::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
]
);
@@ -778,9 +778,9 @@ macro_rules! decl_tests {
assert_eq!(
events(),
[
Event::System(system::Event::KilledAccount { account: 1 }),
Event::Balances(crate::Event::DustLost { account: 1, amount: 99 }),
Event::Balances(crate::Event::Slashed { who: 1, amount: 1 }),
RuntimeEvent::System(system::Event::KilledAccount { account: 1 }),
RuntimeEvent::Balances(crate::Event::DustLost { account: 1, amount: 99 }),
RuntimeEvent::Balances(crate::Event::Slashed { who: 1, amount: 1 }),
]
);
});
@@ -797,9 +797,9 @@ macro_rules! decl_tests {
assert_eq!(
events(),
[
Event::System(system::Event::NewAccount { account: 1 }),
Event::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
Event::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
RuntimeEvent::System(system::Event::NewAccount { account: 1 }),
RuntimeEvent::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
RuntimeEvent::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
]
);
@@ -809,8 +809,8 @@ macro_rules! decl_tests {
assert_eq!(
events(),
[
Event::System(system::Event::KilledAccount { account: 1 }),
Event::Balances(crate::Event::Slashed { who: 1, amount: 100 }),
RuntimeEvent::System(system::Event::KilledAccount { account: 1 }),
RuntimeEvent::Balances(crate::Event::Slashed { who: 1, amount: 100 }),
]
);
});
@@ -830,7 +830,7 @@ macro_rules! decl_tests {
assert_eq!(Balances::slash(&1, 900), (NegativeImbalance::new(900), 0));
// Account is still alive
assert!(System::account_exists(&1));
System::assert_last_event(Event::Balances(crate::Event::Slashed { who: 1, amount: 900 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Slashed { who: 1, amount: 900 }));
// SCENARIO: Slash will kill account because not enough balance left.
assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0));
@@ -57,13 +57,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -77,7 +77,7 @@ impl frame_system::Config for Test {
}
impl pallet_transaction_payment::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Pallet<Test>, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<u64>;
@@ -88,7 +88,7 @@ impl pallet_transaction_payment::Config for Test {
impl Config for Test {
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Pallet<Test>;
type MaxLocks = ();
+14 -11
View File
@@ -58,13 +58,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -78,7 +78,7 @@ impl frame_system::Config for Test {
}
impl pallet_transaction_payment::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Pallet<Test>, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<u64>;
@@ -89,7 +89,7 @@ impl pallet_transaction_payment::Config for Test {
impl Config for Test {
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore =
StorageMapShim<super::Account<Test>, system::Provider<Test>, u64, super::AccountData<u64>>;
@@ -158,9 +158,9 @@ fn emit_events_with_no_existential_deposit_suicide_with_dust() {
assert_eq!(
events(),
[
Event::System(system::Event::NewAccount { account: 1 }),
Event::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
Event::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
RuntimeEvent::System(system::Event::NewAccount { account: 1 }),
RuntimeEvent::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
RuntimeEvent::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
]
);
@@ -168,7 +168,10 @@ fn emit_events_with_no_existential_deposit_suicide_with_dust() {
assert_eq!(res, (NegativeImbalance::new(98), 0));
// no events
assert_eq!(events(), [Event::Balances(crate::Event::Slashed { who: 1, amount: 98 })]);
assert_eq!(
events(),
[RuntimeEvent::Balances(crate::Event::Slashed { who: 1, amount: 98 })]
);
let res = Balances::slash(&1, 1);
assert_eq!(res, (NegativeImbalance::new(1), 0));
@@ -176,9 +179,9 @@ fn emit_events_with_no_existential_deposit_suicide_with_dust() {
assert_eq!(
events(),
[
Event::System(system::Event::KilledAccount { account: 1 }),
Event::Balances(crate::Event::DustLost { account: 1, amount: 1 }),
Event::Balances(crate::Event::Slashed { who: 1, amount: 1 })
RuntimeEvent::System(system::Event::KilledAccount { account: 1 }),
RuntimeEvent::Balances(crate::Event::DustLost { account: 1, amount: 1 }),
RuntimeEvent::Balances(crate::Event::Slashed { who: 1, amount: 1 })
]
);
});
@@ -62,13 +62,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -91,7 +91,7 @@ impl OnUnbalanced<NegativeImbalance<Test>> for OnDustRemoval {
impl Config for Test {
type Balance = u64;
type DustRemoval = OnDustRemoval;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore =
StorageMapShim<super::Account<Test>, system::Provider<Test>, u64, super::AccountData<u64>>;
@@ -157,16 +157,19 @@ fn transfer_dust_removal_tst1_should_work() {
// Verify the events
assert_eq!(System::events().len(), 12);
System::assert_has_event(Event::Balances(crate::Event::Transfer {
System::assert_has_event(RuntimeEvent::Balances(crate::Event::Transfer {
from: 2,
to: 3,
amount: 450,
}));
System::assert_has_event(Event::Balances(crate::Event::DustLost {
System::assert_has_event(RuntimeEvent::Balances(crate::Event::DustLost {
account: 2,
amount: 50,
}));
System::assert_has_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 50 }));
System::assert_has_event(RuntimeEvent::Balances(crate::Event::Deposit {
who: 1,
amount: 50,
}));
});
}
@@ -192,16 +195,19 @@ fn transfer_dust_removal_tst2_should_work() {
// Verify the events
assert_eq!(System::events().len(), 10);
System::assert_has_event(Event::Balances(crate::Event::Transfer {
System::assert_has_event(RuntimeEvent::Balances(crate::Event::Transfer {
from: 2,
to: 1,
amount: 450,
}));
System::assert_has_event(Event::Balances(crate::Event::DustLost {
System::assert_has_event(RuntimeEvent::Balances(crate::Event::DustLost {
account: 2,
amount: 50,
}));
System::assert_has_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 50 }));
System::assert_has_event(RuntimeEvent::Balances(crate::Event::Deposit {
who: 1,
amount: 50,
}));
});
}
@@ -236,18 +242,21 @@ fn repatriating_reserved_balance_dust_removal_should_work() {
// Verify the events
assert_eq!(System::events().len(), 11);
System::assert_has_event(Event::Balances(crate::Event::ReserveRepatriated {
System::assert_has_event(RuntimeEvent::Balances(crate::Event::ReserveRepatriated {
from: 2,
to: 1,
amount: 450,
destination_status: Status::Free,
}));
System::assert_has_event(Event::Balances(crate::Event::DustLost {
System::assert_has_event(RuntimeEvent::Balances(crate::Event::DustLost {
account: 2,
amount: 50,
}));
System::assert_last_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 50 }));
System::assert_last_event(RuntimeEvent::Balances(crate::Event::Deposit {
who: 1,
amount: 50,
}));
});
}
+3 -3
View File
@@ -71,12 +71,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -90,7 +90,7 @@ impl frame_system::Config for Test {
}
impl pallet_session::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = u64;
type ValidatorIdOf = ConvertInto;
type ShouldEndSession = pallet_session::PeriodicSessions<ConstU64<1>, ConstU64<0>>;
+3 -3
View File
@@ -66,12 +66,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -95,7 +95,7 @@ parameter_types! {
}
impl pallet_session::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = u64;
type ValidatorIdOf = ConvertInto;
type ShouldEndSession = pallet_session::PeriodicSessions<ConstU64<1>, ConstU64<0>>;
+2 -2
View File
@@ -179,13 +179,13 @@ pub mod mock {
type Origin = Origin;
type Index = AccountIndex;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type Version = ();
type PalletInfo = PalletInfo;
+2 -2
View File
@@ -94,12 +94,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type Version = ();
type PalletInfo = PalletInfo;
@@ -33,7 +33,7 @@ mod pallet_test {
frame_support::decl_storage! {
trait Store for Module<T: Config<I>, I: Instance = DefaultInstance> as Test where
<T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::Event>
<T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>
{
pub Value get(fn value): Option<u32>;
}
@@ -41,7 +41,7 @@ mod pallet_test {
frame_support::decl_module! {
pub struct Module<T: Config<I>, I: Instance = DefaultInstance> for enum Call where
origin: T::Origin, <T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::Event>
origin: T::Origin, <T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>
{
#[weight = 0]
fn set_value(origin, n: u32) -> frame_support::dispatch::DispatchResult {
@@ -64,9 +64,9 @@ mod pallet_test {
pub trait Config<I: Instance = DefaultInstance>: frame_system::Config + OtherConfig
where
Self::OtherEvent: Into<<Self as Config<I>>::Event>,
Self::OtherEvent: Into<<Self as Config<I>>::RuntimeEvent>,
{
type Event;
type RuntimeEvent;
type LowerBound: Get<u32>;
type UpperBound: Get<u32>;
}
@@ -95,12 +95,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type Version = ();
type PalletInfo = PalletInfo;
@@ -114,13 +114,13 @@ impl frame_system::Config for Test {
}
impl pallet_test::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type LowerBound = ConstU32<1>;
type UpperBound = ConstU32<100>;
}
impl pallet_test::OtherConfig for Test {
type OtherEvent = Event;
type OtherEvent = RuntimeEvent;
}
fn new_test_ext() -> sp_io::TestExternalities {
@@ -142,8 +142,8 @@ mod benchmarks {
where_clause {
where
<T as pallet_test::OtherConfig>::OtherEvent: Clone
+ Into<<T as pallet_test::Config<I>>::Event>,
<T as pallet_test::Config<I>>::Event: Clone,
+ Into<<T as pallet_test::Config<I>>::RuntimeEvent>,
<T as pallet_test::Config<I>>::RuntimeEvent: Clone,
}
set_value {
+1 -1
View File
@@ -82,7 +82,7 @@ fn setup_pot_account<T: Config<I>, I: 'static>() {
let _ = T::Currency::make_free_balance_be(&pot_account, value);
}
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
+2 -1
View File
@@ -230,7 +230,8 @@ pub mod pallet {
type DataDepositPerByte: Get<BalanceOf<Self, I>>;
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Maximum acceptable reason length.
///
+8 -8
View File
@@ -71,13 +71,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u128; // u64 is not enough to hold bytes used to generate bounty account
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -95,7 +95,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -113,7 +113,7 @@ impl pallet_treasury::Config for Test {
type Currency = pallet_balances::Pallet<Test>;
type ApproveOrigin = frame_system::EnsureRoot<u128>;
type RejectOrigin = frame_system::EnsureRoot<u128>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ConstU64<1>;
@@ -132,7 +132,7 @@ impl pallet_treasury::Config<Instance1> for Test {
type Currency = pallet_balances::Pallet<Test>;
type ApproveOrigin = frame_system::EnsureRoot<u128>;
type RejectOrigin = frame_system::EnsureRoot<u128>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ConstU64<1>;
@@ -155,7 +155,7 @@ parameter_types! {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = ConstU64<80>;
type BountyDepositPayoutDelay = ConstU64<3>;
type BountyUpdatePeriod = ConstU64<20>;
@@ -170,7 +170,7 @@ impl Config for Test {
}
impl Config<Instance1> for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = ConstU64<80>;
type BountyDepositPayoutDelay = ConstU64<3>;
type BountyUpdatePeriod = ConstU64<20>;
@@ -204,7 +204,7 @@ fn last_event() -> BountiesEvent<Test> {
System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::Bounties(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::Bounties(inner) = e { Some(inner) } else { None })
.last()
.unwrap()
}
@@ -160,7 +160,7 @@ fn setup_pot_account<T: Config>() {
let _ = T::Currency::make_free_balance_be(&pot_account, value);
}
fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
+1 -1
View File
@@ -146,7 +146,7 @@ pub mod pallet {
type ChildBountyValueMinimum: Get<BalanceOf<Self>>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
+7 -7
View File
@@ -74,13 +74,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u128;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -98,7 +98,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -115,7 +115,7 @@ impl pallet_treasury::Config for Test {
type Currency = pallet_balances::Pallet<Test>;
type ApproveOrigin = frame_system::EnsureRoot<u128>;
type RejectOrigin = frame_system::EnsureRoot<u128>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ConstU64<1>;
@@ -136,7 +136,7 @@ parameter_types! {
}
impl pallet_bounties::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = ConstU64<80>;
type BountyDepositPayoutDelay = ConstU64<3>;
type BountyUpdatePeriod = ConstU64<10>;
@@ -150,7 +150,7 @@ impl pallet_bounties::Config for Test {
type ChildBountyManager = ChildBounties;
}
impl pallet_child_bounties::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = ConstU32<2>;
type ChildBountyValueMinimum = ConstU64<1>;
type WeightInfo = ();
@@ -172,7 +172,7 @@ fn last_event() -> ChildBountiesEvent<Test> {
System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::ChildBounties(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::ChildBounties(inner) = e { Some(inner) } else { None })
.last()
.unwrap()
}
@@ -30,7 +30,7 @@ const SEED: u32 = 0;
const MAX_BYTES: u32 = 1_024;
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
+2 -1
View File
@@ -187,7 +187,8 @@ pub mod pallet {
+ GetDispatchInfo;
/// The outer event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The time-out for council motions.
type MotionDuration: Get<Self::BlockNumber>;
+90 -77
View File
@@ -32,7 +32,7 @@ use sp_runtime::{
};
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, Call, ()>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, RuntimeCall, ()>;
frame_support::construct_runtime!(
pub enum Test where
@@ -61,7 +61,8 @@ mod mock_democracy {
#[pallet::config]
pub trait Config: frame_system::Config + Sized {
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
type ExternalMajorityOrigin: EnsureOrigin<Self::Origin>;
}
@@ -99,13 +100,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -119,8 +120,8 @@ impl frame_system::Config for Test {
}
impl Config<Instance1> for Test {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU64<3>;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
@@ -129,8 +130,8 @@ impl Config<Instance1> for Test {
}
impl Config<Instance2> for Test {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU64<3>;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
@@ -138,13 +139,13 @@ impl Config<Instance2> for Test {
type WeightInfo = ();
}
impl mock_democracy::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExternalMajorityOrigin = EnsureProportionAtLeast<u64, Instance1, 3, 4>;
}
impl Config for Test {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = ConstU64<3>;
type MaxProposals = MaxProposals;
type MaxMembers = MaxMembers;
@@ -171,11 +172,13 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
ext
}
fn make_proposal(value: u64) -> Call {
Call::System(frame_system::Call::remark_with_event { remark: value.to_be_bytes().to_vec() })
fn make_proposal(value: u64) -> RuntimeCall {
RuntimeCall::System(frame_system::Call::remark_with_event {
remark: value.to_be_bytes().to_vec(),
})
}
fn record(event: Event) -> EventRecord<Event, H256> {
fn record(event: RuntimeEvent) -> EventRecord<RuntimeEvent, H256> {
EventRecord { phase: Phase::Initialization, event, topics: vec![] }
}
@@ -216,32 +219,34 @@ fn close_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 2,
no: 1
})),
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
proposal_hash: hash
}))
]
);
});
@@ -250,7 +255,7 @@ fn close_works() {
#[test]
fn proposal_weight_limit_works_on_approve() {
new_test_ext().execute_with(|| {
let proposal = Call::Collective(crate::Call::set_members {
let proposal = RuntimeCall::Collective(crate::Call::set_members {
new_members: vec![1, 2, 3],
prime: None,
old_count: MaxMembers::get(),
@@ -286,7 +291,7 @@ fn proposal_weight_limit_works_on_approve() {
#[test]
fn proposal_weight_limit_ignored_on_disapprove() {
new_test_ext().execute_with(|| {
let proposal = Call::Collective(crate::Call::set_members {
let proposal = RuntimeCall::Collective(crate::Call::set_members {
new_members: vec![1, 2, 3],
prime: None,
old_count: MaxMembers::get(),
@@ -342,32 +347,34 @@ fn close_with_prime_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 2,
no: 1
})),
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
proposal_hash: hash
}))
]
);
});
@@ -402,33 +409,33 @@ fn close_with_voting_prime_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 3,
no: 0
})),
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(Event::Collective(CollectiveEvent::Executed {
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
proposal_hash: hash,
result: Err(DispatchError::BadOrigin)
}))
@@ -473,42 +480,42 @@ fn close_with_no_prime_but_majority_works() {
assert_eq!(
System::events(),
vec![
record(Event::CollectiveMajority(CollectiveEvent::Proposed {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 5
})),
record(Event::CollectiveMajority(CollectiveEvent::Voted {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::CollectiveMajority(CollectiveEvent::Voted {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::CollectiveMajority(CollectiveEvent::Voted {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Voted {
account: 3,
proposal_hash: hash,
voted: true,
yes: 3,
no: 0
})),
record(Event::CollectiveMajority(CollectiveEvent::Closed {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 5,
no: 0
})),
record(Event::CollectiveMajority(CollectiveEvent::Approved {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Approved {
proposal_hash: hash
})),
record(Event::CollectiveMajority(CollectiveEvent::Executed {
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Executed {
proposal_hash: hash,
result: Err(DispatchError::BadOrigin)
}))
@@ -635,7 +642,7 @@ fn propose_works() {
assert_eq!(
System::events(),
vec![record(Event::Collective(CollectiveEvent::Proposed {
vec![record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
@@ -670,7 +677,7 @@ fn limit_active_proposals() {
#[test]
fn correct_validate_and_get_proposal() {
new_test_ext().execute_with(|| {
let proposal = Call::Collective(crate::Call::set_members {
let proposal = RuntimeCall::Collective(crate::Call::set_members {
new_members: vec![1, 2, 3],
prime: None,
old_count: MaxMembers::get(),
@@ -803,20 +810,20 @@ fn motions_vote_after_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 2
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: false,
@@ -915,7 +922,7 @@ fn motions_reproposing_disapproved_works() {
#[test]
fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
new_test_ext().execute_with(|| {
let proposal = Call::Democracy(mock_democracy::Call::external_propose_majority {});
let proposal = RuntimeCall::Democracy(mock_democracy::Call::external_propose_majority {});
let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32);
let proposal_weight = proposal.get_dispatch_info().weight;
let hash: H256 = proposal.blake2_256().into();
@@ -936,33 +943,33 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 2
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(Event::Collective(CollectiveEvent::Executed {
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
proposal_hash: hash,
result: Err(DispatchError::BadOrigin)
})),
@@ -985,41 +992,43 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 1,
proposal_hash: hash,
threshold: 2
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 3,
proposal_hash: hash,
voted: true,
yes: 3,
no: 0
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 3,
no: 0
})),
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(Event::Democracy(mock_democracy::pallet::Event::<Test>::ExternalProposed)),
record(Event::Collective(CollectiveEvent::Executed {
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(RuntimeEvent::Democracy(
mock_democracy::pallet::Event::<Test>::ExternalProposed
)),
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
proposal_hash: hash,
result: Ok(())
})),
@@ -1048,32 +1057,34 @@ fn motions_disapproval_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 3
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: false,
yes: 1,
no: 1
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 1,
no: 1
})),
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash })),
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
proposal_hash: hash
})),
]
);
});
@@ -1099,33 +1110,33 @@ fn motions_approval_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 2
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(Event::Collective(CollectiveEvent::Executed {
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
proposal_hash: hash,
result: Err(DispatchError::BadOrigin)
})),
@@ -1149,7 +1160,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
));
assert_eq!(
System::events()[0],
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
@@ -1173,7 +1184,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
// Events show that the close ended in a disapproval.
assert_eq!(
System::events()[1],
record(Event::Collective(CollectiveEvent::Closed {
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
proposal_hash: hash,
yes: 0,
no: 3
@@ -1181,7 +1192,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
);
assert_eq!(
System::events()[2],
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
);
})
}
@@ -1241,27 +1252,29 @@ fn disapprove_proposal_works() {
assert_eq!(
System::events(),
vec![
record(Event::Collective(CollectiveEvent::Proposed {
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
account: 1,
proposal_index: 0,
proposal_hash: hash,
threshold: 2
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 1,
proposal_hash: hash,
voted: true,
yes: 1,
no: 0
})),
record(Event::Collective(CollectiveEvent::Voted {
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
account: 2,
proposal_hash: hash,
voted: true,
yes: 2,
no: 0
})),
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash })),
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
proposal_hash: hash
})),
]
);
})
+10 -8
View File
@@ -282,7 +282,7 @@ pub trait Ext: sealing::Sealed {
fn append_debug_buffer(&mut self, msg: &str) -> bool;
/// Call some dispatchable and return the result.
fn call_runtime(&self, call: <Self::T as Config>::Call) -> DispatchResultWithPostInfo;
fn call_runtime(&self, call: <Self::T as Config>::RuntimeCall) -> DispatchResultWithPostInfo;
/// Recovers ECDSA compressed public key based on signature and message hash.
fn ecdsa_recover(&self, signature: &[u8; 65], message_hash: &[u8; 32]) -> Result<[u8; 33], ()>;
@@ -1305,7 +1305,7 @@ where
}
}
fn call_runtime(&self, call: <Self::T as Config>::Call) -> DispatchResultWithPostInfo {
fn call_runtime(&self, call: <Self::T as Config>::RuntimeCall) -> DispatchResultWithPostInfo {
let mut origin: T::Origin = RawOrigin::Signed(self.address().clone()).into();
origin.add_filter(T::CallFilter::contains);
call.dispatch(origin)
@@ -1370,7 +1370,8 @@ mod tests {
storage::Storage,
tests::{
test_utils::{get_balance, hash, place_contract, set_balance},
Call, Event as MetaEvent, ExtBuilder, Test, TestFilter, ALICE, BOB, CHARLIE, GAS_LIMIT,
ExtBuilder, RuntimeCall, RuntimeEvent as MetaEvent, Test, TestFilter, ALICE, BOB,
CHARLIE, GAS_LIMIT,
},
Error,
};
@@ -2575,7 +2576,7 @@ mod tests {
#[test]
fn call_runtime_works() {
let code_hash = MockLoader::insert(Call, |ctx, _| {
let call = Call::System(frame_system::Call::remark_with_event {
let call = RuntimeCall::System(frame_system::Call::remark_with_event {
remark: b"Hello World".to_vec(),
});
ctx.ext.call_runtime(call).unwrap();
@@ -2636,10 +2637,11 @@ mod tests {
// remark should still be allowed
let allowed_call =
Call::System(SysCall::remark_with_event { remark: b"Hello".to_vec() });
RuntimeCall::System(SysCall::remark_with_event { remark: b"Hello".to_vec() });
// transfers are disallowed by the `TestFiler` (see below)
let forbidden_call = Call::Balances(BalanceCall::transfer { dest: CHARLIE, value: 22 });
let forbidden_call =
RuntimeCall::Balances(BalanceCall::transfer { dest: CHARLIE, value: 22 });
// simple cases: direct call
assert_err!(
@@ -2648,7 +2650,7 @@ mod tests {
);
// as part of a patch: return is OK (but it interrupted the batch)
assert_ok!(ctx.ext.call_runtime(Call::Utility(UtilCall::batch {
assert_ok!(ctx.ext.call_runtime(RuntimeCall::Utility(UtilCall::batch {
calls: vec![allowed_call.clone(), forbidden_call, allowed_call]
})),);
@@ -2659,7 +2661,7 @@ mod tests {
});
TestFilter::set_filter(|call| match call {
Call::Balances(pallet_balances::Call::transfer { .. }) => false,
RuntimeCall::Balances(pallet_balances::Call::transfer { .. }) => false,
_ => true,
});
+6 -6
View File
@@ -243,13 +243,13 @@ pub mod pallet {
type Currency: ReservableCurrency<Self::AccountId>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The overarching call type.
type Call: Dispatchable<Origin = Self::Origin, PostInfo = PostDispatchInfo>
type RuntimeCall: Dispatchable<Origin = Self::Origin, PostInfo = PostDispatchInfo>
+ GetDispatchInfo
+ codec::Decode
+ IsType<<Self as frame_system::Config>::Call>;
+ IsType<<Self as frame_system::Config>::RuntimeCall>;
/// Filter that is applied to calls dispatched by contracts.
///
@@ -260,7 +260,7 @@ pub mod pallet {
/// # Stability
///
/// The runtime **must** make sure that all dispatchables that are callable by
/// contracts remain stable. In addition [`Self::Call`] itself must remain stable.
/// contracts remain stable. In addition [`Self::RuntimeCall`] itself must remain stable.
/// This means that no existing variants are allowed to switch their positions.
///
/// # Note
@@ -270,7 +270,7 @@ pub mod pallet {
/// Therefore please make sure to be restrictive about which dispatchables are allowed
/// in order to not introduce a new DoS vector like memory allocation patterns that can
/// be exploited to drive the runtime into a panic.
type CallFilter: Contains<<Self as frame_system::Config>::Call>;
type CallFilter: Contains<<Self as frame_system::Config>::RuntimeCall>;
/// Used to answer contracts' queries regarding the current weight price. This is **not**
/// used to calculate the actual fee and is only for informational purposes.
@@ -1119,7 +1119,7 @@ where
fn deposit_event(topics: Vec<T::Hash>, event: Event<T>) {
<frame_system::Pallet<T>>::deposit_event_indexed(
&topics,
<T as Config>::Event::from(event).into(),
<T as Config>::RuntimeEvent::from(event).into(),
)
}
}
+101 -94
View File
@@ -164,27 +164,27 @@ impl ChainExtension<Test> for TestExtension {
let func_id = env.func_id();
let id = env.ext_id() as u32 | func_id as u32;
match func_id {
0x8000 => {
0 => {
let mut env = env.buf_in_buf_out();
let input = env.read(8)?;
env.write(&input, false, None)?;
TestExtensionTestValue::mutate(|e| e.last_seen_buffer = input);
Ok(RetVal::Converging(id))
},
0x8001 => {
1 => {
let env = env.only_in();
TestExtensionTestValue::mutate(|e| {
e.last_seen_inputs = (env.val0(), env.val1(), env.val2(), env.val3())
});
Ok(RetVal::Converging(id))
},
0x8002 => {
2 => {
let mut env = env.buf_in_buf_out();
let weight = Weight::from_ref_time(env.read(5)?[4].into());
env.charge_weight(weight)?;
Ok(RetVal::Converging(id))
},
0x8003 => Ok(RetVal::Diverging { flags: ReturnFlags::REVERT, data: vec![42, 99] }),
3 => Ok(RetVal::Diverging { flags: ReturnFlags::REVERT, data: vec![42, 99] }),
_ => {
panic!("Passed unknown id to test chain extension: {}", func_id);
},
@@ -281,12 +281,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = AccountId32;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -304,7 +304,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -318,8 +318,8 @@ impl pallet_timestamp::Config for Test {
type WeightInfo = ();
}
impl pallet_utility::Config for Test {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller;
type WeightInfo = ();
}
@@ -346,7 +346,7 @@ pub struct TestFilter;
#[derive(Clone)]
pub struct Filters {
filter: fn(&Call) -> bool,
filter: fn(&RuntimeCall) -> bool,
}
impl Default for Filters {
@@ -360,13 +360,13 @@ parameter_types! {
}
impl TestFilter {
pub fn set_filter(filter: fn(&Call) -> bool) {
pub fn set_filter(filter: fn(&RuntimeCall) -> bool) {
CallFilter::mutate(|fltr| fltr.filter = filter);
}
}
impl Contains<Call> for TestFilter {
fn contains(call: &Call) -> bool {
impl Contains<RuntimeCall> for TestFilter {
fn contains(call: &RuntimeCall) -> bool {
(CallFilter::get().filter)(call)
}
}
@@ -379,8 +379,8 @@ impl Config for Test {
type Time = Timestamp;
type Randomness = Randomness;
type Currency = Balances;
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type CallFilter = TestFilter;
type CallStack = [Frame<Self>; 31];
type WeightPrice = Self;
@@ -536,12 +536,14 @@ fn instantiate_and_call_and_deposit_event() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::NewAccount { account: addr.clone() }),
event: RuntimeEvent::System(frame_system::Event::NewAccount {
account: addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Endowed {
event: RuntimeEvent::Balances(pallet_balances::Event::Endowed {
account: addr.clone(),
free_balance: min_balance,
}),
@@ -549,7 +551,7 @@ fn instantiate_and_call_and_deposit_event() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: min_balance,
@@ -558,7 +560,7 @@ fn instantiate_and_call_and_deposit_event() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: addr.clone(),
amount: min_balance,
}),
@@ -566,7 +568,7 @@ fn instantiate_and_call_and_deposit_event() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: value,
@@ -575,7 +577,7 @@ fn instantiate_and_call_and_deposit_event() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::ContractEmitted {
event: RuntimeEvent::Contracts(crate::Event::ContractEmitted {
contract: addr.clone(),
data: vec![1, 2, 3, 4]
}),
@@ -583,7 +585,7 @@ fn instantiate_and_call_and_deposit_event() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Instantiated {
event: RuntimeEvent::Contracts(crate::Event::Instantiated {
deployer: ALICE,
contract: addr.clone()
}),
@@ -828,14 +830,14 @@ fn deploy_and_call_other_contract() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::NewAccount {
event: RuntimeEvent::System(frame_system::Event::NewAccount {
account: callee_addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Endowed {
event: RuntimeEvent::Balances(pallet_balances::Event::Endowed {
account: callee_addr.clone(),
free_balance: min_balance,
}),
@@ -843,7 +845,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: callee_addr.clone(),
amount: min_balance,
@@ -852,7 +854,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: callee_addr.clone(),
amount: min_balance,
}),
@@ -860,7 +862,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: caller_addr.clone(),
to: callee_addr.clone(),
amount: 32768, // hard coded in wasm
@@ -869,7 +871,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Instantiated {
event: RuntimeEvent::Contracts(crate::Event::Instantiated {
deployer: caller_addr.clone(),
contract: callee_addr.clone(),
}),
@@ -877,7 +879,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: caller_addr.clone(),
to: callee_addr.clone(),
amount: 32768,
@@ -886,7 +888,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: caller_addr.clone(),
contract: callee_addr.clone(),
}),
@@ -894,7 +896,7 @@ fn deploy_and_call_other_contract() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: caller_addr.clone(),
}),
@@ -1093,7 +1095,7 @@ fn cannot_self_destruct_by_refund_after_slash() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Slashed {
event: RuntimeEvent::Balances(pallet_balances::Event::Slashed {
who: addr.clone(),
amount: 90,
}),
@@ -1101,7 +1103,7 @@ fn cannot_self_destruct_by_refund_after_slash() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -1109,7 +1111,7 @@ fn cannot_self_destruct_by_refund_after_slash() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::ReserveRepatriated {
event: RuntimeEvent::Balances(pallet_balances::Event::ReserveRepatriated {
from: addr.clone(),
to: ALICE,
amount: 10,
@@ -1201,7 +1203,7 @@ fn self_destruct_works() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: addr.clone(),
to: DJANGO,
amount: 100_000,
@@ -1210,7 +1212,7 @@ fn self_destruct_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Terminated {
event: RuntimeEvent::Contracts(crate::Event::Terminated {
contract: addr.clone(),
beneficiary: DJANGO
}),
@@ -1218,7 +1220,7 @@ fn self_destruct_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -1226,14 +1228,14 @@ fn self_destruct_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::KilledAccount {
event: RuntimeEvent::System(frame_system::Event::KilledAccount {
account: addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::ReserveRepatriated {
event: RuntimeEvent::Balances(pallet_balances::Event::ReserveRepatriated {
from: addr.clone(),
to: ALICE,
amount: 1_000,
@@ -1698,22 +1700,21 @@ fn chain_extension_works() {
),);
let addr = Contracts::contract_address(&ALICE, &hash, &[]);
// 0x8000 = read input buffer and pass it through as output
let input: Vec<u8> =
ExtensionInput { extension_id: 0, func_id: 0x8000, extra: &[99] }.into();
// 0 = read input buffer and pass it through as output
let input: Vec<u8> = ExtensionInput { extension_id: 0, func_id: 0, extra: &[99] }.into();
let result =
Contracts::bare_call(ALICE, addr.clone(), 0, GAS_LIMIT, None, input.clone(), false);
assert_eq!(TestExtension::last_seen_buffer(), input);
assert_eq!(result.result.unwrap().data, Bytes(input));
// 0x8001 = treat inputs as integer primitives and store the supplied integers
// 1 = treat inputs as integer primitives and store the supplied integers
Contracts::bare_call(
ALICE,
addr.clone(),
0,
GAS_LIMIT,
None,
ExtensionInput { extension_id: 0, func_id: 0x8001, extra: &[] }.into(),
ExtensionInput { extension_id: 0, func_id: 1, extra: &[] }.into(),
false,
)
.result
@@ -1721,14 +1722,14 @@ fn chain_extension_works() {
// those values passed in the fixture
assert_eq!(TestExtension::last_seen_inputs(), (4, 4, 16, 12));
// 0x8002 = charge some extra weight (amount supplied in the fifth byte)
// 2 = charge some extra weight (amount supplied in the fifth byte)
let result = Contracts::bare_call(
ALICE,
addr.clone(),
0,
GAS_LIMIT,
None,
ExtensionInput { extension_id: 0, func_id: 0x8002, extra: &[0] }.into(),
ExtensionInput { extension_id: 0, func_id: 2, extra: &[0] }.into(),
false,
);
assert_ok!(result.result);
@@ -1739,7 +1740,7 @@ fn chain_extension_works() {
0,
GAS_LIMIT,
None,
ExtensionInput { extension_id: 0, func_id: 0x8002, extra: &[42] }.into(),
ExtensionInput { extension_id: 0, func_id: 2, extra: &[42] }.into(),
false,
);
assert_ok!(result.result);
@@ -1750,20 +1751,20 @@ fn chain_extension_works() {
0,
GAS_LIMIT,
None,
ExtensionInput { extension_id: 0, func_id: 0x8002, extra: &[95] }.into(),
ExtensionInput { extension_id: 0, func_id: 2, extra: &[95] }.into(),
false,
);
assert_ok!(result.result);
assert_eq!(result.gas_consumed, gas_consumed + 95);
// 0x8003 = diverging chain extension call that sets flags to 0x1 and returns a fixed buffer
// 3 = diverging chain extension call that sets flags to 0x1 and returns a fixed buffer
let result = Contracts::bare_call(
ALICE,
addr.clone(),
0,
GAS_LIMIT,
None,
ExtensionInput { extension_id: 0, func_id: 0x8003, extra: &[] }.into(),
ExtensionInput { extension_id: 0, func_id: 3, extra: &[] }.into(),
false,
)
.result
@@ -2550,7 +2551,7 @@ fn gas_estimation_call_runtime() {
// Call something trivial with a huge gas limit so that we can observe the effects
// of pre-charging. This should create a difference between consumed and required.
let call = Call::Contracts(crate::Call::call {
let call = RuntimeCall::Contracts(crate::Call::call {
dest: addr_callee,
value: 0,
gas_limit: GAS_LIMIT / 3,
@@ -2660,7 +2661,7 @@ fn upload_code_works() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: ALICE,
amount: 240,
}),
@@ -2668,7 +2669,7 @@ fn upload_code_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::CodeStored { code_hash }),
event: RuntimeEvent::Contracts(crate::Event::CodeStored { code_hash }),
topics: vec![code_hash],
},
]
@@ -2739,7 +2740,7 @@ fn remove_code_works() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: ALICE,
amount: 240,
}),
@@ -2747,12 +2748,12 @@ fn remove_code_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::CodeStored { code_hash }),
event: RuntimeEvent::Contracts(crate::Event::CodeStored { code_hash }),
topics: vec![code_hash],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Unreserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Unreserved {
who: ALICE,
amount: 240,
}),
@@ -2760,7 +2761,7 @@ fn remove_code_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::CodeRemoved { code_hash }),
event: RuntimeEvent::Contracts(crate::Event::CodeRemoved { code_hash }),
topics: vec![code_hash],
},
]
@@ -2794,7 +2795,7 @@ fn remove_code_wrong_origin() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: ALICE,
amount: 240,
}),
@@ -2802,7 +2803,7 @@ fn remove_code_wrong_origin() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::CodeStored { code_hash }),
event: RuntimeEvent::Contracts(crate::Event::CodeStored { code_hash }),
topics: vec![code_hash],
},
]
@@ -2895,12 +2896,14 @@ fn instantiate_with_zero_balance_works() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::NewAccount { account: addr.clone() }),
event: RuntimeEvent::System(frame_system::Event::NewAccount {
account: addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Endowed {
event: RuntimeEvent::Balances(pallet_balances::Event::Endowed {
account: addr.clone(),
free_balance: min_balance,
}),
@@ -2908,7 +2911,7 @@ fn instantiate_with_zero_balance_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: min_balance,
@@ -2917,7 +2920,7 @@ fn instantiate_with_zero_balance_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: addr.clone(),
amount: min_balance,
}),
@@ -2925,7 +2928,7 @@ fn instantiate_with_zero_balance_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: ALICE,
amount: 240,
}),
@@ -2933,12 +2936,12 @@ fn instantiate_with_zero_balance_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::CodeStored { code_hash }),
event: RuntimeEvent::Contracts(crate::Event::CodeStored { code_hash }),
topics: vec![code_hash],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Instantiated {
event: RuntimeEvent::Contracts(crate::Event::Instantiated {
deployer: ALICE,
contract: addr.clone(),
}),
@@ -2986,12 +2989,14 @@ fn instantiate_with_below_existential_deposit_works() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::NewAccount { account: addr.clone() }),
event: RuntimeEvent::System(frame_system::Event::NewAccount {
account: addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Endowed {
event: RuntimeEvent::Balances(pallet_balances::Event::Endowed {
account: addr.clone(),
free_balance: min_balance,
}),
@@ -2999,7 +3004,7 @@ fn instantiate_with_below_existential_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: min_balance,
@@ -3008,7 +3013,7 @@ fn instantiate_with_below_existential_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: addr.clone(),
amount: min_balance,
}),
@@ -3016,7 +3021,7 @@ fn instantiate_with_below_existential_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: 50,
@@ -3025,7 +3030,7 @@ fn instantiate_with_below_existential_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: ALICE,
amount: 240,
}),
@@ -3033,12 +3038,12 @@ fn instantiate_with_below_existential_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::CodeStored { code_hash }),
event: RuntimeEvent::Contracts(crate::Event::CodeStored { code_hash }),
topics: vec![code_hash],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Instantiated {
event: RuntimeEvent::Contracts(crate::Event::Instantiated {
deployer: ALICE,
contract: addr.clone(),
}),
@@ -3115,7 +3120,7 @@ fn storage_deposit_works() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: 42,
@@ -3124,7 +3129,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -3132,7 +3137,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: charged0,
@@ -3141,7 +3146,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: addr.clone(),
amount: charged0,
}),
@@ -3149,7 +3154,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -3157,7 +3162,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: charged1,
@@ -3166,7 +3171,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Reserved {
event: RuntimeEvent::Balances(pallet_balances::Event::Reserved {
who: addr.clone(),
amount: charged1,
}),
@@ -3174,7 +3179,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -3182,7 +3187,7 @@ fn storage_deposit_works() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::ReserveRepatriated {
event: RuntimeEvent::Balances(pallet_balances::Event::ReserveRepatriated {
from: addr.clone(),
to: ALICE,
amount: refunded0,
@@ -3264,7 +3269,7 @@ fn set_code_extrinsic() {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(pallet_contracts::Event::ContractCodeUpdated {
event: RuntimeEvent::Contracts(pallet_contracts::Event::ContractCodeUpdated {
contract: addr.clone(),
new_code_hash,
old_code_hash: code_hash,
@@ -3343,14 +3348,14 @@ fn call_after_killed_account_needs_funding() {
vec![
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::KilledAccount {
event: RuntimeEvent::System(frame_system::Event::KilledAccount {
account: addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Slashed {
event: RuntimeEvent::Balances(pallet_balances::Event::Slashed {
who: addr.clone(),
amount: min_balance + 700
}),
@@ -3358,7 +3363,7 @@ fn call_after_killed_account_needs_funding() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -3366,12 +3371,14 @@ fn call_after_killed_account_needs_funding() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::System(frame_system::Event::NewAccount { account: addr.clone() }),
event: RuntimeEvent::System(frame_system::Event::NewAccount {
account: addr.clone()
}),
topics: vec![],
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Endowed {
event: RuntimeEvent::Balances(pallet_balances::Event::Endowed {
account: addr.clone(),
free_balance: min_balance
}),
@@ -3379,7 +3386,7 @@ fn call_after_killed_account_needs_funding() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Balances(pallet_balances::Event::Transfer {
event: RuntimeEvent::Balances(pallet_balances::Event::Transfer {
from: ALICE,
to: addr.clone(),
amount: min_balance
@@ -3388,7 +3395,7 @@ fn call_after_killed_account_needs_funding() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: addr.clone(),
}),
@@ -3571,7 +3578,7 @@ fn set_code_hash() {
&[
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::ContractCodeUpdated {
event: RuntimeEvent::Contracts(crate::Event::ContractCodeUpdated {
contract: contract_addr.clone(),
new_code_hash,
old_code_hash: code_hash,
@@ -3580,7 +3587,7 @@ fn set_code_hash() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: contract_addr.clone(),
}),
@@ -3588,7 +3595,7 @@ fn set_code_hash() {
},
EventRecord {
phase: Phase::Initialization,
event: Event::Contracts(crate::Event::Called {
event: RuntimeEvent::Contracts(crate::Event::Called {
caller: ALICE,
contract: contract_addr.clone(),
}),
+8 -4
View File
@@ -280,7 +280,7 @@ mod tests {
},
gas::GasMeter,
storage::WriteOutcome,
tests::{Call, Test, ALICE, BOB},
tests::{RuntimeCall, Test, ALICE, BOB},
BalanceOf, CodeHash, Error, Pallet as Contracts,
};
use assert_matches::assert_matches;
@@ -339,7 +339,7 @@ mod tests {
transfers: Vec<TransferEntry>,
// (topics, data)
events: Vec<(Vec<H256>, Vec<u8>)>,
runtime_calls: RefCell<Vec<Call>>,
runtime_calls: RefCell<Vec<RuntimeCall>>,
schedule: Schedule<Test>,
gas_meter: GasMeter<Test>,
debug_buffer: Vec<u8>,
@@ -532,7 +532,10 @@ mod tests {
self.debug_buffer.extend(msg.as_bytes());
true
}
fn call_runtime(&self, call: <Self::T as Config>::Call) -> DispatchResultWithPostInfo {
fn call_runtime(
&self,
call: <Self::T as Config>::RuntimeCall,
) -> DispatchResultWithPostInfo {
self.runtime_calls.borrow_mut().push(call);
Ok(Default::default())
}
@@ -2299,7 +2302,8 @@ mod tests {
#[test]
#[cfg(feature = "unstable-interface")]
fn call_runtime_works() {
let call = Call::System(frame_system::Call::remark { remark: b"Hello World".to_vec() });
let call =
RuntimeCall::System(frame_system::Call::remark { remark: b"Hello World".to_vec() });
let mut ext = MockExt::default();
let result = execute(CODE_CALL_RUNTIME, call.encode(), &mut ext).unwrap();
assert_eq!(*ext.runtime_calls.borrow(), vec![call]);
@@ -2316,7 +2316,7 @@ pub mod env {
) -> Result<ReturnCode, TrapReason> {
use frame_support::{dispatch::GetDispatchInfo, weights::extract_actual_weight};
ctx.charge_gas(RuntimeCosts::CopyFromContract(call_len))?;
let call: <E::T as Config>::Call =
let call: <E::T as Config>::RuntimeCall =
ctx.read_sandbox_memory_as_unbounded(call_ptr, call_len)?;
let dispatch_info = call.get_dispatch_info();
let charged = ctx.charge_gas(RuntimeCosts::CallRuntime(dispatch_info.weight))?;
+2 -1
View File
@@ -98,7 +98,8 @@ pub mod pallet {
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config + Sized {
// System level stuff.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
/// Currency type with which voting happens.
@@ -50,9 +50,9 @@ frame_support::construct_runtime!(
// Test that a fitlered call can be dispatched.
pub struct BaseFilter;
impl Contains<Call> for BaseFilter {
fn contains(call: &Call) -> bool {
!matches!(call, &Call::Balances(pallet_balances::Call::set_balance { .. }))
impl Contains<RuntimeCall> for BaseFilter {
fn contains(call: &RuntimeCall) -> bool {
!matches!(call, &RuntimeCall::Balances(pallet_balances::Call::set_balance { .. }))
}
}
@@ -68,13 +68,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -92,7 +92,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type MaxLocks = ConstU32<10>;
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -187,7 +187,7 @@ impl Polling<TallyOf<Test>> for TestPolls {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = pallet_balances::Pallet<Self>;
type VoteLockingPeriod = ConstU64<3>;
type MaxVotes = ConstU32<3>;
@@ -37,7 +37,7 @@ const MAX_REFERENDUMS: u32 = 99;
const MAX_SECONDERS: u32 = 100;
const MAX_BYTES: u32 = 16_384;
fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
+1 -1
View File
@@ -254,7 +254,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config + Sized {
type Proposal: Parameter + Dispatchable<Origin = Self::Origin> + From<Call<Self>>;
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Currency type for this pallet.
type Currency: ReservableCurrency<Self::AccountId>
+17 -13
View File
@@ -70,9 +70,9 @@ frame_support::construct_runtime!(
// Test that a fitlered call can be dispatched.
pub struct BaseFilter;
impl Contains<Call> for BaseFilter {
fn contains(call: &Call) -> bool {
!matches!(call, &Call::Balances(pallet_balances::Call::set_balance { .. }))
impl Contains<RuntimeCall> for BaseFilter {
fn contains(call: &RuntimeCall) -> bool {
!matches!(call, &RuntimeCall::Balances(pallet_balances::Call::set_balance { .. }))
}
}
@@ -88,13 +88,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -110,10 +110,10 @@ parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
}
impl pallet_scheduler::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Origin = Origin;
type PalletsOrigin = OriginCaller;
type Call = Call;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<u64>;
type MaxScheduledPerBlock = ();
@@ -128,7 +128,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type MaxLocks = ConstU32<10>;
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -156,8 +156,8 @@ impl SortedMembers<u64> for OneToFive {
}
impl Config for Test {
type Proposal = Call;
type Event = Event;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Currency = pallet_balances::Pallet<Self>;
type EnactmentPeriod = ConstU64<2>;
type LaunchPeriod = ConstU64<2>;
@@ -217,14 +217,18 @@ fn params_should_work() {
}
fn set_balance_proposal(value: u64) -> Vec<u8> {
Call::Balances(pallet_balances::Call::set_balance { who: 42, new_free: value, new_reserved: 0 })
.encode()
RuntimeCall::Balances(pallet_balances::Call::set_balance {
who: 42,
new_free: value,
new_reserved: 0,
})
.encode()
}
#[test]
fn set_balance_proposal_is_correctly_filtered_out() {
for i in 0..10 {
let call = Call::decode(&mut &set_balance_proposal(i)[..]).unwrap();
let call = RuntimeCall::decode(&mut &set_balance_proposal(i)[..]).unwrap();
assert!(!<Test as frame_system::Config>::BaseCallFilter::contains(&call));
}
}
@@ -570,8 +570,8 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config + SendTransactionTypes<Call<Self>> {
type Event: From<Event<Self>>
+ IsType<<Self as frame_system::Config>::Event>
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>
+ TryInto<Event<Self>>;
/// Currency type.
@@ -50,7 +50,8 @@ use sp_runtime::{
use std::sync::Arc;
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<AccountId, Call, (), ()>;
pub type UncheckedExtrinsic =
sp_runtime::generic::UncheckedExtrinsic<AccountId, RuntimeCall, (), ()>;
frame_support::construct_runtime!(
pub enum Runtime where
@@ -85,7 +86,7 @@ pub(crate) fn multi_phase_events() -> Vec<super::Event<Runtime>> {
System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::MultiPhase(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::MultiPhase(inner) = e { Some(inner) } else { None })
.collect::<Vec<_>>()
}
@@ -201,13 +202,13 @@ impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = u64;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type DbWeight = ();
type BlockLength = ();
@@ -231,7 +232,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime {
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -362,7 +363,7 @@ impl MinerConfig for Runtime {
}
impl crate::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type EstimateCallFee = frame_support::traits::ConstU32<8>;
type SignedPhase = SignedPhase;
@@ -394,13 +395,13 @@ impl crate::Config for Runtime {
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Runtime
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
type Extrinsic = Extrinsic;
}
pub type Extrinsic = sp_runtime::testing::TestXt<Call, ()>;
pub type Extrinsic = sp_runtime::testing::TestXt<RuntimeCall, ()>;
parameter_types! {
pub MaxNominations: u32 = <TestNposSolution as NposSolution>::LIMIT as u32;
@@ -855,8 +855,8 @@ mod tests {
use super::*;
use crate::{
mock::{
roll_to, roll_to_with_ocw, trim_helpers, witness, BlockNumber, Call as OuterCall,
ExtBuilder, Extrinsic, MinerMaxWeight, MultiPhase, Origin, Runtime, System,
roll_to, roll_to_with_ocw, trim_helpers, witness, BlockNumber, ExtBuilder, Extrinsic,
MinerMaxWeight, MultiPhase, Origin, Runtime, RuntimeCall as OuterCall, System,
TestNposSolution, TrimHelpers, UnsignedPhase,
},
CurrentPhase, InvalidTransaction, Phase, QueuedSolution, TransactionSource,
@@ -214,13 +214,13 @@ mod tests {
type Origin = Origin;
type Index = AccountId;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = ();
type RuntimeEvent = ();
type BlockHashCount = ();
type DbWeight = ();
type BlockLength = ();
+12 -11
View File
@@ -195,7 +195,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Identifier for the elections-phragmen pallet's lock
#[pallet::constant]
@@ -1185,13 +1185,13 @@ mod tests {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -1206,7 +1206,7 @@ mod tests {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = frame_system::Pallet<Test>;
@@ -1279,7 +1279,7 @@ mod tests {
impl Config for Test {
type PalletId = ElectionsPhragmenPalletId;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type ChangeMembers = TestChangeMembers;
@@ -1298,7 +1298,8 @@ mod tests {
}
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, Call, ()>;
pub type UncheckedExtrinsic =
sp_runtime::generic::UncheckedExtrinsic<u32, u64, RuntimeCall, ()>;
frame_support::construct_runtime!(
pub enum Test where
@@ -2201,7 +2202,7 @@ mod tests {
System::set_block_number(5);
Elections::on_initialize(System::block_number());
System::assert_last_event(Event::Elections(super::Event::EmptyTerm));
System::assert_last_event(RuntimeEvent::Elections(super::Event::EmptyTerm));
})
}
@@ -2217,7 +2218,7 @@ mod tests {
System::set_block_number(5);
Elections::on_initialize(System::block_number());
System::assert_last_event(Event::Elections(super::Event::NewTerm {
System::assert_last_event(RuntimeEvent::Elections(super::Event::NewTerm {
new_members: vec![(4, 35), (5, 45)],
}));
@@ -2230,7 +2231,7 @@ mod tests {
System::set_block_number(10);
Elections::on_initialize(System::block_number());
System::assert_last_event(Event::Elections(super::Event::NewTerm {
System::assert_last_event(RuntimeEvent::Elections(super::Event::NewTerm {
new_members: vec![],
}));
@@ -2302,7 +2303,7 @@ mod tests {
assert_eq!(Elections::election_rounds(), 1);
assert!(members_ids().is_empty());
System::assert_last_event(Event::Elections(super::Event::NewTerm {
System::assert_last_event(RuntimeEvent::Elections(super::Event::NewTerm {
new_members: vec![],
}));
});
@@ -2610,7 +2611,7 @@ mod tests {
// 5 is an outgoing loser. will also get slashed.
assert_eq!(balances(&5), (45, 2));
System::assert_has_event(Event::Elections(super::Event::NewTerm {
System::assert_has_event(RuntimeEvent::Elections(super::Event::NewTerm {
new_members: vec![(4, 35), (5, 45)],
}));
})
+3 -3
View File
@@ -370,7 +370,7 @@ pub mod pallet {
type MagicNumber: Get<Self::Balance>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Type representing the weight of this pallet
type WeightInfo: WeightInfo;
@@ -719,11 +719,11 @@ impl<T: Config + Send + Sync> sp_std::fmt::Debug for WatchDummy<T> {
impl<T: Config + Send + Sync> SignedExtension for WatchDummy<T>
where
<T as frame_system::Config>::Call: IsSubType<Call<T>>,
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>,
{
const IDENTIFIER: &'static str = "WatchDummy";
type AccountId = T::AccountId;
type Call = <T as frame_system::Config>::Call;
type Call = <T as frame_system::Config>::RuntimeCall;
type AdditionalSigned = ();
type Pre = ();
+4 -4
View File
@@ -63,12 +63,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -87,7 +87,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
@@ -95,7 +95,7 @@ impl pallet_balances::Config for Test {
impl Config for Test {
type MagicNumber = ConstU64<1_000_000_000>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
}
@@ -126,10 +126,7 @@ pub mod pallet {
type AuthorityId: AppCrypto<Self::Public, Self::Signature>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
/// The overarching dispatch call type.
type Call: From<Call<Self>>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
// Configuration parameters
@@ -61,7 +61,7 @@ impl frame_system::Config for Test {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -69,7 +69,7 @@ impl frame_system::Config for Test {
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -82,7 +82,7 @@ impl frame_system::Config for Test {
type MaxConsumers = ConstU32<16>;
}
type Extrinsic = TestXt<Call, ()>;
type Extrinsic = TestXt<RuntimeCall, ()>;
type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
impl frame_system::offchain::SigningTypes for Test {
@@ -92,22 +92,22 @@ impl frame_system::offchain::SigningTypes for Test {
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Test
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
type Extrinsic = Extrinsic;
}
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Test
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
call: RuntimeCall,
_public: <Signature as Verify>::Signer,
_account: AccountId,
nonce: u64,
) -> Option<(Call, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
) -> Option<(RuntimeCall, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
Some((call, (nonce, ())))
}
}
@@ -117,9 +117,8 @@ parameter_types! {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type AuthorityId = crypto::TestAuthId;
type Call = Call;
type GracePeriod = ConstU64<5>;
type UnsignedInterval = ConstU64<128>;
type UnsignedPriority = UnsignedPriority;
@@ -233,7 +232,7 @@ fn should_submit_signed_transaction_on_chain() {
assert!(pool_state.read().transactions.is_empty());
let tx = Extrinsic::decode(&mut &*tx).unwrap();
assert_eq!(tx.signature.unwrap().0, 0);
assert_eq!(tx.call, Call::Example(crate::Call::submit_price { price: 15523 }));
assert_eq!(tx.call, RuntimeCall::Example(crate::Call::submit_price { price: 15523 }));
});
}
@@ -278,7 +277,7 @@ fn should_submit_unsigned_transaction_on_chain_for_any_account() {
let tx = pool_state.write().transactions.pop().unwrap();
let tx = Extrinsic::decode(&mut &*tx).unwrap();
assert_eq!(tx.signature, None);
if let Call::Example(crate::Call::submit_price_unsigned_with_signed_payload {
if let RuntimeCall::Example(crate::Call::submit_price_unsigned_with_signed_payload {
price_payload: body,
signature,
}) = tx.call
@@ -337,7 +336,7 @@ fn should_submit_unsigned_transaction_on_chain_for_all_accounts() {
let tx = pool_state.write().transactions.pop().unwrap();
let tx = Extrinsic::decode(&mut &*tx).unwrap();
assert_eq!(tx.signature, None);
if let Call::Example(crate::Call::submit_price_unsigned_with_signed_payload {
if let RuntimeCall::Example(crate::Call::submit_price_unsigned_with_signed_payload {
price_payload: body,
signature,
}) = tx.call
@@ -379,7 +378,10 @@ fn should_submit_raw_unsigned_transaction_on_chain() {
assert_eq!(tx.signature, None);
assert_eq!(
tx.call,
Call::Example(crate::Call::submit_price_unsigned { block_number: 1, price: 15523 })
RuntimeCall::Example(crate::Call::submit_price_unsigned {
block_number: 1,
price: 15523
})
);
});
}
+1 -4
View File
@@ -41,10 +41,7 @@ pub mod pallet {
use frame_system::pallet_prelude::*;
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching dispatch call type.
type Call: From<Call<Self>>;
}
pub trait Config: frame_system::Config {}
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
@@ -46,7 +46,7 @@ parameter_types! {
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type PalletInfo = PalletInfo;
type Index = u64;
type BlockNumber = u64;
@@ -55,7 +55,7 @@ impl frame_system::Config for Test {
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = frame_support::traits::ConstU64<250>;
type DbWeight = ();
type BlockWeights = ();
@@ -70,9 +70,7 @@ impl frame_system::Config for Test {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
impl Config for Test {
type Call = Call;
}
impl Config for Test {}
fn test_pub(n: u8) -> sp_core::sr25519::Public {
sp_core::sr25519::Public::from_raw([n; 32])
+20 -20
View File
@@ -786,14 +786,14 @@ mod tests {
type DbWeight = ();
type Origin = Origin;
type Index = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type BlockNumber = u64;
type Hash = sp_core::H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<u64>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = RuntimeVersion;
type PalletInfo = PalletInfo;
@@ -809,7 +809,7 @@ mod tests {
type Balance = u64;
impl pallet_balances::Config for Runtime {
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -823,7 +823,7 @@ mod tests {
pub const TransactionByteFee: Balance = 0;
}
impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<Balance>;
@@ -850,7 +850,7 @@ mod tests {
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
type TestXt = sp_runtime::testing::TestXt<Call, SignedExtra>;
type TestXt = sp_runtime::testing::TestXt<RuntimeCall, SignedExtra>;
type TestBlock = Block<TestXt>;
type TestUncheckedExtrinsic = TestXt;
@@ -889,8 +889,8 @@ mod tests {
Some((who, extra(nonce, fee)))
}
fn call_transfer(dest: u64, value: u64) -> Call {
Call::Balances(BalancesCall::transfer { dest, value })
fn call_transfer(dest: u64, value: u64) -> RuntimeCall {
RuntimeCall::Balances(BalancesCall::transfer { dest, value })
}
#[test]
@@ -1033,7 +1033,7 @@ mod tests {
let mut t = new_test_ext(10000);
// given: TestXt uses the encoded len as fixed Len:
let xt = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, 0, 0),
);
let encoded = xt.encode();
@@ -1056,7 +1056,7 @@ mod tests {
for nonce in 0..=num_to_exhaust_block {
let xt = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, nonce.into(), 0),
);
let res = Executive::apply_extrinsic(xt);
@@ -1081,15 +1081,15 @@ mod tests {
#[test]
fn block_weight_and_size_is_stored_per_tx() {
let xt = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, 0, 0),
);
let x1 = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, 1, 0),
);
let x2 = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, 2, 0),
);
let len = xt.clone().encode().len() as u32;
@@ -1145,8 +1145,8 @@ mod tests {
#[test]
fn validate_unsigned() {
let valid = TestXt::new(Call::Custom(custom::Call::allowed_unsigned {}), None);
let invalid = TestXt::new(Call::Custom(custom::Call::unallowed_unsigned {}), None);
let valid = TestXt::new(RuntimeCall::Custom(custom::Call::allowed_unsigned {}), None);
let invalid = TestXt::new(RuntimeCall::Custom(custom::Call::unallowed_unsigned {}), None);
let mut t = new_test_ext(1);
t.execute_with(|| {
@@ -1184,7 +1184,7 @@ mod tests {
id, &1, 110, lock,
);
let xt = TestXt::new(
Call::System(SystemCall::remark { remark: vec![1u8] }),
RuntimeCall::System(SystemCall::remark { remark: vec![1u8] }),
sign_extra(1, 0, 0),
);
let weight = xt.get_dispatch_info().weight +
@@ -1360,7 +1360,7 @@ mod tests {
#[test]
fn custom_runtime_upgrade_is_called_when_using_execute_block_trait() {
let xt = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, 0, 0),
);
@@ -1459,7 +1459,7 @@ mod tests {
#[test]
fn calculating_storage_root_twice_works() {
let call = Call::Custom(custom::Call::calculate_storage_root {});
let call = RuntimeCall::Custom(custom::Call::calculate_storage_root {});
let xt = TestXt::new(call, sign_extra(1, 0, 0));
let header = new_test_ext(1).execute_with(|| {
@@ -1486,10 +1486,10 @@ mod tests {
#[should_panic(expected = "Invalid inherent position for extrinsic at index 1")]
fn invalid_inherent_position_fail() {
let xt1 = TestXt::new(
Call::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 33, value: 0 }),
sign_extra(1, 0, 0),
);
let xt2 = TestXt::new(Call::Custom(custom::Call::inherent_call {}), None);
let xt2 = TestXt::new(RuntimeCall::Custom(custom::Call::inherent_call {}), None);
let header = new_test_ext(1).execute_with(|| {
// Let's build some fake block.
@@ -1514,7 +1514,7 @@ mod tests {
#[test]
fn valid_inherents_position_works() {
let xt1 = TestXt::new(Call::Custom(custom::Call::inherent_call {}), None);
let xt1 = TestXt::new(RuntimeCall::Custom(custom::Call::inherent_call {}), None);
let xt2 = TestXt::new(call_transfer(33, 0), sign_extra(1, 0, 0));
let header = new_test_ext(1).execute_with(|| {
+1 -1
View File
@@ -98,7 +98,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// Overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Currency type that this works on.
type Currency: ReservableCurrency<Self::AccountId, Balance = Self::CurrencyBalance>;
+4 -4
View File
@@ -50,7 +50,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -58,7 +58,7 @@ impl frame_system::Config for Test {
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
@@ -75,7 +75,7 @@ impl frame_system::Config for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = frame_support::traits::ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
@@ -92,7 +92,7 @@ ord_parameter_types! {
}
impl pallet_gilt::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
type AdminOrigin = frame_system::EnsureSignedBy<One, Self::AccountId>;
+3 -6
View File
@@ -87,12 +87,9 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The event type of this module.
type Event: From<Event>
+ Into<<Self as frame_system::Config>::Event>
+ IsType<<Self as frame_system::Config>::Event>;
/// The function call.
type Call: From<Call<Self>>;
type RuntimeEvent: From<Event>
+ Into<<Self as frame_system::Config>::RuntimeEvent>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The proof of key ownership, used for validating equivocation reports
/// The proof must include the session index and validator count of the
+10 -11
View File
@@ -82,13 +82,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -103,10 +103,10 @@ impl frame_system::Config for Test {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where
Call: From<C>,
RuntimeCall: From<C>,
{
type OverarchingCall = Call;
type Extrinsic = TestXt<Call, ()>;
type OverarchingCall = RuntimeCall;
type Extrinsic = TestXt<RuntimeCall, ()>;
}
parameter_types! {
@@ -116,7 +116,7 @@ parameter_types! {
/// Custom `SessionHandler` since we use `TestSessionKeys` as `Keys`.
impl pallet_session::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = u64;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = pallet_session::PeriodicSessions<ConstU64<1>, ConstU64<0>>;
@@ -145,7 +145,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type Balance = u128;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU128<1>;
type AccountStore = System;
type WeightInfo = ();
@@ -188,7 +188,7 @@ impl pallet_staking::Config for Test {
type MaxNominations = ConstU32<16>;
type RewardRemainder = ();
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
type Slash = ();
@@ -213,7 +213,7 @@ impl pallet_staking::Config for Test {
}
impl pallet_offences::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
}
@@ -224,8 +224,7 @@ parameter_types! {
}
impl Config for Test {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type KeyOwnerProofSystem = Historical;
+1 -1
View File
@@ -32,7 +32,7 @@ use sp_runtime::traits::Bounded;
const SEED: u32 = 0;
fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
+1 -1
View File
@@ -105,7 +105,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The currency trait.
type Currency: ReservableCurrency<Self::AccountId>;
+4 -4
View File
@@ -60,12 +60,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
@@ -81,7 +81,7 @@ impl frame_system::Config for Test {
impl pallet_balances::Config for Test {
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -103,7 +103,7 @@ ord_parameter_types! {
type EnsureOneOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<One, u64>>;
type EnsureTwoOrRoot = EitherOfDiverse<EnsureRoot<u64>, EnsureSignedBy<Two, u64>>;
impl pallet_identity::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type Slashed = ();
type BasicDeposit = ConstU64<10>;
+1 -1
View File
@@ -337,7 +337,7 @@ pub mod pallet {
type MaxPeerDataEncodingSize: Get<u32>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// A type for retrieving the validators supposed to be online in a session.
type ValidatorSet: ValidatorSetWithIdentification<Self::AccountId>;
+7 -7
View File
@@ -83,7 +83,7 @@ impl pallet_session::historical::SessionManager<u64, u64> for TestSessionManager
}
/// An extrinsic type used for tests.
pub type Extrinsic = TestXt<Call, ()>;
pub type Extrinsic = TestXt<RuntimeCall, ()>;
type IdentificationTuple = (u64, u64);
type Offence = crate::UnresponsivenessOffence<IdentificationTuple>;
@@ -130,13 +130,13 @@ impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -162,7 +162,7 @@ impl pallet_session::Config for Runtime {
type ValidatorId = u64;
type ValidatorIdOf = ConvertInto;
type Keys = UintAuthorityId;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type WeightInfo = ();
}
@@ -216,7 +216,7 @@ impl frame_support::traits::EstimateNextSessionRotation<u64> for TestNextSession
impl Config for Runtime {
type AuthorityId = UintAuthorityId;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical;
type NextSessionRotation = TestNextSessionRotation;
type ReportUnresponsiveness = OffenceHandler;
@@ -229,9 +229,9 @@ impl Config for Runtime {
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Runtime
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
type Extrinsic = Extrinsic;
}
+4 -2
View File
@@ -240,7 +240,8 @@ fn should_generate_heartbeats() {
// check stuff about the transaction.
let ex: Extrinsic = Decode::decode(&mut &*transaction).unwrap();
let heartbeat = match ex.call {
crate::mock::Call::ImOnline(crate::Call::heartbeat { heartbeat, .. }) => heartbeat,
crate::mock::RuntimeCall::ImOnline(crate::Call::heartbeat { heartbeat, .. }) =>
heartbeat,
e => panic!("Unexpected call: {:?}", e),
};
@@ -355,7 +356,8 @@ fn should_not_send_a_report_if_already_online() {
// check stuff about the transaction.
let ex: Extrinsic = Decode::decode(&mut &*transaction).unwrap();
let heartbeat = match ex.call {
crate::mock::Call::ImOnline(crate::Call::heartbeat { heartbeat, .. }) => heartbeat,
crate::mock::RuntimeCall::ImOnline(crate::Call::heartbeat { heartbeat, .. }) =>
heartbeat,
e => panic!("Unexpected call: {:?}", e),
};
+1 -1
View File
@@ -68,7 +68,7 @@ pub mod pallet {
type Deposit: Get<BalanceOf<Self>>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
+4 -4
View File
@@ -53,7 +53,7 @@ impl frame_system::Config for Test {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -61,7 +61,7 @@ impl frame_system::Config for Test {
type AccountId = u64;
type Lookup = Indices;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -80,7 +80,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
@@ -90,7 +90,7 @@ impl Config for Test {
type AccountIndex = u64;
type Currency = Balances;
type Deposit = ConstU64<1>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
}
+16 -10
View File
@@ -96,17 +96,17 @@ pub struct LotteryConfig<BlockNumber, Balance> {
}
pub trait ValidateCall<T: Config> {
fn validate_call(call: &<T as Config>::Call) -> bool;
fn validate_call(call: &<T as Config>::RuntimeCall) -> bool;
}
impl<T: Config> ValidateCall<T> for () {
fn validate_call(_: &<T as Config>::Call) -> bool {
fn validate_call(_: &<T as Config>::RuntimeCall) -> bool {
false
}
}
impl<T: Config> ValidateCall<T> for Pallet<T> {
fn validate_call(call: &<T as Config>::Call) -> bool {
fn validate_call(call: &<T as Config>::RuntimeCall) -> bool {
let valid_calls = CallIndices::<T>::get();
let call_index = match Self::call_to_index(call) {
Ok(call_index) => call_index,
@@ -134,7 +134,7 @@ pub mod pallet {
type PalletId: Get<PalletId>;
/// A dispatchable call.
type Call: Parameter
type RuntimeCall: Parameter
+ Dispatchable<Origin = Self::Origin>
+ GetDispatchInfo
+ From<frame_system::Call<Self>>;
@@ -146,7 +146,7 @@ pub mod pallet {
type Randomness: Randomness<Self::Hash, Self::BlockNumber>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The manager origin.
type ManagerOrigin: EnsureOrigin<Self::Origin>;
@@ -300,7 +300,10 @@ pub mod pallet {
T::WeightInfo::buy_ticket()
.saturating_add(call.get_dispatch_info().weight)
)]
pub fn buy_ticket(origin: OriginFor<T>, call: Box<<T as Config>::Call>) -> DispatchResult {
pub fn buy_ticket(
origin: OriginFor<T>,
call: Box<<T as Config>::RuntimeCall>,
) -> DispatchResult {
let caller = ensure_signed(origin.clone())?;
call.clone().dispatch(origin).map_err(|e| e.error)?;
@@ -315,7 +318,10 @@ pub mod pallet {
///
/// This extrinsic must be called by the Manager origin.
#[pallet::weight(T::WeightInfo::set_calls(calls.len() as u32))]
pub fn set_calls(origin: OriginFor<T>, calls: Vec<<T as Config>::Call>) -> DispatchResult {
pub fn set_calls(
origin: OriginFor<T>,
calls: Vec<<T as Config>::RuntimeCall>,
) -> DispatchResult {
T::ManagerOrigin::ensure_origin(origin)?;
ensure!(calls.len() <= T::MaxCalls::get() as usize, Error::<T>::TooManyCalls);
if calls.is_empty() {
@@ -404,7 +410,7 @@ impl<T: Config> Pallet<T> {
/// Converts a vector of calls into a vector of call indices.
fn calls_to_indices(
calls: &[<T as Config>::Call],
calls: &[<T as Config>::RuntimeCall],
) -> Result<BoundedVec<CallIndex, T::MaxCalls>, DispatchError> {
let mut indices = BoundedVec::<CallIndex, T::MaxCalls>::with_bounded_capacity(calls.len());
for c in calls.iter() {
@@ -415,7 +421,7 @@ impl<T: Config> Pallet<T> {
}
/// Convert a call to it's call index by encoding the call and taking the first two bytes.
fn call_to_index(call: &<T as Config>::Call) -> Result<CallIndex, DispatchError> {
fn call_to_index(call: &<T as Config>::RuntimeCall) -> Result<CallIndex, DispatchError> {
let encoded_call = call.encode();
if encoded_call.len() < 2 {
return Err(Error::<T>::EncodingFailed.into())
@@ -424,7 +430,7 @@ impl<T: Config> Pallet<T> {
}
/// Logic for buying a ticket.
fn do_buy_ticket(caller: &T::AccountId, call: &<T as Config>::Call) -> DispatchResult {
fn do_buy_ticket(caller: &T::AccountId, call: &<T as Config>::RuntimeCall) -> DispatchResult {
// Check the call is valid lottery
let config = Lottery::<T>::get().ok_or(Error::<T>::NotConfigured)?;
let block_number = frame_system::Pallet::<T>::block_number();
+5 -5
View File
@@ -59,14 +59,14 @@ impl frame_system::Config for Test {
type DbWeight = ();
type Origin = Origin;
type Index = u64;
type Call = Call;
type RuntimeCall = RuntimeCall;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -84,7 +84,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -97,10 +97,10 @@ parameter_types! {
impl Config for Test {
type PalletId = LotteryPalletId;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type Randomness = TestRandomness<Self>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ManagerOrigin = EnsureRoot<u64>;
type MaxCalls = ConstU32<2>;
type ValidateCall = Lottery;
+39 -33
View File
@@ -20,7 +20,8 @@
use super::*;
use frame_support::{assert_noop, assert_ok, assert_storage_noop};
use mock::{
new_test_ext, run_to_block, Balances, BalancesCall, Call, Lottery, Origin, SystemCall, Test,
new_test_ext, run_to_block, Balances, BalancesCall, Lottery, Origin, RuntimeCall, SystemCall,
Test,
};
use pallet_balances::Error as BalancesError;
use sp_runtime::traits::BadOrigin;
@@ -43,8 +44,8 @@ fn basic_end_to_end_works() {
let length = 20;
let delay = 5;
let calls = vec![
Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
];
// Set calls for the lottery
@@ -55,7 +56,7 @@ fn basic_end_to_end_works() {
assert!(crate::Lottery::<Test>::get().is_some());
assert_eq!(Balances::free_balance(&1), 100);
let call = Box::new(Call::Balances(BalancesCall::transfer { dest: 2, value: 20 }));
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 20 }));
assert_ok!(Lottery::buy_ticket(Origin::signed(1), call.clone()));
// 20 from the transfer, 10 from buying a ticket
assert_eq!(Balances::free_balance(&1), 100 - 20 - 10);
@@ -127,17 +128,17 @@ fn set_calls_works() {
assert!(!CallIndices::<Test>::exists());
let calls = vec![
Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
];
assert_ok!(Lottery::set_calls(Origin::root(), calls));
assert!(CallIndices::<Test>::exists());
let too_many_calls = vec![
Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
Call::System(SystemCall::remark { remark: vec![] }),
RuntimeCall::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::System(SystemCall::remark { remark: vec![] }),
];
assert_noop!(
@@ -155,8 +156,8 @@ fn set_calls_works() {
fn call_to_indices_works() {
new_test_ext().execute_with(|| {
let calls = vec![
Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
];
let indices = Lottery::calls_to_indices(&calls).unwrap().into_inner();
// Only comparing the length since it is otherwise dependant on the API
@@ -164,9 +165,9 @@ fn call_to_indices_works() {
assert_eq!(indices.len(), calls.len());
let too_many_calls = vec![
Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
Call::System(SystemCall::remark { remark: vec![] }),
RuntimeCall::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::System(SystemCall::remark { remark: vec![] }),
];
assert_noop!(Lottery::calls_to_indices(&too_many_calls), Error::<Test>::TooManyCalls);
});
@@ -202,7 +203,7 @@ fn buy_ticket_works_as_simple_passthrough() {
// as a simple passthrough to the real call.
new_test_ext().execute_with(|| {
// No lottery set up
let call = Box::new(Call::Balances(BalancesCall::transfer { dest: 2, value: 20 }));
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 20 }));
// This is just a basic transfer then
assert_ok!(Lottery::buy_ticket(Origin::signed(1), call.clone()));
assert_eq!(Balances::free_balance(&1), 100 - 20);
@@ -210,8 +211,8 @@ fn buy_ticket_works_as_simple_passthrough() {
// Lottery is set up, but too expensive to enter, so `do_buy_ticket` fails.
let calls = vec![
Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
];
assert_ok!(Lottery::set_calls(Origin::root(), calls));
@@ -222,24 +223,28 @@ fn buy_ticket_works_as_simple_passthrough() {
assert_eq!(TicketsCount::<Test>::get(), 0);
// If call would fail, the whole thing still fails the same
let fail_call = Box::new(Call::Balances(BalancesCall::transfer { dest: 2, value: 1000 }));
let fail_call =
Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 1000 }));
assert_noop!(
Lottery::buy_ticket(Origin::signed(1), fail_call),
BalancesError::<Test, _>::InsufficientBalance,
);
let bad_origin_call =
Box::new(Call::Balances(BalancesCall::force_transfer { source: 0, dest: 0, value: 0 }));
let bad_origin_call = Box::new(RuntimeCall::Balances(BalancesCall::force_transfer {
source: 0,
dest: 0,
value: 0,
}));
assert_noop!(Lottery::buy_ticket(Origin::signed(1), bad_origin_call), BadOrigin,);
// User can call other txs, but doesn't get a ticket
let remark_call =
Box::new(Call::System(SystemCall::remark { remark: b"hello, world!".to_vec() }));
Box::new(RuntimeCall::System(SystemCall::remark { remark: b"hello, world!".to_vec() }));
assert_ok!(Lottery::buy_ticket(Origin::signed(2), remark_call));
assert_eq!(TicketsCount::<Test>::get(), 0);
let successful_call =
Box::new(Call::Balances(BalancesCall::transfer { dest: 2, value: 1 }));
Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 1 }));
assert_ok!(Lottery::buy_ticket(Origin::signed(2), successful_call));
assert_eq!(TicketsCount::<Test>::get(), 1);
});
@@ -250,13 +255,13 @@ fn buy_ticket_works() {
new_test_ext().execute_with(|| {
// Set calls for the lottery.
let calls = vec![
Call::System(SystemCall::remark { remark: vec![] }),
Call::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
RuntimeCall::System(SystemCall::remark { remark: vec![] }),
RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 }),
];
assert_ok!(Lottery::set_calls(Origin::root(), calls));
// Can't buy ticket before start
let call = Box::new(Call::Balances(BalancesCall::transfer { dest: 2, value: 1 }));
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 2, value: 1 }));
assert_ok!(Lottery::buy_ticket(Origin::signed(1), call.clone()));
assert_eq!(TicketsCount::<Test>::get(), 0);
@@ -269,12 +274,13 @@ fn buy_ticket_works() {
assert_eq!(TicketsCount::<Test>::get(), 1);
// Can't buy another of the same ticket (even if call is slightly changed)
let call = Box::new(Call::Balances(BalancesCall::transfer { dest: 3, value: 30 }));
let call = Box::new(RuntimeCall::Balances(BalancesCall::transfer { dest: 3, value: 30 }));
assert_ok!(Lottery::buy_ticket(Origin::signed(1), call));
assert_eq!(TicketsCount::<Test>::get(), 1);
// Buy ticket for remark
let call = Box::new(Call::System(SystemCall::remark { remark: b"hello, world!".to_vec() }));
let call =
Box::new(RuntimeCall::System(SystemCall::remark { remark: b"hello, world!".to_vec() }));
assert_ok!(Lottery::buy_ticket(Origin::signed(1), call.clone()));
assert_eq!(TicketsCount::<Test>::get(), 2);
@@ -296,7 +302,7 @@ fn buy_ticket_works() {
#[test]
fn do_buy_ticket_already_participating() {
new_test_ext().execute_with(|| {
let calls = vec![Call::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
let calls = vec![RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
assert_ok!(Lottery::set_calls(Origin::root(), calls.clone()));
assert_ok!(Lottery::start_lottery(Origin::root(), 1, 10, 10, false));
@@ -311,7 +317,7 @@ fn do_buy_ticket_already_participating() {
#[test]
fn buy_ticket_already_participating() {
new_test_ext().execute_with(|| {
let calls = vec![Call::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
let calls = vec![RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
assert_ok!(Lottery::set_calls(Origin::root(), calls.clone()));
assert_ok!(Lottery::start_lottery(Origin::root(), 1, 10, 10, false));
@@ -331,7 +337,7 @@ fn buy_ticket_already_participating() {
#[test]
fn buy_ticket_insufficient_balance() {
new_test_ext().execute_with(|| {
let calls = vec![Call::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
let calls = vec![RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
assert_ok!(Lottery::set_calls(Origin::root(), calls.clone()));
// Price set to 100.
assert_ok!(Lottery::start_lottery(Origin::root(), 100, 10, 10, false));
@@ -346,7 +352,7 @@ fn buy_ticket_insufficient_balance() {
#[test]
fn do_buy_ticket_insufficient_balance() {
new_test_ext().execute_with(|| {
let calls = vec![Call::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
let calls = vec![RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
assert_ok!(Lottery::set_calls(Origin::root(), calls.clone()));
// Price set to 101.
assert_ok!(Lottery::start_lottery(Origin::root(), 101, 10, 10, false));
@@ -363,7 +369,7 @@ fn do_buy_ticket_insufficient_balance() {
#[test]
fn do_buy_ticket_keep_alive() {
new_test_ext().execute_with(|| {
let calls = vec![Call::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
let calls = vec![RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
assert_ok!(Lottery::set_calls(Origin::root(), calls.clone()));
// Price set to 100.
assert_ok!(Lottery::start_lottery(Origin::root(), 100, 10, 10, false));
@@ -415,7 +421,7 @@ fn choose_ticket_trivial_cases() {
#[test]
fn choose_account_one_participant() {
new_test_ext().execute_with(|| {
let calls = vec![Call::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
let calls = vec![RuntimeCall::Balances(BalancesCall::transfer { dest: 0, value: 0 })];
assert_ok!(Lottery::set_calls(Origin::root(), calls.clone()));
assert_ok!(Lottery::start_lottery(Origin::root(), 10, 10, 10, false));
let call = Box::new(calls[0].clone());
+6 -5
View File
@@ -55,7 +55,8 @@ pub mod pallet {
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Required origin for adding a member (though can always be Root).
type AddOrigin: EnsureOrigin<Self::Origin>;
@@ -147,7 +148,7 @@ pub mod pallet {
/// One of the members' keys changed.
KeyChanged,
/// Phantom member, never used.
Dummy { _phantom_data: PhantomData<(T::AccountId, <T as Config<I>>::Event)> },
Dummy { _phantom_data: PhantomData<(T::AccountId, <T as Config<I>>::RuntimeEvent)> },
}
#[pallet::error]
@@ -546,12 +547,12 @@ mod tests {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -600,7 +601,7 @@ mod tests {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureSignedBy<One, u64>;
type RemoveOrigin = EnsureSignedBy<Two, u64>;
type SwapOrigin = EnsureSignedBy<Three, u64>;
@@ -48,7 +48,7 @@ frame_support::construct_runtime!(
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -56,7 +56,7 @@ impl frame_system::Config for Test {
type AccountId = sp_core::sr25519::Public;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type BlockWeights = ();
+2 -2
View File
@@ -42,7 +42,7 @@ fn setup_multi<T: Config>(
}
signatories.sort();
// Must first convert to outer call type.
let call: <T as Config>::Call =
let call: <T as Config>::RuntimeCall =
frame_system::Call::<T>::remark { remark: vec![0; z as usize] }.into();
let call_data = OpaqueCall::<T>::from_encoded(call.encode());
Ok((signatories, call_data))
@@ -54,7 +54,7 @@ benchmarks! {
let z in 0 .. 10_000;
let max_signatories = T::MaxSignatories::get().into();
let (mut signatories, _) = setup_multi::<T>(max_signatories, z)?;
let call: <T as Config>::Call = frame_system::Call::<T>::remark {
let call: <T as Config>::RuntimeCall = frame_system::Call::<T>::remark {
remark: vec![0; z as usize]
}.into();
let call_hash = call.using_encoded(blake2_256);
+5 -5
View File
@@ -99,7 +99,7 @@ pub struct Multisig<BlockNumber, Balance, AccountId> {
approvals: Vec<AccountId>,
}
type OpaqueCall<T> = WrapperKeepOpaque<<T as Config>::Call>;
type OpaqueCall<T> = WrapperKeepOpaque<<T as Config>::RuntimeCall>;
type CallHash = [u8; 32];
@@ -117,10 +117,10 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The overarching call type.
type Call: Parameter
type RuntimeCall: Parameter
+ Dispatchable<Origin = Self::Origin, PostInfo = PostDispatchInfo>
+ GetDispatchInfo
+ From<frame_system::Call<Self>>;
@@ -266,7 +266,7 @@ pub mod pallet {
pub fn as_multi_threshold_1(
origin: OriginFor<T>,
other_signatories: Vec<T::AccountId>,
call: Box<<T as Config>::Call>,
call: Box<<T as Config>::RuntimeCall>,
) -> DispatchResultWithPostInfo {
let who = ensure_signed(origin)?;
let max_sigs = T::MaxSignatories::get() as usize;
@@ -698,7 +698,7 @@ impl<T: Config> Pallet<T> {
fn get_call(
hash: &[u8; 32],
maybe_known: Option<&OpaqueCall<T>>,
) -> Option<(<T as Config>::Call, usize)> {
) -> Option<(<T as Config>::RuntimeCall, usize)> {
maybe_known.map_or_else(
|| {
Calls::<T>::get(hash)
+12 -12
View File
@@ -61,12 +61,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -84,7 +84,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -92,19 +92,19 @@ impl pallet_balances::Config for Test {
}
pub struct TestBaseCallFilter;
impl Contains<Call> for TestBaseCallFilter {
fn contains(c: &Call) -> bool {
impl Contains<RuntimeCall> for TestBaseCallFilter {
fn contains(c: &RuntimeCall) -> bool {
match *c {
Call::Balances(_) => true,
RuntimeCall::Balances(_) => true,
// Needed for benchmarking
Call::System(frame_system::Call::remark { .. }) => true,
RuntimeCall::System(frame_system::Call::remark { .. }) => true,
_ => false,
}
}
}
impl Config for Test {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type DepositBase = ConstU64<1>;
type DepositFactor = ConstU64<1>;
@@ -130,8 +130,8 @@ fn now() -> Timepoint<u64> {
Multisig::timepoint()
}
fn call_transfer(dest: u64, value: u64) -> Call {
Call::Balances(BalancesCall::transfer { dest, value })
fn call_transfer(dest: u64, value: u64) -> RuntimeCall {
RuntimeCall::Balances(BalancesCall::transfer { dest, value })
}
#[test]
@@ -850,7 +850,7 @@ fn multisig_1_of_3_works() {
#[test]
fn multisig_filters() {
new_test_ext().execute_with(|| {
let call = Box::new(Call::System(frame_system::Call::set_code { code: vec![] }));
let call = Box::new(RuntimeCall::System(frame_system::Call::set_code { code: vec![] }));
assert_noop!(
Multisig::as_multi_threshold_1(Origin::signed(1), vec![2], call.clone()),
DispatchError::from(frame_system::Error::<Test>::CallFiltered),
+5 -5
View File
@@ -58,7 +58,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The currency trait.
type Currency: ReservableCurrency<Self::AccountId>;
@@ -284,12 +284,12 @@ mod tests {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -307,7 +307,7 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
@@ -318,7 +318,7 @@ mod tests {
pub const One: u64 = 1;
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ReservationFee = ConstU64<2>;
type Slashed = ();
@@ -67,7 +67,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The maximum number of well known nodes that are allowed to set
#[pallet::constant]
@@ -56,12 +56,12 @@ impl frame_system::Config for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
@@ -82,7 +82,7 @@ ord_parameter_types! {
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type MaxWellKnownNodes = ConstU32<4>;
type MaxPeerIdLength = ConstU32<2>;
type AddOrigin = EnsureSignedBy<One, u64>;
@@ -35,13 +35,13 @@ impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = AccountIndex;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type Version = ();
type PalletInfo = PalletInfo;
@@ -69,7 +69,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -96,7 +96,7 @@ impl pallet_staking::Config for Runtime {
type UnixTime = pallet_timestamp::Pallet<Self>;
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type RewardRemainder = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Slash = ();
type Reward = ();
type SessionsPerEra = ();
@@ -123,7 +123,7 @@ parameter_types! {
}
impl pallet_bags_list::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type BagThresholds = BagThresholds;
type ScoreProvider = Staking;
@@ -151,7 +151,7 @@ parameter_types! {
}
impl pallet_nomination_pools::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type Currency = Balances;
type CurrencyBalance = Balance;
+1 -1
View File
@@ -1151,7 +1151,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: weights::WeightInfo;
+6 -6
View File
@@ -131,13 +131,13 @@ impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = u64;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type DbWeight = ();
type BlockLength = ();
@@ -161,7 +161,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -189,7 +189,7 @@ parameter_types! {
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
}
impl pools::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type Currency = Balances;
type CurrencyBalance = Balance;
@@ -329,7 +329,7 @@ pub(crate) fn pool_events_since_last_call() -> Vec<super::Event<Runtime>> {
let events = System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::Pools(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::Pools(inner) = e { Some(inner) } else { None })
.collect::<Vec<_>>();
let already_seen = PoolsEvents::get();
PoolsEvents::set(&(events.len() as u32));
@@ -341,7 +341,7 @@ pub(crate) fn balances_events_since_last_call() -> Vec<pallet_balances::Event<Ru
let events = System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::Balances(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::Balances(inner) = e { Some(inner) } else { None })
.collect::<Vec<_>>();
let already_seen = BalancesEvents::get();
BalancesEvents::set(&(events.len() as u32));
@@ -4147,7 +4147,7 @@ mod create {
Balances::make_free_balance_be(&11, 5 + 20);
// Then
let create = Call::Pools(crate::Call::<Runtime>::create {
let create = RuntimeCall::Pools(crate::Call::<Runtime>::create {
amount: 20,
root: 11,
nominator: 11,
@@ -46,13 +46,13 @@ impl frame_system::Config for Runtime {
type Origin = Origin;
type Index = AccountIndex;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = sp_core::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type Version = ();
type PalletInfo = PalletInfo;
@@ -81,7 +81,7 @@ impl pallet_balances::Config for Runtime {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -111,7 +111,7 @@ impl pallet_staking::Config for Runtime {
type UnixTime = pallet_timestamp::Pallet<Self>;
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type RewardRemainder = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Slash = ();
type Reward = ();
type SessionsPerEra = ();
@@ -138,7 +138,7 @@ parameter_types! {
}
impl pallet_bags_list::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type BagThresholds = BagThresholds;
type ScoreProvider = Staking;
@@ -165,7 +165,7 @@ parameter_types! {
}
impl pallet_nomination_pools::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type Currency = Balances;
type CurrencyBalance = Balance;
@@ -248,7 +248,7 @@ pub(crate) fn pool_events_since_last_call() -> Vec<pallet_nomination_pools::Even
let events = System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::Pools(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::Pools(inner) = e { Some(inner) } else { None })
.collect::<Vec<_>>();
let already_seen = ObservedEventsPools::get();
ObservedEventsPools::set(events.len());
@@ -259,7 +259,7 @@ pub(crate) fn staking_events_since_last_call() -> Vec<pallet_staking::Event<Runt
let events = System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let Event::Staking(inner) = e { Some(inner) } else { None })
.filter_map(|e| if let RuntimeEvent::Staking(inner) = e { Some(inner) } else { None })
.collect::<Vec<_>>();
let already_seen = ObservedEventsStaking::get();
ObservedEventsStaking::set(events.len());
@@ -216,7 +216,7 @@ fn make_offenders_im_online<T: Config>(
}
#[cfg(test)]
fn check_events<T: Config, I: Iterator<Item = <T as SystemConfig>::Event>>(expected: I) {
fn check_events<T: Config, I: Iterator<Item = <T as SystemConfig>::RuntimeEvent>>(expected: I) {
let events = System::<T>::events()
.into_iter()
.map(|frame_system::EventRecord { event, .. }| event)
@@ -308,16 +308,16 @@ benchmarks! {
let reward_amount = slash_amount.saturating_mul(1 + n) / 2;
let reward = reward_amount / r;
let slash = |id| core::iter::once(
<T as StakingConfig>::Event::from(StakingEvent::<T>::Slashed(id, BalanceOf::<T>::from(slash_amount)))
<T as StakingConfig>::RuntimeEvent::from(StakingEvent::<T>::Slashed(id, BalanceOf::<T>::from(slash_amount)))
);
let balance_slash = |id| core::iter::once(
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Slashed{who: id, amount: slash_amount.into()})
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Slashed{who: id, amount: slash_amount.into()})
);
let chill = |id| core::iter::once(
<T as StakingConfig>::Event::from(StakingEvent::<T>::Chilled(id))
<T as StakingConfig>::RuntimeEvent::from(StakingEvent::<T>::Chilled(id))
);
let balance_deposit = |id, amount: u32|
<T as BalancesConfig>::Event::from(pallet_balances::Event::<T>::Deposit{who: id, amount: amount.into()});
<T as BalancesConfig>::RuntimeEvent::from(pallet_balances::Event::<T>::Deposit{who: id, amount: amount.into()});
let mut first = true;
let slash_events = raw_offenders.into_iter()
.flat_map(|offender| {
@@ -339,7 +339,7 @@ benchmarks! {
.flat_map(|reporter| vec![
balance_deposit(reporter.clone(), reward).into(),
frame_system::Event::<T>::NewAccount { account: reporter.clone() }.into(),
<T as BalancesConfig>::Event::from(
<T as BalancesConfig>::RuntimeEvent::from(
pallet_balances::Event::<T>::Endowed{account: reporter, free_balance: reward.into()}
).into(),
])
@@ -366,7 +366,7 @@ benchmarks! {
check_events::<T, _>(
std::iter::empty()
.chain(slash_events.into_iter().map(Into::into))
.chain(std::iter::once(<T as OffencesConfig>::Event::from(
.chain(std::iter::once(<T as OffencesConfig>::RuntimeEvent::from(
pallet_offences::Event::Offence{
kind: UnresponsivenessOffence::<T>::ID,
timeslot: 0_u32.to_le_bytes().to_vec(),
@@ -53,13 +53,13 @@ impl frame_system::Config for Test {
type Origin = Origin;
type Index = AccountIndex;
type BlockNumber = BlockNumber;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hash = sp_core::H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = sp_runtime::testing::Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ();
type Version = ();
type PalletInfo = PalletInfo;
@@ -77,7 +77,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU64<10>;
type AccountStore = System;
@@ -128,7 +128,7 @@ impl pallet_session::Config for Test {
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionHandler = TestSessionHandler;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Test>;
type WeightInfo = ();
@@ -148,7 +148,7 @@ parameter_types! {
pub const RewardCurve: &'static sp_runtime::curve::PiecewiseLinear<'static> = &I_NPOS;
}
pub type Extrinsic = sp_runtime::testing::TestXt<Call, ()>;
pub type Extrinsic = sp_runtime::testing::TestXt<RuntimeCall, ()>;
pub struct OnChainSeqPhragmen;
impl onchain::Config for OnChainSeqPhragmen {
@@ -165,7 +165,7 @@ impl pallet_staking::Config for Test {
type UnixTime = pallet_timestamp::Pallet<Self>;
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type RewardRemainder = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Slash = ();
type Reward = ();
type SessionsPerEra = ();
@@ -188,7 +188,7 @@ impl pallet_staking::Config for Test {
impl pallet_im_online::Config for Test {
type AuthorityId = UintAuthorityId;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type ReportUnresponsiveness = Offences;
@@ -200,23 +200,23 @@ impl pallet_im_online::Config for Test {
}
impl pallet_offences::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
}
impl<T> frame_system::offchain::SendTransactionTypes<T> for Test
where
Call: From<T>,
RuntimeCall: From<T>,
{
type Extrinsic = Extrinsic;
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
}
impl crate::Config for Test {}
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, Call, u64, ()>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, u64, ()>;
frame_support::construct_runtime!(
pub enum Test where
+1 -1
View File
@@ -57,7 +57,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// Full identification of the validator.
type IdentificationTuple: Parameter;
/// A handler called for every offence report.

Some files were not shown because too many files have changed in this diff Show More