Skip to content

feat(tempo): approve stored configurable account operations by hash alone - #5675

Merged
jxom merged 2 commits into
mainfrom
jxom/tempo-owner-hash-approvals
Nov 26, 2026
Merged

jxom merged 2 commits into
mainfrom
jxom/tempo-owner-hash-approvals

Conversation

@jxom

@jxom jxom commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

A later owner of a coordinated configurable account can now approve a stored operation with only its hash. The operation hash commits to the account, config, and transaction, so Viem reads the operation and takes the configurable account from it.

// Owner as the account
await sendTransactionSync(client, { account: owner_2, hash })

// Or a client whose account is the owner
const client = createClient({ account: owner_3, transport })
await client.sendTransactionSync({ hash })
  • A request with hash, no owner, and a root account approves as that owner. That input used to throw, so existing calls keep their behavior.
  • An account that is not an owner of operation.config is rejected before it signs.
  • The sender is Account.fromConfig(operation.account). Core prepareTransactionRequest sets from from request.account, so the owner cannot be the request's account.
  • The read and hash check move into getStoredOperation, which the existing { account, hash, owner } path also uses.

I kept the owner as account instead of { hash, owner } without an account, so core sendTransaction and its types stay unchanged.

For operations with userAddress (TIP-1111 delegates), the sender is the parent and accountSimulation.signer is operation.account, so the owner signs the parent-bound keychain digest.

Tests

src/tempo/e2e.accounts.test.ts adds hash-only approvals on config version 0 and on version 1 after a rotation (with the owner as the client's account), a hash-only approval of a configurable access key operation, a prepared hash approval signed through signTransaction, and a rejection for a non-owner. They fail without this change. The full file passes locally (73/73).

Docs

The send guide adds "Approve by Hash Alone".

@vercel

vercel Bot commented Nov 26, 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 26, 2026 10:48pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e8b64db

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 26, 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-26T22:46:36.585861Z e8b64db 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: 9de6d64efd

ℹ️ 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/chainConfig.ts Outdated
Comment on lines +171 to +172
account: fromConfig(operation.account),
from: operation.userAddress ?? operation.account,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the parent sender for hash-only delegate approvals

For a stored TIP-1111 operation with userAddress, this account has the delegate's address rather than the parent sender's address. Core prepareTransactionRequest resets from to request.account.address after the preparation hook (src/actions/wallet/prepareTransactionRequest.ts:591–595), overwriting the parent address supplied below. Consequently, Account.fromBase.signTransaction sees identical accountSimulation.signer and from values and signs a normal configurable-account digest instead of the parent-bound keychain digest; Transaction.serialize likewise omits the keychain envelope. The resulting approval cannot approve the original stored operation. Use a sender account representing operation.userAddress for delegated operations while retaining operation.account as the simulation signer.

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.

Fixed in e8b64db: the sender account is now Account.fromConfig(operation.userAddress ?? operation.account), so core preparation keeps from as the parent and the owner signs the parent-bound keychain digest. Covered by 'behavior: an owner account approves a stored access key operation by hash', which failed before this change (from was the access key).

Comment thread src/tempo/chainConfig.ts
Comment on lines +176 to +177
},
} as unknown as typeof r

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain the approver in the prepared transaction request

When a caller prepares a hash-only approval with prepareTransactionRequest(client, { account: owner, hash }) and then passes the result to signTransaction, the returned request has replaced the owner account with an address-only configurable account without preserving owner. The signing action selects that returned account, and Account.fromConfig's signTransaction takes its owners.length === 0 branch and returns an unsigned transaction instead of an owner approval. Direct sendTransaction calls happen to work because they retain the original account separately, but the prepare-then-sign flow loses the signer. Preserve owner: approver in the returned request, as the existing explicit-owner branch does.

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.

Fixed in e8b64db: the hash-only branch now returns owner: approver, so prepareTransactionRequest then signTransaction returns the owner approval. Covered by 'behavior: a prepared hash approval signs as the owner account'.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Published [email protected] under the pr-5675 dist-tag, which follows this pull request until it closes.

pnpm add viem@pr-5675
pnpm add [email protected]

@jxom
jxom merged commit c667e59 into main Nov 26, 2026
39 of 40 checks passed
@jxom
jxom deleted the jxom/tempo-owner-hash-approvals branch November 26, 2026 23:21
@github-actions github-actions Bot mentioned this pull request Nov 26, 2026
jxom added a commit to tempoxyz/accounts that referenced this pull request Nov 27, 2026
…nt transactions (#1158)

Added passkey owner inference to `accounts.viem.sendTransaction` and
`sendTransactionSync` for coordinated configurable account transactions,
and `Plugins.viem.OwnerRequiredError`. Raised `viem` to `^2.58.8`.

## Problem

Viem's coordinated signing needs an `owner` on every call. In an app,
that owner is the user's passkey, which the session's Tempo Account
already holds.

## Behavior

A call of the instance session's client that names no `owner`:

| Call | The passkey becomes |
| --- | --- |
| `{ hash }` alone | `account`, so Viem 2.58.8 infers the configurable
account from the stored operation (wevm/viem#5675) |
| `{ account, calls }` with a configurable account that holds no local
owner, such as `Account.fromConfig(address)` | `owner` |

- The user's passkey that the account's configuration names signs.
- If no passkey of the user is an owner,
`Plugins.viem.OwnerRequiredError` throws before any ceremony or relay
request.
- A configurable account with a local owner stays Viem's own, also with
`hash`.
- Every other call is Viem's own, unchanged. A fixed session's client is
unchanged.
- The retry skips a call with `hash`, since the operation names another
account than the session's.
- Coordination needs the plugin's `relay`.

## API changes

```ts
const pending = await accounts.viem.sendTransactionSync({
  account: Account.fromConfig(multisig),
  calls,
})
await accounts.viem.sendTransactionSync({ hash: pending.transactionHash })
```

The user's passkey approves both calls.

```ts
error.name === 'Plugins.viem.OwnerRequiredError'
```

Thrown when no passkey of the user owns the account.

```ts
import { Accounts } from 'accounts'
import { viem } from 'accounts/plugins'
import { Account } from 'viem/tempo'

const accounts = Accounts.create({ plugins: [viem({ relay: '/api/relay' })] })

const account = Account.fromConfig({
  address: 'infer',
  owners: [passkeyOwner, cosigner],
  threshold: 2,
})
const pending = await accounts.viem.sendTransactionSync({ account, calls })
```

## How to test

1. A local Tempo node, Viem's relay with `Relay.accounts({ store })`, a
WebAuthn owner, and a secp256k1 cosigner share a 2-of-2 account.
2. The passkey sends first without `owner`, and the cosigner approves by
hash: `success`, `from` the multisig.
3. The cosigner sends first, and `accounts.viem.sendTransactionSync({
hash })` approves: `success`, `from` the multisig.
4. A user without a passkey owner: `Plugins.viem.OwnerRequiredError`.

All three fail without this change. `src/plugins/viem.test.ts` adds two
regression tests: a non-owner's one passkey throws with no ceremony and
no request, and a `hash` approval of an account with a local owner
reaches Viem unchanged. `src/plugins/viem.test.ts` and
`src/internal/viem/Retry.test.ts` pass (87/87), with `pnpm check` and
`pnpm check:types`. No end-to-end spec covers it yet, since the suite
has no relay with an operation store.

## Waterfall

`pnpm waterfall test/client/plugins/viem.test.ts` at the head and at the
base, with `pnpm waterfall:report --base`: every action's calls and
rounds are unchanged. The suite has no coordinated send. A coordinated
call adds a configuration read (`eth_getTransactionByHash` for `hash`,
which Viem reads again, or `account_getConfig`), and outside the
session's chain an account read.

---------

Co-authored-by: jxom <[email protected]>

This branch had an error being deployed

1 failed deployment
Preview — e8b64dbe Deployed Nov 26, 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.

1 participant