Repository navigation
feat(tempo): add channel.verifyVoucher and rename OpeningCommitmentRecorded event - #5606
Conversation
|
@legion2002 is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 8a194ea 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: 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".
| export async function verifyVoucher<chain extends Chain | undefined>( | ||
| client: Client<Transport, chain>, | ||
| parameters: verifyVoucher.Parameters, | ||
| ): Promise<verifyVoucher.ReturnValue> { |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
| Channel descriptor. The precompile computes the channel ID from it, so a channel ID alone is not enough. | ||
|
|
||
| ### cumulativeAmount |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
Done in 8a194ea: channel, cumulativeAmount and signature each have a focused twoslash example now, and the channel one shows the Channel.from descriptor shape.
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]>
|
I pushed two small commits to this branch. The ABI, the
Locally against One thing for a follow-up: the T15 tests in |
There was a problem hiding this comment.
💡 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".
| expect(call.to).toBe(Channel.address) | ||
| expect(call.functionName).toBe('verifyVoucher') | ||
| expect(call.data.slice(0, 10)).toBe('0xcabd6d5a') | ||
| expect(call.args).toEqual([ |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
Done in f021efd. The test now snapshots the whole call without abi. I checked the calldata against cast calldata.
| export type Parameters = ReadParameters & Args | ||
|
|
||
| export type Args = { |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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 /> |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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...', | ||
| }) |
There was a problem hiding this comment.
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 👍 / 👎.
| link: '/tempo/actions/channel.topUp', | ||
| }, | ||
| { | ||
| text: 'verifyVoucher', |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
💡 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({ |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
What
SignerSnapshotCachedevent on thetip20ChannelReserveABI toOpeningCommitmentRecorded(bytes32 indexed channelId, address indexed signer, bytes32 commitment), matching the final TIP-1166 interface (the event topic changes).verifyVoucher(ChannelDescriptor descriptor, uint96 cumulativeAmount, bytes signature) view returns (bool valid)to the ABI and its selector (0xcabd6d5a) toSelectors.tip20ChannelReserve.channel.verifyVoucheraction with a.call()builder, aclient.channel.verifyVoucherdecorator 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 throwsChannelNotFoundErrorfor an unknown channel.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 forOpeningCommitmentRecorded.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 checkandpnpm check:typespass.verifyVoucher.callencoding,Selectors, decorator bindings). The tests that need a Tempo localnet were not run locally (no Docker available).