mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Use proper messages for ValidatorSets/InInstructions pallet
Provides a DST, and associated metadata as beneficial. Also utilizes MuSig's context to session-bind. Since set_keys_messages also binds to set, this is semi-redundant, yet that's appreciated.
This commit is contained in:
@@ -23,7 +23,7 @@ sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features
|
||||
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
||||
serai-primitives = { path = "../..//primitives", default-features = false }
|
||||
serai-primitives = { path = "../../primitives", default-features = false }
|
||||
in-instructions-primitives = { path = "../primitives", default-features = false }
|
||||
|
||||
tokens-pallet = { path = "../../tokens/pallet", default-features = false }
|
||||
|
||||
@@ -9,7 +9,7 @@ use sp_runtime::RuntimeDebug;
|
||||
use serai_primitives::{BlockHash, NetworkId};
|
||||
|
||||
pub use in_instructions_primitives as primitives;
|
||||
use primitives::{InInstruction, InInstructionWithBalance, SignedBatch};
|
||||
use primitives::*;
|
||||
|
||||
#[derive(Clone, Copy, Encode, RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(scale::Decode, thiserror::Error))]
|
||||
@@ -141,7 +141,7 @@ pub mod pallet {
|
||||
}
|
||||
};
|
||||
|
||||
if !key.verify(&batch.batch.encode(), &batch.signature) {
|
||||
if !key.verify(&batch_message(&batch.batch), &batch.signature) {
|
||||
Err(InvalidTransaction::BadProof)?;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ sp-application-crypto = { git = "https://github.com/serai-dex/substrate", defaul
|
||||
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
||||
serai-primitives = { path = "../..//primitives", default-features = false }
|
||||
serai-primitives = { path = "../../primitives", default-features = false }
|
||||
tokens-primitives = { path = "../../tokens/primitives", default-features = false }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -79,3 +79,8 @@ impl Zeroize for SignedBatch {
|
||||
self.signature.as_mut().zeroize();
|
||||
}
|
||||
}
|
||||
|
||||
/// The message for the batch signature.
|
||||
pub fn batch_message(batch: &Batch) -> Vec<u8> {
|
||||
[b"InInstructions-batch".as_ref(), &batch.encode()].concat()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user