From 866b8ded5faf2ab7d59cc2bc657e90cb5d75a2d1 Mon Sep 17 00:00:00 2001 From: yongkangc Date: Wed, 10 Dec 2025 07:00:06 +0000 Subject: [PATCH] refactor(multiproof): streamline state update message handling - Consolidated the sending of MultiProofMessage::StateUpdate to improve readability. - Updated comments for clarity regarding the batch source logic in tests, ensuring it reflects the expected behavior of the PreBlock source. --- .../tree/src/tree/payload_processor/multiproof.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_processor/multiproof.rs b/crates/engine/tree/src/tree/payload_processor/multiproof.rs index e5d57f0c9a..08cd2733df 100644 --- a/crates/engine/tree/src/tree/payload_processor/multiproof.rs +++ b/crates/engine/tree/src/tree/payload_processor/multiproof.rs @@ -2275,11 +2275,8 @@ mod tests { create_state_update(addr_preblock, 1, 1), )) .unwrap(); - tx.send(MultiProofMessage::StateUpdate( - source_tx, - create_state_update(addr_tx, 2, 2), - )) - .unwrap(); + tx.send(MultiProofMessage::StateUpdate(source_tx, create_state_update(addr_tx, 2, 2))) + .unwrap(); tx.send(MultiProofMessage::StateUpdate( source_postblock, create_state_update(addr_postblock, 3, 3), @@ -2325,8 +2322,8 @@ mod tests { merged_update.extend(next_update); } - // Batch source should stay the first source that arrived. - assert_eq!(batch_source, source_preblock); + // Batch source should stay the first source that arrived (PreBlock). + assert!(matches!(batch_source, StateChangeSource::PreBlock(_))); assert_eq!(merged_update.len(), 3); assert!(merged_update.contains_key(&addr_preblock)); assert!(merged_update.contains_key(&addr_tx));