From 838815882e943fcd95d9b2b333b9b54d7921522a Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Wed, 29 May 2024 15:41:38 -0500 Subject: [PATCH] alter permissiveness of latent tests and aggressiveness in validation to validate/negate hypothesis --- node/consensus/master/broadcast_messaging.go | 6 --- .../master/master_clock_consensus_engine.go | 40 ++++++++++--------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/node/consensus/master/broadcast_messaging.go b/node/consensus/master/broadcast_messaging.go index 18d8d87..83cc9c0 100644 --- a/node/consensus/master/broadcast_messaging.go +++ b/node/consensus/master/broadcast_messaging.go @@ -176,12 +176,6 @@ func (e *MasterClockConsensusEngine) handleSelfTestReport( timestamp := binary.BigEndian.Uint64(proof[:8]) proof = proof[8:] - // Ignore outdated reports, give 3 minutes + proof time for propagation - // delay - if int64(timestamp) < (time.Now().UnixMilli() - (480 * 1000)) { - return nil - } - challenge := binary.BigEndian.AppendUint64([]byte{}, report.MasterHeadFrame) challenge = append(challenge, peerID...) diff --git a/node/consensus/master/master_clock_consensus_engine.go b/node/consensus/master/master_clock_consensus_engine.go index 6f21464..5573bfd 100644 --- a/node/consensus/master/master_clock_consensus_engine.go +++ b/node/consensus/master/master_clock_consensus_engine.go @@ -491,25 +491,27 @@ type verifyChallenge struct { func (e *MasterClockConsensusEngine) performVerifyTest( challenge verifyChallenge, ) { - if !e.frameProver.VerifyChallengeProof( - challenge.challenge, - challenge.timestamp, - challenge.difficultyMetric, - challenge.proofs, - ) { - e.logger.Warn( - "received invalid proof from peer", - zap.String("peer_id", peer.ID(challenge.peerID).String()), - ) - e.pubSub.SetPeerScore(challenge.peerID, -1000) - } else { - e.logger.Debug( - "received valid proof from peer", - zap.String("peer_id", peer.ID(challenge.peerID).String()), - ) - info := e.peerInfoManager.GetPeerInfo(challenge.peerID) - info.LastSeen = time.Now().UnixMilli() - } + go func() { + if !e.frameProver.VerifyChallengeProof( + challenge.challenge, + challenge.timestamp, + challenge.difficultyMetric, + challenge.proofs, + ) { + e.logger.Warn( + "received invalid proof from peer", + zap.String("peer_id", peer.ID(challenge.peerID).String()), + ) + e.pubSub.SetPeerScore(challenge.peerID, -1000) + } else { + e.logger.Debug( + "received valid proof from peer", + zap.String("peer_id", peer.ID(challenge.peerID).String()), + ) + info := e.peerInfoManager.GetPeerInfo(challenge.peerID) + info.LastSeen = time.Now().UnixMilli() + } + }() } func (e *MasterClockConsensusEngine) performBandwidthTest(peerID []byte) {