Repository navigation
fix(tempo): reject a retired root key in the verifyHash hook - #5498
Conversation
…chains without the precompile Amp-Thread-ID: https://ampcode.com/threads/T-01a1cddf-a3e6-74f9-84a1-1eee90c97321 Co-authored-by: jxom <[email protected]>
🦋 Changeset detectedLatest commit: 041a60c 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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: 29bcdbbc09
ℹ️ 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 public actions through the package entrypoint
This new public-surface test imports the actions through the relative source barrel, contrary to the explicit test-import requirement in AGENTS.md. Import Actions from 'viem/tempo' instead so the regression coverage exercises the supported public export. The newly added relative SIWE import in chainConfig.accounts.test.ts should likewise use 'viem/siwe'.
AGENTS.md reference: AGENTS.md:L188-L193
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Applied. accounts.test.ts imports Actions from viem/tempo (02cc290, from #5497), and chainConfig.accounts.test.ts imports the SIWE helpers from viem/siwe (041a60c). No test used the viem/siwe entrypoint before, so that commit also adds its path to test/tsconfig.json; without the path tsc fails with TS2307.
…itment` tests Amp-Thread-ID: https://ampcode.com/threads/T-01a1cddf-a3e6-74f9-84a1-1eee90c97321 Co-authored-by: jxom <[email protected]>
29bcdbb to
041a60c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 041a60c1a1
ℹ️ 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".
| import { supportsFillTransaction } from '../actions/wallet/prepareTransactionRequest.js' | ||
| import { mainnet, tempoLocalnet } from '../chains/index.js' | ||
| import { createClient, http } from '../index.js' | ||
| import { ContractFunctionExecutionError, createClient, http } from '../index.js' |
There was a problem hiding this comment.
Import the newly tested public error from the package entrypoint
The new failed-commitment-read test imports ContractFunctionExecutionError through the relative source barrel, contrary to the repository's explicit requirement to import public APIs through package entrypoints in tests. Import this error from 'viem' so the new assertion exercises the supported public export. This is a separate newly added import from the previously corrected Actions and SIWE imports.
AGENTS.md reference: AGENTS.md:L188-L193
Useful? React with 👍 / 👎.
The Tempo
verifyHashhook accepted a secp256k1 signature of a root key that a config commitment retired (TIP-1113). It now reads the account's config commitment and returnsfalsefor that key, in everymode. Requested by @jxom.Note
Stacked on #5497. This pull request targets
main, so its diff also shows #5497's commit until that one merges. The changes of this pull request alone are 5c51787 and 041a60c: compare view.It is stacked because the fix reads
getConfigCommitmentfor every root-key signature, and without #5497 that read rejects on mainnet, Moderato, and devnet, which hold no precompile. On a T13 node with #5497 reverted, the newsecp256k1: valid signaturetest fails withContractFunctionZeroDataError; with it, the test passes.Problem
An account that commits a config retires its root key. The hook refused such a key only as an access key (the
verifyAccessKeybranch). A plain secp256k1 signature of the root key matched no branch and reached coreverifyHashwithchain: null:mode: 'eoa'returnedtrueon local recovery, with no request.truefrom the ECDSA recovery fallback in itscatch.No branch read the commitment, so
verifyHash,verifyMessage, andverifySiweMessagereturnedtruefor the retired key after an in-place upgrade (tempoxyz/accounts2#319 works around it).Reproduced on a local Tempo node (
ghcr.io/tempoxyz/tempo:latest, TIP-1113 active) before the fix: afterupgradeSync, a signature of the retired secp256k1 root returnedtruein the default mode,mode: 'eoa', andmode: 'allowAccessKey', and throughverifyMessageandverifySiweMessage.Change
Before the fall-through to core
verifyHash, the hook recovers the signer fromhashandsignature.address, nothing changes.address, the hook readsgetConfigCommitment(at the caller's block) in parallel with the core call and returnsvalid && commitment === 0.The core call stays in place and is not replaced by the recovery result. In the default mode core returns the ERC-1271 result for an account with code, and replacing it would change the result for delegated and contract accounts.
Behavior Changes for Review
eth_call. In the default mode it runs in parallel with the existing call.mode: 'eoa'made no request for such a signature and now makes one, because only the chain knows whether the key is retired.true. Returningtruethere would reopen the hole whenever the read fails.viem/chainssize limit goes from 136.5 kB to 137 kB:import * from 'viem/chains'is 136,486 B onmainand 136,561 B here.P256 and WebAuthn Roots
These were already refused, so the hook does not read the commitment for them. An upgraded account holds the
0xef…configurable account marker as code, which is neither empty nor the default delegation, so the local verification branch is skipped and the chain call rejects the retired key. The two new P256 and WebAuthn tests pin this; they pass without the fix. A commitment read on that branch would cost every passkey verification a request and close nothing.Tests
src/tempo/chainConfig.accounts.test.ts, on a node with TIP-1113:behavior: rejects a retired secp256k1 root key:truebefore the upgrade andfalseafter it for the default mode,eoa,allowAccessKey, a bytes signature, an object signature,verifyMessage, andverifySiweMessage. Without the fix all seven aretrueafter the upgrade.truebefore,falseafter (pinning, see above).src/tempo/chainConfig.test.ts, on every hardfork:secp256k1: valid signature(default andeoa) andsecp256k1: invalid signature returns false.secp256k1: failed commitment read rejects, which fails without the fix.Verification
Account.test.ts,Account.accounts.test.ts,chainConfig.test.ts,chainConfig.accounts.test.ts,Decorator.test.ts,e2e.accounts.test.ts,actions/accessKey.test.ts,actions/accounts.test.ts, andactions/accounts.accounts.test.tspass (282 passed, 1 skipped).VITE_TEMPO_HARDFORK=T13): the five of those files that are not*.accounts.test.tspass (190 tests).tsc -bofsrcandtest, Biome,knip --production, and thepnpm sizelimits pass locally.Not run locally: the full test suite,
pnpm bench:types,pnpm docs:build, and any node other than the localtempo:latestimage. The default mode andeoamode were not run against a deployed chain with TIP-1113.Out of Scope
eth_call("Transaction creation failed", withauthorizationList) for both an active and a retired account on the local node, so it is not an acceptance path. It is a separate limitation that exists onmain.PreAuthorized.verifyalready refuses a retired root.