Skip to content

Add support for EIP-6492 - #89

Merged
Agusx1211 merged 5 commits into
v2from
eip-6492
Jul 10, 2023
Merged

Add support for EIP-6492#89
Agusx1211 merged 5 commits into
v2from
eip-6492

Conversation

@Agusx1211

Copy link
Copy Markdown
Member

No description provided.

Comment thread eip_6492/eip_6492.go
Comment thread auth.go Outdated
Comment thread auth.go Outdated
Comment thread auth.go Outdated
Comment thread auth.go
Comment thread auth.go Outdated
Comment thread auth.go Outdated
Comment thread eip6492/eip6492.go Outdated
Comment thread signature.go Outdated
@Agusx1211
Agusx1211 merged commit c5aeb73 into v2 Jul 10, 2023
@Agusx1211
Agusx1211 deleted the eip-6492 branch July 10, 2023 14:48
ScreamingHawk added a commit that referenced this pull request Jul 13, 2026
HashCallWithReplayProtection hashed the payload's parentWallets verbatim.
The session-holding wallet is the last parent wallet in the signing
context, but on chain it is the verifying contract (msg.sender), not a
parent entry, so it must be dropped before hashing to match
SessionSig.hashPayloadCallIdx. Wallet-bound digest comes from the partial
payload replay audit fix (wallet-contracts-v3 9c19609, Code4rena
S-93/S-169, #89).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ScreamingHawk added a commit that referenced this pull request Jul 19, 2026
* fix(v3): sync session encoding with wallet-contracts-v3

The explicit-session and implicit-attestation encodings had drifted from
the deployed v3 contracts, so any config image hash / session signature
go-sequence produced was rejected on-chain. Re-sync three changes the
contracts made (and mirror the sequence.js primitives JSON):

- SessionPermissions: add chainId (32 bytes, after signer) and encode
  deadline as uint64 (8 bytes) instead of 32. Matches SessionSig
  recoverConfiguration and permission.ts.
- Attestation authData: append issuedAt (uint64, 8 bytes) so the
  attestation hash matches LibAttestation.toHash. Serialize issuedAt as a
  decimal string in JSON to match attestation.ts.
- Wire issuedAt through the cmd/sequence CLI input.

Add regression tests with byte vectors verified against the contracts via
forge (recoverConfiguration / LibAttestation.toHash).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(v3): drop session wallet from call digest parent wallets

HashCallWithReplayProtection hashed the payload's parentWallets verbatim.
The session-holding wallet is the last parent wallet in the signing
context, but on chain it is the verifying contract (msg.sender), not a
parent entry, so it must be dropped before hashing to match
SessionSig.hashPayloadCallIdx. Wallet-bound digest comes from the partial
payload replay audit fix (wallet-contracts-v3 9c19609, Code4rena
S-93/S-169, #89).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(v3): validate session deadline fits in uint64

EncodeSessionPermissions encodes deadline into an 8-byte buffer via
big.Int.FillBytes, which panics on a negative value or one that does not
fit in uint64 (e.g. a max-value "no expiry" deadline). Validate the range
and return an error instead of crashing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(v3): validate numeric issuedAt in attestation JSON

AttestationFromJson accepted a JSON-number issuedAt via an unchecked
uint64 cast, so a negative, fractional or out-of-range value was silently
coerced (e.g. -1 -> MaxUint64) and the library would hash/sign a
different attestation than the JSON represented. Reject negatives,
fractions and values outside uint64, matching the string path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(v3): align parent-wallets test with HashPayloadCallIdx rename

#362 was merged with the digest function renamed to HashPayloadCallIdx;
update the parent-wallets test to the new name so the package builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(v3): decode session/attestation numbers safely, validate ranges

Numeric JSON attributes were decoded and encoded unsafely: an unquoted
number above 2^53 was silently rounded by encoding/json before use, and a
negative or over-wide chainId/valueLimit was encoded as its absolute value
or spilled past the fixed 32-byte field.

Add bigIntFromJSON, a single decoder shared by chainId, valueLimit,
deadline and attestation issuedAt: it parses strings and json.Number
exactly and rejects float64 that is non-integer or at/above 2^53.
EncodeSessionPermissions now rejects chainId and valueLimit that are
negative or wider than uint256.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants