From b190fb72fb61fb08a7dd3ed7ec080deadf34db0f Mon Sep 17 00:00:00 2001 From: gskapka Date: Tue, 13 Feb 2024 14:57:33 +0000 Subject: [PATCH] feat(eos-v2-cores): <- adds assertion that global sequence reprocessing protection works w/ multi-incremerkle based submission --- v2_bridges/eos_on_int/src/eos/submit_eos_block.rs | 7 ++++++- v2_bridges/int_on_eos/src/eos/submit_eos_block.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs b/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs index b432c7080..e288964af 100644 --- a/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs +++ b/v2_bridges/eos_on_int/src/eos/submit_eos_block.rs @@ -323,8 +323,13 @@ mod tests { assert!(latest_block_num > submission_block_num); // NOTE: Now we can submit the block with the peg in in it... - let output = EosOutput::from_str(&submit_eos_block_to_core(&db, &submission_block_json).unwrap()).unwrap(); + let mut output = EosOutput::from_str(&submit_eos_block_to_core(&db, &submission_block_json).unwrap()).unwrap(); // NOTE: Asserting a tx is outputted successfully is sufficient for this test. assert_eq!(output.int_signed_transactions.len(), 1); + + // NOTE: If we submit the _same_ material again, we should get no signed transactions since + // the core has already seen this global sequence. + output = EosOutput::from_str(&submit_eos_block_to_core(&db, &submission_block_json).unwrap()).unwrap(); + assert_eq!(output.int_signed_transactions.len(), 0); } } diff --git a/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs b/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs index 96fb7d1b1..57d83bc80 100644 --- a/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs +++ b/v2_bridges/int_on_eos/src/eos/submit_eos_block.rs @@ -448,8 +448,13 @@ mod tests { assert!(latest_block_num > submission_block_num); // NOTE: Now we can submit the block with the peg in in it... - let output = EosOutput::from_str(&submit_eos_block_to_core(&db, &submission_block_json).unwrap()).unwrap(); + let mut output = EosOutput::from_str(&submit_eos_block_to_core(&db, &submission_block_json).unwrap()).unwrap(); // NOTE: Asserting a tx is outputted successfully is sufficient for this test. assert_eq!(output.int_signed_transactions.len(), 1); + + // NOTE: If we submit the _same_ material again, we should get no signed transactions since + // the core has already seen this global sequence. + output = EosOutput::from_str(&submit_eos_block_to_core(&db, &submission_block_json).unwrap()).unwrap(); + assert_eq!(output.int_signed_transactions.len(), 0); } }