Repository navigation
fix(tempo): return the zero commitment from getConfigCommitment on chains without the precompile - #5497
Conversation
…chains without the precompile Amp-Thread-ID: https://ampcode.com/threads/T-01a1cddf-a3e6-74f9-84a1-1eee90c97321 Co-authored-by: jxom <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 02cc290 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7e6cabe14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| configurableAccounts, | ||
| getClient, | ||
| } from '~test/tempo/config.js' | ||
| import * as actions from './index.js' |
There was a problem hiding this comment.
Import the tested action through its public package entrypoint
These tests exercise the public getConfigCommitment API, but import it through the relative actions barrel. The repository explicitly requires public-surface tests to use package entrypoints, reserving relative imports for internal or non-exported members. Import Actions from viem/tempo instead so the regression tests exercise the supported public surface.
AGENTS.md reference: AGENTS.md:L188-L192
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Applied in 02cc290: the tests import Actions from viem/tempo.
|
|
||
| const client = getClient() | ||
|
|
||
| describe('getConfigCommitment', () => { |
There was a problem hiding this comment.
Keep the primary export tests at the top level
This new file tests only getConfigCommitment, so wrapping every test in a top-level describe conflicts with the repository's explicit requirement to put primary-export tests at the top level and reserve describe for nested scenarios or multiple distinct exports. Remove this wrapper and retain the individual test cases at file scope.
AGENTS.md reference: AGENTS.md:L199-L202
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Kept as is. accounts.ts exports many actions and this file covers one of them, so the describe names the action under test and does not echo the file. The sibling accounts.accounts.test.ts uses one describe per action the same way, and AGENTS.md allows describe to separate distinct exports. Without it the tests would read behavior: chain without the precompile with no action name.
…itment` tests Amp-Thread-ID: https://ampcode.com/threads/T-01a1cddf-a3e6-74f9-84a1-1eee90c97321 Co-authored-by: jxom <[email protected]>
Actions.accounts.getConfigCommitmentrejected on every chain without the configurable account precompile (0xAACC000000000000000000000000000000000000). It now returns the zero commitment there. Requested by @jxom.Problem
Tempo mainnet (4217), Moderato (42431), and devnet (31318) hold no code at the precompile, so the
eth_callanswers0xand the action rejected withContractFunctionExecutionErrorcaused byContractFunctionZeroDataError. A caller that reads the commitment before it trusts a root key's signature had to handle that error itself (tempoxyz/accounts2#313 does).Change
The action catches a
ContractFunctionExecutionErrorwhose cause isContractFunctionZeroDataErrorand returnszeroHash, the same checkgetEip712Domainuses. Every other failure (revert, transport error, unknown block) still rejects.Why Zero
chain.hardfork. The chain definitions carry a static value that goes stale at activation, and a client without a chain would have no answer.nullorundefinedwould change the return type and make every caller branch on a third state.Tradeoffs for Review
canMigratecheck in the migrate guide) reads true on a chain where the upgrade is not available yet. The upgrade itself still fails there.account_getConfighandler andvalidateConfig(src/tempo/internal/relay/accounts.ts) call this action, so on such a chain they now see a zero commitment instead of an error.getConfigCommitment.callis unchanged, so a multicall or a directreadContractwith it still gets the zero-data failure.Verification
src/tempo/actions/accounts.test.tsis new.behavior: chain without the precompileruns on a T13 node (theT13job of the Tempo matrix; it is skipped where the precompile exists). It fails without the change with the zero-data error and passes with it.error: failed readchecks on every hardfork that an unknown block still rejects.actions/accounts.test.tsandactions/accounts.accounts.test.tspass on the default node (ghcr.io/tempoxyz/tempo:latest);tsc -bofsrcandtestand Biome are clean; theviem/chainssize limits pass locally (import * from 'viem/chains'is 136,494 B of 136.5 kB).Not run locally: the full test suite,
pnpm bench:types, andpnpm docs:build.#5498 depends on this change.