Skip to content
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

Fix condition check for tx key dissemination #149

Merged
merged 5 commits into from
Jun 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ func (cs *State) handleMsg(ctx context.Context, mi msgInfo, fsyncUponCompletion
// once proposal is set, we can receive block parts
err = cs.setProposal(msg.Proposal, mi.ReceiveTime)
// See if we can try creating the proposal block if keys exist
if err != nil && cs.config.GossipTransactionKeyOnly && cs.privValidatorPubKey != nil {
if err == nil && cs.config.GossipTransactionKeyOnly && cs.privValidatorPubKey != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting...

Could we add a unit test for this to assert if Tx key Dissemination was used? Could even just refactor out this snippet to be a helper if that makes it easier

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah +1 to maybe find a way to test if gossip is on or not under given condition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error == nil means there is a valid proposal already
error != nil means we don't have a valid proposal

So this change means we will try build the blocks and complete for the proposal only if the we have a valid proposal, which make sense to me

Copy link
Contributor Author

@philipsu522 philipsu522 Jun 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly - error == nil means we have a valid proposal, so we should try to build the block from mempool. otherwise we fall back to old behavior where we wait for blockparts to be gossiped

isProposer := cs.isProposer(cs.privValidatorPubKey.Address())
if !isProposer && cs.roundState.ProposalBlock() == nil {
created := cs.tryCreateProposalBlock(spanCtx, msg.Proposal.Height, msg.Proposal.Round, msg.Proposal.Header, msg.Proposal.LastCommit, msg.Proposal.Evidence, msg.Proposal.ProposerAddress)
Expand Down