AA-403: Fix RIP-7560 transaction hash calculation (#19)

This commit is contained in:
Dror Tirosh 2024-07-25 22:29:27 +03:00 committed by GitHub
parent 7f93f508c1
commit 52f50471f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
}