From b7f8ed7bfd7f7c3ce3919bc64eba686e9388fa1e Mon Sep 17 00:00:00 2001 From: Arnon Hod Date: Sun, 27 Oct 2024 11:41:22 +0200 Subject: [PATCH] test: add decision reached step to end to end test (#1408) --- .../tests-integration/tests/end_to_end_test.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/tests-integration/tests/end_to_end_test.rs b/crates/tests-integration/tests/end_to_end_test.rs index 249b202120..24b4b54029 100644 --- a/crates/tests-integration/tests/end_to_end_test.rs +++ b/crates/tests-integration/tests/end_to_end_test.rs @@ -5,6 +5,7 @@ use starknet_api::block::BlockNumber; use starknet_api::transaction::TransactionHash; use starknet_batcher_types::batcher_types::{ BuildProposalInput, + DecisionReachedInput, GetProposalContent, GetProposalContentInput, ProposalId, @@ -49,21 +50,15 @@ pub async fn run_consensus_for_end_to_end_test( batcher_client: &SharedBatcherClient, expected_batched_tx_hashes: &[TransactionHash], ) { - // Setup. Holds the state of the consensus manager. - - // Set start height. - // TODO(Arni): Get the current height and retrospective_block_hash from the rpc storage - let current_height = BlockNumber(1); - - // Test. - // Start height. + // TODO(Arni): Get the current height and retrospective_block_hash from the rpc storage or use + // consensus directly. + let current_height = BlockNumber(1); batcher_client.start_height(StartHeightInput { height: current_height }).await.unwrap(); // Build proposal. let proposal_id = ProposalId(0); let retrospective_block_hash = None; - let build_proposal_duaration = chrono::TimeDelta::new(1, 0).unwrap(); batcher_client .build_proposal(BuildProposalInput { @@ -91,5 +86,8 @@ pub async fn run_consensus_for_end_to_end_test( } }; + // Decision reached. + batcher_client.decision_reached(DecisionReachedInput { proposal_id }).await.unwrap(); + assert_eq!(expected_batched_tx_hashes, executed_tx_hashes); }