Skip to content

Commit

Permalink
fix(lib/grandpa): avoid spamming round messages (#2688)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Timothy Wu <timwu20@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Axay Sagathiya <axaysagathiya@gmail.com>
Co-authored-by: Kishan Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Edward Mack <ed@edwardmack.com>
  • Loading branch information
7 people authored Nov 22, 2022
1 parent 34cee77 commit b0042b8
Show file tree
Hide file tree
Showing 26 changed files with 2,994 additions and 1,465 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
github.com/ChainSafe/gossamer/dot/rpc/modules,
github.com/ChainSafe/gossamer/lib/babe,
github.com/ChainSafe/gossamer/dot/sync,
github.com/ChainSafe/gossamer/lib/grandpa,
]
runs-on: ubuntu-latest
steps:
Expand Down
40 changes: 39 additions & 1 deletion chain/westend-local/westend-local-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@
"minimumValidatorCount": 1,
"invulnerables": [
"5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
"5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc"
"5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8"
],
"forceEra": "NotForcing",
"slashRewardFraction": 100000000,
Expand All @@ -103,6 +105,18 @@
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
100000000000000,
"Validator"
],
[
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
"5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
100000000000000,
"Validator"
],
[
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
"5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
100000000000000,
"Validator"
]
],
"minNominatorBond": 0,
Expand Down Expand Up @@ -135,6 +149,30 @@
"para_assignment": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
"authority_discovery": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
}
],
[
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
"5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
{
"grandpa": "5DbKjhNLpqX3zqZdNBc9BGb4fHU1cRBaDhJUskrvkwfraDi6",
"babe": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
"im_online": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
"para_validator": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
"para_assignment": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
"authority_discovery": "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y"
}
],
[
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
"5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
{
"grandpa": "5ECTwv6cZ5nJQPk6tWfaTrEk8YH2L7X1VT4EL5Tx2ikfFwb7",
"babe": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
"im_online": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
"para_validator": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
"para_assignment": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
"authority_discovery": "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy"
}
]
]
},
Expand Down
13 changes: 4 additions & 9 deletions lib/grandpa/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ package grandpa

import (
"errors"
"fmt"

"github.com/ChainSafe/gossamer/lib/blocktree"
)

// errRoundMismatch is returned when trying to validate a vote message that isn't for the current round
func errRoundMismatch(got, want uint64) error {
return fmt.Errorf("rounds do not match: got %d, want %d", got, want)
}

var (
// ErrBlockDoesNotExist is returned when trying to validate a vote for a block that doesn't exist
ErrBlockDoesNotExist = errors.New("block does not exist")
Expand Down Expand Up @@ -60,6 +54,8 @@ var (

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

ErrBlockNumbersMismatch = errors.New("block numbers mismatch")

// ErrMinVotesNotMet is returned when the number of votes is less than the required minimum in a Justification
ErrMinVotesNotMet = errors.New("minimum number of votes not met in a Justification")

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

// ErrServicePaused is returned if the service is paused and waiting for catch up messages
ErrServicePaused = errors.New("service is paused")

// ErrPrecommitSignatureMismatch is returned when the number of precommits
// and signatures in a CommitMessage do not match
ErrPrecommitSignatureMismatch = errors.New("number of precommits does not match number of signatures")
Expand All @@ -93,4 +86,6 @@ var (
errVoteToSignatureMismatch = errors.New("votes and authority count mismatch")
errVoteBlockMismatch = errors.New("block in vote is not descendant of previously finalised block")
errVoteFromSelf = errors.New("got vote from ourselves")
errRoundOutOfBounds = errors.New("round out of bounds")
errRoundsMismatch = errors.New("rounds mismatch")
)
Loading

0 comments on commit b0042b8

Please sign in to comment.