mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Add Batch messages from processor, verify Batchs published on-chain
Renames Update to SignedBatch. Checks Batch equality via a hash of the InInstructions. That prevents needing to keep the Batch in node state or TX introspect.
This commit is contained in:
@@ -8,7 +8,7 @@ use serde::{Serialize, Deserialize};
|
||||
use dkg::{Participant, ThresholdParams};
|
||||
|
||||
use serai_primitives::{BlockHash, NetworkId};
|
||||
use in_instructions_primitives::SignedBatch;
|
||||
use in_instructions_primitives::{Batch, SignedBatch};
|
||||
use tokens_primitives::OutInstructionWithBalance;
|
||||
use validator_sets_primitives::{ValidatorSet, KeyPair};
|
||||
|
||||
@@ -178,7 +178,8 @@ pub mod substrate {
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, Encode, Decode, Serialize, Deserialize)]
|
||||
pub enum ProcessorMessage {
|
||||
Update { batch: SignedBatch },
|
||||
Batch { batch: Batch },
|
||||
SignedBatch { batch: SignedBatch },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,8 +365,9 @@ impl ProcessorMessage {
|
||||
ProcessorMessage::Substrate(msg) => {
|
||||
let (sub, id) = match msg {
|
||||
// Unique since network and ID binding
|
||||
substrate::ProcessorMessage::Update { batch, .. } => {
|
||||
(0, (batch.batch.network, batch.batch.id).encode())
|
||||
substrate::ProcessorMessage::Batch { batch } => (0, (batch.network, batch.id).encode()),
|
||||
substrate::ProcessorMessage::SignedBatch { batch, .. } => {
|
||||
(1, (batch.batch.network, batch.batch.id).encode())
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user