Repository navigation
feat(tempo): default channel salt to configurable signer commitment - #5545
Conversation
Adds client-side support for TIP-1166 (configurable account voucher signers for the TIP-1034 channel reserve) to viem/tempo channels.\n\n- ABI: SignerSnapshotCached event, SignerConfigChanged and SaltNotSignerCommitment errors on tip20ChannelReserve (and coreErrors), with messages and hints.\n- channel.open / openSync: when salt is omitted and the voucher signer (authorizedSigner, else the account) is a configurable account, salt defaults to its nonzero config commitment; otherwise random as before. authorizedSigner also accepts an Account.\n- channel.getOpenSalt: returns the signer's nonzero commitment, else a random 32-byte salt.\n- Typed ChannelSaltNotSignerCommitmentError and ChannelSignerConfigChangedError.\n- open.call stays pure (no RPC); callers pass salt there.
|
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. |
🦋 Changeset detectedLatest commit: 97273d2 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cafd35ae4
ℹ️ 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".
| transport: custom({ | ||
| async request(request: Request) { | ||
| requests.push(request) | ||
| if (request.method === 'eth_chainId') return toHex(chain.id) | ||
| if (request.method === 'eth_call') { |
There was a problem hiding this comment.
Replace the mocked transport with real chain coverage
The new salt suite uses a fake client transport that fabricates commitment reads, transaction hashes, and reverts, so none of these tests exercise the channel reserve's actual commitment enforcement. This directly violates the root AGENTS.md prohibition on mocks, stubs, and fake clients. Replace this helper with tests against the configured Tempo test chain, initializing configurable signers and asserting actual channel outcomes and reverts.
AGENTS.md reference: AGENTS.md:L155-L158
Useful? React with 👍 / 👎.
|
Published pnpm add viem@pr-5545
pnpm add [email protected] |
…keys An access key signs as its parent account, which can be a configurable account, so channel.open now reads the parent's commitment for access key signers too. Points the SaltNotSignerCommitment hint at channel.getOpenSalt, documents the salt default on openSync and the decorator, and aligns the channel.getOpenSalt page with the action page layout. Amp-Thread-ID: https://ampcode.com/threads/T-01a1e539-38a8-772b-bb1c-b71e34a5bd2e Co-authored-by: jxom <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97273d2864
ℹ️ 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".
| const signerSnapshots = | ||
| Number(/^T(\d+)$/.exec(import.meta.env.VITE_TEMPO_HARDFORK ?? '')?.[1]) >= 15 |
There was a problem hiding this comment.
Enable signer snapshot tests for Tnext and default local runs
When VITE_TEMPO_HARDFORK is Tnext or unset, this expression evaluates to false, skipping all six tests covering registered configurable signers, access keys, initial registration, and the new reserve errors. The test-tempo job in .github/workflows/verify.yml only runs T13 and Tnext; test/vitest.config.ts excludes this entire file on T13, so none of those tests execute in CI. Treat Tnext and the unset default as the latest fork, consistent with the existing test harness, while retaining the numeric version check for explicitly pinned forks.
Useful? React with 👍 / 👎.
What
Client-side support in
viem/tempochannels for TIP-1166 (configurable account voucher signers for the TIP-1034 channel reserve, activating at T15).tip20ChannelReservegains theSignerSnapshotCached(bytes32 indexed channelId, address indexed signer, bytes32 commitment)event and theSignerConfigChanged(address signer)andSaltNotSignerCommitment(address signer, bytes32 commitment)errors. Both errors are also incoreErrors, with messages and hints inExecutionError.channel.open/channel.openSync: whensaltis omitted and the voucher signer (authorizedSigner, else the acting account) is a configurable account (Account.fromConfig), the salt defaults to the signer's config commitment if it is nonzero, read withaccounts.getConfigCommitment. Otherwise the salt isHex.random(32), as it is today.authorizedSignernow also accepts anAccount, so a configurable signer can be passed directly.channel.getOpenSalt(client, { signer })(new): returns the signer's nonzero commitment, else a random 32-byte salt. Use it when the signer is known only by address, or withchannel.open.call.channel.open.callmakes no RPC calls, so callers passsaltthere. This is now in its docs.ChannelSaltNotSignerCommitmentError(open) andChannelSignerConfigChangedError(topUp after the signer's config changed; the fix is to close and reopen, which is not done automatically). Both are added tochannel.ExecutionErrorType.channel.getOpenSaltpage, a "Configurable Account Signers" section inchannel.open, and a sidebar entry. Changeset included.Why
From T15, when a channel's voucher signer has a nonzero configurable-account commitment, the salt must equal that commitment, or
openreverts withSaltNotSignerCommitment. AtopUpafter the signer's config changes reverts withSignerConfigChanged. Protocol change: tempoxyz/tempo#9293. TIP text: tempoxyz/tempo#9133.Backward compatibility
Every change adds something new, and the defaults behave as before:
saltalways wins.authorizedSignerstill means the payer signs.open.callis unchanged.The new salt default only matters once tempoxyz/tempo#9293 lands for T15. Before then, configurable accounts read a zero commitment (or the precompile is absent), so they fall back to a random salt.
Tests
src/tempo/actions/channel.salt.test.ts(13 unit tests on a mocked transport). It coversgetOpenSaltwith a nonzero commitment, a zero commitment and a missing precompile. It checks thatopenkeeps the defaults (random salt, no extra read) for regular accounts and address signers, that a configurable signer's salt defaults to its commitment, that a zero commitment falls back to random, that an explicit salt wins, that a zeroauthorizedSignerstill means the payer, and thatopen.callstays pure. It also checks thatSaltNotSignerCommitmentandSignerConfigChangedreverts decode to the typed errors.vitestonchannel.salt.test.ts,ExecutionError.test.ts,Selectors.test.tsandAbis.test.ts(87 passed),scripts/checkTempoErrors.ts,biome check,tsc -p src/tsconfig.json, and a tsc check of the new test file.