Add ACP-224 Fee Manager Precompile#4872
Conversation
There was a problem hiding this comment.
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
ACP224FeeConfigstruct, validation (Verify()), and equality check to thecommontypepackage, 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| // UnpackFeeConfigUpdatedEventData attempts to unpack non-indexed [dataBytes]. | ||
| func UnpackFeeConfigUpdatedEventData(dataBytes []byte) (FeeConfigUpdatedEventData, error) { | ||
| eventData := FeeConfigUpdatedEventData{} | ||
| err := ACP224FeeManagerABI.UnpackIntoInterface(&eventData, "FeeConfigUpdated", dataBytes) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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>
cfde4ac to
f2bdf43
Compare
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
FeeConfigstruct matches the ACP-224 spec:validatorTargetGasbooltargetGasuint256validatorTargetGasis true, >= 1,000,000 otherwise)staticPricingboolminGasPriceuint256timeToDoubleuint256staticPricingis true, > 0 otherwise)Validation rules
minGasPricemust always be > 0validatorTargetGas = true->targetGas == 0validatorTargetGas = false->targetGas >= 1,000,000staticPricing = true->timeToDouble == 0staticPricing = false->timeToDouble > 0see 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.