fix: system config consensus (#1180)

* fix: system config to check sign in any case

* chore: auto version bump [bot]
This commit is contained in:
Morty 2025-04-30 22:29:22 +08:00 committed by GitHub
parent a4109fd8a9
commit 7b56ff1d66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 14 deletions

View file

@ -130,7 +130,7 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header
return errInvalidNonce return errInvalidNonce
} }
// Check that the BlockSignature contains signature if block is not requested // Check that the BlockSignature contains signature if block is not requested
if !header.Requested && header.Number.Cmp(big.NewInt(0)) != 0 && len(header.BlockSignature) != extraSeal { if header.Number.Cmp(big.NewInt(0)) != 0 && len(header.BlockSignature) != extraSeal {
return errMissingSignature return errMissingSignature
} }
// Ensure that the mix digest is zero // Ensure that the mix digest is zero
@ -197,20 +197,17 @@ func (s *SystemContract) verifyCascadingFields(chain consensus.ChainHeaderReader
return err return err
} }
// only if block header has NOT been requested, then verify the signature against the current signer signer, err := ecrecover(header)
if !header.Requested { if err != nil {
signer, err := ecrecover(header) return err
if err != nil { }
return err
}
s.lock.RLock() s.lock.RLock()
defer s.lock.RUnlock() defer s.lock.RUnlock()
if signer != s.signerAddressL1 { if signer != s.signerAddressL1 {
log.Error("Unauthorized signer", "Got", signer, "Expected:", s.signerAddressL1) log.Error("Unauthorized signer", "Got", signer, "Expected:", s.signerAddressL1)
return ErrUnauthorizedSigner return ErrUnauthorizedSigner
}
} }
return nil return nil

View file

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