From 52f50471f21db175c21318e5f09838d704275f19 Mon Sep 17 00:00:00 2001 From: Dror Tirosh Date: Thu, 25 Jul 2024 22:29:27 +0300 Subject: [PATCH] AA-403: Fix RIP-7560 transaction hash calculation (#19) --- core/types/tx_rip7560.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/types/tx_rip7560.go b/core/types/tx_rip7560.go index 59e2792570..7cb45aeda3 100644 --- a/core/types/tx_rip7560.go +++ b/core/types/tx_rip7560.go @@ -129,7 +129,18 @@ func (tx *Rip7560AccountAbstractionTx) setSignatureValues(chainID, v, r, s *big. } // encode the subtype byte and the payload-bearing bytes of the RIP-7560 transaction -func (tx *Rip7560AccountAbstractionTx) encode(b *bytes.Buffer) error { +func (t *Rip7560AccountAbstractionTx) encode(b *bytes.Buffer) error { + zeroAddress := common.Address{} + tx := t.copy().(*Rip7560AccountAbstractionTx) + if tx.Paymaster != nil && zeroAddress.Cmp(*tx.Paymaster) == 0 { + tx.Paymaster = nil + } + if tx.Deployer != nil && zeroAddress.Cmp(*tx.Deployer) == 0 { + tx.Deployer = nil + } + if tx.To != nil && zeroAddress.Cmp(*tx.To) == 0 { + tx.To = nil + } return rlp.Encode(b, tx) }