From d0169bcbb6011cae8fbddc2e339efb45fbab7f4d Mon Sep 17 00:00:00 2001 From: ethanoroshiba Date: Wed, 20 Nov 2024 08:56:49 -0600 Subject: [PATCH] fix test, remove proposer address from begin_block, name changes --- crates/astria-sequencer/src/accounts/component.rs | 2 +- crates/astria-sequencer/src/app/mod.rs | 5 ----- crates/astria-sequencer/src/app/tests_app/mod.rs | 6 ++---- crates/astria-sequencer/src/authority/component.rs | 4 ++-- crates/astria-sequencer/src/component.rs | 4 +--- crates/astria-sequencer/src/fees/component.rs | 2 +- crates/astria-sequencer/src/ibc/component.rs | 3 ++- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/crates/astria-sequencer/src/accounts/component.rs b/crates/astria-sequencer/src/accounts/component.rs index 161ac938e2..bb6bf255d7 100644 --- a/crates/astria-sequencer/src/accounts/component.rs +++ b/crates/astria-sequencer/src/accounts/component.rs @@ -50,7 +50,7 @@ impl Component for AccountsComponent { #[instrument(name = "AccountsComponent::prepare_state_for_tx_execution", skip_all)] async fn prepare_state_for_tx_execution( _state: &mut Arc, - _prepare_state_for_tx_execution: &PrepareStateInfo, + _prepare_state_info: &PrepareStateInfo, ) -> Result<()> { Ok(()) } diff --git a/crates/astria-sequencer/src/app/mod.rs b/crates/astria-sequencer/src/app/mod.rs index 822f585b53..6d81219f33 100644 --- a/crates/astria-sequencer/src/app/mod.rs +++ b/crates/astria-sequencer/src/app/mod.rs @@ -379,7 +379,6 @@ impl App { height: prepare_proposal.height, time: prepare_proposal.time, next_validators_hash: prepare_proposal.next_validators_hash, - proposer_address: prepare_proposal.proposer_address, }; self.pre_execute_transactions(block_data) @@ -481,7 +480,6 @@ impl App { height: process_proposal.height, time: process_proposal.time, next_validators_hash: process_proposal.next_validators_hash, - proposer_address: process_proposal.proposer_address, }; self.pre_execute_transactions(block_data) @@ -706,7 +704,6 @@ impl App { chain_id, height: block_data.height, next_validators_hash: block_data.next_validators_hash, - proposer_address: block_data.proposer_address, time: block_data.time, }; @@ -838,7 +835,6 @@ impl App { height, time, next_validators_hash: finalize_block.next_validators_hash, - proposer_address, }; self.pre_execute_transactions(block_data) @@ -1150,7 +1146,6 @@ struct BlockData { height: tendermint::block::Height, time: tendermint::Time, next_validators_hash: Hash, - proposer_address: account::Id, } fn signed_transaction_from_bytes(bytes: &[u8]) -> Result { diff --git a/crates/astria-sequencer/src/app/tests_app/mod.rs b/crates/astria-sequencer/src/app/tests_app/mod.rs index efcb9153ec..ce9b9bf371 100644 --- a/crates/astria-sequencer/src/app/tests_app/mod.rs +++ b/crates/astria-sequencer/src/app/tests_app/mod.rs @@ -109,7 +109,6 @@ async fn app_pre_execute_transactions() { height: 1u8.into(), time: Time::now(), next_validators_hash: Hash::default(), - proposer_address: account::Id::try_from([0u8; 20].to_vec()).unwrap(), }; app.pre_execute_transactions(block_data.clone()) @@ -156,7 +155,6 @@ async fn app_prepare_state_for_tx_execution_remove_byzantine_validators() { chain_id: "test".to_string().try_into().unwrap(), height: 1u8.into(), next_validators_hash: Hash::default(), - proposer_address: account::Id::try_from([0u8; 20].to_vec()).unwrap(), time: Time::now(), }; @@ -887,13 +885,13 @@ async fn app_handle_post_tx_execution_validator_updates() { .unwrap(); app.apply(state_tx); - let (validator_updates, _) = app + let (returned_validator_updates, _) = app .component_post_execution_state_updates(&proposer_address) .await .unwrap(); // we only assert length here as the ordering of the updates is not guaranteed // and validator::Update does not implement Ord - assert_eq!(validator_updates.len(), validator_updates.len()); + assert_eq!(returned_validator_updates.len(), validator_updates.len()); // validator with pubkey_a should be removed (power set to 0) // validator with pubkey_b should be updated diff --git a/crates/astria-sequencer/src/authority/component.rs b/crates/astria-sequencer/src/authority/component.rs index eb2426bdda..cd8ce06775 100644 --- a/crates/astria-sequencer/src/authority/component.rs +++ b/crates/astria-sequencer/src/authority/component.rs @@ -50,14 +50,14 @@ impl Component for AuthorityComponent { #[instrument(name = "AuthorityComponent::prepare_state_for_tx_execution", skip_all)] async fn prepare_state_for_tx_execution( state: &mut Arc, - prepare_state_for_tx_execution: &PrepareStateInfo, + prepare_state_info: &PrepareStateInfo, ) -> Result<()> { let mut current_set = state .get_validator_set() .await .wrap_err("failed getting validator set")?; - for misbehaviour in &prepare_state_for_tx_execution.byzantine_validators { + for misbehaviour in &prepare_state_info.byzantine_validators { current_set.remove(&misbehaviour.validator.address); } diff --git a/crates/astria-sequencer/src/component.rs b/crates/astria-sequencer/src/component.rs index e45907237f..83bbef8a6d 100644 --- a/crates/astria-sequencer/src/component.rs +++ b/crates/astria-sequencer/src/component.rs @@ -5,7 +5,6 @@ use async_trait::async_trait; use cnidarium::StateWrite; use tendermint::{ abci::types, - account, block, chain, AppHash, @@ -19,7 +18,6 @@ pub(crate) struct PrepareStateInfo { pub(crate) chain_id: chain::Id, pub(crate) height: block::Height, pub(crate) next_validators_hash: Hash, - pub(crate) proposer_address: account::Id, pub(crate) time: Time, } @@ -49,7 +47,7 @@ pub(crate) trait Component { /// it returns, so that `state.get_mut().is_some()` on completion. async fn prepare_state_for_tx_execution( state: &mut Arc, - prepare_state_for_tx_execution: &PrepareStateInfo, + prepare_state_info: &PrepareStateInfo, ) -> Result<()>; /// Handles necessary state changes for the given component after transaction execution, ending diff --git a/crates/astria-sequencer/src/fees/component.rs b/crates/astria-sequencer/src/fees/component.rs index 1c833dc47f..d9f28df705 100644 --- a/crates/astria-sequencer/src/fees/component.rs +++ b/crates/astria-sequencer/src/fees/component.rs @@ -135,7 +135,7 @@ impl Component for FeesComponent { #[instrument(name = "FeesComponent::prepare_state_for_tx_execution", skip_all)] async fn prepare_state_for_tx_execution( _state: &mut Arc, - _prepare_state_for_tx_execution: &PrepareStateInfo, + _prepare_state_info: &PrepareStateInfo, ) -> Result<()> { Ok(()) } diff --git a/crates/astria-sequencer/src/ibc/component.rs b/crates/astria-sequencer/src/ibc/component.rs index 49123881d6..ce03975c9c 100644 --- a/crates/astria-sequencer/src/ibc/component.rs +++ b/crates/astria-sequencer/src/ibc/component.rs @@ -13,6 +13,7 @@ use tendermint::{ abci::{ self, }, + account::Id, block::Header, Hash, }; @@ -78,7 +79,7 @@ impl Component for IbcComponent { last_commit_hash: Some(Hash::default()), last_results_hash: Some(Hash::default()), next_validators_hash: prepare_state_info.next_validators_hash, - proposer_address: prepare_state_info.proposer_address, + proposer_address: Id::new([0; 20]), time: prepare_state_info.time, validators_hash: Hash::default(), version: tendermint::block::header::Version {