-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
proto: deduplicate consensus params #9287
Conversation
Good catch. @williambanfield and I had noticed that My question is: what was the rationale in the first place to move |
Follow up: I was intrigued by this duplication, and how it landed on the |
Appears that this was originally done during v0.35 in this pull request: #5987 There is no rationale present on that pull request so it's difficult to understand why it was done. |
@sergio-mena I don't see this as being present in v0.34.x tendermint/abci/types/types.pb.go Line 613 in a41c5ee
|
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.
Needs a changelog entry, will break in-process apps.
I have added this PR to the Tendermint project, so people have visibility from the project board. |
I also added a checkbox in #9053 (final adjustments) with a reference to this PR |
@williambanfield not sure I get what you mean. Do you mean that protos and generated code don't match in v0.34.x? |
@sergio-mena |
// TODO: We should remove next line in case we don't vote for v in case cs.ProposalBlock == nil, | ||
// even if cs.LockedBlock != nil. See https://docs.tendermint.com/master/spec/. |
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.
Is this comment now stale too?
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.
It's in v0.36.x so I assume not
state/store.go
Outdated
// Allocate empty Consensus params at compile time to avoid multiple allocations during runtime | ||
var ( | ||
empty = types.ConsensusParams{} | ||
emptypb = tmproto.ConsensusParams{} | ||
) |
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.
Is this copped from somewhere else? It seems dubious that this would actually save any measurable memory or time, and just opens us up to weird testing flukes. If there's a good way to omit this pattern, I would.
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.
Yeah it's copied from the original PR
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.
Agree with Sam. This is saving us almost nothing. As far as I know, global variables are not allocated at compile time. I'm not really sure I know what that means. They're allocated when the program starts. This just means they're allocated only once which really saves us so little here.
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.
LGTM
state/store.go
Outdated
var params types.ConsensusParams | ||
params, err = store.LoadConsensusParams(h) |
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.
var params types.ConsensusParams | |
params, err = store.LoadConsensusParams(h) | |
params, err := store.LoadConsensusParams(h) |
Not sure the separated variable declaration gets us anything.
state/store.go
Outdated
// Allocate empty Consensus params at compile time to avoid multiple allocations during runtime | ||
var ( | ||
empty = types.ConsensusParams{} | ||
emptypb = tmproto.ConsensusParams{} | ||
) |
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.
Agree with Sam. This is saving us almost nothing. As far as I know, global variables are not allocated at compile time. I'm not really sure I know what that means. They're allocated when the program starts. This just means they're allocated only once which really saves us so little here.
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.
all minor points, otherwise looks good.
proto files contain two identical cosnensus params. One in
types
and the other inabci
. This PR aims at consolidating the two. Port of #5994This PR also includes the depracation of
TimeIotaMs
(ref: #5792)