Restore workspace-wide clippy

Fixes accumulated errors in the Substrate code. Modifies the runtime build to
work with a modern clippy. Removes e2e tests from the workspace.
This commit is contained in:
Luke Parker 2025-01-19 02:27:35 -05:00
parent 47560fa9a9
commit 0b30ac175e
No known key found for this signature in database
22 changed files with 3329 additions and 295 deletions
Cargo.lockCargo.toml
coordinator/substrate/src
networks/monero
ringct/bulletproofs/src/original
wallet/src/tests
processor/scanner/src/batch
substrate
tests/message-queue/src

3332
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -144,9 +144,9 @@ members = [
"tests/docker",
"tests/message-queue",
"tests/processor",
"tests/coordinator",
"tests/full-stack",
# TODO "tests/processor",
# TODO "tests/coordinator",
# TODO "tests/full-stack",
"tests/reproducible-runtime",
]

View file

@ -180,7 +180,7 @@ impl<D: Db> ContinuallyRan for CanonicalEventStream<D> {
batch = Some(ExecutedBatch {
id: *id,
publisher: *publishing_session,
external_network_block_hash: *external_network_block_hash,
external_network_block_hash: external_network_block_hash.0,
in_instructions_hash: *in_instructions_hash,
in_instruction_results: in_instruction_results
.iter()

View file

@ -56,7 +56,7 @@ impl AggregateRangeWitness {
}
}
impl<'a> AggregateRangeStatement<'a> {
impl AggregateRangeStatement<'_> {
fn initial_transcript(&self) -> (Scalar, Vec<EdwardsPoint>) {
let V = self.commitments.iter().map(|c| c * INV_EIGHT()).collect::<Vec<_>>();
(keccak256_to_scalar(V.iter().flat_map(|V| V.compress().to_bytes()).collect::<Vec<_>>()), V)

View file

@ -9,6 +9,7 @@ use crate::{
// https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/
// tests/unit_tests/test_tx_utils.cpp
// which is licensed
#[allow(clippy::empty_line_after_outer_attr)] // rustfmt is for the comment, not for the const
#[rustfmt::skip]
/*
Copyright (c) 2014-2022, The Monero Project

View file

@ -5,6 +5,7 @@ use blake2::{digest::typenum::U32, Digest, Blake2b};
use scale::Encode;
use serai_db::{DbTxn, Db};
use serai_primitives::BlockHash;
use serai_in_instructions_primitives::{MAX_BATCH_SIZE, Batch};
use primitives::{
@ -106,7 +107,7 @@ impl<D: Db, S: ScannerFeed> ContinuallyRan for BatchTask<D, S> {
// If this block is notable, create the Batch(s) for it
if notable {
let network = S::NETWORK;
let external_network_block_hash = index::block_id(&txn, block_number);
let external_network_block_hash = BlockHash(index::block_id(&txn, block_number));
let mut batch_id = BatchDb::<S>::acquire_batch_id(&mut txn);
// start with empty batch

View file

@ -20,7 +20,7 @@ pub enum Event {
network: NetworkId,
publishing_session: Session,
id: u32,
external_network_block_hash: [u8; 32],
external_network_block_hash: BlockHash,
in_instructions_hash: [u8; 32],
in_instruction_results: bitvec::vec::BitVec<u8, bitvec::order::Lsb0>,
},

View file

@ -8,12 +8,13 @@ use blake2::{
use scale::Encode;
use serai_client::{
primitives::{Amount, NetworkId, Coin, Balance, BlockHash, SeraiAddress},
primitives::{BlockHash, NetworkId, Coin, Amount, Balance, SeraiAddress},
coins::CoinsEvent,
validator_sets::primitives::Session,
in_instructions::{
primitives::{InInstruction, InInstructionWithBalance, Batch},
InInstructionsEvent,
},
coins::CoinsEvent,
Serai,
};
@ -32,9 +33,13 @@ serai_test!(
let amount = Amount(OsRng.next_u64().saturating_add(1));
let balance = Balance { coin, amount };
let mut external_network_block_hash = BlockHash([0; 32]);
OsRng.fill_bytes(&mut external_network_block_hash.0);
let batch = Batch {
network,
id,
external_network_block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Transfer(address),
balance,
@ -51,8 +56,11 @@ serai_test!(
batches,
vec![InInstructionsEvent::Batch {
network,
publishing_session: Session(0),
id,
instructions_hash: Blake2b::<U32>::digest(batch.instructions.encode()).into(),
external_network_block_hash,
in_instructions_hash: Blake2b::<U32>::digest(batch.instructions.encode()).into(),
in_instruction_results: bitvec::bitvec![u8, bitvec::order::Lsb0; 1; 1],
}]
);
}

View file

@ -7,19 +7,22 @@ use blake2::{
use scale::Encode;
use serai_abi::coins::primitives::OutInstructionWithBalance;
use sp_core::Pair;
use serai_client::{
primitives::{
Amount, NetworkId, Coin, Balance, BlockHash, SeraiAddress, ExternalAddress,
BlockHash, NetworkId, Coin, Amount, Balance, SeraiAddress, ExternalAddress,
insecure_pair_from_name,
},
coins::{
primitives::{OutInstruction, OutInstructionWithBalance},
CoinsEvent,
},
validator_sets::primitives::Session,
in_instructions::{
InInstructionsEvent,
primitives::{InInstruction, InInstructionWithBalance, Batch},
},
coins::{primitives::OutInstruction, CoinsEvent},
Serai, SeraiCoins,
};
@ -45,7 +48,7 @@ serai_test!(
let batch = Batch {
network,
id,
block: block_hash,
external_network_block_hash: block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Transfer(address),
balance,
@ -61,9 +64,11 @@ serai_test!(
batches,
vec![InInstructionsEvent::Batch {
network,
publishing_session: Session(0),
id,
block: block_hash,
instructions_hash: Blake2b::<U32>::digest(batch.instructions.encode()).into(),
external_network_block_hash: block_hash,
in_instructions_hash: Blake2b::<U32>::digest(batch.instructions.encode()).into(),
in_instruction_results: bitvec::bitvec![u8, bitvec::order::Lsb0; 1; 1],
}]
);

View file

@ -10,12 +10,12 @@ use schnorrkel::Schnorrkel;
use sp_core::{sr25519::Signature, Pair as PairTrait};
use serai_abi::{
genesis_liquidity::primitives::{oraclize_values_message, Values},
validator_sets::primitives::{musig_context, Session, ValidatorSet},
in_instructions::primitives::{InInstruction, InInstructionWithBalance, Batch},
primitives::{
Amount, NetworkId, Coin, Balance, BlockHash, SeraiAddress, insecure_pair_from_name,
BlockHash, NetworkId, Coin, Amount, Balance, SeraiAddress, insecure_pair_from_name,
},
validator_sets::primitives::{musig_context, Session, ValidatorSet},
genesis_liquidity::primitives::{oraclize_values_message, Values},
in_instructions::primitives::{InInstruction, InInstructionWithBalance, Batch},
};
use serai_client::{Serai, SeraiGenesisLiquidity};
@ -53,7 +53,7 @@ pub async fn set_up_genesis(
})
.collect::<Vec<_>>();
// set up bloch hash
// set up block hash
let mut block = BlockHash([0; 32]);
OsRng.fill_bytes(&mut block.0);
@ -65,7 +65,12 @@ pub async fn set_up_genesis(
})
.or_insert(0);
let batch = Batch { network: coin.network(), id: batch_ids[&coin.network()], instructions };
let batch = Batch {
network: coin.network(),
external_network_block_hash: block,
id: batch_ids[&coin.network()],
instructions,
};
provide_batch(serai, batch).await;
}

View file

@ -9,7 +9,7 @@ use scale::Encode;
use sp_core::Pair;
use serai_client::{
primitives::{insecure_pair_from_name, BlockHash, NetworkId, Balance, SeraiAddress},
primitives::{BlockHash, NetworkId, Balance, SeraiAddress, insecure_pair_from_name},
validator_sets::primitives::{ValidatorSet, KeyPair},
in_instructions::{
primitives::{Batch, SignedBatch, batch_message, InInstruction, InInstructionWithBalance},
@ -45,16 +45,29 @@ pub async fn provide_batch(serai: &Serai, batch: Batch) -> [u8; 32] {
)
.await;
let batches = serai.as_of(block).in_instructions().batch_events().await.unwrap();
// TODO: impl From<Batch> for BatchEvent?
assert_eq!(
batches,
vec![InInstructionsEvent::Batch {
network: batch.network,
id: batch.id,
instructions_hash: Blake2b::<U32>::digest(batch.instructions.encode()).into(),
}],
);
{
let mut batches = serai.as_of(block).in_instructions().batch_events().await.unwrap();
assert_eq!(batches.len(), 1);
let InInstructionsEvent::Batch {
network,
publishing_session,
id,
external_network_block_hash,
in_instructions_hash,
in_instruction_results: _,
} = batches.swap_remove(0)
else {
panic!("Batch event wasn't Batch event")
};
assert_eq!(network, batch.network);
assert_eq!(publishing_session, session);
assert_eq!(id, batch.id);
assert_eq!(external_network_block_hash, batch.external_network_block_hash);
assert_eq!(
in_instructions_hash,
<[u8; 32]>::from(Blake2b::<U32>::digest(batch.instructions.encode()))
);
}
// TODO: Check the tokens events
@ -75,7 +88,7 @@ pub async fn mint_coin(
let batch = Batch {
network,
id: batch_id,
block: block_hash,
external_network_block_hash: block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Transfer(address),
balance,

View file

@ -6,8 +6,8 @@ use serai_abi::in_instructions::primitives::DexCall;
use serai_client::{
primitives::{
Amount, NetworkId, Coin, Balance, BlockHash, insecure_pair_from_name, ExternalAddress,
SeraiAddress,
BlockHash, NetworkId, Coin, Amount, Balance, SeraiAddress, ExternalAddress,
insecure_pair_from_name,
},
in_instructions::primitives::{
InInstruction, InInstructionWithBalance, Batch, IN_INSTRUCTION_EXECUTOR, OutAddress,
@ -229,7 +229,7 @@ serai_test!(
let batch = Batch {
network: NetworkId::Bitcoin,
id: batch_id,
block: block_hash,
external_network_block_hash: block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Dex(DexCall::SwapAndAddLiquidity(pair.public().into())),
balance: Balance { coin: Coin::Bitcoin, amount: Amount(20_000_000_000_000) },
@ -313,7 +313,7 @@ serai_test!(
let batch = Batch {
network: NetworkId::Monero,
id: coin1_batch_id,
block: block_hash,
external_network_block_hash: block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Dex(DexCall::Swap(out_balance, out_address)),
balance: Balance { coin: coin1, amount: Amount(200_000_000_000_000) },
@ -353,7 +353,7 @@ serai_test!(
let batch = Batch {
network: NetworkId::Ethereum,
id: coin2_batch_id,
block: block_hash,
external_network_block_hash: block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Dex(DexCall::Swap(out_balance, out_address.clone())),
balance: Balance { coin: coin2, amount: Amount(200_000_000_000) },
@ -391,7 +391,7 @@ serai_test!(
let batch = Batch {
network: NetworkId::Monero,
id: coin1_batch_id,
block: block_hash,
external_network_block_hash: block_hash,
instructions: vec![InInstructionWithBalance {
instruction: InInstruction::Dex(DexCall::Swap(out_balance, out_address.clone())),
balance: Balance { coin: coin1, amount: Amount(100_000_000_000_000) },

View file

@ -4,13 +4,13 @@ use rand_core::{RngCore, OsRng};
use serai_client::TemporalSerai;
use serai_abi::{
emissions::primitives::{INITIAL_REWARD_PER_BLOCK, SECURE_BY},
in_instructions::primitives::Batch,
primitives::{
BlockHash, Coin, COINS, FAST_EPOCH_DURATION, FAST_EPOCH_INITIAL_PERIOD, NETWORKS,
TARGET_BLOCK_TIME,
NETWORKS, COINS, TARGET_BLOCK_TIME, FAST_EPOCH_DURATION, FAST_EPOCH_INITIAL_PERIOD, BlockHash,
Coin,
},
validator_sets::primitives::Session,
emissions::primitives::{INITIAL_REWARD_PER_BLOCK, SECURE_BY},
in_instructions::primitives::Batch,
};
use serai_client::{
@ -42,7 +42,16 @@ async fn send_batches(serai: &Serai, ids: &mut HashMap<NetworkId, u32>) {
let mut block = BlockHash([0; 32]);
OsRng.fill_bytes(&mut block.0);
provide_batch(serai, Batch { network, id: ids[&network], block, instructions: vec![] }).await;
provide_batch(
serai,
Batch {
network,
id: ids[&network],
external_network_block_hash: block,
instructions: vec![],
},
)
.await;
}
}
}

View file

@ -7,7 +7,7 @@ use sp_core::{
use serai_client::{
primitives::{
FAST_EPOCH_DURATION, TARGET_BLOCK_TIME, NETWORKS, EmbeddedEllipticCurve, NetworkId, BlockHash,
FAST_EPOCH_DURATION, TARGET_BLOCK_TIME, NETWORKS, BlockHash, NetworkId, EmbeddedEllipticCurve,
insecure_pair_from_name,
},
validator_sets::{
@ -311,7 +311,8 @@ async fn validator_set_rotation() {
// provide a batch to complete the handover and retire the previous set
let mut block_hash = BlockHash([0; 32]);
OsRng.fill_bytes(&mut block_hash.0);
let batch = Batch { network, id: 0, block: block_hash, instructions: vec![] };
let batch =
Batch { network, id: 0, external_network_block_hash: block_hash, instructions: vec![] };
publish_tx(
&serai,
&SeraiInInstructions::execute_batch(SignedBatch {

View file

@ -19,6 +19,8 @@ ignored = ["scale", "scale-info"]
workspace = true
[dependencies]
bitvec = { version = "1", default-features = false, features = ["alloc"] }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2", default-features = false, features = ["derive"] }

View file

@ -63,10 +63,10 @@ pub mod pallet {
Batch {
network: NetworkId,
publishing_session: Session,
external_network_block_hash: [u8; 32],
id: u32,
external_network_block_hash: BlockHash,
in_instructions_hash: [u8; 32],
in_instruction_results: BitVec<u8, Lsb0>,
in_instruction_results: bitvec::vec::BitVec<u8, bitvec::order::Lsb0>,
},
Halt {
network: NetworkId,
@ -101,9 +101,10 @@ pub mod pallet {
// Use a dedicated transaction layer when executing this InInstruction
// This lets it individually error without causing any storage modifications
#[frame_support::transactional]
fn execute(instruction: InInstructionWithBalance) -> Result<(), DispatchError> {
match instruction.instruction {
fn execute(instruction: &InInstructionWithBalance) -> Result<(), DispatchError> {
match &instruction.instruction {
InInstruction::Transfer(address) => {
let address = *address;
Coins::<T>::mint(address.into(), instruction.balance)?;
}
InInstruction::Dex(call) => {
@ -113,6 +114,7 @@ pub mod pallet {
match call {
DexCall::SwapAndAddLiquidity(address) => {
let origin = RawOrigin::Signed(IN_INSTRUCTION_EXECUTOR.into());
let address = *address;
let coin = instruction.balance.coin;
// mint the given coin on the account
@ -207,7 +209,9 @@ pub mod pallet {
let coin_balance =
Coins::<T>::balance(IN_INSTRUCTION_EXECUTOR.into(), out_balance.coin);
let instruction = OutInstructionWithBalance {
instruction: OutInstruction { address: out_address.as_external().unwrap() },
instruction: OutInstruction {
address: out_address.clone().as_external().unwrap(),
},
balance: Balance { coin: out_balance.coin, amount: coin_balance },
};
Coins::<T>::burn_with_instruction(origin.into(), instruction)?;
@ -216,12 +220,14 @@ pub mod pallet {
}
}
InInstruction::GenesisLiquidity(address) => {
let address = *address;
Coins::<T>::mint(GENESIS_LIQUIDITY_ACCOUNT.into(), instruction.balance)?;
GenesisLiq::<T>::add_coin_liquidity(address.into(), instruction.balance)?;
}
InInstruction::SwapToStakedSRI(address, network) => {
let address = *address;
Coins::<T>::mint(POL_ACCOUNT.into(), instruction.balance)?;
Emissions::<T>::swap_to_staked_sri(address.into(), network, instruction.balance)?;
Emissions::<T>::swap_to_staked_sri(address.into(), *network, instruction.balance)?;
}
}
Ok(())
@ -259,7 +265,7 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight((0, DispatchClass::Operational))] // TODO
pub fn execute_batch(origin: OriginFor<T>, batch: SignedBatch) -> DispatchResult {
pub fn execute_batch(origin: OriginFor<T>, _batch: SignedBatch) -> DispatchResult {
ensure_none(origin)?;
// The entire Batch execution is handled in pre_dispatch
@ -309,7 +315,7 @@ pub mod pallet {
Err(InvalidTransaction::BadProof)?;
}
let batch = batch.batch;
let batch = &batch.batch;
if Halted::<T>::contains_key(network) {
Err(InvalidTransaction::Custom(1))?;
@ -343,8 +349,8 @@ pub mod pallet {
LastBatch::<T>::insert(batch.network, batch.id);
let in_instructions_hash = blake2_256(&batch.instructions.encode());
let mut in_instruction_results = BitVec::new();
for (i, instruction) in batch.instructions.into_iter().enumerate() {
let mut in_instruction_results = bitvec::vec::BitVec::new();
for instruction in &batch.instructions {
// Verify this coin is for this network
if instruction.balance.coin.network() != batch.network {
Err(InvalidTransaction::Custom(2))?;
@ -363,7 +369,7 @@ pub mod pallet {
});
ValidTransaction::with_tag_prefix("in-instructions")
.and_provides((batch.batch.network, batch.batch.id))
.and_provides((batch.network, batch.id))
// Set a 10 block longevity, though this should be included in the next block
.longevity(10)
.propagate(true)

View file

@ -19,7 +19,8 @@ use sp_application_crypto::sr25519::Signature;
use sp_std::vec::Vec;
use sp_runtime::RuntimeDebug;
use serai_primitives::{Balance, NetworkId, SeraiAddress, ExternalAddress, system_address};
#[rustfmt::skip]
use serai_primitives::{BlockHash, NetworkId, Balance, SeraiAddress, ExternalAddress, system_address};
mod shorthand;
pub use shorthand::*;
@ -106,7 +107,7 @@ pub struct InInstructionWithBalance {
pub struct Batch {
pub network: NetworkId,
pub id: u32,
pub external_network_block_hash: [u8; 32],
pub external_network_block_hash: BlockHash,
pub instructions: Vec<InInstructionWithBalance>,
}

View file

@ -20,71 +20,71 @@ workspace = true
name = "serai-node"
[dependencies]
#rand_core = "0.6"
#zeroize = "1"
#hex = "0.4"
#log = "0.4"
rand_core = "0.6"
zeroize = "1"
hex = "0.4"
log = "0.4"
#schnorrkel = "0.11"
schnorrkel = "0.11"
#ciphersuite = { path = "../../crypto/ciphersuite" }
#embedwards25519 = { path = "../../crypto/evrf/embedwards25519" }
#secq256k1 = { path = "../../crypto/evrf/secq256k1" }
ciphersuite = { path = "../../crypto/ciphersuite" }
embedwards25519 = { path = "../../crypto/evrf/embedwards25519" }
secq256k1 = { path = "../../crypto/evrf/secq256k1" }
#libp2p = "0.52"
libp2p = "0.52"
#sp-core = { git = "https://github.com/serai-dex/substrate" }
#sp-keystore = { git = "https://github.com/serai-dex/substrate" }
#sp-timestamp = { git = "https://github.com/serai-dex/substrate" }
#sp-io = { git = "https://github.com/serai-dex/substrate" }
#sp-blockchain = { git = "https://github.com/serai-dex/substrate" }
#sp-api = { git = "https://github.com/serai-dex/substrate" }
#sp-block-builder = { git = "https://github.com/serai-dex/substrate" }
#sp-consensus-babe = { git = "https://github.com/serai-dex/substrate" }
sp-core = { git = "https://github.com/serai-dex/substrate" }
sp-keystore = { git = "https://github.com/serai-dex/substrate" }
sp-timestamp = { git = "https://github.com/serai-dex/substrate" }
sp-io = { git = "https://github.com/serai-dex/substrate" }
sp-blockchain = { git = "https://github.com/serai-dex/substrate" }
sp-api = { git = "https://github.com/serai-dex/substrate" }
sp-block-builder = { git = "https://github.com/serai-dex/substrate" }
sp-consensus-babe = { git = "https://github.com/serai-dex/substrate" }
#frame-benchmarking = { git = "https://github.com/serai-dex/substrate" }
frame-benchmarking = { git = "https://github.com/serai-dex/substrate" }
#serai-runtime = { path = "../runtime", features = ["std"] }
serai-runtime = { path = "../runtime", features = ["std"] }
#clap = { version = "4", features = ["derive"] }
clap = { version = "4", features = ["derive"] }
#futures-util = "0.3"
#tokio = { version = "1", features = ["sync", "rt-multi-thread"] }
#jsonrpsee = { version = "0.16", features = ["server"] }
futures-util = "0.3"
tokio = { version = "1", features = ["sync", "rt-multi-thread"] }
jsonrpsee = { version = "0.16", features = ["server"] }
#sc-offchain = { git = "https://github.com/serai-dex/substrate" }
#sc-transaction-pool = { git = "https://github.com/serai-dex/substrate" }
#sc-transaction-pool-api = { git = "https://github.com/serai-dex/substrate" }
#sc-basic-authorship = { git = "https://github.com/serai-dex/substrate" }
#sc-executor = { git = "https://github.com/serai-dex/substrate" }
#sc-service = { git = "https://github.com/serai-dex/substrate" }
#sc-client-api = { git = "https://github.com/serai-dex/substrate" }
#sc-network-common = { git = "https://github.com/serai-dex/substrate" }
#sc-network = { git = "https://github.com/serai-dex/substrate" }
sc-offchain = { git = "https://github.com/serai-dex/substrate" }
sc-transaction-pool = { git = "https://github.com/serai-dex/substrate" }
sc-transaction-pool-api = { git = "https://github.com/serai-dex/substrate" }
sc-basic-authorship = { git = "https://github.com/serai-dex/substrate" }
sc-executor = { git = "https://github.com/serai-dex/substrate" }
sc-service = { git = "https://github.com/serai-dex/substrate" }
sc-client-api = { git = "https://github.com/serai-dex/substrate" }
sc-network-common = { git = "https://github.com/serai-dex/substrate" }
sc-network = { git = "https://github.com/serai-dex/substrate" }
#sc-consensus = { git = "https://github.com/serai-dex/substrate" }
#sc-consensus-babe = { git = "https://github.com/serai-dex/substrate" }
#sc-consensus-grandpa = { git = "https://github.com/serai-dex/substrate" }
#sc-authority-discovery = { git = "https://github.com/serai-dex/substrate" }
sc-consensus = { git = "https://github.com/serai-dex/substrate" }
sc-consensus-babe = { git = "https://github.com/serai-dex/substrate" }
sc-consensus-grandpa = { git = "https://github.com/serai-dex/substrate" }
sc-authority-discovery = { git = "https://github.com/serai-dex/substrate" }
#sc-telemetry = { git = "https://github.com/serai-dex/substrate" }
#sc-cli = { git = "https://github.com/serai-dex/substrate" }
sc-telemetry = { git = "https://github.com/serai-dex/substrate" }
sc-cli = { git = "https://github.com/serai-dex/substrate" }
#sc-rpc-api = { git = "https://github.com/serai-dex/substrate" }
sc-rpc-api = { git = "https://github.com/serai-dex/substrate" }
#substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" }
#pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" }
substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" }
pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" }
#serai-env = { path = "../../common/env" }
serai-env = { path = "../../common/env" }
[build-dependencies]
#substrate-build-script-utils = { git = "https://github.com/serai-dex/substrate" }
substrate-build-script-utils = { git = "https://github.com/serai-dex/substrate" }
[features]
#default = []
#fast-epoch = ["serai-runtime/fast-epoch"]
#runtime-benchmarks = [
# "frame-benchmarking/runtime-benchmarks",
default = []
fast-epoch = ["serai-runtime/fast-epoch"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
# "serai-runtime/runtime-benchmarks",
#]
"serai-runtime/runtime-benchmarks",
]

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,

View file

@ -1203,7 +1203,7 @@ pub mod pallet {
// There must have been a previous session is PendingSlashReport is populated
let set =
ValidatorSet { network, session: Session(Self::session(network).unwrap().0 - 1) };
if !key.verify(&report_slashes_message(&set, slashes), signature) {
if !key.verify(&slashes.report_slashes_message(), signature) {
Err(InvalidTransaction::BadProof)?;
}

View file

@ -90,7 +90,8 @@ fn basic_functionality() {
},
b"Hello, World!".to_vec(),
)
.await;
.await
.unwrap();
// Queue this twice, which message-queue should de-duplicate
for _ in 0 .. 2 {
@ -103,7 +104,8 @@ fn basic_functionality() {
},
b"Hello, World, again!".to_vec(),
)
.await;
.await
.unwrap();
}
// Successfully get it
@ -146,7 +148,8 @@ fn basic_functionality() {
},
b"Hello, World!".to_vec(),
)
.await;
.await
.unwrap();
let monero = MessageQueue::new(
Service::Processor(NetworkId::Monero),