Skip to content

feat(tempo): add TIP-1049 admin access keys to KeyAuthorization#262

Merged
jxom merged 1 commit into
mainfrom
feat/tip-1049-admin-keys
May 29, 2026
Merged

feat(tempo): add TIP-1049 admin access keys to KeyAuthorization#262
jxom merged 1 commit into
mainfrom
feat/tip-1049-admin-keys

Conversation

@jxom

@jxom jxom commented May 29, 2026

Copy link
Copy Markdown
Member

Implements TIP-1049 (admin access keys) ox-side, matching the wire format in tempoxyz/tempo.

Summary

Adds two paired fields to KeyAuthorization that together declare an admin access key with an explicit account binding:

  • isAdmin: boolean — encodes as RLP integer 1 (0x01) at trailing position 7. Any other marker value is a hard decode error (InvalidAdminMarkerError).
  • account: addressType — 20-byte address at trailing position 8, providing TIP-1049 cross-account replay protection.

The two fields are modeled as a OneOf union — either both are specified or neither — since they conceptually pair together.

Wire layout

[chainId, keyType, keyId, expiry?, limits?, scopes?, witness?, isAdmin?, account?]
                                                              ↑         ↑
                                                              TIP-1049 ──┘

Built on the extensible optionals table from #260, so this PR adds two entries to toTuple and destructures two more slots in fromTuple — no structural changes.

Behaviour

  • Construction (from, fromRpc) requires account + isAdmin together or neither — the type-level OneOf enforces it.
  • toTuple emits both fields when present, omits both when absent (byte-equivalent to pre-TIP-1049).
  • fromTuple tolerates orphan wire shapes (only one of the two fields on the wire) by dropping the orphan, since the public API requires the pair.
  • account/isAdmin are included in the signing hash, so admin authorizations cannot be replayed against a different account that shares the same root key.

Depends on

Tests

  • Unit (src/tempo/KeyAuthorization.test.ts): 11 new tests covering from/toTuple/fromTuple/serialize/hash/toRpc/fromRpc round-trips, paired encoding/decoding, marker validation, orphan tolerance.
  • E2E (src/tempo/e2e.test.ts): registers an admin access key via auth+use keychain envelope against the localnet T6 image and verifies isAdmin + account survive the round trip through the node. Also covers the byte-equivalence check for the no-admin-pair case.

89/89 tempo-unit tests pass, 2/2 TIP-1049 e2e tests pass, types clean.

@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ox Ready Ready Preview, Comment May 29, 2026 9:36pm

Request Review

Add paired `account` and `isAdmin` fields to `KeyAuthorization` and its
RPC/tuple representations, matching tempo's TIP-1049 wire format.

The two fields are modeled as a OneOf union — either both are specified
or neither — since they pair together to declare an admin access key
with an explicit account binding (replay protection).

- `isAdmin`: encodes as RLP integer `1` (`0x01`) at trailing position 7.
  Any other marker value is a hard decode error.
- `account`: 20-byte address at trailing position 8 (TIP-1049 cross-account
  replay protection).
- `InvalidAdminMarkerError` thrown by `fromTuple` when the marker is
  present but not `0x01`.
- `from`, `fromRpc`, `toRpc`, `fromTuple`, `toTuple` updated to carry
  both fields end-to-end. `fromTuple` drops orphan wire shapes (only
  one of the two present) since the public API requires the pair.
- Unit tests cover round-trips, paired encoding/decoding, marker
  validation, and orphan tolerance.
- E2E test registers an admin access key via auth+use keychain envelope
  and verifies `isAdmin` + `account` survive the round trip through
  the node.

Amp-Thread-ID: https://ampcode.com/threads/T-019e6fa7-78d6-70ef-b9de-0cba0eaffcb0
@jxom jxom force-pushed the feat/tip-1049-admin-keys branch from ab0f15c to 0a6b192 Compare May 29, 2026 21:31
@pkg-pr-new

pkg-pr-new Bot commented May 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/ox@262

commit: 0a6b192

@jxom jxom merged commit b1ac8c8 into main May 29, 2026
10 of 12 checks passed
@jxom jxom deleted the feat/tip-1049-admin-keys branch May 29, 2026 21:34
@github-actions github-actions Bot mentioned this pull request May 29, 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.

1 participant