Skip to content

Rework fee reporting #1369

@ethanoroshiba

Description

@ethanoroshiba

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions