Skip to content

fix(tempo): reject a retired root key in the verifyHash hook - #5498

Merged
jxom merged 4 commits into
mainfrom
fix/tempo-verify-hash-retired-root
Nov 12, 2026
Merged

jxom merged 4 commits into
mainfrom
fix/tempo-verify-hash-retired-root

Conversation

@jxom

@jxom jxom commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

The Tempo verifyHash hook accepted a secp256k1 signature of a root key that a config commitment retired (TIP-1113). It now reads the account's config commitment and returns false for that key, in every mode. 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 getConfigCommitment for 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 new secp256k1: valid signature test fails with ContractFunctionZeroDataError; 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 verifyAccessKey branch). A plain secp256k1 signature of the root key matched no branch and reached core verifyHash with chain: null:

  • mode: 'eoa' returned true on local recovery, with no request.
  • The default mode ran the deployless validator call, which reverted for the upgraded account, and then returned true from the ECDSA recovery fallback in its catch.

No branch read the commitment, so verifyHash, verifyMessage, and verifySiweMessage returned true for 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: after upgradeSync, a signature of the retired secp256k1 root returned true in the default mode, mode: 'eoa', and mode: 'allowAccessKey', and through verifyMessage and verifySiweMessage.

Change

Before the fall-through to core verifyHash, the hook recovers the signer from hash and signature.

  • If recovery fails or the signer is not address, nothing changes.
  • If the signer is address, the hook reads getConfigCommitment (at the caller's block) in parallel with the core call and returns valid && 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

  • A secp256k1 signature that recovers to the account costs one more 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.
  • If that read fails (transport error, unknown block), verification rejects instead of returning true. Returning true there would reopen the hole whenever the read fails.
  • The viem/chains size limit goes from 136.5 kB to 137 kB: import * from 'viem/chains' is 136,486 B on main and 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: true before the upgrade and false after it for the default mode, eoa, allowAccessKey, a bytes signature, an object signature, verifyMessage, and verifySiweMessage. Without the fix all seven are true after the upgrade.
  • P256 and WebAuthn roots: true before, false after (pinning, see above).

src/tempo/chainConfig.test.ts, on every hardfork:

  • secp256k1: valid signature (default and eoa) and secp256k1: invalid signature returns false.
  • secp256k1: failed commitment read rejects, which fails without the fix.

Verification

  • Default node: 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, and actions/accounts.accounts.test.ts pass (282 passed, 1 skipped).
  • T13 node (VITE_TEMPO_HARDFORK=T13): the five of those files that are not *.accounts.test.ts pass (190 tests).
  • tsc -b of src and test, Biome, knip --production, and the pnpm size limits pass locally.

Not run locally: the full test suite, pnpm bench:types, pnpm docs:build, and any node other than the local tempo:latest image. The default mode and eoa mode were not run against a deployed chain with TIP-1113.

Out of Scope

  • An ERC-8010 wrapped signature makes the node refuse the eth_call ("Transaction creation failed", with authorizationList) 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 on main.
  • PreAuthorized.verify already refuses a retired root.

@changeset-bot

changeset-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 041a60c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

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

@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
viem Error Error Nov 12, 2026 4:43am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T04:41:44.419888Z 041a60c New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/tempo/actions/accounts.test.ts Outdated
configurableAccounts,
getClient,
} from '~test/tempo/config.js'
import * as actions from './index.js'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@jxom
jxom force-pushed the fix/tempo-verify-hash-retired-root branch from 29bcdbb to 041a60c Compare November 12, 2026 04:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@jxom
jxom merged commit e87e3ec into main Nov 12, 2026
39 of 40 checks passed
@jxom
jxom deleted the fix/tempo-verify-hash-retired-root branch November 12, 2026 04:44
@github-actions github-actions Bot mentioned this pull request Nov 12, 2026

This branch had an error being deployed

1 failed deployment
Preview — 041a60c1 Deployed Nov 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants