Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion consensus/system_contract/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
Loading