Merge branch 'next' into serai-rpc

This commit is contained in:
Luke Parker
2025-01-30 10:22:52 +01:00
committed by GitHub
585 changed files with 44213 additions and 23721 deletions

View File

@@ -6,7 +6,7 @@ license = "AGPL-3.0-only"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/runtime"
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021"
rust-version = "1.74"
rust-version = "1.80"
[package.metadata.docs.rs]
all-features = true
@@ -19,7 +19,7 @@ ignored = ["scale", "scale-info"]
workspace = true
[dependencies]
hashbrown = { version = "0.14", default-features = false, features = ["ahash", "inline-more"] }
hashbrown = { version = "0.15", default-features = false, features = ["default-hasher", "inline-more"] }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] }

View File

@@ -1,5 +1,12 @@
use substrate_wasm_builder::WasmBuilder;
fn main() {
WasmBuilder::new().with_current_project().export_heap_base().import_memory().build()
WasmBuilder::new()
.with_current_project()
// https://substrate.stackexchange.com/questions/12124
// TODO: Remove once we've moved to polkadot-sdk
.disable_runtime_version_section_check()
.export_heap_base()
.import_memory()
.build()
}

View File

@@ -5,8 +5,6 @@ use scale::{Encode, Decode};
use serai_abi::Call;
use crate::{
Vec,
primitives::{PublicKey, SeraiAddress},
timestamp, coins, dex, genesis_liquidity,
validator_sets::{self, MembershipProof},
in_instructions, signals, babe, grandpa, RuntimeCall,
@@ -92,28 +90,26 @@ impl From<Call> for RuntimeCall {
Call::ValidatorSets(vs) => match vs {
serai_abi::validator_sets::Call::set_keys {
network,
removed_participants,
key_pair,
signature_participants,
signature,
} => RuntimeCall::ValidatorSets(validator_sets::Call::set_keys {
network,
removed_participants: <_>::try_from(
removed_participants.into_iter().map(PublicKey::from).collect::<Vec<_>>(),
)
.unwrap(),
key_pair,
signature_participants,
signature,
}),
serai_abi::validator_sets::Call::set_embedded_elliptic_curve_key {
embedded_elliptic_curve,
key,
} => RuntimeCall::ValidatorSets(validator_sets::Call::set_embedded_elliptic_curve_key {
embedded_elliptic_curve,
key,
}),
serai_abi::validator_sets::Call::report_slashes { network, slashes, signature } => {
RuntimeCall::ValidatorSets(validator_sets::Call::report_slashes {
network,
slashes: <_>::try_from(
slashes
.into_iter()
.map(|(addr, slash)| (PublicKey::from(addr), slash))
.collect::<Vec<_>>(),
)
.unwrap(),
slashes,
signature,
})
}
@@ -282,30 +278,23 @@ impl TryInto<Call> for RuntimeCall {
_ => Err(())?,
}),
RuntimeCall::ValidatorSets(call) => Call::ValidatorSets(match call {
validator_sets::Call::set_keys { network, removed_participants, key_pair, signature } => {
validator_sets::Call::set_keys { network, key_pair, signature_participants, signature } => {
serai_abi::validator_sets::Call::set_keys {
network,
removed_participants: <_>::try_from(
removed_participants.into_iter().map(SeraiAddress::from).collect::<Vec<_>>(),
)
.unwrap(),
key_pair,
signature_participants,
signature,
}
}
validator_sets::Call::report_slashes { network, slashes, signature } => {
serai_abi::validator_sets::Call::report_slashes {
network,
slashes: <_>::try_from(
slashes
.into_iter()
.map(|(addr, slash)| (SeraiAddress::from(addr), slash))
.collect::<Vec<_>>(),
)
.unwrap(),
signature,
validator_sets::Call::set_embedded_elliptic_curve_key { embedded_elliptic_curve, key } => {
serai_abi::validator_sets::Call::set_embedded_elliptic_curve_key {
embedded_elliptic_curve,
key,
}
}
validator_sets::Call::report_slashes { network, slashes, signature } => {
serai_abi::validator_sets::Call::report_slashes { network, slashes, signature }
}
validator_sets::Call::allocate { network, amount } => {
serai_abi::validator_sets::Call::allocate { network, amount }
}

View File

@@ -283,7 +283,7 @@ impl pallet_authorship::Config for Runtime {
}
// Maximum number of authorities per session.
pub type MaxAuthorities = ConstU32<{ validator_sets::primitives::MAX_KEY_SHARES_PER_SET }>;
pub type MaxAuthorities = ConstU32<{ validator_sets::primitives::MAX_KEY_SHARES_PER_SET_U32 }>;
/// Longevity of an offence report.
pub type ReportLongevity = <Runtime as pallet_babe::Config>::EpochDuration;