fix(system-contract): Check coinbase during header verification (#1128)

This commit is contained in:
Péter Garamvölgyi 2025-03-03 10:06:50 +01:00 committed by GitHub
parent 1ceb1ba496
commit 87e196052a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -37,7 +37,10 @@ var (
// that is not part of the local blockchain.
errUnknownBlock = errors.New("unknown block")
// errNonceNotEmpty is returned if a nonce value is non-zero
// errInvalidCoinbase is returned if a coinbase value is non-zero
errInvalidCoinbase = errors.New("coinbase not empty")
// errInvalidNonce is returned if a nonce value is non-zero
errInvalidNonce = errors.New("nonce not empty nor zero")
// errMissingSignature is returned if a block's extra-data section doesn't seem
@ -116,6 +119,10 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header
if header.Time > uint64(time.Now().Unix()) {
return consensus.ErrFutureBlock
}
// Ensure that the coinbase is zero
if header.Coinbase != (common.Address{}) {
return errInvalidCoinbase
}
// Ensure that the nonce is zero
if header.Nonce != (types.BlockNonce{}) {
return errInvalidNonce

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 8 // Minor version component of the current release
VersionPatch = 16 // Patch version component of the current release
VersionPatch = 17 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)