Skip to content

Commit

Permalink
Merge branch 'main' into ENG-995/refactor_sequencer_app
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanoroshiba authored Dec 5, 2024
2 parents 899394e + eac2759 commit 12728e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
4 changes: 1 addition & 3 deletions crates/astria-sequencer/src/fees/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ async fn check_and_pay_fees<S: StateWrite, T: FeeHandler + Protobuf>(
.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
Expand Down
16 changes: 4 additions & 12 deletions crates/astria-sequencer/src/fees/state_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
{
Expand All @@ -409,7 +408,6 @@ pub(crate) trait StateWriteExt: StateWrite {
};

self.object_put(keys::BLOCK, new_fees);
Ok(())
}

#[instrument(skip_all)]
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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!(
Expand Down

0 comments on commit 12728e6

Please sign in to comment.