Skip to content

feat(node): default executor finish message with hook#4

Merged
cryptoAtwill merged 3 commits intomasterfrom
customize-gas
Feb 25, 2025
Merged

feat(node): default executor finish message with hook#4
cryptoAtwill merged 3 commits intomasterfrom
customize-gas

Conversation

@cryptoAtwill
Copy link
Copy Markdown

@cryptoAtwill cryptoAtwill commented Feb 18, 2025

This PR introduces finish_message_with_hook method that allows customisation on which actors receives the transaction gas fee, i.e.

transfer_to_actor(BURNT_FUNDS_ACTOR_ID, &base_fee_burn)?;
.

This is implemented by introducing a gas processing hook with a newly added method: execute_with_options. This method takes a closure as the gas processing hook. At the end of the execution, finish_message is replaced with finish_message_with_hook instead that calls the hook.

@cryptoAtwill cryptoAtwill changed the title initial commit feat(node): customise txn gas distribution Feb 18, 2025
@cryptoAtwill cryptoAtwill changed the title feat(node): customise txn gas distribution feat(node): default executor finish message with hook Feb 18, 2025
Comment thread fvm/src/executor/default.rs Outdated
if (&base_fee_burn + &over_estimation_burn + &refund + &miner_tip) != gas_cost {
if gas_sum != gas_cost {
// Sanity check. This could be a fatal error.
return Err(anyhow!("Gas handling math is wrong"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide more context and use the bail! macro

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread fvm/src/executor/default.rs
Comment thread testing/integration/tests/main.rs Outdated
Comment thread testing/integration/tests/main.rs
@cryptoAtwill cryptoAtwill merged commit 6831002 into master Feb 25, 2025
@cryptoAtwill cryptoAtwill deleted the customize-gas branch February 25, 2025 08:34
karlem pushed a commit that referenced this pull request Oct 13, 2025
* initial commit

* expose default gas hook

* review feedbacks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants