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: retrieves timeout propose and timeout commit dynamically per height according to the app version #1494

Merged
merged 91 commits into from
Oct 15, 2024

Conversation

staheri14
Copy link
Contributor

@staheri14 staheri14 commented Sep 19, 2024

The celestia-core portion of #3859

@staheri14 staheri14 changed the title WIP WIP: embeds timeouts in abci calls Sep 19, 2024
@staheri14 staheri14 self-assigned this Sep 19, 2024
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

for future readers, we've had discussions on if we need to store the timeouts in the state or not. We don't need to, as we're always capable of reading these values from the application. The rpc portion was also only added for being able to query nodes during tests, but is not needed.

also per a previous discussion, we don't need to block on that.

will approve after some e2e testing, either here or in the knuu tests

evan-forbes
evan-forbes previously approved these changes Oct 11, 2024
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

👍 thanks for testing this

its not a major deal, but in the future I think we can make reviewer's lives easier by limiting the scope of PRs. there are a lot of changes here such as unrelated spelling / doc stuff and RPC / storing the state that I think would have been possible to avoid.

if there are any remaining todos for edge cases or cleanups, then do you mind writing those up @staheri14 sometime next week?

@staheri14
Copy link
Contributor Author

staheri14 commented Oct 11, 2024

its not a major deal, but in the future I think we can make reviewer's lives easier by limiting the scope of PRs. there are a lot of changes here such as unrelated spelling / doc stuff and RPC / storing the state that I think would have been possible to avoid.

I agree, I myself am against large PRs. However, for this one, I initially suggested creating an ADR, but it was deemed unnecessary. If we had an ADR, then major design decisions could have been documented, followed by smaller PRs based on that design. Since there was no design document, I had to include everything in a single PR to ensure it made sense to the reviewer. But if it makes it easier to review, I can and will be willing to split the PR into smaller PRs.

@staheri14
Copy link
Contributor Author

if there are any remaining todos for edge cases or cleanups, then do you mind writing those up @staheri14 sometime next week?

Sure, will do next week!

config/config.go Show resolved Hide resolved
@@ -674,9 +674,28 @@ func (cs *State) updateToState(state sm.State) {
// to be gathered for the first block.
// And alternative solution that relies on clocks:
// cs.StartTime = state.LastBlockTime.Add(timeoutCommit)
cs.StartTime = cs.config.Commit(cmttime.Now())

if state.LastBlockHeight == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to keep this can you compact this into a simpler IsGenesis method and then just have a single if statement to set cs.StartTime

state/execution.go Outdated Show resolved Hide resolved
state/store.go Outdated Show resolved Hide resolved
@cmwaters
Copy link
Contributor

Thanks for clarifying that saving timeouts and the RPC endpoint are for the celestia-app e2e tests. I had initially thought they were used in this repo for testing. My approach would be to measure the block time before the upgrade and measure the block time after the upgrade and assert that the first is close to 11 seconds and the second is close to 6 seconds

Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

A lot of the comments I left on the last review haven't been addressed. Do you want me to continue re-reviewing?

Comment on lines 679 to 686
// state represents the genesis state, hence the StartTime should be set based on the state's TimeoutCommit
// we don't use cs.state.TimeoutCommit because that is zero
cs.StartTime = cs.config.CommitWithCustomTimeout(cmttime.Now(), state.TimeoutCommit)
} else {
// if state does not represent the genesis state,
// we use the cs.state.TimeoutCommit
cs.StartTime = cs.config.CommitWithCustomTimeout(cmttime.Now(), cs.state.TimeoutCommit)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment wasn't addressed.

node/node.go Outdated
Comment on lines 878 to 879
fastSync := config.FastSyncMode && !onlyValidatorIsUs(state,
pubKey) // the state certainly has the latest timeouts according
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment wasn't addressed.

node/node.go Outdated
// app may modify the validator set, specifying ourselves as the only validator.
fastSync := config.FastSyncMode && !onlyValidatorIsUs(state,
pubKey) // the state certainly has the latest timeouts according
// the app version lastBlock in the blockstore
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment wasn't addressed.

node/node.go Outdated
@@ -888,6 +895,7 @@ func NewNodeWithContext(ctx context.Context,
}

// Make MempoolReactor
// TODO limit the proxyApp to Mempool only
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment wasn't addressed.

node/node.go Outdated
@@ -943,6 +952,7 @@ func NewNodeWithContext(ctx context.Context,
}

// Setup Transport.
// TODO limit the proxyApp to Query only
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment wasn't addressed.

@@ -77,4 +77,7 @@ message State {

// the latest AppHash we've received from calling abci.Commit()
bytes app_hash = 13;

// timeouts to be used for the next block height
tendermint.abci.TimeoutsInfo timeouts = 15 [(gogoproto.nullable) = false];
Copy link
Collaborator

Choose a reason for hiding this comment

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

[question] why not 14? The last used field number is 13.

Copy link
Member

Choose a reason for hiding this comment

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

this is a good question

Copy link
Contributor

Choose a reason for hiding this comment

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

It's weirdly formatted but above there is initial_height which uses the 14 tag

@@ -54,6 +54,9 @@ var Routes = map[string]*rpc.RPCFunc{

// evidence API
"broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),

// get Timeouts by height
"timeout": rpc.NewRPCFunc(ConsensusTimeoutsInfo, "height"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment wasn't addressed.

@rootulp rootulp self-requested a review October 14, 2024 17:30
@evan-forbes
Copy link
Member

@rootulp @cmwaters

just removed rpc and storing the timeouts, and most importantly, set the timeouts after state sync after the call to Info

other nits with comments and spelling etc were handled in the first two commits, but I'm going through now to make sure I got all of them

@evan-forbes
Copy link
Member

I'll still need to fix the linter, so there will be at least one more commit

rootulp
rootulp previously approved these changes Oct 14, 2024
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

A few of my comments still haven't been addressed but not going to block on any of them.

golangci-lint is failing.

It would have been nice if the PR description included a Testing section that describes how this PR was manually tested.

state/store.go Outdated Show resolved Hide resolved
@evan-forbes evan-forbes enabled auto-merge (squash) October 14, 2024 17:53
@evan-forbes evan-forbes merged commit c2c6463 into v0.34.x-celestia Oct 15, 2024
18 checks passed
@evan-forbes evan-forbes deleted the sanaz/adds-timeouts-to-endblock-abci branch October 15, 2024 01:19
rach-id pushed a commit that referenced this pull request Nov 18, 2024
…ight according to the app version (#1494)

The celestia-core portion of
[#3859](celestiaorg/celestia-app#3859)

---------

Co-authored-by: evan-forbes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants