Skip to content

feat(tempo): add channel.verifyVoucher and rename OpeningCommitmentRecorded event - #5606

Merged
jxom merged 6 commits into
wevm:mainfrom
legion2002:tempo/channel-verify-voucher
Nov 19, 2026
Merged

jxom merged 6 commits into
wevm:mainfrom
legion2002:tempo/channel-verify-voucher

Conversation

@legion2002

Copy link
Copy Markdown
Contributor

What

  • Renames the SignerSnapshotCached event on the tip20ChannelReserve ABI to OpeningCommitmentRecorded(bytes32 indexed channelId, address indexed signer, bytes32 commitment), matching the final TIP-1166 interface (the event topic changes).
  • Adds verifyVoucher(ChannelDescriptor descriptor, uint96 cumulativeAmount, bytes signature) view returns (bool valid) to the ABI and its selector (0xcabd6d5a) to Selectors.tip20ChannelReserve.
  • Adds a read-only channel.verifyVoucher action with a .call() builder, a client.channel.verifyVoucher decorator entry, a docs page and a sidebar link. It returns whether the signature is a valid voucher from the channel's voucher signer; it does not check the amount against the deposit, and throws ChannelNotFoundError for an unknown channel.
  • Tests: a node test for verifyVoucher (valid voucher, amount above deposit, wrong amount, wrong signer, unknown channel) and a unit test of the call encoding. The accounts tests now look for OpeningCommitmentRecorded.
  • Patch changeset.

Why

Follow-up to #5545. The TIP-1166 interface in tempoxyz/tempo changed after that PR: tempoxyz/tempo#9422 renamed the event, and tempoxyz/tempo#9420 added verifyVoucher.

Testing

  • pnpm check and pnpm check:types pass.
  • Unit tests pass locally (verifyVoucher.call encoding, Selectors, decorator bindings). The tests that need a Tempo localnet were not run locally (no Docker available).

@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@legion2002 is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8a194ea

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 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-19T08:07:48.845054Z eb9dbc2 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: 4f4ca2781b

ℹ️ 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 on lines +1256 to +1259
export async function verifyVoucher<chain extends Chain | undefined>(
client: Client<Transport, chain>,
parameters: verifyVoucher.Parameters,
): Promise<verifyVoucher.ReturnValue> {

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 Add the required type tests for the voucher API

This adds a public standalone action, .call builder, and bound client method, but no accompanying .test-d.ts coverage. Root AGENTS.md requires unit and type tests alongside every public behavior change; the runtime encoding test and typeof ...call assertion do not verify the public return types or builder/decorator compatibility with downstream actions. Add colocated type tests covering these new entrypoints.

AGENTS.md reference: AGENTS.md:L222-L222

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Done in 8a194ea: src/tempo/actions/channel.test-d.ts covers the standalone action, the decorated client method and the .call builder through readContract (all typed as boolean), plus @ts-expect-error cases for a missing signature and a channel ID in place of a descriptor.

Comment on lines +60 to +62
Channel descriptor. The precompile computes the channel ID from it, so a channel ID alone is not enough.

### cumulativeAmount

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 Add focused examples beneath each parameter heading

The new channel, cumulativeAmount, and signature parameter references contain only types and prose. Root AGENTS.md explicitly requires a focused ts twoslash example after every parameter description, with // [!code focus] marking the relevant lines; the shared Usage example does not satisfy that per-parameter requirement. Add minimal examples beneath these headings, including the descriptor shape required for channel.

AGENTS.md reference: AGENTS.md:L340-L344

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Done in 8a194ea: channel, cumulativeAmount and signature each have a focused twoslash example now, and the channel one shows the Channel.from descriptor shape.

ampagent and others added 2 commits November 19, 2026 07:48
verifyVoucher is scheduled from T15, so the test reverted with an unknown selector on the T13 CI matrix. Also drop the decode round trip in the call test, which only re-checked the ABI encoder.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1f2b6-397a-708b-bd28-cabd6caf9e45
Co-authored-by: jxom <[email protected]>

jxom commented Nov 19, 2026

Copy link
Copy Markdown
Member

I pushed two small commits to this branch. The ABI, the 0xcabd6d5a selector and the OpeningCommitmentRecorded event match ITIP20ChannelReserve and the precompile on tempoxyz/tempo main.

  • 5f7cfea test(tempo): the precompile only dispatches verifyVoucher from T15 (#[schedule(since = T15)]). On the T13 CI matrix the test reverted with UnknownFunctionSelector. It now skips unless T15 is active in tempo_forkSchedule. I also dropped the decodeFunctionData round trip from the .call test, since it only re-checked the ABI encoder.
  • 0837aaa docs(tempo): moved ChannelNotFoundError into an ## Errors table and reworded the changeset. It stays a patch because the precompile no longer emits SignerSnapshotCached, and no Tempo release ever shipped it.

Locally against ghcr.io/tempoxyz/tempo:latest, the channel tests pass on T13, T15 and Tnext. Biome, the src and test typechecks and pnpm size also pass (CJS is 120.99 kB of 121.5 kB).

One thing for a follow-up: the T15 tests in channel.accounts.test.ts read VITE_TEMPO_HARDFORK, so they skip on Tnext, and CI never runs the OpeningCommitmentRecorded assertion. It passes with VITE_TEMPO_HARDFORK=T15, and fails if the old event name is put back.

@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: 0837aaab1c

ℹ️ 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/channel.test.ts Outdated
Comment on lines +461 to +464
expect(call.to).toBe(Channel.address)
expect(call.functionName).toBe('verifyVoucher')
expect(call.data.slice(0, 10)).toBe('0xcabd6d5a')
expect(call.args).toEqual([

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 Snapshot the complete deterministic voucher call

The new call-encoding test checks selected fields and only the four-byte selector of data, leaving the encoded argument bytes out of the expected output. AGENTS.md explicitly requires whole-object snapshots instead of cherry-picked field assertions. Snapshot the deterministic call result so the complete calldata and call metadata are covered together.

AGENTS.md reference: AGENTS.md:L212-L212

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done in f021efd. The test now snapshots the whole call without abi. I checked the calldata against cast calldata.

Comment on lines +1268 to +1270
export type Parameters = ReadParameters & Args

export type Args = {

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 Document the newly exported voucher types

The new verifyVoucher.Parameters, Args, ReturnValue, and ErrorType are public exports without attached TSDoc. The function-level documentation and comments on individual argument fields do not document these type exports. AGENTS.md requires TSDoc on every public type, so add a short type-level documentation block to each.

AGENTS.md reference: AGENTS.md:L120-L120

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not changing this one. No other channel.* namespace documents Parameters, Args, ReturnValue or ErrorType (see getOpenSalt, getStates and topUp), and each Args field already has TSDoc.


Voucher signature, from [`channel.signVoucher`](/tempo/actions/channel.signVoucher).

<ReadParameters />

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 Alphabetize inherited read parameters with the voucher fields

Here <ReadParameters /> appends the peer headings blockNumber, blockOverrides, and blockTag after signature, making the new parameter reference nonalphabetical. AGENTS.md explicitly requires required and optional option-bag properties to share the same alphabetical ordering. Arrange the inherited fields so the block* headings precede channel, with stateOverride remaining last.

AGENTS.md reference: AGENTS.md:L113-L114

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not changing this one. <ReadParameters /> is a shared snippet, and every read action page (channel.getStates, channel.getOpenSalt) puts it last. The alphabetical rule covers hand-written parameters, which are in order here.

channel,
cumulativeAmount: parseUnits('40', 6),
signature: '0x...',
})

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 Annotate the standalone example's return value

The standalone Usage example binds valid but ends without showing its returned boolean, unlike the client-extension example above. AGENTS.md requires a // @log: response annotation directly below the bound result in value-returning Action Usage examples. Add // @log: true after this call as well.

AGENTS.md reference: AGENTS.md:L108-L110

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done in eb9dbc2.

Comment thread site/vocs.config.ts
link: '/tempo/actions/channel.topUp',
},
{
text: 'verifyVoucher',

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 Use a task phrase for the new sidebar label

The new sidebar label simply repeats verifyVoucher rather than describing a task, and it is not Title Case. AGENTS.md explicitly requires short Title Case concept/task labels that do not merely echo the identifier. Use a label such as Verify a Voucher while retaining the existing route.

AGENTS.md reference: AGENTS.md:L358-L361

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not changing this one. Every Tempo action sidebar entry uses the action name (topUp, withdraw, and so on). The task-phrase rule is for module pages.

@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: eb9dbc2b88

ℹ️ 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 signature = `0x${'ab'.repeat(65)}` as const

const call = actions.channel.verifyVoucher.call({

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 new voucher tests through the package entrypoint

The new standalone and .call tests invoke actions.channel.verifyVoucher, but actions is imported from ./index.js, so they do not exercise the public Actions.channel.verifyVoucher export path. AGENTS.md requires public API tests to use package entrypoints; import Actions from 'viem/tempo' for these new cases instead of extending the existing relative-import pattern.

AGENTS.md reference: AGENTS.md:L188-L190

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not changing this one. Every test in channel.test.ts uses actions from ./index.js, and switching only these cases would mix two import styles in one file. Moving the whole file to viem/tempo belongs in a separate change. Decorator.test.ts already covers the public binding.

cumulativeAmount,
signature,
}),
).toBe(true)

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 Snapshot the deterministic voucher verification results

The new verification cases assert fixed true and false results with .toBe(...). AGENTS.md explicitly prefers toMatchInlineSnapshot() over direct assertions for stable return values, so these newly added assertions do not follow the documented testing convention. Convert the deterministic verification-result assertions to inline snapshots.

AGENTS.md reference: AGENTS.md:L203-L203

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not changing this one. The test checks one boolean per case, and the rest of the file asserts booleans with toBe. An inline snapshot of true would add no coverage.

@jxom
jxom merged commit b5df586 into wevm:main Nov 19, 2026
2 of 3 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 19, 2026
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.

4 participants