Skip to content

Commit 2d95ba7

Browse files
authored
core/types: expose sigHash as Hash for SetCodeAuthorization (#32298)
1 parent d14d4d2 commit 2d95ba7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/types/tx_setcode.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type authorizationMarshaling struct {
8989

9090
// SignSetCode creates a signed the SetCode authorization.
9191
func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAuthorization, error) {
92-
sighash := auth.sigHash()
92+
sighash := auth.SigHash()
9393
sig, err := crypto.Sign(sighash[:], prv)
9494
if err != nil {
9595
return SetCodeAuthorization{}, err
@@ -105,7 +105,8 @@ func SignSetCode(prv *ecdsa.PrivateKey, auth SetCodeAuthorization) (SetCodeAutho
105105
}, nil
106106
}
107107

108-
func (a *SetCodeAuthorization) sigHash() common.Hash {
108+
// SigHash returns the hash of SetCodeAuthorization for signing.
109+
func (a *SetCodeAuthorization) SigHash() common.Hash {
109110
return prefixedRlpHash(0x05, []any{
110111
a.ChainID,
111112
a.Address,
@@ -115,7 +116,7 @@ func (a *SetCodeAuthorization) sigHash() common.Hash {
115116

116117
// Authority recovers the the authorizing account of an authorization.
117118
func (a *SetCodeAuthorization) Authority() (common.Address, error) {
118-
sighash := a.sigHash()
119+
sighash := a.SigHash()
119120
if !crypto.ValidateSignatureValues(a.V, a.R.ToBig(), a.S.ToBig(), true) {
120121
return common.Address{}, ErrInvalidSig
121122
}

0 commit comments

Comments
 (0)