mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Correct the prior documented TOCTOU
Now, if a malicious validator set publishes a malicious `Batch` at the last moment, it'll cause all future `Batch`s signed by the next validator set to require a bool being set (yet they never will set it). This will prevent the handover. The only overhead is having two distinct `batch_message` calls on-chain.
This commit is contained in:
@@ -84,6 +84,6 @@ impl Zeroize for SignedBatch {
|
||||
|
||||
// TODO: Make this an associated method?
|
||||
/// The message for the batch signature.
|
||||
pub fn batch_message(batch: &Batch) -> Vec<u8> {
|
||||
[b"InInstructions-batch".as_ref(), &batch.encode()].concat()
|
||||
pub fn batch_message(is_first_batch_of_set: bool, batch: &Batch) -> Vec<u8> {
|
||||
[b"InInstructions-batch".as_ref(), &(is_first_batch_of_set, batch).encode()].concat()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user