Skip to content

Add ACP-224 Fee Manager Precompile#4872

Merged
joshua-kim merged 106 commits into
masterfrom
JonathanOppenheimer/acp224-add-precompile
May 6, 2026
Merged

Add ACP-224 Fee Manager Precompile#4872
joshua-kim merged 106 commits into
masterfrom
JonathanOppenheimer/acp224-add-precompile

Conversation

@JonathanOppenheimer

@JonathanOppenheimer JonathanOppenheimer commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Why this should be merged

Adds the ACP-224 Fee Manager precompile to enable dynamic gas limit configuration in subnet-evm. This implements the configuration interface specified in ACP-224.

This PR adds the precompile package for reading/writing configuration state, along with tests. The core blockchain integration (using these values for actual gas limit adjustments) is deferred to after SAE, as SAE will redo the ACP-176 mechanism. Module registration is commented out until ready -- this will be done in a follow up "activation" PR.

How this works

The precompile provides three functions with AllowList-based access control:

  • setFeeConfig(FeeConfig): Updates configuration (Admin/Manager/Enabled only)
  • getFeeConfig(): Retrieves current configuration (public)
  • getFeeConfigLastChangedAt(): Returns block number of last update (public)

FeeConfig struct

The FeeConfig struct matches the ACP-224 spec:

Field Type Description
validatorTargetGas bool Whether target gas is determined by the validator set
targetGas uint256 Target gas consumption per second (must be 0 when validatorTargetGas is true, >= 1,000,000 otherwise)
staticPricing bool Whether gas pricing is static
minGasPrice uint256 Minimum gas price in wei (must be > 0)
timeToDouble uint256 Seconds for gas price to double at max capacity (must be 0 when staticPricing is true, > 0 otherwise)

Validation rules

  • minGasPrice must always be > 0
  • validatorTargetGas = true -> targetGas == 0
  • validatorTargetGas = false -> targetGas >= 1,000,000
  • staticPricing = true -> timeToDouble == 0
  • staticPricing = false -> timeToDouble > 0

see the ACP-224 spec for these.

Need to be documented in RELEASES.md?

Yes, but not in this PR as the module is not yet registered. Once the precompile is fully available and functional, the release notes should be updated.

@JonathanOppenheimer JonathanOppenheimer self-assigned this Jan 16, 2026
@JonathanOppenheimer
JonathanOppenheimer requested a review from a team as a code owner January 16, 2026 20:09
@JonathanOppenheimer JonathanOppenheimer added DO NOT MERGE This PR must not be merged in its current state evm Related to EVM functionality acp224 Introduce ACP-176-Based Dynamic Gas Limits and Fee Manager Precompile in Subnet-EVM subnet-evm Related to the former subnet-evm standalone repository labels Jan 16, 2026
Comment thread graft/subnet-evm/commontype/test_fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/fee_config.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
@JonathanOppenheimer JonathanOppenheimer changed the title feat: add acp224 precompile feat: add ACP-224 precompile Jan 27, 2026
@JonathanOppenheimer
JonathanOppenheimer marked this pull request as draft February 4, 2026 17:06
Base automatically changed from JonathanOppenheimer/add-acp224-interface-and-bindings to master March 4, 2026 17:09
@JonathanOppenheimer JonathanOppenheimer removed the DO NOT MERGE This PR must not be merged in its current state label Mar 4, 2026
@JonathanOppenheimer
JonathanOppenheimer marked this pull request as ready for review March 4, 2026 20:28
Copilot AI review requested due to automatic review settings March 4, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR implements the ACP-224 Fee Manager precompile for enabling dynamic gas limit configuration in subnet-evm. It adds the configuration interface specified in ACP-224, providing functions to read and write fee configuration state, with AllowList-based access control. Per the PR description, the precompile package is intentionally incomplete (the core blockchain integration is deferred post-SAE).

Changes:

  • Adds ACP224FeeConfig struct, validation (Verify()), and equality check to the commontype package, along with a test helper value
  • Adds the full precompile implementation: module registration, contract execution functions (setFeeConfig, getFeeConfig, getFeeConfigLastChangedAt), event packing/unpacking, and chain config integration
  • Adds the Solidity interface (IACP224FeeManager.sol), generated ABI, and Go bindings for the new precompile

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
graft/subnet-evm/commontype/fee_config.go New ACP224FeeConfig struct with Verify(), Equal(), and checkByteLens() methods
graft/subnet-evm/commontype/test_fee_config.go Adds ValidTestACP224FeeConfig test fixture
graft/subnet-evm/precompile/contracts/acp224feemanager/module.go Registers the precompile module with its config key and contract address
graft/subnet-evm/precompile/contracts/acp224feemanager/config.go Precompile Config struct with Equal(), Verify(), and constructor helpers
graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Core precompile logic: storage keys, gas costs, state read/write, and function dispatch
graft/subnet-evm/precompile/contracts/acp224feemanager/event.go FeeConfigUpdated event pack/unpack helpers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/module.go
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/commontype/fee_config.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread graft/subnet-evm/commontype/fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/fee_config.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/module.go
// UnpackFeeConfigUpdatedEventData attempts to unpack non-indexed [dataBytes].
func UnpackFeeConfigUpdatedEventData(dataBytes []byte) (FeeConfigUpdatedEventData, error) {
eventData := FeeConfigUpdatedEventData{}
err := ACP224FeeManagerABI.UnpackIntoInterface(&eventData, "FeeConfigUpdated", dataBytes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

huh would this work as it's? Event data should have 2 different data: data[0]=oldFeeConfig, data[1]=newFeeConfig. Maybe it works due to how UnpackIntoInterface but I'm just surprised as this is not the same way we used in legacy fee manager event.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes it works because UnpackIntoInterface with multiple args does field-name matching, unlike the single-arg case which hits copyAtomic. Do you want to change this?

Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
@joshua-kim joshua-kim changed the title feat: add ACP-224 precompile Add ACP-224 Fee Manager Precompile Apr 29, 2026
@joshua-kim
joshua-kim removed the request for review from ARR4N April 29, 2026 15:44
@joshua-kim
joshua-kim enabled auto-merge April 29, 2026 15:48
@JonathanOppenheimer
JonathanOppenheimer removed the request for review from a team April 29, 2026 16:38
Comment thread graft/subnet-evm/commontype/acp224_fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/acp224_fee_config.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/config.go Outdated
Comment thread graft/subnet-evm/commontype/acp224_fee_config.go Outdated
Comment thread graft/subnet-evm/commontype/acp224_fee_config.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/config_test.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/acp224feemanager/config_test.go Outdated
JonathanOppenheimer and others added 6 commits May 1, 2026 16:45
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
@JonathanOppenheimer
JonathanOppenheimer force-pushed the JonathanOppenheimer/acp224-add-precompile branch from cfde4ac to f2bdf43 Compare May 1, 2026 21:23
Comment thread graft/subnet-evm/precompile/contracts/gaspricemanager/contract.go Outdated
Comment thread graft/subnet-evm/precompile/contracts/gaspricemanager/module.go Outdated
@JonathanOppenheimer
JonathanOppenheimer requested review from alarso16 and removed request for powerslider May 6, 2026 16:08
@joshua-kim
joshua-kim added this pull request to the merge queue May 6, 2026
Merged via the queue into master with commit cce132b May 6, 2026
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acp224 Introduce ACP-176-Based Dynamic Gas Limits and Fee Manager Precompile in Subnet-EVM evm Related to EVM functionality subnet-evm Related to the former subnet-evm standalone repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants