Merge branch 'develop' into next

This commit is contained in:
Luke Parker
2025-10-05 18:43:53 -04:00
102 changed files with 3016 additions and 4149 deletions

View File

@@ -13,17 +13,16 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.cargo-machete]
ignored = ["scale", "scale-info"]
ignored = ["scale"]
[lints]
workspace = true
[dependencies]
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false }
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
dex-pallet = { package = "serai-dex-pallet", path = "../../dex/pallet", default-features = false }
coins-pallet = { package = "serai-coins-pallet", path = "../../coins/pallet", default-features = false }
@@ -31,21 +30,21 @@ coins-pallet = { package = "serai-coins-pallet", path = "../../coins/pallet", de
serai-primitives = { path = "../../primitives", default-features = false }
[dev-dependencies]
pallet-babe = { git = "https://github.com/serai-dex/substrate", default-features = false }
pallet-grandpa = { git = "https://github.com/serai-dex/substrate", default-features = false }
pallet-timestamp = { git = "https://github.com/serai-dex/substrate", default-features = false }
pallet-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b" }
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
validator-sets-pallet = { package = "serai-validator-sets-pallet", path = "../../validator-sets/pallet", default-features = false }
sp-io = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-consensus-babe = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
sp-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "da19e1f8ca7a9e2cbf39fbfa493918eeeb45e10b", default-features = false }
[features]
std = [
"scale/std",
"scale-info/std",
"frame-system/std",
"frame-support/std",

View File

@@ -23,9 +23,7 @@ pub mod pallet {
use serai_primitives::*;
#[pallet::config]
pub trait Config: frame_system::Config + CoinsConfig + DexConfig {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
pub trait Config: frame_system::Config + CoinsConfig + DexConfig {}
#[pallet::event]
#[pallet::generate_deposit(fn deposit_event)]

View File

@@ -6,7 +6,7 @@ use core::marker::PhantomData;
use std::collections::HashMap;
use frame_support::{
construct_runtime,
derive_impl, construct_runtime,
traits::{ConstU16, ConstU32, ConstU64},
};
@@ -58,10 +58,9 @@ construct_runtime!(
}
);
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
@@ -72,16 +71,6 @@ impl frame_system::Config for Test {
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}
impl timestamp::Config for Test {
@@ -91,6 +80,16 @@ impl timestamp::Config for Test {
type WeightInfo = ();
}
pub struct GetSession;
impl pallet_session::GetCurrentSessionForSubstrate for GetSession {
fn get() -> u32 {
0
}
}
impl pallet_session::Config for Test {
type Session = GetSession;
}
impl babe::Config for Test {
type EpochDuration = ConstU64<{ FAST_EPOCH_DURATION }>;
@@ -100,6 +99,7 @@ impl babe::Config for Test {
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxAuthorities;
type KeyOwnerProof = MembershipProof<Self>;
type EquivocationReportSystem = ();
@@ -110,6 +110,7 @@ impl grandpa::Config for Test {
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxAuthorities;
type MaxSetIdSessionEntries = ConstU64<0>;
type KeyOwnerProof = MembershipProof<Self>;
@@ -117,18 +118,14 @@ impl grandpa::Config for Test {
}
impl coins::Config for Test {
type RuntimeEvent = RuntimeEvent;
type AllowMint = ValidatorSets;
}
impl coins::Config<coins::Instance1> for Test {
type RuntimeEvent = RuntimeEvent;
type AllowMint = ();
}
impl dex::Config for Test {
type RuntimeEvent = RuntimeEvent;
type LPFee = ConstU32<3>; // 0.3%
type MintMinLiquidity = ConstU64<10000>;
@@ -140,13 +137,10 @@ impl dex::Config for Test {
}
impl validator_sets::Config for Test {
type RuntimeEvent = RuntimeEvent;
type ShouldEndSession = Babe;
}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
}
impl Config for Test {}
// For a const we can't define
pub fn genesis_participants() -> Vec<Pair> {
@@ -202,7 +196,7 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
.into_iter()
.map(|validator| (validator.public().into(), 1))
.collect(),
epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG),
epoch_config: BABE_GENESIS_EPOCH_CONFIG,
_config: PhantomData,
}
.assimilate_storage(&mut t)

View File

@@ -17,7 +17,7 @@ fn set_keys_for_session(network: ExternalNetworkId) {
network,
KeyPair(insecure_pair_from_name("Alice").public(), vec![].try_into().unwrap()),
vec![].try_into().unwrap(),
Signature([0u8; 64]),
Signature::from([0u8; 64]),
)
.unwrap();
}