-
Notifications
You must be signed in to change notification settings - Fork 636
test(consensus): PBTS should be enabled by default in test units #2329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11c09f7
ba1e2ca
9537c7a
2424a9c
c2fc2ec
5c72f06
ee9aeae
b36a348
40189f3
723ca99
938c728
f9bdaa2
2e61683
de246aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,8 +190,8 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { | |
extCommit = &types.ExtendedCommit{} | ||
case lazyProposer.LastCommit.HasTwoThirdsMajority(): | ||
// Make the commit from LastCommit | ||
veHeightParam := types.DefaultFeatureParams() | ||
veHeightParam.VoteExtensionsEnableHeight = height | ||
// Vote extensions are enabled by default for test units | ||
veHeightParam := lazyProposer.state.ConsensusParams.Feature | ||
extCommit = lazyProposer.LastCommit.MakeExtendedCommit(veHeightParam) | ||
default: // This shouldn't happen. | ||
lazyProposer.Logger.Error("enterPropose: Cannot propose anything: No commit for the previous block") | ||
|
@@ -499,9 +499,9 @@ func byzantineDecideProposalFunc(ctx context.Context, t *testing.T, height int64 | |
t.Logf("Byzantine: broadcasting conflicting proposals to %d peers", len(peers)) | ||
for i, peer := range peers { | ||
if i < len(peers)/2 { | ||
go sendProposalAndParts(height, round, cs, peer, proposal1, block1Hash, blockParts1) | ||
go sendProposalAndParts(height, round, cs, peer, proposal1, block1, block1Hash, blockParts1) | ||
} else { | ||
go sendProposalAndParts(height, round, cs, peer, proposal2, block2Hash, blockParts2) | ||
go sendProposalAndParts(height, round, cs, peer, proposal2, block2, block2Hash, blockParts2) | ||
} | ||
} | ||
} | ||
|
@@ -512,6 +512,7 @@ func sendProposalAndParts( | |
cs *State, | ||
peer p2p.Peer, | ||
proposal *types.Proposal, | ||
block *types.Block, | ||
blockHash []byte, | ||
parts *types.PartSet, | ||
) { | ||
|
@@ -541,7 +542,7 @@ func sendProposalAndParts( | |
// votes | ||
cs.mtx.Lock() | ||
prevote, _ := cs.signVote(types.PrevoteType, blockHash, parts.Header(), nil) | ||
precommit, _ := cs.signVote(types.PrecommitType, blockHash, parts.Header(), nil) | ||
precommit, _ := cs.signVote(types.PrecommitType, blockHash, parts.Header(), block) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Otherwise, vote extensions don't work as expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be a different PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can leave the @lasarojc I think it has to be this PR, otherwise the tests won't pass. @cason unless you decide to run just this test case with vote extensions disabled (but I'm also OK with the current solution) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Indeed, reverting. |
||
cs.mtx.Unlock() | ||
peer.Send(p2p.Envelope{ | ||
ChannelID: VoteChannel, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -493,12 +493,12 @@ func randStateWithAppWithHeight( | |
|
||
func randStateWithAppWithBFTTime(nValidators int) (*State, []*validatorStub) { | ||
c := test.ConsensusParams() | ||
c.Feature.PbtsEnableHeight = 0 // Disable PBTS | ||
return randStateWithAppImpl(nValidators, kvstore.NewInMemoryApplication(), c) | ||
} | ||
|
||
func randStateWithApp(nValidators int, app abci.Application) (*State, []*validatorStub) { | ||
c := test.ConsensusParams() | ||
c.Feature.PbtsEnableHeight = 1 | ||
return randStateWithAppImpl(nValidators, app, c) | ||
} | ||
|
||
|
@@ -920,6 +920,10 @@ func randGenesisDoc(numValidators int, | |
} | ||
sort.Sort(types.PrivValidatorsByAddress(privValidators)) | ||
|
||
if consensusParams == nil { | ||
consensusParams = test.ConsensusParams() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enables both vote extensions and PBTS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not force the callers to pass a non-nil value. They could (should?) run with different configurations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked around and my understanding is that test cases that don't care, just provide There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are only two calls to |
||
} | ||
|
||
return &types.GenesisDoc{ | ||
GenesisTime: genesisTime, | ||
InitialHeight: 1, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor (I know this is not directly related to this PR).
Why are we passing the whole
Feature
struct toMakeExtendedCommit
? Can't we just past the VE enable height?If you agree but doing this takes much effort, just ignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method uses the helper:
fp.VoteExtensionsEnabled(ec.Height)
. We could use the same logic used there here, but it does not look great.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you