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

[R4R] Add proposer to NewRound event and proposal info to CompleteProposal event #2767

Merged
merged 14 commits into from Nov 15, 2018

Conversation

kevlubkcm
Copy link
Contributor

@kevlubkcm kevlubkcm commented Nov 6, 2018

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

@codecov-io
Copy link

codecov-io commented Nov 6, 2018

Codecov Report

Merging #2767 into develop will decrease coverage by 0.06%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           develop    #2767      +/-   ##
===========================================
- Coverage    62.21%   62.15%   -0.07%     
===========================================
  Files          212      212              
  Lines        17269    17212      -57     
===========================================
- Hits         10744    10698      -46     
+ Misses        5621     5608      -13     
- Partials       904      906       +2
Impacted Files Coverage Δ
consensus/state.go 79.78% <100%> (ø) ⬆️
privval/tcp_server.go 78.57% <0%> (-2.86%) ⬇️
consensus/reactor.go 66.39% <0%> (-1.74%) ⬇️
libs/db/prefix_db.go 58.55% <0%> (+0.82%) ⬆️
privval/ipc_server.go 69.81% <0%> (+5.66%) ⬆️

Copy link
Contributor

@ebuchman ebuchman left a comment

Choose a reason for hiding this comment

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

Nice - just add the Step, and a CHANGELOG_PENDING#Improvements. Anything else ?

types/events.go Show resolved Hide resolved
@kevlubkcm
Copy link
Contributor Author

I was thinking that maybe we should also add the ProposerAddress and ProposerIndex to the NewRound event as well, since we may want to know who the proposer should be before actually receiving the proposal. wdyt? should I include that in this pull request or open a separate one?

@ebuchman
Copy link
Contributor

Hmm - can you briefly describe the use case here? We should try to think about the event msgs a bit more holistically before we start adding fields here and there.

@kevlubkcm
Copy link
Contributor Author

Sure. I am trying to build a live tendermint consensus visualizer with all of the critical steps for consensus

essentially a live version of this flow chart https://tendermint.com/docs/assets/img/consensus_logic.e9f4ca6f.png
(with a visual for each validator and each message being passed around)

Really the only thing I am missing is being able to highlight the proposer. Originally I was thinking it makes sense to include that in the CompleteProposal event, but that is at the wrong point. Makes more sense to do it at New Round and/or New Height. (though also it is nice to get the BlockID in the CompleteProposal event)

@ebuchman
Copy link
Contributor

Right of course. I think a NewRound msg makes sense. Currently we just use EventDataRoundState but I don't think we should add the proposer stuff to that. Instead we should probably have a new type, EventDataNewRound, that has the basic H/R/S info as well as a ProposerInfo field that contains the proposer's address and index. How's that sound?

@kevlubkcm
Copy link
Contributor Author

sounds good to me. will update

@kevlubkcm kevlubkcm changed the title [WIP] Add proposer and proposal info to CompleteProposal event [R4R] Add proposer to NewRound event and proposal info to CompleteProposal event Nov 12, 2018
types/events.go Outdated Show resolved Hide resolved
types/events.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ebuchman ebuchman left a comment

Choose a reason for hiding this comment

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

Thanks! I'll address most of my comments and merge this :)

Round int `json:"round"`
Step string `json:"step"`

BlockID BlockID `json:"block_id"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add the ValidatorInfo to this event as well? Seems it would make sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had it there at first, but EventDataNewRound seems like the correct place to put it. Can add it back if you like.

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries. Let's leave it as is for now - can always add it later.

consensus/types/round_state.go Outdated Show resolved Hide resolved
consensus/types/round_state.go Outdated Show resolved Hide resolved
@@ -492,6 +524,31 @@ func ensureVote(voteCh <-chan interface{}, height int64, round int,
}
}

func ensureProposal(proposalCh <-chan interface{}, height int64, round int, propId types.BlockID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What prompted the need for this if we already have ensureNewProposal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

allows us to also assert details about the proposal (eg we want to assert this specific block is proposed vs a block is proposed). I took the pattern from ensureNewVote (though it isnt actually used at the moment) vs ensureVote

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep - we probably want to replace ensureNewProposal with this eventually so we're always asserting the correct value. Fine for now.

consensus/common_test.go Show resolved Hide resolved
CHANGELOG_PENDING.md Outdated Show resolved Hide resolved
@ebuchman ebuchman merged commit a676c71 into tendermint:develop Nov 15, 2018
@kevlubkcm
Copy link
Contributor Author

thanks! responded to leftover comments

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.

None yet

3 participants