From 5239f5fd3ffa2f55c84dcfbb655332a29d90018a Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Mon, 16 Dec 2024 17:34:47 +0200 Subject: [PATCH] state_witness: require that new_transactions are empty --- .../src/stateless_validation/chunk_validation.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/chain/chain/src/stateless_validation/chunk_validation.rs b/chain/chain/src/stateless_validation/chunk_validation.rs index 4dfa11f4e04..033311d44d0 100644 --- a/chain/chain/src/stateless_validation/chunk_validation.rs +++ b/chain/chain/src/stateless_validation/chunk_validation.rs @@ -377,12 +377,13 @@ pub fn pre_validate_chunk_state_witness( RelaxedChunkValidation, current_protocol_version ) { + if !state_witness.new_transactions.is_empty() { + return Err(Error::InvalidChunkStateWitness(format!( + "Witness new_transactions must be empty", + ))); + } let mut check = chain.transaction_validity_check(last_chunk_block.header().clone()); - state_witness - .transactions - .iter() - .map(|t| check(t)) - .collect::>() + state_witness.transactions.iter().map(|t| check(t)).collect::>() } else { let new_transactions = &state_witness.new_transactions; let (new_tx_root_from_state_witness, _) = merklize(&new_transactions);