From f5aea9e0b7203de89341b688104e8e926692877e Mon Sep 17 00:00:00 2001 From: Morty Date: Tue, 17 Dec 2024 02:32:19 +0800 Subject: [PATCH] fix: check extra field lens --- consensus/system_contract/consensus.go | 4 ++-- consensus/system_contract/system_contract.go | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/consensus/system_contract/consensus.go b/consensus/system_contract/consensus.go index 878012f42827..bffb2c17d1b3 100644 --- a/consensus/system_contract/consensus.go +++ b/consensus/system_contract/consensus.go @@ -110,7 +110,7 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header return errInvalidNonce } // Check that the extra-data contains signature - if len(header.Extra) != extraSeal { + if header.Number != big.NewInt(0) && len(header.Extra) != extraSeal { return errMissingSignature } // Ensure that the mix digest is zero @@ -121,7 +121,7 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header if header.UncleHash != uncleHash { return errInvalidUncleHash } - // Ensure that the difficulty is zero + // Ensure that the difficulty is one if header.Difficulty.Cmp(common.Big0) != 1 { return errInvalidDifficulty } diff --git a/consensus/system_contract/system_contract.go b/consensus/system_contract/system_contract.go index f77a80eb2d4c..c7919fc466af 100644 --- a/consensus/system_contract/system_contract.go +++ b/consensus/system_contract/system_contract.go @@ -78,7 +78,6 @@ func (s *SystemContract) Start() { return case <-syncTicker.C: blockNumber := big.NewInt(-1) // todo: get block number from L1BlocksContract (l1 block hash relay) or other source (depending on exact design) - address, err := s.client.StorageAt(s.ctx, s.config.SystemContractAddress, s.config.SystemContractSlot, blockNumber) if err != nil { log.Error("failed to get signer address from L1 System Contract", "err", err)