runtime compiling

This commit is contained in:
undercover-cactus 2026-02-13 13:47:24 +01:00
parent 1fe1aa66b6
commit 68afceb1ba
79 changed files with 480 additions and 189 deletions

3
operator/Cargo.lock generated
View file

@ -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",

View file

@ -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 }

View file

@ -166,9 +166,12 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
(BOB, INITIAL_BALANCE),
(CHARLIE, INITIAL_BALANCE),
];
pallet_balances::GenesisConfig::<Test> { balances }
.assimilate_storage(&mut t)
.unwrap();
pallet_balances::GenesisConfig::<Test> {
balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.unwrap();
let mut ext: sp_io::TestExternalities = t.into();
ext.execute_with(|| {

View file

@ -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,
}
};

View file

@ -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,
}
};
}

View file

@ -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!(

View file

@ -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]
);
});
}

View file

@ -171,6 +171,7 @@ impl pallet_session::Config for Test {
type ValidatorIdOf = ConvertInto;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type WeightInfo = ();
type DisablingStrategy = ();
}
sp_runtime::impl_opaque_keys! {

View file

@ -283,6 +283,7 @@ impl HandleInflation<H160> 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<ActiveEraInfo>,
pub era_inflation: Option<u128>,
/// Set of validators that are considered offline (for liveness testing)
pub offline_validators: sp_std::vec::Vec<sp_core::H160>,
pub offline_validators: Vec<sp_core::H160>,
/// 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::<Test> { balances }
.assimilate_storage(&mut t)
.unwrap();
pallet_balances::GenesisConfig::<Test> {
balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.unwrap();
let ext: sp_io::TestExternalities = t.into();

View file

@ -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]

View file

@ -301,7 +301,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
};
pallet_balances::GenesisConfig::<Test> {
balances,
..Default::default()
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.unwrap();

View file

@ -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::<Test> {
balances: self.balances,
..Default::default()
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -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};

View file

@ -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<Location> for Origin {

View file

@ -196,6 +196,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
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::<Runtime>::create_account(
Revert.into(),
hex_literal::hex!("1460006000fd").to_vec(),
None,
);
});
ext

View file

@ -45,6 +45,7 @@ fn evm_call(from: impl Into<H160>, input: Vec<u8>) -> EvmCall<Runtime> {
max_priority_fee_per_gas: Some(U256::zero()),
nonce: None, // Use the next nonce
access_list: Vec::new(),
authorization_list: Vec::new(),
}
}

View file

@ -180,6 +180,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
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::<Runtime>::create_account(
Revert.into(),
hex_literal::hex!("1460006000fd").to_vec(),
None,
);
});
ext

View file

@ -298,6 +298,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balances.clone(),
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -266,6 +266,8 @@ impl pallet_conviction_voting::Config for Runtime {
type WeightInfo = ();
type MaxTurnout = TotalIssuanceOf<Balances, Self::AccountId>;
type Polls = TestPolls;
type BlockNumberProvider = ();
type VotingHooks = ();
}
pub(crate) struct ExtBuilder {
@ -294,6 +296,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balances.clone(),
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -45,6 +45,7 @@ fn evm_call(input: Vec<u8>) -> EvmCall<Runtime> {
max_priority_fee_per_gas: Some(U256::zero()),
nonce: None,
access_list: Vec::new(),
authorization_list: Vec::new(),
}
}

View file

@ -272,6 +272,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -207,6 +207,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -576,6 +576,7 @@ fn deposit(data: Vec<u8>) {
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");

View file

@ -240,6 +240,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balances.clone(),
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -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::<Runtime>(41)?;
pallet_evm::Pallet::<Runtime>::create_account(address.0, DUMMY_CODE.to_vec(), None);
let _ = pallet_evm::Pallet::<Runtime>::create_account(address.0, DUMMY_CODE.to_vec(), None);
Ok(())
}

View file

@ -181,6 +181,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
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::<Runtime>::create_account(
SmartContract.into(),
b"SmartContract".to_vec(),
None,
);
});
ext

View file

@ -187,6 +187,7 @@ impl ExtBuilder {
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -34,6 +34,7 @@ fn evm_call(input: Vec<u8>) -> EvmCall<Runtime> {
max_priority_fee_per_gas: Some(U256::zero()),
nonce: None,
access_list: Vec::new(),
authorization_list: Vec::new(),
}
}

View file

@ -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::<Runtime> {
balances: self.balances.clone(),
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -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<Vec<(u8, TrackInfo<Balance, u32>)>> 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<Vec<(u8, TrackInfo<Balance, u32>)>> 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<Balance, u32> for TestTracksInfo {
type Id = u8;
type RuntimeOrigin = OriginCaller;
fn tracks() -> &'static [(Self::Id, TrackInfo<Balance, u32>)] {
static TRACKS: &[(u8, TrackInfo<Balance, u32>)] = &[
fn tracks() -> impl Iterator<Item = Cow<'static, Track<Self::Id, Balance, u32>>> {
static DATA: [Track<u8, u128, u32>; 2] = [
(
0,
TrackInfo {
name: "root",
name: str_array("root"),
max_deciding: 1,
decision_deposit: 10,
prepare_period: 2,
@ -350,7 +353,7 @@ impl TracksInfo<Balance, u32> 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::<Runtime> {
balances: self.balances,
dev_accounts: Default::default(),
}
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");

View file

@ -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,

View file

@ -1,13 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
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<Balance> {
/// ETH/DOT exchange rate
pub exchange_rate: FixedU128,
@ -19,7 +21,9 @@ pub struct PricingParameters<Balance> {
pub multiplier: FixedU128,
}
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)]
#[derive(
Clone, Encode, Decode, PartialEq, RuntimeDebug, MaxEncodedLen, DecodeWithMemTracking, TypeInfo,
)]
pub struct Rewards<Balance> {
/// Local reward in DOT
pub local: Balance,

View file

@ -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<Location> for Origin {

View file

@ -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",

View file

@ -34,7 +34,16 @@ pub mod custom_origins {
pub struct Pallet<T>(_);
#[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]

View file

@ -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<Balance, BlockNumber>); 6] = [
(
0,
pallet_referenda::TrackInfo {
const TRACKS_DATA: [Track<u16, Balance, BlockNumber>; 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber> 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<Balance, BlockNumber> 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<Balance, BlockNumber> 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!(
<Runtime as pallet_conviction_voting::Config>::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();

View file

@ -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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = mainnet_weights::pallet_session::WeightInfo<Runtime>;
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<Runtime>;
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<Runtime>;
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<Runtime>;
}

View file

@ -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 = <Signature as Verify>::Signer;
type WeightInfo = crate::weights::pallet_nfts::WeightInfo<Runtime>;
type Locker = ();
type BlockNumberProvider = System;
#[cfg(feature = "runtime-benchmarks")]
type Helper = benchmark_helpers::NftHelper;
}

View file

@ -56,6 +56,7 @@ fn testnet_genesis(
.cloned()
.map(|k| (k, 1u128 << 110))
.collect::<Vec<_>>(),
dev_accounts: Default::default(),
},
babe: pallet_babe::GenesisConfig {
epoch_config: BABE_GENESIS_EPOCH_CONFIG,

View file

@ -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<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
authorization_list: Option<AuthorizationList>,
) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
authorization_list: Option<AuthorizationList>,
) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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_std::vec::Vec<u8>, sp_runtime::transaction_validity::TransactionValidityError> {
) -> Result<alloc::vec::Vec<u8>, 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 = (

View file

@ -90,4 +90,6 @@ impl<T: frame_system::Config> pallet_beefy_mmr::WeightInfo for WeightInfo<T> {
.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!() }
}

View file

@ -178,4 +178,8 @@ impl<T: frame_system::Config> pallet_message_queue::WeightInfo for WeightInfo<T>
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
fn set_service_head() -> Weight {
todo!()
}
}

View file

@ -169,4 +169,6 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn poke_deposit(_: u32) -> sp_runtime::Weight { todo!() }
}

View file

@ -224,4 +224,8 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn poke_deposit() -> Weight {
todo!()
}
}

View file

@ -119,4 +119,11 @@ impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
.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!()
}
}

View file

@ -168,9 +168,12 @@ impl ExtBuilder {
.build_storage()
.expect("System pallet builds valid default genesis config");
pallet_balances::GenesisConfig::<Runtime> { balances }
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");
pallet_balances::GenesisConfig::<Runtime> {
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

View file

@ -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]

View file

@ -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",

View file

@ -34,7 +34,16 @@ pub mod custom_origins {
pub struct Pallet<T>(_);
#[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]

View file

@ -57,6 +57,8 @@ impl pallet_conviction_voting::Config for Runtime {
type MaxVotes = ConstU32<20>;
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, AccountId>;
type Polls = Referenda;
type BlockNumberProvider = System;
type VotingHooks = ();
}
impl pallet_whitelist::Config for Runtime {

View file

@ -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<Balance, BlockNumber>); 6] = [
(
0,
pallet_referenda::TrackInfo {
const TRACKS_DATA: [Track<u16, Balance, BlockNumber>; 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber> for TracksInfo {
type Id = u16;
type RuntimeOrigin = <RuntimeOrigin as frame_support::traits::OriginTrait>::PalletsOrigin;
fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo<Balance, BlockNumber>)] {
&TRACKS_DATA[..]
fn tracks() -> impl Iterator<Item = Cow<'static, Track<Self::Id, Balance, BlockNumber>>> {
TRACKS_DATA.iter().map(Cow::Borrowed)
}
fn track_for(id: &Self::RuntimeOrigin) -> Result<Self::Id, ()> {
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<Balance, BlockNumber> 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(())
}

View file

@ -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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = stagenet_weights::pallet_session::WeightInfo<Runtime>;
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<Runtime>;
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<Runtime>;
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<Runtime>;
}

View file

@ -15,11 +15,11 @@
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
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};

View file

@ -13,13 +13,14 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
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 = <Signature as Verify>::Signer;
type WeightInfo = crate::weights::pallet_nfts::WeightInfo<Runtime>;
type Locker = ();
type BlockNumberProvider = System;
#[cfg(feature = "runtime-benchmarks")]
type Helper = benchmark_helpers::NftHelper;
}

View file

@ -56,6 +56,7 @@ fn testnet_genesis(
.cloned()
.map(|k| (k, 1u128 << 80))
.collect::<Vec<_>>(),
dev_accounts: Default::default(),
},
babe: pallet_babe::GenesisConfig {
epoch_config: BABE_GENESIS_EPOCH_CONFIG,

View file

@ -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<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
authorization_list: Option<AuthorizationList>,
) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
authorization_list: Option<AuthorizationList>,
) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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_std::vec::Vec<u8>, sp_runtime::transaction_validity::TransactionValidityError> {
) -> Result<Vec<u8>, 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 = (

View file

@ -90,4 +90,6 @@ impl<T: frame_system::Config> pallet_beefy_mmr::WeightInfo for WeightInfo<T> {
.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!() }
}

View file

@ -178,4 +178,8 @@ impl<T: frame_system::Config> pallet_message_queue::WeightInfo for WeightInfo<T>
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
fn set_service_head() -> Weight {
todo!()
}
}

View file

@ -169,4 +169,6 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn poke_deposit(_: u32) -> sp_runtime::Weight { todo!() }
}

View file

@ -224,4 +224,8 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn poke_deposit() -> Weight {
todo!()
}
}

View file

@ -119,4 +119,11 @@ impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
.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!()
}
}

View file

@ -168,9 +168,12 @@ impl ExtBuilder {
.build_storage()
.expect("System pallet builds valid default genesis config");
pallet_balances::GenesisConfig::<Runtime> { balances }
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");
pallet_balances::GenesisConfig::<Runtime> {
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

View file

@ -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]

View file

@ -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",

View file

@ -34,7 +34,16 @@ pub mod custom_origins {
pub struct Pallet<T>(_);
#[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]

View file

@ -57,6 +57,8 @@ impl pallet_conviction_voting::Config for Runtime {
type MaxVotes = ConstU32<20>;
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, AccountId>;
type Polls = Referenda;
type BlockNumberProvider = System;
type VotingHooks = ();
}
impl pallet_whitelist::Config for Runtime {

View file

@ -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<Balance, BlockNumber>); 6] = [
(
0,
pallet_referenda::TrackInfo {
const TRACKS_DATA: [Track<u16, Balance, BlockNumber>; 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber>); 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<Balance, BlockNumber> for TracksInfo {
type Id = u16;
type RuntimeOrigin = <RuntimeOrigin as frame_support::traits::OriginTrait>::PalletsOrigin;
fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo<Balance, BlockNumber>)] {
&TRACKS_DATA[..]
fn tracks() -> impl Iterator<Item = Cow<'static, Track<Self::Id, Balance, BlockNumber>>> {
TRACKS_DATA.iter().map(Cow::Borrowed)
}
fn track_for(id: &Self::RuntimeOrigin) -> Result<Self::Id, ()> {
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<Balance, BlockNumber> 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<Balance, BlockNumber> 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!(
<Runtime as pallet_conviction_voting::Config>::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);
}

View file

@ -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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = testnet_weights::pallet_session::WeightInfo<Runtime>;
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<Runtime>;
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<Runtime>;
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<Runtime>;
}

View file

@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
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;

View file

@ -13,13 +13,14 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
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 = <Signature as Verify>::Signer;
type WeightInfo = crate::weights::pallet_nfts::WeightInfo<Runtime>;
type Locker = ();
type BlockNumberProvider = System;
#[cfg(feature = "runtime-benchmarks")]
type Helper = benchmark_helpers::NftHelper;
}

View file

@ -56,6 +56,7 @@ fn testnet_genesis(
.cloned()
.map(|k| (k, 1u128 << 80))
.collect::<Vec<_>>(),
dev_accounts: Default::default(),
},
babe: pallet_babe::GenesisConfig {
epoch_config: BABE_GENESIS_EPOCH_CONFIG,

View file

@ -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<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
authorization_list: Option<AuthorizationList>,
) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
authorization_list: Option<AuthorizationList>,
) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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_std::vec::Vec<u8>, sp_runtime::transaction_validity::TransactionValidityError> {
) -> Result<Vec<u8>, 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 = (

View file

@ -90,4 +90,6 @@ impl<T: frame_system::Config> pallet_beefy_mmr::WeightInfo for WeightInfo<T> {
.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!() }
}

View file

@ -178,4 +178,8 @@ impl<T: frame_system::Config> pallet_message_queue::WeightInfo for WeightInfo<T>
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
fn set_service_head() -> Weight {
todo!()
}
}

View file

@ -169,4 +169,6 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn poke_deposit(_: u32) -> sp_runtime::Weight { todo!() }
}

View file

@ -224,4 +224,19 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
.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))
}
}

View file

@ -119,4 +119,21 @@ impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
.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))
}
}

View file

@ -168,9 +168,12 @@ impl ExtBuilder {
.build_storage()
.expect("System pallet builds valid default genesis config");
pallet_balances::GenesisConfig::<Runtime> { balances }
.assimilate_storage(&mut t)
.expect("Pallet balances storage can be assimilated");
pallet_balances::GenesisConfig::<Runtime> {
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

View file

@ -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]