Add more log in SetCodeAuthorities method

This commit is contained in:
q 2026-01-25 02:44:38 +08:00
parent 9a8e14e77e
commit 8a88690024
2 changed files with 12 additions and 7 deletions

View file

@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/holiman/uint256" "github.com/holiman/uint256"
) )
@ -524,13 +525,17 @@ func (tx *Transaction) SetCodeAuthorities() []common.Address {
auths = make([]common.Address, 0, len(setcodetx.AuthList)) auths = make([]common.Address, 0, len(setcodetx.AuthList))
) )
for _, auth := range setcodetx.AuthList { for _, auth := range setcodetx.AuthList {
if addr, err := auth.Authority(); err == nil { addr, err := auth.Authority()
if marks[addr] { if err != nil {
continue log.Error("SetCodeTx authorization has invalid signature", "tx", tx.Hash(), "address", addr, "err", err)
} continue
marks[addr] = true
auths = append(auths, addr)
} }
if marks[addr] {
log.Warn("SetCodeTx authorization has duplicate authority", "tx", tx.Hash(), "address", addr)
continue
}
marks[addr] = true
auths = append(auths, addr)
} }
return auths return auths
} }

View file

@ -117,7 +117,7 @@ func (a *SetCodeAuthorization) SigHash() common.Hash {
}) })
} }
// Authority recovers the the authorizing account of an authorization. // Authority recovers the authorizing account of an authorization.
func (a *SetCodeAuthorization) Authority() (common.Address, error) { 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) { if !crypto.ValidateSignatureValues(a.V, a.R.ToBig(), a.S.ToBig(), true) {