Skip to content

fix: encode fee payer signature as [v, r, s] with normalized parity#72

Merged
zerosnacks merged 3 commits intomasterfrom
georgen/fix-fee-payer-sig-encoding
Feb 17, 2026
Merged

fix: encode fee payer signature as [v, r, s] with normalized parity#72
zerosnacks merged 3 commits intomasterfrom
georgen/fix-fee-payer-sig-encoding

Conversation

@gakonst
Copy link
Copy Markdown
Contributor

@gakonst gakonst commented Feb 14, 2026

Summary

Fix fee payer signature RLP encoding order and parity normalization.

Motivation

_encodeFeePayerSignature encoded as [r, s, v] but Rust's Signature::decode_rlp_vrs expects [v, r, s]. Also v was 27/28 but Rust decodes as bool (0/1), causing RLP overflow.

Changes

  • Reorder from [r, s, v] to [v, r, s] in TempoTransactionLib.sol
  • Normalize v from 27/28 to 0/1 parity

The _encodeFeePayerSignature function encoded signature components as
[r, s, v] but Rust's Signature::decode_rlp_vrs expects [v, r, s].
Additionally, v was encoded as raw uint8 (27/28) but Rust decodes it
as a bool parity (0/1).

Changes:
- Reorder RLP list from [r, s, v] to [v, r, s]
- Normalize v from 27/28 to 0/1 parity before encoding
gakonst added a commit to tempoxyz/tempo that referenced this pull request Feb 14, 2026
- Update tempo-std submodule to fix _encodeFeePayerSignature:
  reorder [r,s,v] → [v,r,s] and normalize v from 27/28 → 0/1
- Fix same issue in TxBuilder.sol's copy of _encodeFeePayerSignature
- Add test_feePayerSignatureDecodesCorrectly smoke test confirming
  sponsored txs decode without RLP overflow errors

Depends on: tempoxyz/tempo-std#72
- signingHash(): computes user signing hash matching Rust's
  encode_for_signing (skips fee_token + placeholder for fee payer sig)
- feePayerSignatureHash(): computes fee payer hash matching Rust's
  fee_payer_signature_hash (magic byte 0x78 + sender address)
@zerosnacks zerosnacks requested a review from grandizzy February 16, 2026 10:39
@zerosnacks zerosnacks merged commit 94dc862 into master Feb 17, 2026
13 checks passed
@zerosnacks zerosnacks deleted the georgen/fix-fee-payer-sig-encoding branch February 17, 2026 08:53
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.

2 participants