Skip to content

Commit b0042b8

Browse files
EclesioMeloJuniortimwu20qdm12dependabot[bot]axaysagathiya
authored
fix(lib/grandpa): avoid spamming round messages (#2688)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Timothy Wu <[email protected]> Co-authored-by: Quentin McGaw <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Axay Sagathiya <[email protected]> Co-authored-by: Kishan Sagathiya <[email protected]> Co-authored-by: Edward Mack <[email protected]>
1 parent 34cee77 commit b0042b8

26 files changed

+2994
-1465
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
github.com/ChainSafe/gossamer/dot/rpc/modules,
2929
github.com/ChainSafe/gossamer/lib/babe,
3030
github.com/ChainSafe/gossamer/dot/sync,
31+
github.com/ChainSafe/gossamer/lib/grandpa,
3132
]
3233
runs-on: ubuntu-latest
3334
steps:

chain/westend-local/westend-local-spec.json

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
"minimumValidatorCount": 1,
8787
"invulnerables": [
8888
"5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
89-
"5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc"
89+
"5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
90+
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
91+
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8"
9092
],
9193
"forceEra": "NotForcing",
9294
"slashRewardFraction": 100000000,
@@ -103,6 +105,18 @@
103105
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
104106
100000000000000,
105107
"Validator"
108+
],
109+
[
110+
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
111+
"5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
112+
100000000000000,
113+
"Validator"
114+
],
115+
[
116+
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
117+
"5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
118+
100000000000000,
119+
"Validator"
106120
]
107121
],
108122
"minNominatorBond": 0,
@@ -135,6 +149,30 @@
135149
"para_assignment": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
136150
"authority_discovery": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
137151
}
152+
],
153+
[
154+
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
155+
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
156+
{
157+
"grandpa": "5DbKjhNLpqX3zqZdNBc9BGb4fHU1cRBaDhJUskrvkwfraDi6",
158+
"babe": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
159+
"im_online": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
160+
"para_validator": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
161+
"para_assignment": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
162+
"authority_discovery": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y"
163+
}
164+
],
165+
[
166+
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
167+
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
168+
{
169+
"grandpa": "5ECTwv6cZ5nJQPk6tWfaTrEk8YH2L7X1VT4EL5Tx2ikfFwb7",
170+
"babe": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
171+
"im_online": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
172+
"para_validator": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
173+
"para_assignment": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
174+
"authority_discovery": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy"
175+
}
138176
]
139177
]
140178
},

lib/grandpa/errors.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@ package grandpa
55

66
import (
77
"errors"
8-
"fmt"
98

109
"github.com/ChainSafe/gossamer/lib/blocktree"
1110
)
1211

13-
// errRoundMismatch is returned when trying to validate a vote message that isn't for the current round
14-
func errRoundMismatch(got, want uint64) error {
15-
return fmt.Errorf("rounds do not match: got %d, want %d", got, want)
16-
}
17-
1812
var (
1913
// ErrBlockDoesNotExist is returned when trying to validate a vote for a block that doesn't exist
2014
ErrBlockDoesNotExist = errors.New("block does not exist")
@@ -60,6 +54,8 @@ var (
6054

6155
ErrBlockHashMismatch = errors.New("block hash does not correspond to given block number")
6256

57+
ErrBlockNumbersMismatch = errors.New("block numbers mismatch")
58+
6359
// ErrMinVotesNotMet is returned when the number of votes is less than the required minimum in a Justification
6460
ErrMinVotesNotMet = errors.New("minimum number of votes not met in a Justification")
6561

@@ -76,9 +72,6 @@ var (
7672
// ErrCatchUpResponseNotCompletable is returned when the round represented by the catch up response is not completable
7773
ErrCatchUpResponseNotCompletable = errors.New("catch up response is not completable")
7874

79-
// ErrServicePaused is returned if the service is paused and waiting for catch up messages
80-
ErrServicePaused = errors.New("service is paused")
81-
8275
// ErrPrecommitSignatureMismatch is returned when the number of precommits
8376
// and signatures in a CommitMessage do not match
8477
ErrPrecommitSignatureMismatch = errors.New("number of precommits does not match number of signatures")
@@ -93,4 +86,6 @@ var (
9386
errVoteToSignatureMismatch = errors.New("votes and authority count mismatch")
9487
errVoteBlockMismatch = errors.New("block in vote is not descendant of previously finalised block")
9588
errVoteFromSelf = errors.New("got vote from ourselves")
89+
errRoundOutOfBounds = errors.New("round out of bounds")
90+
errRoundsMismatch = errors.New("rounds mismatch")
9691
)

0 commit comments

Comments
 (0)