Skip to content

Specify transaction fees in a selected asset - #641

Open
pixelcircuits wants to merge 8 commits into
masterfrom
pixelcircuits/fee-assets
Open

pixelcircuits wants to merge 8 commits into
masterfrom
pixelcircuits/fee-assets

Conversation

@pixelcircuits

@pixelcircuits pixelcircuits commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

This lets a Script pay its gas and tip in FUEL or another asset the producer accepts. The sender signs an output index and a maximum fee. The asset of that Change output determines which coins fund the fee and where the unused amount goes, including on revert.

A block ends with one Mint for each supplemental asset used or announced, followed by the base-asset Mint. Each Mint records the inclusion price and collected fees for its asset. A validator can replay the block using those prices. Feed selection and wallet quotes are node policy.

The changes cover the existing policy, transaction validity, Mint, relayer and instruction-set sections. The VM exposes the policy index through GTF. Programs can use the existing output lookup to read the asset ID.

The existing fee examples now include the tip, refund the unused part of MaxFee, and use the configured base asset for messages. The Mint amount check describes what Core already enforces for a nonzero coinbase contract.

The implementation drafts are Fuel VM #1029 and Fuel Core #3366. I ran mdbook build and git diff --check.

@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
The diff changes consensus-critical fee economics, balance checks, change/refund rules, and block-ending Mint layout—implementations must match exactly or validators will disagree.

Overview
Adds a FeeAsset policy so Script transactions can pay gas and tips from a chosen Change output’s asset (default remains base asset). Tip and MaxFee are documented in that fee asset; validity math resolves feeAssetId, includes tip(tx) in cost/min_fee/max_fee, and applies fee reserves only when assetId == feeAssetId.

Change output rules are rewritten: success/revert balances per asset, with unused MaxFee refunded on the fee asset. Coinbase is extended to a trailing contiguous Mint sequence—one Mint per fee asset used or price-announced (distinct non-base assets, shared coinbase contract), with the base-asset Mint last; each Mint’s gasPrice is the inclusion price for that asset.

Relayed L1 transactions are specified at gas price zero and must use the base fee asset. The VM docs update GM_GET_GAS_PRICE to the transaction’s fee-denominated price and add GTF_POLICY_FEE_ASSET for the policy output index.

Reviewed by Cursor Bugbot for commit 0351227. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread src/protocol/tx-validity.md Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e125515. Configure here.

Comment thread src/fuel-vm/index.md Resolved
@pixelcircuits
pixelcircuits marked this pull request as ready for review December 2, 2026 19:26

This branch has not been deployed

No deployments
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.

1 participant