Commit 4913b42a authored by Adrian Sutton's avatar Adrian Sutton

Don't log warnings when legacy block gossip validation fails

parent 7bafdba5
...@@ -329,9 +329,9 @@ func BuildBlocksValidator(log log.Logger, cfg *rollup.Config, runCfg GossipRunti ...@@ -329,9 +329,9 @@ func BuildBlocksValidator(log log.Logger, cfg *rollup.Config, runCfg GossipRunti
} }
func verifyBlockSignature(log log.Logger, cfg *rollup.Config, runCfg GossipRuntimeConfig, id peer.ID, signatureBytes []byte, payloadBytes []byte) pubsub.ValidationResult { func verifyBlockSignature(log log.Logger, cfg *rollup.Config, runCfg GossipRuntimeConfig, id peer.ID, signatureBytes []byte, payloadBytes []byte) pubsub.ValidationResult {
result := verifyBlockSignatureWithHasher(log, cfg, runCfg, id, signatureBytes, payloadBytes, BlockSigningHash) result := verifyBlockSignatureWithHasher(nil, cfg, runCfg, id, signatureBytes, payloadBytes, LegacyBlockSigningHash)
if result != pubsub.ValidationAccept { if result != pubsub.ValidationAccept {
return verifyBlockSignatureWithHasher(log, cfg, runCfg, id, signatureBytes, payloadBytes, LegacyBlockSigningHash) return verifyBlockSignatureWithHasher(log, cfg, runCfg, id, signatureBytes, payloadBytes, BlockSigningHash)
} }
return result return result
} }
...@@ -339,13 +339,17 @@ func verifyBlockSignature(log log.Logger, cfg *rollup.Config, runCfg GossipRunti ...@@ -339,13 +339,17 @@ func verifyBlockSignature(log log.Logger, cfg *rollup.Config, runCfg GossipRunti
func verifyBlockSignatureWithHasher(log log.Logger, cfg *rollup.Config, runCfg GossipRuntimeConfig, id peer.ID, signatureBytes []byte, payloadBytes []byte, hasher func(cfg *rollup.Config, payloadBytes []byte) (common.Hash, error)) pubsub.ValidationResult { func verifyBlockSignatureWithHasher(log log.Logger, cfg *rollup.Config, runCfg GossipRuntimeConfig, id peer.ID, signatureBytes []byte, payloadBytes []byte, hasher func(cfg *rollup.Config, payloadBytes []byte) (common.Hash, error)) pubsub.ValidationResult {
signingHash, err := hasher(cfg, payloadBytes) signingHash, err := hasher(cfg, payloadBytes)
if err != nil { if err != nil {
if log != nil {
log.Warn("failed to compute block signing hash", "err", err, "peer", id) log.Warn("failed to compute block signing hash", "err", err, "peer", id)
}
return pubsub.ValidationReject return pubsub.ValidationReject
} }
pub, err := crypto.SigToPub(signingHash[:], signatureBytes) pub, err := crypto.SigToPub(signingHash[:], signatureBytes)
if err != nil { if err != nil {
if log != nil {
log.Warn("invalid block signature", "err", err, "peer", id) log.Warn("invalid block signature", "err", err, "peer", id)
}
return pubsub.ValidationReject return pubsub.ValidationReject
} }
addr := crypto.PubkeyToAddress(*pub) addr := crypto.PubkeyToAddress(*pub)
...@@ -356,10 +360,14 @@ func verifyBlockSignatureWithHasher(log log.Logger, cfg *rollup.Config, runCfg G ...@@ -356,10 +360,14 @@ func verifyBlockSignatureWithHasher(log log.Logger, cfg *rollup.Config, runCfg G
// This means we may drop old payloads upon key rotation, // This means we may drop old payloads upon key rotation,
// but this can be recovered from like any other missed unsafe payload. // but this can be recovered from like any other missed unsafe payload.
if expected := runCfg.P2PSequencerAddress(); expected == (common.Address{}) { if expected := runCfg.P2PSequencerAddress(); expected == (common.Address{}) {
if log != nil {
log.Warn("no configured p2p sequencer address, ignoring gossiped block", "peer", id, "addr", addr) log.Warn("no configured p2p sequencer address, ignoring gossiped block", "peer", id, "addr", addr)
}
return pubsub.ValidationIgnore return pubsub.ValidationIgnore
} else if addr != expected { } else if addr != expected {
if log != nil {
log.Warn("unexpected block author", "err", err, "peer", id, "addr", addr, "expected", expected) log.Warn("unexpected block author", "err", err, "peer", id, "addr", addr, "expected", expected)
}
return pubsub.ValidationReject return pubsub.ValidationReject
} }
return pubsub.ValidationAccept return pubsub.ValidationAccept
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment