From 49e880d407856117a65aa8f3779c77bc8724f278 Mon Sep 17 00:00:00 2001 From: nuno Date: Wed, 1 Nov 2023 11:52:08 +0100 Subject: [PATCH] wip: address todos and fix tests --- libs/primitives/src/lib.rs | 5 ++++- pallets/anchors/src/mock.rs | 2 +- pallets/block-rewards/src/mock.rs | 1 + pallets/bridge/src/mock.rs | 4 +--- pallets/collator-allowlist/src/mock.rs | 2 +- pallets/crowdloan-claim/src/mock.rs | 2 +- pallets/crowdloan-reward/src/mock.rs | 2 +- pallets/ethereum-transaction/src/mock.rs | 8 ++------ pallets/fees/src/lib.rs | 1 - pallets/fees/src/mock.rs | 2 +- pallets/investments/src/mock.rs | 2 +- pallets/keystore/src/mock.rs | 2 +- pallets/liquidity-pools-gateway/routers/src/mock.rs | 6 +----- pallets/liquidity-pools-gateway/src/mock.rs | 2 +- pallets/loans/src/tests/mock.rs | 2 +- pallets/migration/src/mock.rs | 6 +++--- pallets/nft-sales/src/mock.rs | 2 +- pallets/nft/src/mock.rs | 2 +- pallets/order-book/src/mock.rs | 3 ++- pallets/pool-registry/src/mock.rs | 2 +- pallets/pool-system/src/impls.rs | 4 +--- pallets/pool-system/src/mock.rs | 3 ++- pallets/restricted-tokens/src/mock.rs | 2 +- pallets/transfer-allowlist/src/mock.rs | 2 +- runtime/altair/src/evm.rs | 10 ++++------ runtime/altair/src/lib.rs | 5 ++--- runtime/centrifuge/src/evm.rs | 9 ++++----- runtime/centrifuge/src/lib.rs | 2 +- runtime/common/src/tests/mock.rs | 9 ++++++--- runtime/development/src/evm.rs | 10 +++------- runtime/development/src/lib.rs | 2 +- 31 files changed, 52 insertions(+), 64 deletions(-) diff --git a/libs/primitives/src/lib.rs b/libs/primitives/src/lib.rs index 3b4694d5f8..b7e5be88ba 100644 --- a/libs/primitives/src/lib.rs +++ b/libs/primitives/src/lib.rs @@ -180,7 +180,6 @@ pub mod types { /// Common constants for all runtimes pub mod constants { - use cumulus_primitives_core::relay_chain::MAX_POV_SIZE; use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}; use sp_runtime::Perbill; @@ -269,6 +268,10 @@ pub mod constants { /// The safe XCM version of pallet-xcm, same as on relay chain pub const SAFE_XCM_VERSION: u32 = xcm::opaque::v2::VERSION; + + pub const MAX_POV_SIZE: u64 = cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64; + /// Block storage limit in bytes. Set to 40 KB. + pub const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; } /// Listing of parachains we integrate with. diff --git a/pallets/anchors/src/mock.rs b/pallets/anchors/src/mock.rs index a80eb844af..ecfd24a901 100644 --- a/pallets/anchors/src/mock.rs +++ b/pallets/anchors/src/mock.rs @@ -95,7 +95,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/block-rewards/src/mock.rs b/pallets/block-rewards/src/mock.rs index b7d144f322..628bfe0a46 100644 --- a/pallets/block-rewards/src/mock.rs +++ b/pallets/block-rewards/src/mock.rs @@ -192,6 +192,7 @@ impl pallet_restricted_tokens::Config for Test { type PreFungiblesMutate = cfg_traits::Always; type PreFungiblesMutateHold = cfg_traits::Always; type PreFungiblesTransfer = cfg_traits::Always; + type PreFungiblesUnbalanced = cfg_traits::Always; type PreReservableCurrency = cfg_traits::Always; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/pallets/bridge/src/mock.rs b/pallets/bridge/src/mock.rs index 59face1c29..8fd922e567 100644 --- a/pallets/bridge/src/mock.rs +++ b/pallets/bridge/src/mock.rs @@ -55,8 +55,6 @@ pub(crate) const RELAYER_A: u64 = 0x2; pub(crate) const RELAYER_B: u64 = 0x3; pub(crate) const RELAYER_C: u64 = 0x4; pub(crate) const ENDOWED_BALANCE: Balance = 10000 * CFG; -//todo(nuno): if we AllowDeath in Fees::withdraw_fee, we don't need to add the -// ED here pub(crate) const RELAYER_B_INITIAL_BALANCE: Balance = NATIVE_TOKEN_TRANSFER_FEE + ExistentialDeposit::get(); pub(crate) const TEST_RELAYER_VOTE_THRESHOLD: u32 = 2; @@ -139,7 +137,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/collator-allowlist/src/mock.rs b/pallets/collator-allowlist/src/mock.rs index 0443f91495..768138cd3a 100644 --- a/pallets/collator-allowlist/src/mock.rs +++ b/pallets/collator-allowlist/src/mock.rs @@ -78,7 +78,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/crowdloan-claim/src/mock.rs b/pallets/crowdloan-claim/src/mock.rs index 3c8e984d13..2ee9abecfc 100644 --- a/pallets/crowdloan-claim/src/mock.rs +++ b/pallets/crowdloan-claim/src/mock.rs @@ -116,7 +116,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/crowdloan-reward/src/mock.rs b/pallets/crowdloan-reward/src/mock.rs index 3ccebe50bc..afecfdedf8 100644 --- a/pallets/crowdloan-reward/src/mock.rs +++ b/pallets/crowdloan-reward/src/mock.rs @@ -71,7 +71,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/ethereum-transaction/src/mock.rs b/pallets/ethereum-transaction/src/mock.rs index 0be3340c94..39b53f98a0 100644 --- a/pallets/ethereum-transaction/src/mock.rs +++ b/pallets/ethereum-transaction/src/mock.rs @@ -1,5 +1,6 @@ use std::str::FromStr; +use cfg_primitives::{BLOCK_STORAGE_LIMIT, MAX_POV_SIZE}; use fp_evm::{FeeCalculator, Precompile, PrecompileResult}; use frame_support::{parameter_types, traits::FindAuthor, weights::Weight}; use pallet_ethereum::{IntermediateStateRoot, PostLogContent}; @@ -78,7 +79,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); @@ -162,10 +163,6 @@ impl PrecompileSet for MockPrecompileSet { } } -const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; -/// Block storage limit in bytes. Set to 40 KB. -const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; - parameter_types! { pub BlockGasLimit: U256 = U256::max_value(); pub WeightPerGas: Weight = Weight::from_parts(20_000, 0); @@ -204,7 +201,6 @@ impl pallet_evm::Config for Runtime { parameter_types! { pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; - //todo(nuno): revisit this pub const ExtraDataLength: u32 = 30; } diff --git a/pallets/fees/src/lib.rs b/pallets/fees/src/lib.rs index f54bd59f34..1ffaad6235 100644 --- a/pallets/fees/src/lib.rs +++ b/pallets/fees/src/lib.rs @@ -212,7 +212,6 @@ impl Pallet { from, balance, WithdrawReasons::FEE, - // todo(nuno): discuss whether we can make this AllowDeath instead ExistenceRequirement::KeepAlive, ) } diff --git a/pallets/fees/src/mock.rs b/pallets/fees/src/mock.rs index 7cb94e2306..3aef16059f 100644 --- a/pallets/fees/src/mock.rs +++ b/pallets/fees/src/mock.rs @@ -113,7 +113,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/investments/src/mock.rs b/pallets/investments/src/mock.rs index 2048e81085..e316376f21 100644 --- a/pallets/investments/src/mock.rs +++ b/pallets/investments/src/mock.rs @@ -128,7 +128,7 @@ impl pallet_balances::Config for MockRuntime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/keystore/src/mock.rs b/pallets/keystore/src/mock.rs index 31dc18fdc3..7c57ec1898 100644 --- a/pallets/keystore/src/mock.rs +++ b/pallets/keystore/src/mock.rs @@ -105,7 +105,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/liquidity-pools-gateway/routers/src/mock.rs b/pallets/liquidity-pools-gateway/routers/src/mock.rs index 5cf5163bd4..895849c00c 100644 --- a/pallets/liquidity-pools-gateway/routers/src/mock.rs +++ b/pallets/liquidity-pools-gateway/routers/src/mock.rs @@ -1,6 +1,7 @@ use std::str::FromStr; use cfg_mocks::{pallet_mock_liquidity_pools, pallet_mock_routers, MessageMock, RouterMock}; +use cfg_primitives::{BLOCK_STORAGE_LIMIT, MAX_POV_SIZE}; use cfg_traits::TryConvert; use cfg_types::domain_address::DomainAddress; use codec::{Decode, Encode}; @@ -233,10 +234,6 @@ impl PrecompileSet for MockPrecompileSet { } } -const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; -/// Block storage limit in bytes. Set to 40 KB. -const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; - parameter_types! { pub BlockGasLimit: U256 = U256::max_value(); pub WeightPerGas: Weight = Weight::from_parts(20_000, 0); @@ -275,7 +272,6 @@ impl pallet_evm::Config for Runtime { parameter_types! { pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; - //todo(nuno): revisit this pub const ExtraDataLength: u32 = 30; } diff --git a/pallets/liquidity-pools-gateway/src/mock.rs b/pallets/liquidity-pools-gateway/src/mock.rs index 7b83ae9c67..04d0de0515 100644 --- a/pallets/liquidity-pools-gateway/src/mock.rs +++ b/pallets/liquidity-pools-gateway/src/mock.rs @@ -79,7 +79,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/loans/src/tests/mock.rs b/pallets/loans/src/tests/mock.rs index c3a84a2a9a..c05235b695 100644 --- a/pallets/loans/src/tests/mock.rs +++ b/pallets/loans/src/tests/mock.rs @@ -161,7 +161,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/migration/src/mock.rs b/pallets/migration/src/mock.rs index 7ae47dce74..f26473fd30 100644 --- a/pallets/migration/src/mock.rs +++ b/pallets/migration/src/mock.rs @@ -21,7 +21,7 @@ use frame_support::{ parameter_types, scale_info::TypeInfo, sp_runtime::traits::ConvertInto, - traits::{Contains, InstanceFilter, WithdrawReasons}, + traits::{ConstU32, Contains, InstanceFilter, WithdrawReasons}, }; use sp_core::{RuntimeDebug, H256}; use sp_runtime::{ @@ -124,7 +124,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); @@ -175,7 +175,7 @@ impl frame_system::Config for Runtime { type Header = sp_runtime::generic::Header; type Index = Index; type Lookup = IdentityLookup; - type MaxConsumers = frame_support::traits::ConstU32<16>; + type MaxConsumers = ConstU32<16>; type OnKilledAccount = (); type OnNewAccount = (); type OnSetCode = (); diff --git a/pallets/nft-sales/src/mock.rs b/pallets/nft-sales/src/mock.rs index 6be066079c..f21000928b 100644 --- a/pallets/nft-sales/src/mock.rs +++ b/pallets/nft-sales/src/mock.rs @@ -154,7 +154,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/nft/src/mock.rs b/pallets/nft/src/mock.rs index a7062da46d..bca6d29e97 100644 --- a/pallets/nft/src/mock.rs +++ b/pallets/nft/src/mock.rs @@ -140,7 +140,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/order-book/src/mock.rs b/pallets/order-book/src/mock.rs index b1939b63df..62bf47343a 100644 --- a/pallets/order-book/src/mock.rs +++ b/pallets/order-book/src/mock.rs @@ -126,7 +126,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; @@ -183,6 +183,7 @@ impl pallet_restricted_tokens::Config for Runtime { type PreFungiblesMutate = cfg_traits::Always; type PreFungiblesMutateHold = cfg_traits::Always; type PreFungiblesTransfer = cfg_traits::Always; + type PreFungiblesUnbalanced = cfg_traits::Always; type PreReservableCurrency = cfg_traits::Always; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/pallets/pool-registry/src/mock.rs b/pallets/pool-registry/src/mock.rs index 9c89ba6bdd..ee3a48ac07 100644 --- a/pallets/pool-registry/src/mock.rs +++ b/pallets/pool-registry/src/mock.rs @@ -422,7 +422,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = (); diff --git a/pallets/pool-system/src/impls.rs b/pallets/pool-system/src/impls.rs index bdf298d0fc..1b00e0697b 100644 --- a/pallets/pool-system/src/impls.rs +++ b/pallets/pool-system/src/impls.rs @@ -374,9 +374,7 @@ impl InvestmentAccountant for Pallet { ) -> Result<(), Self::Error> { let _details = Pool::::get(id.of_pool()).ok_or(Error::::NoSuchPool)?; - T::Tokens::mint_into(id.into(), buyer, amount).map(|_| ()) // todo(nuno): - // propagate this api - // change upstream + T::Tokens::mint_into(id.into(), buyer, amount).map(|_| ()) } fn withdraw( diff --git a/pallets/pool-system/src/mock.rs b/pallets/pool-system/src/mock.rs index 31441feaac..932b5e30ea 100644 --- a/pallets/pool-system/src/mock.rs +++ b/pallets/pool-system/src/mock.rs @@ -154,7 +154,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = (); @@ -216,6 +216,7 @@ impl pallet_restricted_tokens::Config for Runtime { type PreFungiblesMutate = cfg_traits::Always; type PreFungiblesMutateHold = cfg_traits::Always; type PreFungiblesTransfer = cfg_traits::Always; + type PreFungiblesUnbalanced = cfg_traits::Always; type PreReservableCurrency = cfg_traits::Always; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/pallets/restricted-tokens/src/mock.rs b/pallets/restricted-tokens/src/mock.rs index 5689bff284..08896155ae 100644 --- a/pallets/restricted-tokens/src/mock.rs +++ b/pallets/restricted-tokens/src/mock.rs @@ -450,7 +450,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = ConstU32<50>; - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; diff --git a/pallets/transfer-allowlist/src/mock.rs b/pallets/transfer-allowlist/src/mock.rs index 46c70db9c4..7cc718c3c2 100644 --- a/pallets/transfer-allowlist/src/mock.rs +++ b/pallets/transfer-allowlist/src/mock.rs @@ -153,7 +153,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; diff --git a/runtime/altair/src/evm.rs b/runtime/altair/src/evm.rs index 25556f02fd..b6f5b5d969 100644 --- a/runtime/altair/src/evm.rs +++ b/runtime/altair/src/evm.rs @@ -10,7 +10,10 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use cfg_primitives::{EnsureRootOr, HalfOfCouncil, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO}; +use cfg_primitives::{ + EnsureRootOr, HalfOfCouncil, BLOCK_STORAGE_LIMIT, MAXIMUM_BLOCK_WEIGHT, MAX_POV_SIZE, + NORMAL_DISPATCH_RATIO, +}; use frame_support::{parameter_types, traits::FindAuthor, weights::Weight, ConsensusEngineId}; use pallet_ethereum::PostLogContent; use pallet_evm::{EnsureAddressRoot, EnsureAddressTruncated}; @@ -41,10 +44,6 @@ impl> FindAuthor for FindAuthorTruncated { } } -const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; -/// Block storage limit in bytes. Set to 40 KB. -const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; - parameter_types! { pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: Altair = Altair::<_>::new(); @@ -97,7 +96,6 @@ impl pallet_base_fee::Config for Runtime { parameter_types! { pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; - //todo(nuno): revisit this pub const ExtraDataLength: u32 = 30; } diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index f4f935bfa7..8c279a165c 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -326,10 +326,9 @@ impl pallet_balances::Config for Runtime { /// The minimum amount required to keep an account open. type ExistentialDeposit = ExistentialDeposit; type FreezeIdentifier = (); - //todo(nuno) type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; @@ -678,7 +677,7 @@ parameter_types! { pub const DesiredRunnersUp: u32 = 9; pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect"; // todo(nuno) - pub const MaxVotesPerVoter: u32 = 5; + pub const MaxVotesPerVoter: u32 = 20; } // Make sure that there are no more than `MAX_MEMBERS` members elected via diff --git a/runtime/centrifuge/src/evm.rs b/runtime/centrifuge/src/evm.rs index 06b8fe0b37..949867f91c 100644 --- a/runtime/centrifuge/src/evm.rs +++ b/runtime/centrifuge/src/evm.rs @@ -10,7 +10,10 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use cfg_primitives::{TwoThirdOfCouncil, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO}; +use cfg_primitives::{ + TwoThirdOfCouncil, BLOCK_STORAGE_LIMIT, MAXIMUM_BLOCK_WEIGHT, MAX_POV_SIZE, + NORMAL_DISPATCH_RATIO, +}; use frame_support::{parameter_types, traits::FindAuthor, weights::Weight, ConsensusEngineId}; use pallet_ethereum::PostLogContent; use pallet_evm::{EnsureAddressRoot, EnsureAddressTruncated}; @@ -42,10 +45,6 @@ impl> FindAuthor for FindAuthorTruncated { } } -const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; -/// Block storage limit in bytes. Set to 40 KB. -const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; - parameter_types! { pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: CentrifugePrecompiles = CentrifugePrecompiles::<_>::new(); diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 0d87ae3d56..bd50f85bab 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -473,7 +473,7 @@ impl pallet_balances::Config for Runtime { //todo(nuno) type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8]; diff --git a/runtime/common/src/tests/mock.rs b/runtime/common/src/tests/mock.rs index 38c70af89e..73a1151e76 100644 --- a/runtime/common/src/tests/mock.rs +++ b/runtime/common/src/tests/mock.rs @@ -1,5 +1,9 @@ use cfg_primitives::AccountId; -use frame_support::{parameter_types, traits::FindAuthor, PalletId}; +use frame_support::{ + parameter_types, + traits::{ConstU32, FindAuthor}, + PalletId, +}; use sp_core::{ConstU64, H256}; use sp_io::TestExternalities; use sp_runtime::{ @@ -7,7 +11,6 @@ use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, }; use sp_std::convert::{TryFrom, TryInto}; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]); @@ -64,7 +67,7 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = [u8; 8]; diff --git a/runtime/development/src/evm.rs b/runtime/development/src/evm.rs index 3f8d982e7c..e52aaa6c34 100644 --- a/runtime/development/src/evm.rs +++ b/runtime/development/src/evm.rs @@ -10,7 +10,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use cfg_primitives::{AccountId, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO}; +use cfg_primitives::{ + AccountId, BLOCK_STORAGE_LIMIT, MAXIMUM_BLOCK_WEIGHT, MAX_POV_SIZE, NORMAL_DISPATCH_RATIO, +}; use frame_support::{parameter_types, traits::FindAuthor, weights::Weight, ConsensusEngineId}; use frame_system::EnsureRoot; use pallet_ethereum::PostLogContent; @@ -42,11 +44,6 @@ impl> FindAuthor for FindAuthorTruncated { } } -// todo(nuno): dry this -const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; -/// Block storage limit in bytes. Set to 40 KB. -const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; - parameter_types! { pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); pub PrecompilesValue: Development = Development::<_>::new(); @@ -99,7 +96,6 @@ impl pallet_base_fee::Config for Runtime { parameter_types! { pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; - //todo(nuno): revisit this pub const ExtraDataLength: u32 = 30; } diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index ac75659ff0..fcf7cd534c 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -340,7 +340,7 @@ impl pallet_balances::Config for Runtime { //todo(nuno) type HoldIdentifier = (); type MaxFreezes = (); - type MaxHolds = ConstU32<1>; + type MaxHolds = frame_support::traits::ConstU32<1>; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = [u8; 8];