From 87e196052a348570dd8b634457b8be0b44b83301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Mon, 3 Mar 2025 10:06:50 +0100 Subject: [PATCH] fix(system-contract): Check coinbase during header verification (#1128) --- consensus/system_contract/consensus.go | 9 ++++++++- params/version.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/consensus/system_contract/consensus.go b/consensus/system_contract/consensus.go index 444b61d4a8..299577ac14 100644 --- a/consensus/system_contract/consensus.go +++ b/consensus/system_contract/consensus.go @@ -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 diff --git a/params/version.go b/params/version.go index b54686ad3e..650b578480 100644 --- a/params/version.go +++ b/params/version.go @@ -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 )