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

@@ -58,7 +58,6 @@ pub mod pallet {
+ GenesisLiqConfig
+ EmissionsConfig
{
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
#[pallet::event]

View File

@@ -5,7 +5,7 @@ use super::*;
use std::collections::HashMap;
use frame_support::{
construct_runtime,
derive_impl, construct_runtime,
traits::{ConstU16, ConstU32, ConstU64},
};
@@ -52,10 +52,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;
@@ -66,16 +65,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 {
@@ -85,6 +74,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 }>;
@@ -94,6 +93,7 @@ impl babe::Config for Test {
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxAuthorities;
type KeyOwnerProof = MembershipProof<Self>;
type EquivocationReportSystem = ();
@@ -104,6 +104,7 @@ impl grandpa::Config for Test {
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxAuthorities;
type MaxSetIdSessionEntries = ConstU64<0>;
type KeyOwnerProof = MembershipProof<Self>;
@@ -111,18 +112,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>;
@@ -134,25 +131,16 @@ impl dex::Config for Test {
}
impl validator_sets::Config for Test {
type RuntimeEvent = RuntimeEvent;
type ShouldEndSession = Babe;
}
impl genesis_liquidity::Config for Test {
type RuntimeEvent = RuntimeEvent;
}
impl genesis_liquidity::Config for Test {}
impl emissions::Config for Test {
type RuntimeEvent = RuntimeEvent;
}
impl emissions::Config for Test {}
impl economic_security::Config for Test {
type RuntimeEvent = RuntimeEvent;
}
impl economic_security::Config for Test {}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
}
impl Config for Test {}
// Amounts for single key share per network
pub fn key_shares() -> HashMap<NetworkId, Amount> {

View File

@@ -22,7 +22,7 @@ fn set_keys_for_session(key: Public) {
n,
KeyPair(key, vec![].try_into().unwrap()),
vec![].try_into().unwrap(),
Signature([0u8; 64]),
Signature::from([0u8; 64]),
)
.unwrap();
}
@@ -80,7 +80,7 @@ fn validate_batch() {
}
let call = pallet::Call::<Test>::execute_batch {
batch: SignedBatch { batch: batch.clone(), signature: Signature([0u8; 64]) },
batch: SignedBatch { batch: batch.clone(), signature: Signature::from([0u8; 64]) },
};
assert_eq!(
InInstructions::validate_unsigned(TransactionSource::External, &call),
@@ -95,7 +95,7 @@ fn validate_batch() {
// 0 signature should be invalid
let call = pallet::Call::<Test>::execute_batch {
batch: SignedBatch { batch: batch.clone(), signature: Signature([0u8; 64]) },
batch: SignedBatch { batch: batch.clone(), signature: Signature::from([0u8; 64]) },
};
assert_eq!(
InInstructions::validate_unsigned(TransactionSource::External, &call),
@@ -121,7 +121,7 @@ fn validate_batch() {
// can't submit in the first block(Block 0)
let call = pallet::Call::<Test>::execute_batch {
batch: SignedBatch { batch: batch.clone(), signature: signature.clone() },
batch: SignedBatch { batch: batch.clone(), signature },
};
assert_eq!(
InInstructions::validate_unsigned(TransactionSource::External, &call),
@@ -133,7 +133,7 @@ fn validate_batch() {
// first batch id should be 0
let call = pallet::Call::<Test>::execute_batch {
batch: SignedBatch { batch: batch.clone(), signature: signature.clone() },
batch: SignedBatch { batch: batch.clone(), signature },
};
assert_eq!(
InInstructions::validate_unsigned(TransactionSource::External, &call),
@@ -146,7 +146,7 @@ fn validate_batch() {
// can't have more than 1 batch per block
let call = pallet::Call::<Test>::execute_batch {
batch: SignedBatch { batch: batch.clone(), signature: signature.clone() },
batch: SignedBatch { batch: batch.clone(), signature },
};
assert_eq!(
InInstructions::validate_unsigned(TransactionSource::External, &call),
@@ -224,7 +224,7 @@ fn transfer_instruction() {
balance: ExternalBalance { coin, amount },
}],
},
signature: Signature([0u8; 64]),
signature: Signature::from([0u8; 64]),
};
InInstructions::execute_batch(RawOrigin::None.into(), batch).unwrap();
@@ -250,7 +250,7 @@ fn dex_instruction_add_liquidity() {
balance: ExternalBalance { coin, amount },
}],
},
signature: Signature([0u8; 64]),
signature: Signature::from([0u8; 64]),
};
// we should have a liquid pool before we can swap
@@ -328,7 +328,7 @@ fn dex_instruction_swap() {
balance: ExternalBalance { coin, amount },
}],
},
signature: Signature([0u8; 64]),
signature: Signature::from([0u8; 64]),
};
// we can't send SRI to external address
@@ -418,7 +418,7 @@ fn genesis_liquidity_instruction() {
balance: ExternalBalance { coin, amount },
}],
},
signature: Signature([0u8; 64]),
signature: Signature::from([0u8; 64]),
};
InInstructions::execute_batch(RawOrigin::None.into(), batch.clone()).unwrap();
@@ -456,7 +456,7 @@ fn swap_to_staked_sri_instruction() {
coin.network(),
KeyPair(insecure_pair_from_name("random-key").public(), Vec::new().try_into().unwrap()),
Vec::new().try_into().unwrap(),
Signature([0u8; 64]),
Signature::from([0u8; 64]),
)
.unwrap();
@@ -479,7 +479,7 @@ fn swap_to_staked_sri_instruction() {
balance: ExternalBalance { coin, amount },
}],
},
signature: Signature([0u8; 64]),
signature: Signature::from([0u8; 64]),
};
InInstructions::execute_batch(RawOrigin::None.into(), batch.clone()).unwrap();