From eac2759e3d5a0bf8d7f67da98ef103df8f286af0 Mon Sep 17 00:00:00 2001 From: Ethan Oroshiba Date: Thu, 5 Dec 2024 14:36:14 -0600 Subject: [PATCH] chore(sequencer): remove unnecessary result return (#1849) ## Summary Removed an unnecessary return of a `Result` from the `fees` state extension trait. ## Background The method is infallible. ## Changes - Removed the return type from `add_fee_to_block_fees()` ## Testing Passing all tests. ## Changelogs No updates required ## Related Issues closes #1845 --- crates/astria-sequencer/src/fees/mod.rs | 4 +--- crates/astria-sequencer/src/fees/state_ext.rs | 16 ++++------------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/crates/astria-sequencer/src/fees/mod.rs b/crates/astria-sequencer/src/fees/mod.rs index 195ad7be47..9536888e65 100644 --- a/crates/astria-sequencer/src/fees/mod.rs +++ b/crates/astria-sequencer/src/fees/mod.rs @@ -347,9 +347,7 @@ async fn check_and_pay_fees( .wrap_err("failed to check allowed fee assets in state")?, "invalid fee asset", ); - state - .add_fee_to_block_fees::<_, T>(fee_asset, total_fees, position_in_transaction) - .wrap_err("failed to add to block fees")?; + state.add_fee_to_block_fees::<_, T>(fee_asset, total_fees, position_in_transaction); state .decrease_balance(&from, fee_asset, total_fees) .await diff --git a/crates/astria-sequencer/src/fees/state_ext.rs b/crates/astria-sequencer/src/fees/state_ext.rs index 142cc2b607..d3a74ba65f 100644 --- a/crates/astria-sequencer/src/fees/state_ext.rs +++ b/crates/astria-sequencer/src/fees/state_ext.rs @@ -383,8 +383,7 @@ pub(crate) trait StateWriteExt: StateWrite { asset: &'a TAsset, amount: u128, position_in_transaction: u64, - ) -> Result<()> - where + ) where TAsset: Sync + std::fmt::Display, asset::IbcPrefixed: From<&'a TAsset>, { @@ -409,7 +408,6 @@ pub(crate) trait StateWriteExt: StateWrite { }; self.object_put(keys::BLOCK, new_fees); - Ok(()) } #[instrument(skip_all)] @@ -622,9 +620,7 @@ mod tests { // can write let asset = asset_0(); let amount = 100u128; - state - .add_fee_to_block_fees::<_, Transfer>(&asset, amount, 0) - .unwrap(); + state.add_fee_to_block_fees::<_, Transfer>(&asset, amount, 0); // holds expected let fee_balances_updated = state.get_block_fees(); @@ -652,12 +648,8 @@ mod tests { let amount_first = 100u128; let amount_second = 200u128; - state - .add_fee_to_block_fees::<_, Transfer>(&asset_first, amount_first, 0) - .unwrap(); - state - .add_fee_to_block_fees::<_, Transfer>(&asset_second, amount_second, 1) - .unwrap(); + state.add_fee_to_block_fees::<_, Transfer>(&asset_first, amount_first, 0); + state.add_fee_to_block_fees::<_, Transfer>(&asset_second, amount_second, 1); // holds expected let fee_balances = HashSet::<_>::from_iter(state.get_block_fees()); assert_eq!(