Issue
#1305 added fee reporting by way of get_and_increase_block_fees(), which was fixed in #1343 by adding a call to this function in all actions which require fees. This setup requires passing ABCI events all the way through to finalize_block(), where the events are retroactively placed into ExecTxResults. We should rework this such that the result Txs are constructed at a lower level and passed back through the execution calls to finalize_block().
Note: this should only be done after #1332 is merged
Relevant Code
Fee reporting in get_and_increase_block_fees
|
let tx_fee_event = construct_tx_fee_event(&asset, amount, action_type); |
|
self.record(tx_fee_event); |
Construction of fee event
|
fn construct_tx_fee_event<T: std::fmt::Display>( |
|
asset: &T, |
|
fee_amount: u128, |
|
action_type: String, |
|
) -> Event { |
|
Event::new( |
|
"tx.fees", |
|
[ |
|
("asset", asset.to_string()).index(), |
|
("feeAmount", fee_amount.to_string()).index(), |
|
("actionType", action_type).index(), |
|
], |
|
) |
|
} |
Construction of ExecTxResult from ABCI event
|
match self.execute_transaction(Arc::new(signed_tx)).await { |
|
Ok(events) => tx_results.push(ExecTxResult { |
|
events, |
|
..Default::default() |
┆Issue Number: ENG-718
Issue
#1305 added fee reporting by way of
get_and_increase_block_fees(), which was fixed in #1343 by adding a call to this function in all actions which require fees. This setup requires passing ABCI events all the way through tofinalize_block(), where the events are retroactively placed intoExecTxResults. We should rework this such that the result Txs are constructed at a lower level and passed back through the execution calls tofinalize_block().Note: this should only be done after #1332 is merged
Relevant Code
Fee reporting in
get_and_increase_block_feesastria/crates/astria-sequencer/src/assets/state_ext.rs
Line 208 in c5364e8
astria/crates/astria-sequencer/src/assets/state_ext.rs
Line 231 in c5364e8
Construction of fee event
astria/crates/astria-sequencer/src/assets/state_ext.rs
Lines 50 to 63 in c5364e8
Construction of
ExecTxResultfrom ABCI eventastria/crates/astria-sequencer/src/app/mod.rs
Lines 817 to 820 in c5364e8
┆Issue Number: ENG-718