mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Alternate handover batch TOCTOU fix (#397)
* Revert "Correct the prior documented TOCTOU" This reverts commitd50fe87801. * Correct the prior documented TOCTOUd50fe87801edited the challenge for the Batch to fix it. This won't produce Batch n+1 until Batch n is successfully published and verified. It's an alternative strategy able to be reviewed, with a much smaller impact to scope.
This commit is contained in:
@@ -137,10 +137,8 @@ pub(crate) async fn sign_batch(
|
||||
messages::substrate::ProcessorMessage::SignedBatch { batch: this_batch },
|
||||
) => {
|
||||
if batch.is_none() {
|
||||
assert!(PublicKey::from_raw(key).verify(
|
||||
&batch_message(this_batch.batch.id == 0, &this_batch.batch),
|
||||
&this_batch.signature
|
||||
));
|
||||
assert!(PublicKey::from_raw(key)
|
||||
.verify(&batch_message(&this_batch.batch), &this_batch.signature));
|
||||
|
||||
batch = Some(this_batch.clone());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user