Skip to content

Commit

Permalink
fix: check extra field lens
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweichi committed Dec 16, 2024
1 parent ef0fef8 commit f5aea9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions consensus/system_contract/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion consensus/system_contract/system_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f5aea9e

Please sign in to comment.