From 2d95ba7d15879677cb451bbaa5d2c34c2b4f323d Mon Sep 17 00:00:00 2001 From: Daniel Katzan <108216499+dkatzan@users.noreply.github.com> Date: Thu, 31 Jul 2025 08:34:17 +0700 Subject: [PATCH] core/types: expose sigHash as Hash for SetCodeAuthorization (#32298) --- core/types/tx_setcode.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/types/tx_setcode.go b/core/types/tx_setcode.go index b8e38ef1f7..f2281d4ae7 100644 --- a/core/types/tx_setcode.go +++ b/core/types/tx_setcode.go @@ -89,7 +89,7 @@ type authorizationMarshaling struct { // SignSetCode creates a signed the SetCode authorization. func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAuthorization, error) { - sighash := auth.sigHash() + sighash := auth.SigHash() sig, err := crypto.Sign(sighash[:], prv) if err != nil { return SetCodeAuthorization{}, err @@ -105,7 +105,8 @@ func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAutho }, nil } -func (a *SetCodeAuthorization) sigHash() common.Hash { +// SigHash returns the hash of SetCodeAuthorization for signing. +func (a *SetCodeAuthorization) SigHash() common.Hash { return prefixedRlpHash(0x05, []any{ a.ChainID, a.Address, @@ -115,7 +116,7 @@ func (a *SetCodeAuthorization) sigHash() common.Hash { // Authority recovers the the authorizing account of an authorization. func (a *SetCodeAuthorization) Authority() (common.Address, error) { - sighash := a.sigHash() + sighash := a.SigHash() if !crypto.ValidateSignatureValues(a.V, a.R.ToBig(), a.S.ToBig(), true) { return common.Address{}, ErrInvalidSig }