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

feat: add time to RequestPreparePropsosal #1081

Merged
merged 6 commits into from
Sep 18, 2023

Conversation

evan-forbes
Copy link
Member

@evan-forbes evan-forbes commented Sep 17, 2023

Description

Adds the last commit median time to RequestPreparePropsosal. This allows the application to accurately calculate the spendable funds of vesting accounts, since this is the time used when executing the transactions and when evaluating the propsoal during ProcessProposal.

The height was also added, but it doesn't have to be since the application can calculate that value. That value is also passed in other versions of comet, and we'll have to add it we want to unfork from the sdk so I figured why not. Happy to remove it as well.

@evan-forbes evan-forbes added this to the Mainnet milestone Sep 17, 2023
@evan-forbes evan-forbes requested a review from liamsi September 17, 2023 18:29
@evan-forbes evan-forbes self-assigned this Sep 17, 2023
Comment on lines 140 to 146
// height is the height of the proposal block
int64 height = 4;
// time is the time that will end up in the header. This is the voting power
// weighted median of the last commit.
google.protobuf.Timestamp time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// version is the block and app versions for the proposal.
tendermint.version.Consensus version = 6 [(gogoproto.nullable) = false];
Copy link
Member Author

Choose a reason for hiding this comment

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

per op, the height and the application version aren't really needed since the application keeps track of those. However the block version is not kept track of afaik, so went ahead and added it as well. Happy to remove if it is desired to keep separate or requires further discussion

Copy link
Contributor

Choose a reason for hiding this comment

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

version isn't also part of cometbft v0.37.x so I don't think it's necessary to add it here if we're not using it.

Ref of our main branch:

message RequestPrepareProposal {

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I noticed that, I figured there could be an scenario where we use the block version for single binary syncs/upgrades, but we can add it then if needed so removed in fde59be

cmwaters
cmwaters previously approved these changes Sep 18, 2023
Comment on lines 140 to 146
// height is the height of the proposal block
int64 height = 4;
// time is the time that will end up in the header. This is the voting power
// weighted median of the last commit.
google.protobuf.Timestamp time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// version is the block and app versions for the proposal.
tendermint.version.Consensus version = 6 [(gogoproto.nullable) = false];
Copy link
Contributor

Choose a reason for hiding this comment

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

version isn't also part of cometbft v0.37.x so I don't think it's necessary to add it here if we're not using it.

Ref of our main branch:

message RequestPrepareProposal {

int64 height = 4;
// time is the time that will end up in the header. This is the voting power
// weighted median of the last commit.
google.protobuf.Timestamp time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +118 to +123
var timestamp time.Time
if height == state.InitialHeight {
timestamp = state.LastBlockTime // genesis time
} else {
timestamp = MedianTime(commit, state.LastValidators)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@evan-forbes evan-forbes merged commit 074d981 into v0.34.x-celestia Sep 18, 2023
@evan-forbes evan-forbes deleted the evan/add-time-to-prepare-proposal branch September 18, 2023 14:56
@faddat faddat mentioned this pull request Feb 22, 2024
3 tasks
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.

4 participants