From e7e30150f08c88abe9d5e902b73b27462c1ff87a Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 22 Oct 2023 05:38:44 -0400 Subject: [PATCH] Don't let the Serai set publish batches --- substrate/in-instructions/pallet/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/substrate/in-instructions/pallet/src/lib.rs b/substrate/in-instructions/pallet/src/lib.rs index 5c6149ad..f81bdd09 100644 --- a/substrate/in-instructions/pallet/src/lib.rs +++ b/substrate/in-instructions/pallet/src/lib.rs @@ -152,8 +152,13 @@ pub mod pallet { Err(InvalidTransaction::ExhaustsResources)?; } - // verify the signature let network = batch.batch.network; + // Don't allow the Serai set to publish `Batch`s as-if Serai itself was an external network + if network == NetworkId::Serai { + Err(InvalidTransaction::Custom(0))?; + } + + // verify the signature let (current_session, prior, current) = keys_for_network::(network)?; let batch_message = batch_message(&batch.batch); // Check the prior key first since only a single `Batch` (the last one) will be when prior is @@ -208,7 +213,7 @@ pub mod pallet { // Accordingly, there's no value in writing code to fully slash the network, when such an // even would require a runtime upgrade to fully resolve anyways if instruction.balance.coin.network() != batch.batch.network { - Err(InvalidTransaction::Custom(0))?; + Err(InvalidTransaction::Custom(1))?; } }