feat: Add support for ERC-8132: Gas Limit Override Capability#238
Open
ajhodges wants to merge 7 commits intobase:masterfrom
Open
feat: Add support for ERC-8132: Gas Limit Override Capability#238ajhodges wants to merge 7 commits intobase:masterfrom
ajhodges wants to merge 7 commits intobase:masterfrom
Conversation
Collaborator
🟡 Heimdall Review Status
|
There was a problem hiding this comment.
Pull request overview
Implements ERC-8132-style per-call gasLimitOverride support for wallet_sendCalls, including capability advertisement, validation, and forwarding/aggregation when routing calls through the global account.
Changes:
- Advertises
gasLimitOverride: { supported: true }under the0x0(all chains) key inwallet_getCapabilities. - Adds RPC/types for per-call capabilities (
gasLimitOverride) and threads them throughwallet_sendCalls→wallet_prepareCalls. - Validates per-call
gasLimitOverride.valuein the sub-account signer and aggregates per-call gas overrides onto the routedexecuteBatchcall.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/account-sdk/src/sign/base-account/utils/routeThroughGlobalAccount.ts | Aggregates per-call gas limit overrides onto the routed executeBatch call when using the global account. |
| packages/account-sdk/src/sign/base-account/utils/routeThroughGlobalAccount.test.ts | Adds unit tests for aggregation/estimation behavior and propagation of aggregated override. |
| packages/account-sdk/src/sign/base-account/utils/createSubAccountSigner.ts | Adds client-side validation for gasLimitOverride.value (hex + non-zero) and forwards per-call capabilities. |
| packages/account-sdk/src/sign/base-account/utils/createSubAccountSigner.test.ts | Adds unit tests for gas limit override validation/pass-through. |
| packages/account-sdk/src/sign/base-account/utils.ts | Updates request helper typing to allow per-call capabilities. |
| packages/account-sdk/src/sign/base-account/Signer.ts | Always includes 0x0.gasLimitOverride in wallet_getCapabilities and ensures it survives filtering. |
| packages/account-sdk/src/sign/base-account/Signer.test.ts | Updates/adds tests to cover 0x0 wildcard capability behavior. |
| packages/account-sdk/src/core/rpc/wallet_sendCalls.ts | Introduces CallCapabilities and gasLimitOverride types for wallet_sendCalls. |
| packages/account-sdk/src/core/rpc/wallet_prepareCalls.ts | Extends PrepareCallsCall to include per-call capabilities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/account-sdk/src/sign/base-account/utils/routeThroughGlobalAccount.ts
Show resolved
Hide resolved
montycheese
reviewed
Mar 9, 2026
| // Filter capabilities | ||
| const filteredCapabilities = Object.fromEntries( | ||
| Object.entries(capabilities).filter(([capabilityKey]) => { | ||
| if (capabilityKey === '0x0') { |
Collaborator
There was a problem hiding this comment.
would prefer a named const for 0x0 to highlight significance
| } from '../utils.js'; | ||
| import { createSmartAccount } from './createSmartAccount.js'; | ||
|
|
||
| function validateGasLimitOverrides(calls: { capabilities?: CallCapabilities }[]): void { |
Collaborator
There was a problem hiding this comment.
why do we only run this validation for sub account sendCalls requests?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements ERC-8132 Gas Limit Override capability, allowing apps to specify per-call gas limits in
wallet_sendCalls.Resolves BA-3860
Changes:
wallet_getCapabilitiesnow returnsgasLimitOverride: { supported: true }under the0x0wildcard key (all chains)GasLimitOverrideCallCapability,CallCapabilities, andWalletSendCallsCalltypes inwallet_sendCalls.ts;PrepareCallsCallupdated to include per-callcapabilitiesvalidateGasLimitOverrides()in the sub-account signer validates each call'sgasLimitOverride.valueis valid hex and non-zero, returning-32602on failurewallet_sendCalls→wallet_prepareCalls→ bundler RPCexecuteBatch, per-call gas limit overrides are aggregated (witheth_estimateGasfor calls without an override) and set on the batch call sent to the popup. Batch overhead uses backend-aligned buffer params (500 gas/call safety buffer+2 gas/byte input data cost)How did you test your changes?
wallet_getCapabilitiesgasLimitOverride advertisement inSigner.test.tscreateSubAccountSigner.test.tsrouteThroughGlobalAccount.test.tstsc --noEmittype-check