diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 307068b38b..d2458209de 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,9 +1,5 @@ on: pull_request: - types: - - opened - - edited - - reopened paths: - .github/workflows/checks.yml - .github/PULL_REQUEST/pull_request.go diff --git a/dot/network/block_announce.go b/dot/network/block_announce.go index 5edf37f104..2a06a0843c 100644 --- a/dot/network/block_announce.go +++ b/dot/network/block_announce.go @@ -8,6 +8,7 @@ import ( "fmt" "math/big" + "github.com/ChainSafe/gossamer/dot/peerset" "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/pkg/scale" @@ -176,6 +177,10 @@ func (s *Service) validateBlockAnnounceHandshake(from peer.ID, hs Handshake) err } if bhs.GenesisHash != s.blockState.GenesisHash() { + s.host.cm.peerSetHandler.ReportPeer(peerset.ReputationChange{ + Value: peerset.GenesisMismatch, + Reason: peerset.GenesisMismatchReason, + }, from) return errors.New("genesis hash mismatch") } diff --git a/dot/peerset/constants.go b/dot/peerset/constants.go index d46922e692..c4011d534d 100644 --- a/dot/peerset/constants.go +++ b/dot/peerset/constants.go @@ -62,4 +62,9 @@ const ( BadJustificationValue Reputation = -(1 << 16) // BadJustificationReason is used when peer send invalid justification. BadJustificationReason = "Bad justification" + + // GenesisMismatch is used when peer has a different genesis + GenesisMismatch Reputation = math.MinInt32 + // GenesisMismatchReason used when a peer has a different genesis + GenesisMismatchReason = "Genesis mismatch" ) diff --git a/tests/stress/helpers.go b/tests/stress/helpers.go index c3841089ce..acc843e0b1 100644 --- a/tests/stress/helpers.go +++ b/tests/stress/helpers.go @@ -113,7 +113,7 @@ func compareBlocksByNumberWithRetry(t *testing.T, nodes []*utils.Node, num strin var hashes map[common.Hash][]string var err error - timeout := time.After(30 * time.Second) + timeout := time.After(60 * time.Second) doneBlockProduction: for { time.Sleep(time.Second) diff --git a/tests/stress/stress_test.go b/tests/stress/stress_test.go index 58afc5823d..4f112c2eb8 100644 --- a/tests/stress/stress_test.go +++ b/tests/stress/stress_test.go @@ -102,7 +102,7 @@ func TestSync_SingleBlockProducer(t *testing.T) { require.NoError(t, err) nodes = append(nodes, node) - time.Sleep(time.Second * 30) + time.Sleep(time.Second * 60) defer func() { errList := utils.StopNodes(t, nodes)