Skip to content
Snippets Groups Projects
Unverified Commit 35ed272d authored by Dmitry Borodin's avatar Dmitry Borodin Committed by GitHub
Browse files

migrate babe and authorship to use derive-impl (#1790)


Moving a babe and authorship pallets to the latest and greatest
derive_impl.

Part of https://github.com/paritytech/polkadot-sdk/issues/171

---------

Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
parent ddf5e5c0
Branches
No related merge requests found
Pipeline #398186 failed with stages
in 1 hour, 2 minutes, and 6 seconds
......@@ -97,16 +97,10 @@ mod tests {
use super::*;
use crate as pallet_authorship;
use codec::{Decode, Encode};
use frame_support::{
traits::{ConstU32, ConstU64},
ConsensusEngineId,
};
use frame_support::{derive_impl, ConsensusEngineId};
use sp_core::H256;
use sp_runtime::{
generic::DigestItem,
testing::Header,
traits::{BlakeTwo256, Header as HeaderT, IdentityLookup},
BuildStorage,
generic::DigestItem, testing::Header, traits::Header as HeaderT, BuildStorage,
};
type Block = frame_system::mocking::MockBlock<Test>;
......@@ -119,30 +113,9 @@ mod tests {
}
);
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}
impl pallet::Config for Test {
......
......@@ -24,7 +24,7 @@ use frame_election_provider_support::{
onchain, SequentialPhragmen,
};
use frame_support::{
parameter_types,
derive_impl, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, KeyOwnerProofSystem, OnInitialize},
};
use pallet_session::historical as pallet_session_historical;
......@@ -32,14 +32,14 @@ use pallet_staking::FixedNominationsQuota;
use sp_consensus_babe::{AuthorityId, AuthorityPair, Randomness, Slot, VrfSignature};
use sp_core::{
crypto::{KeyTypeId, Pair, VrfSecret},
H256, U256,
U256,
};
use sp_io;
use sp_runtime::{
curve::PiecewiseLinear,
impl_opaque_keys,
testing::{Digest, DigestItem, Header, TestXt},
traits::{Header as _, IdentityLookup, OpaqueKeys},
traits::{Header as _, OpaqueKeys},
BuildStorage, Perbill,
};
use sp_staking::{EraIndex, SessionIndex};
......@@ -63,30 +63,10 @@ frame_support::construct_runtime!(
}
);
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Version = ();
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = DummyValidatorId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment