diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 898a2979..b9a48923 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -2700,6 +2700,7 @@ dependencies = [ "bridge-hub-common 0.13.1", "datahaven-runtime-common", "dhp-bridge", + "ethereum", "fp-account", "fp-evm", "fp-rpc", @@ -3001,6 +3002,7 @@ dependencies = [ "bridge-hub-common 0.13.1", "datahaven-runtime-common", "dhp-bridge", + "ethereum", "fp-account", "fp-evm", "fp-rpc", @@ -3156,6 +3158,7 @@ dependencies = [ "bridge-hub-common 0.13.1", "datahaven-runtime-common", "dhp-bridge", + "ethereum", "fp-account", "fp-evm", "fp-rpc", diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 9e977c5b..5115b5c7 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -258,6 +258,9 @@ pallet-evm-precompile-simple = { git = "https://github.com/polkadot-evm/frontier pallet-hotfix-sufficients = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2503", default-features = false } precompile-utils = { git = "https://github.com/polkadot-evm/frontier/", branch = "stable2503", default-features = false } precompile-utils-macro = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2503", default-features = false } +ethereum = { version = "0.18.2", default-features = false, features = [ + "with-scale", +] } # Frontier (client) fc-api = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2503", default-features = false } diff --git a/operator/pallets/datahaven-native-transfer/src/mock.rs b/operator/pallets/datahaven-native-transfer/src/mock.rs index f9bc4f12..172d3293 100644 --- a/operator/pallets/datahaven-native-transfer/src/mock.rs +++ b/operator/pallets/datahaven-native-transfer/src/mock.rs @@ -166,9 +166,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities { (BOB, INITIAL_BALANCE), (CHARLIE, INITIAL_BALANCE), ]; - pallet_balances::GenesisConfig:: { balances } - .assimilate_storage(&mut t) - .unwrap(); + pallet_balances::GenesisConfig:: { + balances, + dev_accounts: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext: sp_io::TestExternalities = t.into(); ext.execute_with(|| { diff --git a/operator/pallets/ethereum-client/src/mock.rs b/operator/pallets/ethereum-client/src/mock.rs index d994aad8..cb3963be 100644 --- a/operator/pallets/ethereum-client/src/mock.rs +++ b/operator/pallets/ethereum-client/src/mock.rs @@ -136,6 +136,10 @@ parameter_types! { }, electra: Fork { version: [5, 0, 0, 0], // 0x05000000 + epoch: 0, + }, + fulu: Fork { + version: [6, 0, 0, 0], // 0x06000000 epoch: 80000000000, } }; diff --git a/operator/pallets/ethereum-client/src/mock_electra.rs b/operator/pallets/ethereum-client/src/mock_electra.rs index 2887a119..bb6ba573 100644 --- a/operator/pallets/ethereum-client/src/mock_electra.rs +++ b/operator/pallets/ethereum-client/src/mock_electra.rs @@ -117,6 +117,10 @@ parameter_types! { electra: Fork { version: [5, 0, 0, 0], // 0x05000000 epoch: 0, + }, + fulu: Fork { + version: [6, 0, 0, 0], // 0x06000000 + epoch: 0, } }; } diff --git a/operator/pallets/ethereum-client/src/tests.rs b/operator/pallets/ethereum-client/src/tests.rs index 143315b6..c56817d8 100644 --- a/operator/pallets/ethereum-client/src/tests.rs +++ b/operator/pallets/ethereum-client/src/tests.rs @@ -248,6 +248,10 @@ fn compute_fork_version() { version: [0, 0, 0, 5], epoch: 50, }, + fulu: Fork { + version: [0, 0, 0, 6], + epoch: 60, + }, }; new_tester().execute_with(|| { assert_eq!( diff --git a/operator/pallets/ethereum-client/src/tests_electra.rs b/operator/pallets/ethereum-client/src/tests_electra.rs index 73666b2c..aed3dce5 100644 --- a/operator/pallets/ethereum-client/src/tests_electra.rs +++ b/operator/pallets/ethereum-client/src/tests_electra.rs @@ -247,6 +247,10 @@ fn compute_fork_version() { version: [0, 0, 0, 5], epoch: 50, }, + fulu: Fork { + version: [0, 0, 0, 6], + epoch: 60, + }, }; new_tester().execute_with(|| { assert_eq!( @@ -281,6 +285,10 @@ fn compute_fork_version() { EthereumBeaconClient::select_fork_version(&mock_fork_versions, 50), [0, 0, 0, 5] ); + assert_eq!( + EthereumBeaconClient::select_fork_version(&mock_fork_versions, 60), + [0, 0, 0, 6] + ); }); } diff --git a/operator/pallets/external-validator-slashes/src/mock.rs b/operator/pallets/external-validator-slashes/src/mock.rs index efe2c509..34ba198e 100644 --- a/operator/pallets/external-validator-slashes/src/mock.rs +++ b/operator/pallets/external-validator-slashes/src/mock.rs @@ -171,6 +171,7 @@ impl pallet_session::Config for Test { type ValidatorIdOf = ConvertInto; type NextSessionRotation = pallet_session::PeriodicSessions; type WeightInfo = (); + type DisablingStrategy = (); } sp_runtime::impl_opaque_keys! { diff --git a/operator/pallets/external-validators-rewards/src/mock.rs b/operator/pallets/external-validators-rewards/src/mock.rs index 6b99b7c3..e28599bf 100644 --- a/operator/pallets/external-validators-rewards/src/mock.rs +++ b/operator/pallets/external-validators-rewards/src/mock.rs @@ -283,6 +283,7 @@ impl HandleInflation for InflationMinter { // Pallet to provide some mock data, used to test #[frame_support::pallet] pub mod mock_data { + use alloc::vec::Vec; use { frame_support::pallet_prelude::*, pallet_external_validators::traits::{ActiveEraInfo, EraIndex, EraIndexProvider}, @@ -293,9 +294,9 @@ pub mod mock_data { pub active_era: Option, pub era_inflation: Option, /// Set of validators that are considered offline (for liveness testing) - pub offline_validators: sp_std::vec::Vec, + pub offline_validators: Vec, /// Set of (era_index, validator_id) pairs that are slashed - pub slashed_validators: sp_std::vec::Vec<(u32, sp_core::H160)>, + pub slashed_validators: Vec<(u32, sp_core::H160)>, /// When true, MockOkOutboundQueue::validate will return Err(SendError::MessageTooLarge) pub send_message_fails: bool, } @@ -357,9 +358,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities { ExistentialDeposit::get(), ), // Rewards account needs existential deposit ]; - pallet_balances::GenesisConfig:: { balances } - .assimilate_storage(&mut t) - .unwrap(); + pallet_balances::GenesisConfig:: { + balances, + dev_accounts: Default::default(), + } + .assimilate_storage(&mut t) + .unwrap(); let ext: sp_io::TestExternalities = t.into(); diff --git a/operator/pallets/external-validators-rewards/src/tests.rs b/operator/pallets/external-validators-rewards/src/tests.rs index 752a55c0..d5741cb4 100644 --- a/operator/pallets/external-validators-rewards/src/tests.rs +++ b/operator/pallets/external-validators-rewards/src/tests.rs @@ -16,10 +16,10 @@ use { crate::{self as pallet_external_validators_rewards, mock::*}, + alloc::collections::btree_map::BTreeMap, frame_support::{assert_noop, assert_ok, traits::fungible::Mutate}, pallet_external_validators::traits::{ActiveEraInfo, OnEraEnd, OnEraStart}, sp_core::H160, - sp_std::collections::btree_map::BTreeMap, }; #[test] diff --git a/operator/pallets/external-validators/src/mock.rs b/operator/pallets/external-validators/src/mock.rs index 872a0c62..8db7676c 100644 --- a/operator/pallets/external-validators/src/mock.rs +++ b/operator/pallets/external-validators/src/mock.rs @@ -301,7 +301,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { }; pallet_balances::GenesisConfig:: { balances, - ..Default::default() + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .unwrap(); diff --git a/operator/pallets/proxy-genesis-companion/src/mock.rs b/operator/pallets/proxy-genesis-companion/src/mock.rs index 116fd2c2..29734e8e 100644 --- a/operator/pallets/proxy-genesis-companion/src/mock.rs +++ b/operator/pallets/proxy-genesis-companion/src/mock.rs @@ -17,7 +17,7 @@ //! A minimal runtime including the proxy-genesis-companion pallet use super::*; use crate as proxy_companion; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{ConstU32, InstanceFilter}, @@ -79,6 +79,7 @@ parameter_types! { Debug, MaxEncodedLen, scale_info::TypeInfo, + DecodeWithMemTracking, serde::Serialize, serde::Deserialize, Default, @@ -108,6 +109,7 @@ impl pallet_proxy::Config for Test { type CallHasher = BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = (); } impl Config for Test { @@ -147,7 +149,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, - ..Default::default() + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/pallets/system-v2/src/lib.rs b/operator/pallets/system-v2/src/lib.rs index b3b07f73..2ddd2821 100644 --- a/operator/pallets/system-v2/src/lib.rs +++ b/operator/pallets/system-v2/src/lib.rs @@ -16,6 +16,8 @@ //! //! * [`Call::register_token`]: Register a token location as a wrapped ERC20 contract on Ethereum. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(test)] mod mock; @@ -29,7 +31,8 @@ pub mod api; pub mod weights; pub use weights::*; -use core::prelude::*; +use alloc::boxed::Box; +use alloc::vec; use frame_support::{pallet_prelude::*, traits::EnsureOrigin}; use frame_system::pallet_prelude::*; use snowbridge_core::{AgentIdOf as LocationHashOf, AssetMetadata, TokenId, TokenIdOf}; diff --git a/operator/pallets/system/src/mock.rs b/operator/pallets/system/src/mock.rs index d3572eaf..b513b375 100644 --- a/operator/pallets/system/src/mock.rs +++ b/operator/pallets/system/src/mock.rs @@ -49,7 +49,17 @@ mod pallet_xcm_origin { // Insert this custom Origin into the aggregate RuntimeOrigin #[pallet::origin] - #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] + #[derive( + PartialEq, + Eq, + Clone, + Encode, + Decode, + RuntimeDebug, + TypeInfo, + DecodeWithMemTracking, + MaxEncodedLen, + )] pub struct Origin(pub Location); impl From for Origin { diff --git a/operator/precompiles/batch/src/mock.rs b/operator/precompiles/batch/src/mock.rs index 5b51a83e..7af4c141 100644 --- a/operator/precompiles/batch/src/mock.rs +++ b/operator/precompiles/batch/src/mock.rs @@ -196,6 +196,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); @@ -206,6 +207,7 @@ impl ExtBuilder { pallet_evm::Pallet::::create_account( Revert.into(), hex_literal::hex!("1460006000fd").to_vec(), + None, ); }); ext diff --git a/operator/precompiles/batch/src/tests.rs b/operator/precompiles/batch/src/tests.rs index 61883b45..655a9cb0 100644 --- a/operator/precompiles/batch/src/tests.rs +++ b/operator/precompiles/batch/src/tests.rs @@ -45,6 +45,7 @@ fn evm_call(from: impl Into, input: Vec) -> EvmCall { max_priority_fee_per_gas: Some(U256::zero()), nonce: None, // Use the next nonce access_list: Vec::new(), + authorization_list: Vec::new(), } } diff --git a/operator/precompiles/call-permit/src/mock.rs b/operator/precompiles/call-permit/src/mock.rs index efe85f83..504bc924 100644 --- a/operator/precompiles/call-permit/src/mock.rs +++ b/operator/precompiles/call-permit/src/mock.rs @@ -180,6 +180,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); @@ -190,6 +191,7 @@ impl ExtBuilder { pallet_evm::Pallet::::create_account( Revert.into(), hex_literal::hex!("1460006000fd").to_vec(), + None, ); }); ext diff --git a/operator/precompiles/collective/src/mock.rs b/operator/precompiles/collective/src/mock.rs index 8a27223e..10614256 100644 --- a/operator/precompiles/collective/src/mock.rs +++ b/operator/precompiles/collective/src/mock.rs @@ -298,6 +298,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances.clone(), + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/conviction-voting/src/mock.rs b/operator/precompiles/conviction-voting/src/mock.rs index ad62c6d5..90ab3458 100644 --- a/operator/precompiles/conviction-voting/src/mock.rs +++ b/operator/precompiles/conviction-voting/src/mock.rs @@ -266,6 +266,8 @@ impl pallet_conviction_voting::Config for Runtime { type WeightInfo = (); type MaxTurnout = TotalIssuanceOf; type Polls = TestPolls; + type BlockNumberProvider = (); + type VotingHooks = (); } pub(crate) struct ExtBuilder { @@ -294,6 +296,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances.clone(), + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/conviction-voting/src/tests.rs b/operator/precompiles/conviction-voting/src/tests.rs index 36f45fe1..32450ded 100644 --- a/operator/precompiles/conviction-voting/src/tests.rs +++ b/operator/precompiles/conviction-voting/src/tests.rs @@ -45,6 +45,7 @@ fn evm_call(input: Vec) -> EvmCall { max_priority_fee_per_gas: Some(U256::zero()), nonce: None, access_list: Vec::new(), + authorization_list: Vec::new(), } } diff --git a/operator/precompiles/datahaven-native-transfer/src/mock.rs b/operator/precompiles/datahaven-native-transfer/src/mock.rs index 48dc9627..f4c7be83 100644 --- a/operator/precompiles/datahaven-native-transfer/src/mock.rs +++ b/operator/precompiles/datahaven-native-transfer/src/mock.rs @@ -272,6 +272,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/erc20-balances/src/mock.rs b/operator/precompiles/erc20-balances/src/mock.rs index aaa2a64d..f7213ccf 100644 --- a/operator/precompiles/erc20-balances/src/mock.rs +++ b/operator/precompiles/erc20-balances/src/mock.rs @@ -207,6 +207,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/erc20-balances/src/tests.rs b/operator/precompiles/erc20-balances/src/tests.rs index e4eb35c1..c089a213 100644 --- a/operator/precompiles/erc20-balances/src/tests.rs +++ b/operator/precompiles/erc20-balances/src/tests.rs @@ -576,6 +576,7 @@ fn deposit(data: Vec) { None, // max priority None, // nonce vec![], // access list + vec![], // authorization list ) .expect("it works"); @@ -692,6 +693,7 @@ fn deposit_zero() { None, // max priority None, // nonce vec![], // access list + vec![], // authorization list ) .expect("it works"); diff --git a/operator/precompiles/identity/src/mock.rs b/operator/precompiles/identity/src/mock.rs index b984730f..ebb79c20 100644 --- a/operator/precompiles/identity/src/mock.rs +++ b/operator/precompiles/identity/src/mock.rs @@ -240,6 +240,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances.clone(), + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/precompile-registry/src/lib.rs b/operator/precompiles/precompile-registry/src/lib.rs index 741d25b8..5e52d3fb 100644 --- a/operator/precompiles/precompile-registry/src/lib.rs +++ b/operator/precompiles/precompile-registry/src/lib.rs @@ -92,7 +92,7 @@ where // AccountCodes: Blake2128(16) + H160(20) + Vec(5) // We asume an existing precompile can hold at most 5 bytes worth of dummy code. handle.record_db_read::(41)?; - pallet_evm::Pallet::::create_account(address.0, DUMMY_CODE.to_vec(), None); + let _ = pallet_evm::Pallet::::create_account(address.0, DUMMY_CODE.to_vec(), None); Ok(()) } diff --git a/operator/precompiles/precompile-registry/src/mock.rs b/operator/precompiles/precompile-registry/src/mock.rs index 45f364ce..c78fda24 100644 --- a/operator/precompiles/precompile-registry/src/mock.rs +++ b/operator/precompiles/precompile-registry/src/mock.rs @@ -181,6 +181,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); @@ -191,6 +192,7 @@ impl ExtBuilder { pallet_evm::Pallet::::create_account( SmartContract.into(), b"SmartContract".to_vec(), + None, ); }); ext diff --git a/operator/precompiles/preimage/src/mock.rs b/operator/precompiles/preimage/src/mock.rs index 2c520ef1..1687718c 100644 --- a/operator/precompiles/preimage/src/mock.rs +++ b/operator/precompiles/preimage/src/mock.rs @@ -187,6 +187,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/preimage/src/tests.rs b/operator/precompiles/preimage/src/tests.rs index 626c22f4..dddddd7f 100644 --- a/operator/precompiles/preimage/src/tests.rs +++ b/operator/precompiles/preimage/src/tests.rs @@ -34,6 +34,7 @@ fn evm_call(input: Vec) -> EvmCall { max_priority_fee_per_gas: Some(U256::zero()), nonce: None, access_list: Vec::new(), + authorization_list: Vec::new(), } } diff --git a/operator/precompiles/proxy/src/mock.rs b/operator/precompiles/proxy/src/mock.rs index 3985182e..fbb79b90 100644 --- a/operator/precompiles/proxy/src/mock.rs +++ b/operator/precompiles/proxy/src/mock.rs @@ -269,6 +269,7 @@ impl pallet_proxy::Config for Runtime { type CallHasher = BlakeTwo256; type AnnouncementDepositBase = (); type AnnouncementDepositFactor = (); + type BlockNumberProvider = (); } /// Build test externalities, prepopulated with data for testing democracy precompiles @@ -298,6 +299,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances.clone(), + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/precompiles/referenda/src/mock.rs b/operator/precompiles/referenda/src/mock.rs index 6a70d108..901adc6f 100644 --- a/operator/precompiles/referenda/src/mock.rs +++ b/operator/precompiles/referenda/src/mock.rs @@ -18,6 +18,7 @@ use super::*; +use alloc::borrow::Cow; use frame_support::pallet_prelude::*; use frame_support::traits::VoteTally; use frame_support::{ @@ -29,6 +30,7 @@ use frame_system::RawOrigin; use pallet_evm::{ EnsureAddressNever, EnsureAddressRoot, FrameSystemAccountProvider, SubstrateBlockHashMapping, }; +use pallet_referenda::Track; use pallet_referenda::{Curve, TrackInfo, TracksInfo}; use precompile_utils::{precompile_set::*, testing::MockAccount}; use sp_core::{H256, U256}; @@ -217,6 +219,7 @@ impl pallet_scheduler::Config for Runtime { type WeightInfo = (); type OriginPrivilegeCmp = EqualPrivilegeOnly; type Preimages = Preimage; + type BlockNumberProvider = (); } // Preimage configuration @@ -274,7 +277,7 @@ impl Get)>> for TestTracksInfo { ( 0, TrackInfo { - name: "root", + name: str_array("root"), max_deciding: 1, decision_deposit: 10, prepare_period: 2, @@ -296,7 +299,7 @@ impl Get)>> for TestTracksInfo { ( 1, TrackInfo { - name: "none", + name: str_array("none"), max_deciding: 1, decision_deposit: 10, prepare_period: 2, @@ -323,12 +326,12 @@ impl TracksInfo for TestTracksInfo { type Id = u8; type RuntimeOrigin = OriginCaller; - fn tracks() -> &'static [(Self::Id, TrackInfo)] { - static TRACKS: &[(u8, TrackInfo)] = &[ + fn tracks() -> impl Iterator>> { + static DATA: [Track; 2] = [ ( 0, TrackInfo { - name: "root", + name: str_array("root"), max_deciding: 1, decision_deposit: 10, prepare_period: 2, @@ -350,7 +353,7 @@ impl TracksInfo for TestTracksInfo { ( 1, TrackInfo { - name: "none", + name: str_array("none"), max_deciding: 1, decision_deposit: 10, prepare_period: 2, @@ -425,6 +428,7 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: self.balances, + dev_accounts: Default::default(), } .assimilate_storage(&mut t) .expect("Pallet balances storage can be assimilated"); diff --git a/operator/primitives/snowbridge/bridge-hub-common/src/message_queue.rs b/operator/primitives/snowbridge/bridge-hub-common/src/message_queue.rs index 2f0a6d09..0b25fa8e 100644 --- a/operator/primitives/snowbridge/bridge-hub-common/src/message_queue.rs +++ b/operator/primitives/snowbridge/bridge-hub-common/src/message_queue.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. //! Runtime configuration for MessageQueue pallet -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use core::marker::PhantomData; use cumulus_primitives_core::{AggregateMessageOrigin as CumulusAggregateMessageOrigin, ParaId}; use frame_support::{ @@ -29,7 +29,18 @@ use xcm::latest::prelude::{Junction, Location}; /// The aggregate origin of an inbound message. /// This is specialized for BridgeHub, as the snowbridge-outbound-queue-pallet is also using /// the shared MessageQueue pallet. -#[derive(Encode, Decode, Copy, MaxEncodedLen, Clone, Eq, PartialEq, TypeInfo, Debug)] +#[derive( + Encode, + Decode, + Copy, + MaxEncodedLen, + Clone, + Eq, + PartialEq, + TypeInfo, + DecodeWithMemTracking, + Debug, +)] pub enum AggregateMessageOrigin { /// The message came from the para-chain itself. Here, diff --git a/operator/primitives/snowbridge/core/src/pricing.rs b/operator/primitives/snowbridge/core/src/pricing.rs index ba825239..edbe86e3 100644 --- a/operator/primitives/snowbridge/core/src/pricing.rs +++ b/operator/primitives/snowbridge/core/src/pricing.rs @@ -1,13 +1,15 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2023 Snowfork -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_arithmetic::traits::{BaseArithmetic, Unsigned, Zero}; use sp_core::U256; use sp_runtime::{FixedU128, RuntimeDebug}; -#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive( + Clone, Encode, Decode, PartialEq, RuntimeDebug, MaxEncodedLen, DecodeWithMemTracking, TypeInfo, +)] pub struct PricingParameters { /// ETH/DOT exchange rate pub exchange_rate: FixedU128, @@ -19,7 +21,9 @@ pub struct PricingParameters { pub multiplier: FixedU128, } -#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive( + Clone, Encode, Decode, PartialEq, RuntimeDebug, MaxEncodedLen, DecodeWithMemTracking, TypeInfo, +)] pub struct Rewards { /// Local reward in DOT pub local: Balance, diff --git a/operator/primitives/snowbridge/test-utils/src/mock_origin.rs b/operator/primitives/snowbridge/test-utils/src/mock_origin.rs index efced79f..e2058549 100644 --- a/operator/primitives/snowbridge/test-utils/src/mock_origin.rs +++ b/operator/primitives/snowbridge/test-utils/src/mock_origin.rs @@ -20,7 +20,17 @@ pub mod pallet_xcm_origin { // Insert this custom Origin into the aggregate RuntimeOrigin #[pallet::origin] - #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)] + #[derive( + PartialEq, + Eq, + Clone, + Encode, + Decode, + RuntimeDebug, + TypeInfo, + DecodeWithMemTracking, + MaxEncodedLen, + )] pub struct Origin(pub Location); impl From for Origin { diff --git a/operator/runtime/mainnet/Cargo.toml b/operator/runtime/mainnet/Cargo.toml index 21c5a02d..a4cadb47 100644 --- a/operator/runtime/mainnet/Cargo.toml +++ b/operator/runtime/mainnet/Cargo.toml @@ -18,10 +18,11 @@ bridge-hub-common = { workspace = true, optional = true } codec = { workspace = true, features = ["derive"] } datahaven-runtime-common = { workspace = true } dhp-bridge = { workspace = true } +ethereum = { workspace = true } fp-account = { workspace = true, features = ["serde"] } fp-evm = { workspace = true, features = ["serde"] } fp-rpc = { workspace = true } -fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] } +fp-self-contained = { workspace = true, features = ["serde"] } frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } @@ -189,6 +190,7 @@ default = ["std"] std = [ "codec/std", "datahaven-runtime-common/std", + "ethereum/std", "fp-account/std", "fp-evm/std", "frame-benchmarking?/std", diff --git a/operator/runtime/mainnet/src/configs/governance/origins.rs b/operator/runtime/mainnet/src/configs/governance/origins.rs index 277e35a1..b11603c2 100644 --- a/operator/runtime/mainnet/src/configs/governance/origins.rs +++ b/operator/runtime/mainnet/src/configs/governance/origins.rs @@ -34,7 +34,16 @@ pub mod custom_origins { pub struct Pallet(_); #[derive( - PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug, EnumString, + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + TypeInfo, + RuntimeDebug, + EnumString, + DecodeWithMemTracking, )] #[strum(serialize_all = "snake_case")] #[pallet::origin] diff --git a/operator/runtime/mainnet/src/configs/governance/tracks.rs b/operator/runtime/mainnet/src/configs/governance/tracks.rs index d38c0790..bb26faeb 100644 --- a/operator/runtime/mainnet/src/configs/governance/tracks.rs +++ b/operator/runtime/mainnet/src/configs/governance/tracks.rs @@ -21,9 +21,12 @@ use super::*; use crate::currency::{HAVE, KILOHAVE, SUPPLY_FACTOR}; +use alloc::borrow::Cow; +use core::str::from_utf8; use core::str::FromStr; use datahaven_runtime_common::time::*; use pallet_referenda::Curve; +use pallet_referenda::Track; use sp_runtime::str_array; const fn percent(x: i32) -> sp_runtime::FixedI64 { @@ -33,10 +36,10 @@ const fn permill(x: i32) -> sp_runtime::FixedI64 { sp_runtime::FixedI64::from_rational(x as u128, 1000) } -const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] = [ - ( - 0, - pallet_referenda::TrackInfo { +const TRACKS_DATA: [Track; 6] = [ + Track { + id: 0, + info: pallet_referenda::TrackInfo { // Name of this track. name: str_array("root"), // A limit for the number of referenda on this track that can be being decided at once. @@ -59,10 +62,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] // is needed for approval as a function of time into decision period. min_support: Curve::make_linear(14, 14, permill(5), percent(25)), }, - ), - ( - 1, - pallet_referenda::TrackInfo { + }, + Track { + id: 1, + info: pallet_referenda::TrackInfo { name: str_array("whitelisted_caller"), max_deciding: 100, decision_deposit: 2 * KILOHAVE * SUPPLY_FACTOR, @@ -73,10 +76,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14 * 24, percent(1), percent(0), percent(2)), }, - ), - ( - 2, - pallet_referenda::TrackInfo { + }, + Track { + id: 2, + info: pallet_referenda::TrackInfo { name: str_array("general_admin"), max_deciding: 10, decision_deposit: 100 * HAVE * SUPPLY_FACTOR, @@ -87,10 +90,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(4, 14, percent(80), percent(50), percent(100)), min_support: Curve::make_reciprocal(7, 14, percent(10), percent(0), percent(50)), }, - ), - ( - 3, - pallet_referenda::TrackInfo { + }, + Track { + id: 3, + info: pallet_referenda::TrackInfo { name: str_array("referendum_canceller"), max_deciding: 20, decision_deposit: 2 * KILOHAVE * SUPPLY_FACTOR, @@ -101,10 +104,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14, percent(1), percent(0), percent(10)), }, - ), - ( - 4, - pallet_referenda::TrackInfo { + }, + Track { + id: 4, + info: pallet_referenda::TrackInfo { name: str_array("referendum_killer"), max_deciding: 100, decision_deposit: 4 * KILOHAVE * SUPPLY_FACTOR, @@ -115,10 +118,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14, percent(1), percent(0), percent(10)), }, - ), - ( - 5, - pallet_referenda::TrackInfo { + }, + Track { + id: 5, + info: pallet_referenda::TrackInfo { name: str_array("fast_general_admin"), max_deciding: 10, decision_deposit: 100 * HAVE * SUPPLY_FACTOR, @@ -129,7 +132,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(4, 14, percent(80), percent(50), percent(100)), min_support: Curve::make_reciprocal(5, 14, percent(1), percent(0), percent(50)), }, - ), + }, ]; pub struct TracksInfo; @@ -146,9 +149,9 @@ impl pallet_referenda::TracksInfo for TracksInfo { frame_system::RawOrigin::Root => { if let Some(track) = Self::tracks() .into_iter() - .find(|track| track.name == str_array("root")) + .find(|track| track.info.name == str_array("root")) { - Ok(*track_id) + Ok(track.id) } else { Err(()) } @@ -156,8 +159,12 @@ impl pallet_referenda::TracksInfo for TracksInfo { _ => Err(()), } } else if let Ok(custom_origin) = custom_origins::Origin::try_from(id.clone()) { - if let Some(track_id) = Self::tracks().into_iter().find(|track| { - if let Ok(track_custom_origin) = custom_origins::Origin::from_str(track.name) { + if let Some(track) = Self::tracks().into_iter().find(|track| { + let Ok(track_name) = from_utf8(&track.info.name) else { + return false; + }; + let track_name = track_name.trim_end_matches('\0'); + if let Ok(track_custom_origin) = custom_origins::Origin::from_str(track_name) { track_custom_origin == custom_origin } else { false @@ -176,7 +183,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { #[test] /// To ensure voters are always locked into their vote fn vote_locking_always_longer_than_enactment_period() { - for (_, track) in TRACKS_DATA { + for track in TRACKS_DATA { assert!( ::VoteLockingPeriod::get() >= track.min_enactment_period, @@ -190,7 +197,7 @@ fn vote_locking_always_longer_than_enactment_period() { #[test] fn all_tracks_have_origins() { - for (_, track) in TRACKS_DATA { + for track in TRACKS_DATA { // check name.into() is successful either converts into "root" or custom origin let track_is_root = track.name == "root"; let track_has_custom_origin = custom_origins::Origin::from_str(track.name).is_ok(); diff --git a/operator/runtime/mainnet/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs index b83c05d2..7d140bcb 100644 --- a/operator/runtime/mainnet/src/configs/mod.rs +++ b/operator/runtime/mainnet/src/configs/mod.rs @@ -30,8 +30,9 @@ use super::{ Signature, System, Timestamp, Treasury, TxPause, BLOCK_HASH_COUNT, EXTRINSIC_BASE_WEIGHT, MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION, }; +use alloc::vec::Vec; use alloy_core::primitives::Address; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{traits::AccountIdConversion, RuntimeDebug}; @@ -48,6 +49,7 @@ use sp_runtime::{traits::AccountIdConversion, RuntimeDebug}; Decode, RuntimeDebug, MaxEncodedLen, + DecodeWithMemTracking, TypeInfo, serde::Serialize, serde::Deserialize, @@ -76,10 +78,7 @@ impl Default for ProxyType { Self::Any } } -use core::{ - convert::{From, Into}, - prelude::*, -}; +use core::convert::{From, Into}; use datahaven_runtime_common::{ deal_with_fees::{ DealWithEthereumBaseFees, DealWithEthereumPriorityFees, DealWithSubstrateFeesAndTip, @@ -396,6 +395,7 @@ impl pallet_session::Config for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = mainnet_weights::pallet_session::WeightInfo; + type DisablingStrategy = (); } parameter_types! { @@ -593,6 +593,7 @@ impl pallet_scheduler::Config for Runtime { type OriginPrivilegeCmp = EqualPrivilegeOnly; type Preimages = Preimage; type WeightInfo = mainnet_weights::pallet_scheduler::WeightInfo; + type BlockNumberProvider = System; } parameter_types! { @@ -687,6 +688,7 @@ impl pallet_multisig::Config for Runtime { type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; type WeightInfo = mainnet_weights::pallet_multisig::WeightInfo; + type BlockNumberProvider = System; } parameter_types! { @@ -852,6 +854,7 @@ impl pallet_proxy::Config for Runtime { type CallHasher = sp_runtime::traits::BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = System; } impl pallet_proxy_genesis_companion::Config for Runtime { @@ -1053,6 +1056,8 @@ impl pallet_evm::Config for Runtime { type GasLimitPovSizeRatio = GasLimitPovSizeRatio; type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio; type Timestamp = Timestamp; + type CreateOriginFilter = (); + type CreateInnerOriginFilter = (); type WeightInfo = mainnet_weights::pallet_evm::WeightInfo; } diff --git a/operator/runtime/mainnet/src/configs/storagehub/mod.rs b/operator/runtime/mainnet/src/configs/storagehub/mod.rs index 4cb6512c..437e49c6 100644 --- a/operator/runtime/mainnet/src/configs/storagehub/mod.rs +++ b/operator/runtime/mainnet/src/configs/storagehub/mod.rs @@ -19,7 +19,7 @@ use super::HAVE; #[cfg(feature = "runtime-benchmarks")] use super::MICROHAVE; use super::{ - AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, + AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, System, TreasuryAccount, }; use crate::configs::runtime_params::dynamic_params::runtime_config; @@ -30,6 +30,7 @@ use crate::{ use alloc::{vec, vec::Vec}; use core::convert::{From, Into}; use core::marker::PhantomData; + #[cfg(feature = "runtime-benchmarks")] use datahaven_runtime_common::benchmarking::StorageHubBenchmarking; use datahaven_runtime_common::time::{DAYS, MINUTES}; @@ -126,6 +127,7 @@ impl pallet_nfts::Config for Runtime { type OffchainPublic = ::Signer; type WeightInfo = crate::weights::pallet_nfts::WeightInfo; type Locker = (); + type BlockNumberProvider = System; #[cfg(feature = "runtime-benchmarks")] type Helper = benchmark_helpers::NftHelper; } diff --git a/operator/runtime/mainnet/src/genesis_config_presets.rs b/operator/runtime/mainnet/src/genesis_config_presets.rs index 321df0a1..5eb01dc3 100644 --- a/operator/runtime/mainnet/src/genesis_config_presets.rs +++ b/operator/runtime/mainnet/src/genesis_config_presets.rs @@ -56,6 +56,7 @@ fn testnet_genesis( .cloned() .map(|k| (k, 1u128 << 110)) .collect::>(), + dev_accounts: Default::default(), }, babe: pallet_babe::GenesisConfig { epoch_config: BABE_GENESIS_EPOCH_CONFIG, diff --git a/operator/runtime/mainnet/src/lib.rs b/operator/runtime/mainnet/src/lib.rs index f295318a..b9099825 100644 --- a/operator/runtime/mainnet/src/lib.rs +++ b/operator/runtime/mainnet/src/lib.rs @@ -37,8 +37,10 @@ use pallet_collective as pallet_collective_treasury_council; #[allow(unused_imports)] use pallet_collective as pallet_collective_technical_committee; +use alloc::collections::btree_map::BTreeMap; use alloc::{borrow::Cow, vec::Vec}; use codec::Encode; +use ethereum::AuthorizationList; use fp_rpc::TransactionStatus; use frame_support::{ genesis_builder_helper::{build_state, get_preset}, @@ -85,7 +87,6 @@ use sp_runtime::{ transaction_validity::{InvalidTransaction, TransactionSource}, ApplyExtrinsicResult, Perbill, Permill, }; -use sp_std::collections::btree_map::BTreeMap; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -1073,6 +1074,7 @@ impl_runtime_apis! { nonce: Option, estimate: bool, access_list: Option)>>, + authorization_list: Option, ) -> Result { let config = if estimate { let mut config = ::config().clone(); @@ -1102,6 +1104,7 @@ impl_runtime_apis! { max_priority_fee_per_gas, nonce, access_list.unwrap_or_default(), + authorization_list.unwrap_or_default(), is_transactional, validate, Some(weight_limit), @@ -1120,6 +1123,7 @@ impl_runtime_apis! { nonce: Option, estimate: bool, access_list: Option)>>, + authorization_list: Option, ) -> Result { let config = if estimate { let mut config = ::config().clone(); @@ -1153,6 +1157,7 @@ impl_runtime_apis! { max_priority_fee_per_gas, nonce, access_list.unwrap_or_default(), + authorization_list.unwrap_or_default(), is_transactional, validate, Some(weight_limit), @@ -1414,7 +1419,7 @@ impl_runtime_apis! { fn compute_signed_extra_implicit( era: sp_runtime::generic::Era, enable_metadata: bool, - ) -> Result, sp_runtime::transaction_validity::TransactionValidityError> { + ) -> Result, sp_runtime::transaction_validity::TransactionValidityError> { // Build the SignedExtra tuple with minimal values; only `era` and `enable_metadata` // influence the implicit. Other extensions have `()` implicit. let extra: SignedExtra = ( diff --git a/operator/runtime/mainnet/src/weights/pallet_beefy_mmr.rs b/operator/runtime/mainnet/src/weights/pallet_beefy_mmr.rs index bfda6ad1..13332957 100644 --- a/operator/runtime/mainnet/src/weights/pallet_beefy_mmr.rs +++ b/operator/runtime/mainnet/src/weights/pallet_beefy_mmr.rs @@ -90,4 +90,6 @@ impl pallet_beefy_mmr::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(1_511_565, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } + + fn n_leafs_proof_is_optimal(_: u32) -> sp_runtime::Weight { todo!() } } diff --git a/operator/runtime/mainnet/src/weights/pallet_message_queue.rs b/operator/runtime/mainnet/src/weights/pallet_message_queue.rs index fe3ca7a3..59bae039 100644 --- a/operator/runtime/mainnet/src/weights/pallet_message_queue.rs +++ b/operator/runtime/mainnet/src/weights/pallet_message_queue.rs @@ -178,4 +178,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + fn set_service_head() -> Weight { + todo!() + } } diff --git a/operator/runtime/mainnet/src/weights/pallet_multisig.rs b/operator/runtime/mainnet/src/weights/pallet_multisig.rs index b27df6fa..a66d67ab 100644 --- a/operator/runtime/mainnet/src/weights/pallet_multisig.rs +++ b/operator/runtime/mainnet/src/weights/pallet_multisig.rs @@ -169,4 +169,6 @@ impl pallet_multisig::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + fn poke_deposit(_: u32) -> sp_runtime::Weight { todo!() } } diff --git a/operator/runtime/mainnet/src/weights/pallet_proxy.rs b/operator/runtime/mainnet/src/weights/pallet_proxy.rs index 3340f407..30300e76 100644 --- a/operator/runtime/mainnet/src/weights/pallet_proxy.rs +++ b/operator/runtime/mainnet/src/weights/pallet_proxy.rs @@ -224,4 +224,8 @@ impl pallet_proxy::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + fn poke_deposit() -> Weight { + todo!() + } } diff --git a/operator/runtime/mainnet/src/weights/pallet_utility.rs b/operator/runtime/mainnet/src/weights/pallet_utility.rs index a60a2a24..b9915e72 100644 --- a/operator/runtime/mainnet/src/weights/pallet_utility.rs +++ b/operator/runtime/mainnet/src/weights/pallet_utility.rs @@ -119,4 +119,11 @@ impl pallet_utility::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(6_595_620, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } + fn dispatch_as_fallible() -> Weight { + todo!() + } + + fn if_else() -> Weight { + todo!() + } } diff --git a/operator/runtime/mainnet/tests/common.rs b/operator/runtime/mainnet/tests/common.rs index 1e9ecdf2..f5f1bf21 100644 --- a/operator/runtime/mainnet/tests/common.rs +++ b/operator/runtime/mainnet/tests/common.rs @@ -168,9 +168,12 @@ impl ExtBuilder { .build_storage() .expect("System pallet builds valid default genesis config"); - pallet_balances::GenesisConfig:: { balances } - .assimilate_storage(&mut t) - .expect("Pallet balances storage can be assimilated"); + pallet_balances::GenesisConfig:: { + balances, + dev_accounts: Default::default(), + } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); // Set up session keys for validators let session_keys: Vec<_> = validators diff --git a/operator/runtime/mainnet/tests/governance/benchmarks.rs b/operator/runtime/mainnet/tests/governance/benchmarks.rs index 4a27975a..64245724 100644 --- a/operator/runtime/mainnet/tests/governance/benchmarks.rs +++ b/operator/runtime/mainnet/tests/governance/benchmarks.rs @@ -23,6 +23,7 @@ #![cfg(feature = "runtime-benchmarks")] use crate::common::*; +use alloc::vec::Vec; use datahaven_mainnet_runtime::{ configs::governance::council::{TechnicalMaxMembers, TechnicalMaxProposals}, governance::TracksInfo, @@ -36,7 +37,6 @@ use frame_support::{ traits::{Get, StorePreimage}, }; use pallet_conviction_voting::{AccountVote, Conviction, Vote}; -use sp_std::vec::Vec; /// Benchmark council proposal creation with varying member counts #[test] diff --git a/operator/runtime/stagenet/Cargo.toml b/operator/runtime/stagenet/Cargo.toml index f976a97d..efd77c24 100644 --- a/operator/runtime/stagenet/Cargo.toml +++ b/operator/runtime/stagenet/Cargo.toml @@ -18,10 +18,11 @@ bridge-hub-common = { workspace = true, optional = true } codec = { workspace = true, features = ["derive"] } datahaven-runtime-common = { workspace = true } dhp-bridge = { workspace = true } +ethereum = { workspace = true } fp-account = { workspace = true } fp-evm = { workspace = true, features = ["serde"] } fp-rpc = { workspace = true } -fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] } +fp-self-contained = { workspace = true, features = ["serde"] } frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } @@ -190,6 +191,7 @@ std = [ "alloy-core/std", "codec/std", "datahaven-runtime-common/std", + "ethereum/std", "fp-account/std", "fp-evm/std", "frame-benchmarking?/std", diff --git a/operator/runtime/stagenet/src/configs/governance/origins.rs b/operator/runtime/stagenet/src/configs/governance/origins.rs index 0f943cf6..be8043d8 100644 --- a/operator/runtime/stagenet/src/configs/governance/origins.rs +++ b/operator/runtime/stagenet/src/configs/governance/origins.rs @@ -34,7 +34,16 @@ pub mod custom_origins { pub struct Pallet(_); #[derive( - PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug, EnumString, + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + TypeInfo, + RuntimeDebug, + EnumString, + DecodeWithMemTracking, )] #[strum(serialize_all = "snake_case")] #[pallet::origin] diff --git a/operator/runtime/stagenet/src/configs/governance/referenda.rs b/operator/runtime/stagenet/src/configs/governance/referenda.rs index 9db06dfa..9f8955c3 100644 --- a/operator/runtime/stagenet/src/configs/governance/referenda.rs +++ b/operator/runtime/stagenet/src/configs/governance/referenda.rs @@ -57,6 +57,8 @@ impl pallet_conviction_voting::Config for Runtime { type MaxVotes = ConstU32<20>; type MaxTurnout = frame_support::traits::TotalIssuanceOf; type Polls = Referenda; + type BlockNumberProvider = System; + type VotingHooks = (); } impl pallet_whitelist::Config for Runtime { diff --git a/operator/runtime/stagenet/src/configs/governance/tracks.rs b/operator/runtime/stagenet/src/configs/governance/tracks.rs index 388cf0b4..71d7aaa0 100644 --- a/operator/runtime/stagenet/src/configs/governance/tracks.rs +++ b/operator/runtime/stagenet/src/configs/governance/tracks.rs @@ -21,9 +21,13 @@ use super::*; use crate::currency::{HAVE, KILOHAVE, SUPPLY_FACTOR}; +use alloc::borrow::Cow; +use core::str::from_utf8; +use core::str::FromStr; use datahaven_runtime_common::time::*; use pallet_referenda::Curve; -use sp_std::str::FromStr; +use pallet_referenda::Track; +use sp_runtime::str_array; const fn percent(x: i32) -> sp_runtime::FixedI64 { sp_runtime::FixedI64::from_rational(x as u128, 100) @@ -32,12 +36,12 @@ const fn permill(x: i32) -> sp_runtime::FixedI64 { sp_runtime::FixedI64::from_rational(x as u128, 1000) } -const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] = [ - ( - 0, - pallet_referenda::TrackInfo { +const TRACKS_DATA: [Track; 6] = [ + Track { + id: 0, + info: pallet_referenda::TrackInfo { // Name of this track. - name: "root", + name: str_array("root"), // A limit for the number of referenda on this track that can be being decided at once. // For Root origin this should generally be just one. max_deciding: 5, @@ -58,11 +62,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] // is needed for approval as a function of time into decision period. min_support: Curve::make_linear(14, 14, permill(5), percent(25)), }, - ), - ( - 1, - pallet_referenda::TrackInfo { - name: "whitelisted_caller", + }, + Track { + id: 1, + info: pallet_referenda::TrackInfo { + name: str_array("whitelisted_caller"), max_deciding: 100, decision_deposit: 10 * KILOHAVE * SUPPLY_FACTOR, prepare_period: 10 * MINUTES, @@ -72,11 +76,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14 * 24, percent(1), percent(0), percent(2)), }, - ), - ( - 2, - pallet_referenda::TrackInfo { - name: "general_admin", + }, + Track { + id: 2, + info: pallet_referenda::TrackInfo { + name: str_array("general_admin"), max_deciding: 10, decision_deposit: 500 * HAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -86,11 +90,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(4, 14, percent(80), percent(50), percent(100)), min_support: Curve::make_reciprocal(7, 14, percent(10), percent(0), percent(50)), }, - ), - ( - 3, - pallet_referenda::TrackInfo { - name: "referendum_canceller", + }, + Track { + id: 3, + info: pallet_referenda::TrackInfo { + name: str_array("referendum_canceller"), max_deciding: 20, decision_deposit: 10 * KILOHAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -100,11 +104,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14, percent(1), percent(0), percent(50)), }, - ), - ( - 4, - pallet_referenda::TrackInfo { - name: "referendum_killer", + }, + Track { + id: 4, + info: pallet_referenda::TrackInfo { + name: str_array("referendum_killer"), max_deciding: 100, decision_deposit: 20 * KILOHAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -114,11 +118,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14, percent(1), percent(0), percent(10)), }, - ), - ( - 5, - pallet_referenda::TrackInfo { - name: "fast_general_admin", + }, + Track { + id: 5, + info: pallet_referenda::TrackInfo { + name: str_array("fast_general_admin"), max_deciding: 10, decision_deposit: 500 * HAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -128,25 +132,25 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(4, 14, percent(80), percent(50), percent(100)), min_support: Curve::make_reciprocal(5, 14, percent(1), percent(0), percent(50)), }, - ), + }, ]; pub struct TracksInfo; impl pallet_referenda::TracksInfo for TracksInfo { type Id = u16; type RuntimeOrigin = ::PalletsOrigin; - fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] { - &TRACKS_DATA[..] + fn tracks() -> impl Iterator>> { + TRACKS_DATA.iter().map(Cow::Borrowed) } fn track_for(id: &Self::RuntimeOrigin) -> Result { if let Ok(system_origin) = frame_system::RawOrigin::try_from(id.clone()) { match system_origin { frame_system::RawOrigin::Root => { - if let Some((track_id, _)) = Self::tracks() + if let Some(track) = Self::tracks() .into_iter() - .find(|(_, track)| track.name == "root") + .find(|track| track.info.name == str_array("root")) { - Ok(*track_id) + Ok(track.id) } else { Err(()) } @@ -154,14 +158,18 @@ impl pallet_referenda::TracksInfo for TracksInfo { _ => Err(()), } } else if let Ok(custom_origin) = custom_origins::Origin::try_from(id.clone()) { - if let Some((track_id, _)) = Self::tracks().into_iter().find(|(_, track)| { - if let Ok(track_custom_origin) = custom_origins::Origin::from_str(track.name) { + if let Some(track) = Self::tracks().into_iter().find(|track| { + let Ok(track_name) = from_utf8(&track.info.name) else { + return false; + }; + let track_name = track_name.trim_end_matches('\0'); + if let Ok(track_custom_origin) = custom_origins::Origin::from_str(track_name) { track_custom_origin == custom_origin } else { false } }) { - Ok(*track_id) + Ok(track.id) } else { Err(()) } diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index 12b4a960..1da8e0f1 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -30,8 +30,9 @@ use super::{ Signature, System, Timestamp, Treasury, TxPause, BLOCK_HASH_COUNT, EXTRINSIC_BASE_WEIGHT, MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION, }; +use alloc::vec::Vec; use alloy_core::primitives::Address; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{traits::AccountIdConversion, RuntimeDebug}; @@ -49,6 +50,7 @@ use sp_runtime::{traits::AccountIdConversion, RuntimeDebug}; RuntimeDebug, MaxEncodedLen, TypeInfo, + DecodeWithMemTracking, serde::Serialize, serde::Deserialize, )] @@ -76,6 +78,10 @@ impl Default for ProxyType { Self::Any } } +use core::{ + convert::{From, Into}, + prelude::*, +}; use datahaven_runtime_common::{ deal_with_fees::{ DealWithEthereumBaseFees, DealWithEthereumPriorityFees, DealWithSubstrateFeesAndTip, @@ -141,10 +147,6 @@ use sp_runtime::{ FixedPointNumber, Perbill, Perquintill, }; use sp_staking::EraIndex; -use sp_std::{ - convert::{From, Into}, - prelude::*, -}; use sp_version::RuntimeVersion; use xcm::latest::NetworkId; use xcm::prelude::*; @@ -395,6 +397,7 @@ impl pallet_session::Config for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = stagenet_weights::pallet_session::WeightInfo; + type DisablingStrategy = (); } parameter_types! { @@ -590,6 +593,7 @@ impl pallet_scheduler::Config for Runtime { type OriginPrivilegeCmp = EqualPrivilegeOnly; type Preimages = Preimage; type WeightInfo = stagenet_weights::pallet_scheduler::WeightInfo; + type BlockNumberProvider = System; } parameter_types! { @@ -684,6 +688,7 @@ impl pallet_multisig::Config for Runtime { type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; type WeightInfo = stagenet_weights::pallet_multisig::WeightInfo; + type BlockNumberProvider = System; } parameter_types! { @@ -849,6 +854,7 @@ impl pallet_proxy::Config for Runtime { type CallHasher = sp_runtime::traits::BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = System; } impl pallet_proxy_genesis_companion::Config for Runtime { @@ -1050,6 +1056,8 @@ impl pallet_evm::Config for Runtime { type GasLimitPovSizeRatio = GasLimitPovSizeRatio; type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio; type Timestamp = Timestamp; + type CreateOriginFilter = (); + type CreateInnerOriginFilter = (); type WeightInfo = stagenet_weights::pallet_evm::WeightInfo; } diff --git a/operator/runtime/stagenet/src/configs/runtime_params.rs b/operator/runtime/stagenet/src/configs/runtime_params.rs index dcf136c9..5294fd94 100644 --- a/operator/runtime/stagenet/src/configs/runtime_params.rs +++ b/operator/runtime/stagenet/src/configs/runtime_params.rs @@ -15,11 +15,11 @@ // along with DataHaven. If not, see . use crate::Runtime; +use alloc::vec; use frame_support::dynamic_params::{dynamic_pallet_params, dynamic_params}; use hex_literal::hex; use sp_core::{ConstU32, H160, H256}; use sp_runtime::{BoundedVec, Perbill}; -use sp_std::vec; use crate::configs::storagehub::{ChallengeTicksTolerance, ReplicationTargetType, SpMinDeposit}; use crate::currency::{GIGAWEI, HAVE, SUPPLY_FACTOR}; diff --git a/operator/runtime/stagenet/src/configs/storagehub/mod.rs b/operator/runtime/stagenet/src/configs/storagehub/mod.rs index 79a71b14..57ecddb0 100644 --- a/operator/runtime/stagenet/src/configs/storagehub/mod.rs +++ b/operator/runtime/stagenet/src/configs/storagehub/mod.rs @@ -13,13 +13,14 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . +extern crate alloc; #[cfg(not(feature = "runtime-benchmarks"))] use super::HAVE; #[cfg(feature = "runtime-benchmarks")] use super::MICROHAVE; use super::{ - AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, + AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, System, TreasuryAccount, }; use crate::configs::runtime_params::dynamic_params::runtime_config; @@ -27,6 +28,8 @@ use crate::{ BucketNfts, Nfts, PaymentStreams, ProofsDealer, Providers, Runtime, Signature, WeightToFee, HOURS, }; +use alloc::{vec, vec::Vec}; +use core::convert::{From, Into}; use core::marker::PhantomData; #[cfg(feature = "runtime-benchmarks")] use datahaven_runtime_common::benchmarking::StorageHubBenchmarking; @@ -59,8 +62,6 @@ use sp_runtime::traits::Verify; use sp_runtime::traits::Zero; use sp_runtime::SaturatedConversion; use sp_runtime::{traits::BlakeTwo256, Perbill}; -use sp_std::convert::{From, Into}; -use sp_std::{vec, vec::Vec}; use sp_trie::{LayoutV1, TrieConfiguration, TrieLayout}; #[cfg(feature = "std")] @@ -126,6 +127,7 @@ impl pallet_nfts::Config for Runtime { type OffchainPublic = ::Signer; type WeightInfo = crate::weights::pallet_nfts::WeightInfo; type Locker = (); + type BlockNumberProvider = System; #[cfg(feature = "runtime-benchmarks")] type Helper = benchmark_helpers::NftHelper; } diff --git a/operator/runtime/stagenet/src/genesis_config_presets.rs b/operator/runtime/stagenet/src/genesis_config_presets.rs index 0265f5a3..671eae1c 100644 --- a/operator/runtime/stagenet/src/genesis_config_presets.rs +++ b/operator/runtime/stagenet/src/genesis_config_presets.rs @@ -56,6 +56,7 @@ fn testnet_genesis( .cloned() .map(|k| (k, 1u128 << 80)) .collect::>(), + dev_accounts: Default::default(), }, babe: pallet_babe::GenesisConfig { epoch_config: BABE_GENESIS_EPOCH_CONFIG, diff --git a/operator/runtime/stagenet/src/lib.rs b/operator/runtime/stagenet/src/lib.rs index df43090f..293c28ad 100644 --- a/operator/runtime/stagenet/src/lib.rs +++ b/operator/runtime/stagenet/src/lib.rs @@ -37,8 +37,10 @@ use pallet_collective as pallet_collective_treasury_council; #[allow(unused_imports)] use pallet_collective as pallet_collective_technical_committee; +use alloc::collections::btree_map::BTreeMap; use alloc::{borrow::Cow, vec::Vec}; use codec::Encode; +use ethereum::AuthorizationList; use fp_rpc::TransactionStatus; use frame_support::{ genesis_builder_helper::{build_state, get_preset}, @@ -82,7 +84,6 @@ use sp_runtime::{ transaction_validity::{InvalidTransaction, TransactionSource}, ApplyExtrinsicResult, Perbill, Permill, }; -use sp_std::collections::btree_map::BTreeMap; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -1075,6 +1076,7 @@ impl_runtime_apis! { nonce: Option, estimate: bool, access_list: Option)>>, + authorization_list: Option, ) -> Result { let config = if estimate { let mut config = ::config().clone(); @@ -1104,6 +1106,7 @@ impl_runtime_apis! { max_priority_fee_per_gas, nonce, access_list.unwrap_or_default(), + authorization_list.unwrap_or_default(), is_transactional, validate, Some(weight_limit), @@ -1122,6 +1125,7 @@ impl_runtime_apis! { nonce: Option, estimate: bool, access_list: Option)>>, + authorization_list: Option, ) -> Result { let config = if estimate { let mut config = ::config().clone(); @@ -1155,6 +1159,7 @@ impl_runtime_apis! { max_priority_fee_per_gas, nonce, access_list.unwrap_or_default(), + authorization_list.unwrap_or_default(), is_transactional, validate, Some(weight_limit), @@ -1417,7 +1422,7 @@ impl_runtime_apis! { fn compute_signed_extra_implicit( era: sp_runtime::generic::Era, enable_metadata: bool, - ) -> Result, sp_runtime::transaction_validity::TransactionValidityError> { + ) -> Result, sp_runtime::transaction_validity::TransactionValidityError> { // Build the SignedExtra tuple with minimal values; only `era` and `enable_metadata` // influence the implicit. Other extensions have `()` implicit. let extra: SignedExtra = ( diff --git a/operator/runtime/stagenet/src/weights/pallet_beefy_mmr.rs b/operator/runtime/stagenet/src/weights/pallet_beefy_mmr.rs index 8ccffb0c..99d4a97e 100644 --- a/operator/runtime/stagenet/src/weights/pallet_beefy_mmr.rs +++ b/operator/runtime/stagenet/src/weights/pallet_beefy_mmr.rs @@ -90,4 +90,6 @@ impl pallet_beefy_mmr::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(1_561_896, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } + + fn n_leafs_proof_is_optimal(_: u32) -> sp_runtime::Weight { todo!() } } diff --git a/operator/runtime/stagenet/src/weights/pallet_message_queue.rs b/operator/runtime/stagenet/src/weights/pallet_message_queue.rs index e358a8ac..ec68caa2 100644 --- a/operator/runtime/stagenet/src/weights/pallet_message_queue.rs +++ b/operator/runtime/stagenet/src/weights/pallet_message_queue.rs @@ -178,4 +178,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + fn set_service_head() -> Weight { + todo!() + } } diff --git a/operator/runtime/stagenet/src/weights/pallet_multisig.rs b/operator/runtime/stagenet/src/weights/pallet_multisig.rs index 7d7f4167..0623414b 100644 --- a/operator/runtime/stagenet/src/weights/pallet_multisig.rs +++ b/operator/runtime/stagenet/src/weights/pallet_multisig.rs @@ -169,4 +169,6 @@ impl pallet_multisig::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + fn poke_deposit(_: u32) -> sp_runtime::Weight { todo!() } } diff --git a/operator/runtime/stagenet/src/weights/pallet_proxy.rs b/operator/runtime/stagenet/src/weights/pallet_proxy.rs index 084540e3..ba33a80a 100644 --- a/operator/runtime/stagenet/src/weights/pallet_proxy.rs +++ b/operator/runtime/stagenet/src/weights/pallet_proxy.rs @@ -224,4 +224,8 @@ impl pallet_proxy::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + fn poke_deposit() -> Weight { + todo!() + } } diff --git a/operator/runtime/stagenet/src/weights/pallet_utility.rs b/operator/runtime/stagenet/src/weights/pallet_utility.rs index 31df3b74..48517ea0 100644 --- a/operator/runtime/stagenet/src/weights/pallet_utility.rs +++ b/operator/runtime/stagenet/src/weights/pallet_utility.rs @@ -119,4 +119,11 @@ impl pallet_utility::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(6_810_676, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } + fn dispatch_as_fallible() -> Weight { + todo!() + } + + fn if_else() -> Weight { + todo!() + } } diff --git a/operator/runtime/stagenet/tests/common.rs b/operator/runtime/stagenet/tests/common.rs index 9a8edc40..fa7639e4 100644 --- a/operator/runtime/stagenet/tests/common.rs +++ b/operator/runtime/stagenet/tests/common.rs @@ -168,9 +168,12 @@ impl ExtBuilder { .build_storage() .expect("System pallet builds valid default genesis config"); - pallet_balances::GenesisConfig:: { balances } - .assimilate_storage(&mut t) - .expect("Pallet balances storage can be assimilated"); + pallet_balances::GenesisConfig:: { + balances, + dev_accounts: Default::default(), + } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); // Set up session keys for validators let session_keys: Vec<_> = validators diff --git a/operator/runtime/stagenet/tests/governance/benchmarks.rs b/operator/runtime/stagenet/tests/governance/benchmarks.rs index 1cf51ad2..74d772d2 100644 --- a/operator/runtime/stagenet/tests/governance/benchmarks.rs +++ b/operator/runtime/stagenet/tests/governance/benchmarks.rs @@ -23,6 +23,7 @@ #![cfg(feature = "runtime-benchmarks")] use crate::common::*; +use alloc::vec::Vec; use datahaven_stagenet_runtime::{ configs::governance::council::{TechnicalMaxMembers, TechnicalMaxProposals}, governance::TracksInfo, @@ -36,7 +37,6 @@ use frame_support::{ traits::{Get, StorePreimage}, }; use pallet_conviction_voting::{AccountVote, Conviction, Vote}; -use sp_std::vec::Vec; /// Benchmark council proposal creation with varying member counts #[test] diff --git a/operator/runtime/testnet/Cargo.toml b/operator/runtime/testnet/Cargo.toml index c415d382..1675a8c2 100644 --- a/operator/runtime/testnet/Cargo.toml +++ b/operator/runtime/testnet/Cargo.toml @@ -18,10 +18,11 @@ bridge-hub-common = { workspace = true, optional = true } codec = { workspace = true, features = ["derive"] } datahaven-runtime-common = { workspace = true } dhp-bridge = { workspace = true } +ethereum = { workspace = true } fp-account = { workspace = true, features = ["serde"] } fp-evm = { workspace = true, features = ["serde"] } fp-rpc = { workspace = true } -fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] } +fp-self-contained = { workspace = true, features = ["serde"] } frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } @@ -190,6 +191,7 @@ std = [ "alloy-core/std", "codec/std", "datahaven-runtime-common/std", + "ethereum/std", "fp-account/std", "fp-evm/std", "frame-benchmarking?/std", diff --git a/operator/runtime/testnet/src/configs/governance/origins.rs b/operator/runtime/testnet/src/configs/governance/origins.rs index 0f943cf6..be8043d8 100644 --- a/operator/runtime/testnet/src/configs/governance/origins.rs +++ b/operator/runtime/testnet/src/configs/governance/origins.rs @@ -34,7 +34,16 @@ pub mod custom_origins { pub struct Pallet(_); #[derive( - PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug, EnumString, + PartialEq, + Eq, + Clone, + MaxEncodedLen, + Encode, + Decode, + TypeInfo, + RuntimeDebug, + EnumString, + DecodeWithMemTracking, )] #[strum(serialize_all = "snake_case")] #[pallet::origin] diff --git a/operator/runtime/testnet/src/configs/governance/referenda.rs b/operator/runtime/testnet/src/configs/governance/referenda.rs index 29feae39..e65727d3 100644 --- a/operator/runtime/testnet/src/configs/governance/referenda.rs +++ b/operator/runtime/testnet/src/configs/governance/referenda.rs @@ -57,6 +57,8 @@ impl pallet_conviction_voting::Config for Runtime { type MaxVotes = ConstU32<20>; type MaxTurnout = frame_support::traits::TotalIssuanceOf; type Polls = Referenda; + type BlockNumberProvider = System; + type VotingHooks = (); } impl pallet_whitelist::Config for Runtime { diff --git a/operator/runtime/testnet/src/configs/governance/tracks.rs b/operator/runtime/testnet/src/configs/governance/tracks.rs index c1b8a233..a97cf314 100644 --- a/operator/runtime/testnet/src/configs/governance/tracks.rs +++ b/operator/runtime/testnet/src/configs/governance/tracks.rs @@ -21,9 +21,13 @@ use super::*; use crate::currency::{HAVE, KILOHAVE, SUPPLY_FACTOR}; +use alloc::borrow::Cow; +use core::str::from_utf8; +use core::str::FromStr; use datahaven_runtime_common::time::*; use pallet_referenda::Curve; -use sp_std::str::FromStr; +use pallet_referenda::Track; +use sp_runtime::str_array; const fn percent(x: i32) -> sp_runtime::FixedI64 { sp_runtime::FixedI64::from_rational(x as u128, 100) @@ -32,12 +36,12 @@ const fn permill(x: i32) -> sp_runtime::FixedI64 { sp_runtime::FixedI64::from_rational(x as u128, 1000) } -const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] = [ - ( - 0, - pallet_referenda::TrackInfo { +const TRACKS_DATA: [Track; 6] = [ + Track { + id: 0, + info: pallet_referenda::TrackInfo { // Name of this track. - name: "root", + name: str_array("root"), // A limit for the number of referenda on this track that can be being decided at once. // For Root origin this should generally be just one. max_deciding: 5, @@ -58,11 +62,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] // is needed for approval as a function of time into decision period. min_support: Curve::make_linear(14, 14, permill(5), percent(25)), }, - ), - ( - 1, - pallet_referenda::TrackInfo { - name: "whitelisted_caller", + }, + Track { + id: 1, + info: pallet_referenda::TrackInfo { + name: str_array("whitelisted_caller"), max_deciding: 100, decision_deposit: 10 * KILOHAVE * SUPPLY_FACTOR, prepare_period: 10 * MINUTES, @@ -72,11 +76,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14 * 24, percent(1), percent(0), percent(2)), }, - ), - ( - 2, - pallet_referenda::TrackInfo { - name: "general_admin", + }, + Track { + id: 2, + info: pallet_referenda::TrackInfo { + name: str_array("general_admin"), max_deciding: 10, decision_deposit: 500 * HAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -86,11 +90,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(4, 14, percent(80), percent(50), percent(100)), min_support: Curve::make_reciprocal(7, 14, percent(10), percent(0), percent(50)), }, - ), - ( - 3, - pallet_referenda::TrackInfo { - name: "referendum_canceller", + }, + Track { + id: 3, + info: pallet_referenda::TrackInfo { + name: str_array("referendum_canceller"), max_deciding: 20, decision_deposit: 10 * KILOHAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -100,11 +104,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14, percent(1), percent(0), percent(10)), }, - ), - ( - 4, - pallet_referenda::TrackInfo { - name: "referendum_killer", + }, + Track { + id: 4, + info: pallet_referenda::TrackInfo { + name: str_array("referendum_killer"), max_deciding: 100, decision_deposit: 20 * KILOHAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -114,11 +118,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(1, 14, percent(96), percent(50), percent(100)), min_support: Curve::make_reciprocal(1, 14, percent(1), percent(0), percent(10)), }, - ), - ( - 5, - pallet_referenda::TrackInfo { - name: "fast_general_admin", + }, + Track { + id: 5, + info: pallet_referenda::TrackInfo { + name: str_array("fast_general_admin"), max_deciding: 10, decision_deposit: 500 * HAVE * SUPPLY_FACTOR, prepare_period: 1 * HOURS, @@ -128,25 +132,25 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 6] min_approval: Curve::make_reciprocal(4, 14, percent(80), percent(50), percent(100)), min_support: Curve::make_reciprocal(5, 14, percent(1), percent(0), percent(50)), }, - ), + }, ]; pub struct TracksInfo; impl pallet_referenda::TracksInfo for TracksInfo { type Id = u16; type RuntimeOrigin = ::PalletsOrigin; - fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] { - &TRACKS_DATA[..] + fn tracks() -> impl Iterator>> { + TRACKS_DATA.iter().map(Cow::Borrowed) } fn track_for(id: &Self::RuntimeOrigin) -> Result { if let Ok(system_origin) = frame_system::RawOrigin::try_from(id.clone()) { match system_origin { frame_system::RawOrigin::Root => { - if let Some((track_id, _)) = Self::tracks() + if let Some(track) = Self::tracks() .into_iter() - .find(|(_, track)| track.name == "root") + .find(|track| track.info.name == str_array("root")) { - Ok(*track_id) + Ok(track.id) } else { Err(()) } @@ -154,14 +158,18 @@ impl pallet_referenda::TracksInfo for TracksInfo { _ => Err(()), } } else if let Ok(custom_origin) = custom_origins::Origin::try_from(id.clone()) { - if let Some((track_id, _)) = Self::tracks().into_iter().find(|(_, track)| { - if let Ok(track_custom_origin) = custom_origins::Origin::from_str(track.name) { + if let Some(track) = Self::tracks().into_iter().find(|track| { + let Ok(track_name) = from_utf8(&track.info.name) else { + return false; + }; + let track_name = track_name.trim_end_matches('\0'); + if let Ok(track_custom_origin) = custom_origins::Origin::from_str(track_name) { track_custom_origin == custom_origin } else { false } }) { - Ok(*track_id) + Ok(track.id) } else { Err(()) } @@ -174,7 +182,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { #[test] /// To ensure voters are always locked into their vote fn vote_locking_always_longer_than_enactment_period() { - for (_, track) in TRACKS_DATA { + for track in TRACKS_DATA { assert!( ::VoteLockingPeriod::get() >= track.min_enactment_period, @@ -188,9 +196,9 @@ fn vote_locking_always_longer_than_enactment_period() { #[test] fn all_tracks_have_origins() { - for (_, track) in TRACKS_DATA { + for track in TRACKS_DATA { // check name.into() is successful either converts into "root" or custom origin - let track_is_root = track.name == "root"; + let track_is_root = track.name == str_array("root"); let track_has_custom_origin = custom_origins::Origin::from_str(track.name).is_ok(); assert!(track_is_root || track_has_custom_origin); } diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index 27dbc538..5b9b1437 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -30,8 +30,9 @@ use super::{ Signature, System, Timestamp, Treasury, TxPause, BLOCK_HASH_COUNT, EXTRINSIC_BASE_WEIGHT, MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION, }; +use alloc::vec::Vec; use alloy_core::primitives::Address; -use codec::{Decode, Encode, MaxEncodedLen}; +use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{traits::AccountIdConversion, RuntimeDebug}; @@ -49,6 +50,7 @@ use sp_runtime::{traits::AccountIdConversion, RuntimeDebug}; RuntimeDebug, MaxEncodedLen, TypeInfo, + DecodeWithMemTracking, serde::Serialize, serde::Deserialize, )] @@ -76,6 +78,10 @@ impl Default for ProxyType { Self::Any } } +use core::{ + convert::{From, Into}, + prelude::*, +}; use datahaven_runtime_common::{ deal_with_fees::{ DealWithEthereumBaseFees, DealWithEthereumPriorityFees, DealWithSubstrateFeesAndTip, @@ -141,10 +147,6 @@ use sp_runtime::{ FixedPointNumber, Perbill, Perquintill, }; use sp_staking::EraIndex; -use sp_std::{ - convert::{From, Into}, - prelude::*, -}; use sp_version::RuntimeVersion; use xcm::latest::NetworkId; use xcm::prelude::*; @@ -395,6 +397,7 @@ impl pallet_session::Config for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = testnet_weights::pallet_session::WeightInfo; + type DisablingStrategy = (); } parameter_types! { @@ -593,6 +596,7 @@ impl pallet_scheduler::Config for Runtime { type OriginPrivilegeCmp = EqualPrivilegeOnly; type Preimages = Preimage; type WeightInfo = testnet_weights::pallet_scheduler::WeightInfo; + type BlockNumberProvider = System; } parameter_types! { @@ -687,6 +691,7 @@ impl pallet_multisig::Config for Runtime { type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; type WeightInfo = testnet_weights::pallet_multisig::WeightInfo; + type BlockNumberProvider = System; } parameter_types! { @@ -852,6 +857,7 @@ impl pallet_proxy::Config for Runtime { type CallHasher = sp_runtime::traits::BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = System; } impl pallet_proxy_genesis_companion::Config for Runtime { @@ -1053,6 +1059,8 @@ impl pallet_evm::Config for Runtime { type GasLimitPovSizeRatio = GasLimitPovSizeRatio; type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio; type Timestamp = Timestamp; + type CreateOriginFilter = (); + type CreateInnerOriginFilter = (); type WeightInfo = testnet_weights::pallet_evm::WeightInfo; } diff --git a/operator/runtime/testnet/src/configs/runtime_params.rs b/operator/runtime/testnet/src/configs/runtime_params.rs index 40c89108..b0ffbfc9 100644 --- a/operator/runtime/testnet/src/configs/runtime_params.rs +++ b/operator/runtime/testnet/src/configs/runtime_params.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . +use alloc::vec; use frame_support::dynamic_params::{dynamic_pallet_params, dynamic_params}; use hex_literal::hex; use sp_core::{ConstU32, H160, H256}; use sp_runtime::{BoundedVec, Perbill}; -use sp_std::vec; use crate::Runtime; diff --git a/operator/runtime/testnet/src/configs/storagehub/mod.rs b/operator/runtime/testnet/src/configs/storagehub/mod.rs index 7717475c..3b0505ba 100644 --- a/operator/runtime/testnet/src/configs/storagehub/mod.rs +++ b/operator/runtime/testnet/src/configs/storagehub/mod.rs @@ -13,13 +13,14 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . +extern crate alloc; #[cfg(not(feature = "runtime-benchmarks"))] use super::HAVE; #[cfg(feature = "runtime-benchmarks")] use super::MICROHAVE; use super::{ - AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, + AccountId, Balance, Balances, BlockNumber, Hash, RuntimeEvent, RuntimeHoldReason, System, TreasuryAccount, }; use crate::configs::runtime_params::dynamic_params::runtime_config; @@ -27,6 +28,8 @@ use crate::{ BucketNfts, Nfts, PaymentStreams, ProofsDealer, Providers, Runtime, Signature, WeightToFee, HOURS, }; +use alloc::{vec, vec::Vec}; +use core::convert::{From, Into}; use core::marker::PhantomData; #[cfg(feature = "runtime-benchmarks")] use datahaven_runtime_common::benchmarking::StorageHubBenchmarking; @@ -59,8 +62,6 @@ use sp_runtime::traits::Verify; use sp_runtime::traits::Zero; use sp_runtime::SaturatedConversion; use sp_runtime::{traits::BlakeTwo256, Perbill}; -use sp_std::convert::{From, Into}; -use sp_std::{vec, vec::Vec}; use sp_trie::{LayoutV1, TrieConfiguration, TrieLayout}; #[cfg(feature = "std")] @@ -126,6 +127,7 @@ impl pallet_nfts::Config for Runtime { type OffchainPublic = ::Signer; type WeightInfo = crate::weights::pallet_nfts::WeightInfo; type Locker = (); + type BlockNumberProvider = System; #[cfg(feature = "runtime-benchmarks")] type Helper = benchmark_helpers::NftHelper; } diff --git a/operator/runtime/testnet/src/genesis_config_presets.rs b/operator/runtime/testnet/src/genesis_config_presets.rs index e568f266..d5875718 100644 --- a/operator/runtime/testnet/src/genesis_config_presets.rs +++ b/operator/runtime/testnet/src/genesis_config_presets.rs @@ -56,6 +56,7 @@ fn testnet_genesis( .cloned() .map(|k| (k, 1u128 << 80)) .collect::>(), + dev_accounts: Default::default(), }, babe: pallet_babe::GenesisConfig { epoch_config: BABE_GENESIS_EPOCH_CONFIG, diff --git a/operator/runtime/testnet/src/lib.rs b/operator/runtime/testnet/src/lib.rs index a8248dbd..d549b48e 100644 --- a/operator/runtime/testnet/src/lib.rs +++ b/operator/runtime/testnet/src/lib.rs @@ -37,8 +37,10 @@ use pallet_collective as pallet_collective_treasury_council; #[allow(unused_imports)] use pallet_collective as pallet_collective_technical_committee; +use alloc::collections::btree_map::BTreeMap; use alloc::{borrow::Cow, vec::Vec}; use codec::Encode; +use ethereum::AuthorizationList; use fp_rpc::TransactionStatus; use frame_support::{ genesis_builder_helper::{build_state, get_preset}, @@ -85,7 +87,6 @@ use sp_runtime::{ transaction_validity::{InvalidTransaction, TransactionSource}, ApplyExtrinsicResult, Perbill, Permill, }; -use sp_std::collections::btree_map::BTreeMap; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -1073,6 +1074,7 @@ impl_runtime_apis! { nonce: Option, estimate: bool, access_list: Option)>>, + authorization_list: Option, ) -> Result { let config = if estimate { let mut config = ::config().clone(); @@ -1102,6 +1104,7 @@ impl_runtime_apis! { max_priority_fee_per_gas, nonce, access_list.unwrap_or_default(), + authorization_list.unwrap_or_default(), is_transactional, validate, Some(weight_limit), @@ -1120,6 +1123,7 @@ impl_runtime_apis! { nonce: Option, estimate: bool, access_list: Option)>>, + authorization_list: Option, ) -> Result { let config = if estimate { let mut config = ::config().clone(); @@ -1153,6 +1157,7 @@ impl_runtime_apis! { max_priority_fee_per_gas, nonce, access_list.unwrap_or_default(), + authorization_list.unwrap_or_default(), is_transactional, validate, Some(weight_limit), @@ -1414,7 +1419,7 @@ impl_runtime_apis! { fn compute_signed_extra_implicit( era: sp_runtime::generic::Era, enable_metadata: bool, - ) -> Result, sp_runtime::transaction_validity::TransactionValidityError> { + ) -> Result, sp_runtime::transaction_validity::TransactionValidityError> { // Build the SignedExtra tuple with minimal values; only `era` and `enable_metadata` // influence the implicit. Other extensions have `()` implicit. let extra: SignedExtra = ( diff --git a/operator/runtime/testnet/src/weights/pallet_beefy_mmr.rs b/operator/runtime/testnet/src/weights/pallet_beefy_mmr.rs index e9364feb..4a536f01 100644 --- a/operator/runtime/testnet/src/weights/pallet_beefy_mmr.rs +++ b/operator/runtime/testnet/src/weights/pallet_beefy_mmr.rs @@ -90,4 +90,6 @@ impl pallet_beefy_mmr::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(1_513_924, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } + + fn n_leafs_proof_is_optimal(_: u32) -> sp_runtime::Weight { todo!() } } diff --git a/operator/runtime/testnet/src/weights/pallet_message_queue.rs b/operator/runtime/testnet/src/weights/pallet_message_queue.rs index 2f4d7d50..c9c4413c 100644 --- a/operator/runtime/testnet/src/weights/pallet_message_queue.rs +++ b/operator/runtime/testnet/src/weights/pallet_message_queue.rs @@ -178,4 +178,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + fn set_service_head() -> Weight { + todo!() + } } diff --git a/operator/runtime/testnet/src/weights/pallet_multisig.rs b/operator/runtime/testnet/src/weights/pallet_multisig.rs index 4cd22b25..fff435ce 100644 --- a/operator/runtime/testnet/src/weights/pallet_multisig.rs +++ b/operator/runtime/testnet/src/weights/pallet_multisig.rs @@ -169,4 +169,6 @@ impl pallet_multisig::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + fn poke_deposit(_: u32) -> sp_runtime::Weight { todo!() } } diff --git a/operator/runtime/testnet/src/weights/pallet_proxy.rs b/operator/runtime/testnet/src/weights/pallet_proxy.rs index 43e52ea6..b5e44871 100644 --- a/operator/runtime/testnet/src/weights/pallet_proxy.rs +++ b/operator/runtime/testnet/src/weights/pallet_proxy.rs @@ -224,4 +224,19 @@ impl pallet_proxy::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(845), added: 3320, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(1837), added: 4312, mode: `MaxEncodedLen`) + fn poke_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `496` + // Estimated: `5302` + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(32_000_000, 5302) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } } diff --git a/operator/runtime/testnet/src/weights/pallet_utility.rs b/operator/runtime/testnet/src/weights/pallet_utility.rs index 1088c16b..89e069e8 100644 --- a/operator/runtime/testnet/src/weights/pallet_utility.rs +++ b/operator/runtime/testnet/src/weights/pallet_utility.rs @@ -119,4 +119,21 @@ impl pallet_utility::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(6_535_635, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } + fn dispatch_as_fallible() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(5_000_000, 0) + } + /// Storage: `MaintenanceMode::MaintenanceMode` (r:1 w:0) + /// Proof: `MaintenanceMode::MaintenanceMode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn if_else() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `1527` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(8_000_000, 1527) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } } diff --git a/operator/runtime/testnet/tests/common.rs b/operator/runtime/testnet/tests/common.rs index b2df06ea..77550995 100644 --- a/operator/runtime/testnet/tests/common.rs +++ b/operator/runtime/testnet/tests/common.rs @@ -168,9 +168,12 @@ impl ExtBuilder { .build_storage() .expect("System pallet builds valid default genesis config"); - pallet_balances::GenesisConfig:: { balances } - .assimilate_storage(&mut t) - .expect("Pallet balances storage can be assimilated"); + pallet_balances::GenesisConfig:: { + balances, + dev_accounts: Default::default(), + } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); // Set up session keys for validators let session_keys: Vec<_> = validators diff --git a/operator/runtime/testnet/tests/governance/benchmarks.rs b/operator/runtime/testnet/tests/governance/benchmarks.rs index 0bd3b245..d737f581 100644 --- a/operator/runtime/testnet/tests/governance/benchmarks.rs +++ b/operator/runtime/testnet/tests/governance/benchmarks.rs @@ -23,6 +23,7 @@ #![cfg(feature = "runtime-benchmarks")] use crate::common::*; +use alloc::vec::Vec; use datahaven_testnet_runtime::{ configs::governance::council::{TechnicalMaxMembers, TechnicalMaxProposals}, governance::TracksInfo, @@ -36,7 +37,6 @@ use frame_support::{ traits::{Get, StorePreimage}, }; use pallet_conviction_voting::{AccountVote, Conviction, Vote}; -use sp_std::vec::Vec; /// Benchmark council proposal creation with varying member counts #[test]