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

Conversation

philipsu522
Copy link
Contributor

@philipsu522 philipsu522 commented Jun 16, 2023

Describe your changes and provide context

In a previous PR, the intent was: If there is an error in setProposal then it doesn't make sense to continue with handling proposal

However, it was incorrectly set here: https://github.com/sei-protocol/sei-tendermint/pull/87/files#diff-c27a58d5a8b3c15166169543b3cdb94da91bb60efa27609ef446719474af78c5R1059 meaning we haven't been using tx-key dissemination for a while.

Testing performed to validate your change

Deployed on loadtest cluster, verify metrics work:
http://grafana.sei-loadtest-testnet.seinetwork.io:9090/graph?g0.expr=tendermint_consensus_proposal_block_created_on_propose&g0.tab=0&g0.stacked=0&g0.show_exemplars=0&g0.range_input=1h
Chain ran fine over weekend:http://grafana.sei-loadtest-testnet.seinetwork.io/d/ecVP_k37z/sei-chain-monitoring?orgId=1&refresh=5s&var-chain_id=psu-gossip-tx-test&var-public_dns=All&from=now-2d&to=now-1h

@@ -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

@@ -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.

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

@@ -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.

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

@philipsu522 philipsu522 requested a review from yzang2019 June 16, 2023 20:46
@philipsu522 philipsu522 requested a review from BrandonWeng June 20, 2023 21:52
@@ -2924,6 +2924,49 @@ func TestStateOutputsBlockPartsStats(t *testing.T) {

}

func TestGossipTransactionKeyOnlyConfig(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@philipsu522 philipsu522 enabled auto-merge (squash) June 21, 2023 16:03
@philipsu522 philipsu522 disabled auto-merge June 21, 2023 18:31
@philipsu522 philipsu522 merged commit 6762b3e into main Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants