8000 enterPrecommit is almost always double verifying the block · Issue #2854 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

enterPrecommit is almost always double verifying the block #2854

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

Closed
ValarDragon opened this issue Apr 20, 2024 · 12 comments · Fixed by #3070 or osmosis-labs/cometbft#73
Closed

enterPrecommit is almost always double verifying the block #2854

ValarDragon opened this issue Apr 20, 2024 · 12 comments · Fixed by #3070 or osmosis-labs/cometbft#73
Labels
consensus enhancement New feature or request
Milestone

Comments

@ValarDragon
Copy link
Contributor

Feature Request

Summary

enterPrecommit almost always runs ValidateBlock, however in most cases this is duplicate logic as we have already prevoted the block. We only enter a lock after this line! This is the line where we run validate block: https://github.com/cometbft/cometbft/blob/main/internal/consensus/state.go#L1667

I suggest that we change this line here, to be one of two things:

  • Only validate the block after checking some cache for whether we have already validated this block.
  • Check "did we prevote this block", and only ran ValidateBlock if we did not.

Problem Definition

We see we have duplicate VerifyBlock logic on synced full nodes:
image

This operation is expensive, especially in consensus critical contexts!

Proposal

I think that making a cache for checking if we've already validated a block is better, as it seems easier to also avoid extra redundant validations for finalizeCommit. I haven't read that logic, but guessing by how all 3 of these validate block calls are pretty similar in the amount of time spent, I'm guessing its a redundant ValidateBlock as well.

@ValarDragon ValarDragon added enhancement New feature or request needs-triage This issue/PR has not yet been triaged by the team. labels Apr 20, 2024
@cason
Copy link
Contributor
cason commented Apr 22, 2024

We had a discussion at some point regarding the multiple validations of the same block. I found this comment:

cometbft/knowledge-base#14 (comment)

@cason
Copy link
Contributor
cason commented Apr 22, 2024

A similar discussion also here: #1391

@cason
Copy link
Contributor
cason commented Apr 22, 2024

We need to separate the validation of a block by the state-machine/blockchain, and the validation of a block by the application. The first validation, whether a block can be appended to the blockchain, could indeed be cached.

@cason cason added consensus and removed needs-triage This issue/PR has not yet been triaged by the team. labels Apr 22, 2024
@cason cason added this to CometBFT Apr 22, 2024
@github-project-automation github-project-automation bot moved this to Todo in CometBFT Apr 22, 2024
@ValarDragon
Copy link
Contributor Author

Thanks for the links to past discussions! This would be great to do for the comet side checks! Its easy enough to say its the app's job to handle it for app-side checks

@ValarDragon
Copy link
Contributor Author

Just checked, we are indeed also doing an extra validate Block call in FinalizeCommit, that would be mitigated with a simple cache :)

@ValarDragon
Copy link
Contributor Author

Ah we are actually double validating the block in FinalizeCommit -- though this one is super easy to fix using ApplyVerifiedBlock:
image

@adizere adizere added this to the 2024-Q2 milestone Apr 29, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 30, 2024
#2928)

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

Simplest component of #2854 

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
mergify bot pushed a commit that referenced this issue Apr 30, 2024
#2928)

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

Simplest component of #2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 94fa3c9)
mergify bot pushed a commit that referenced this issue Apr 30, 2024
#2928)

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

Simplest component of #2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 94fa3c9)

# Conflicts:
#	consensus/state.go
mergify bot pushed a commit that referenced this issue Apr 30, 2024
#2928)

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

Simplest component of #2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 94fa3c9)

# Conflicts:
#	consensus/state.go
melekes pushed a commit that referenced this issue Apr 30, 2024
…k (backport #2928) (#2943)

Simplest component of #2854 

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #2928 done by
[Mergify](https://mergify.com).

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
melekes added a commit that referenced this issue Apr 30, 2024
…k (backport #2928) (#2944)

Simplest component of #2854 

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
melekes added a commit that referenced this issue Apr 30, 2024
…k (backport #2928) (#2945)

Simplest component of #2854 

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in #2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
@sergio-mena
Copy link
Contributor
sergio-mena commented May 1, 2024

Hi @ValarDragon @cason chiming in here

First of all, the caching mechanism that @ValarDragon is proposing shouldn't be hard to do, and would probably do the trick. So this is still and option.

However, going through @cason's old comments on the algorithm's valid(v) (which were made in the context of non-deterministic ProcessProposal, i.e., RFC 105) I think we can go further if we agree that the following is true:

  • valid(v) can be thought of as consisting of two parts: CometBFT-valid and App-valid. The former being ValidateBlock, the latter being ProcessProposal.
  • The modifications made to the Tendermint algorithm in RFC 105 are correct (in particular, the calls to valid(v) that were removed as part of RFC 105)

If we agree this is true, then we can conclude that CometBFT-valid can just be called where and only where App-valid is called; without affecting the algorithm's correctness.

If I didn't terribly miss anything in my reasoning, then the solution I would implement here is aligning ValidateBlock with ProcessProposal; IOW calling ValidateBlock only when we call ProcessProposal.

@cason what do you think?

@sergio-mena
Copy link
Contributor
sergio-mena commented May 1, 2024 8000

@ValarDragon I just posted #2960 for review. We need to wait for @cason to come back from vacation (he's back next Mon). I would like to have his opinion on correctness.
In the meantime, do you folks think you could measure if this PR improves the performance and how much? Thanks!

@sergio-mena sergio-mena moved this from Todo to In Progress in CometBFT May 1, 2024
@ValarDragon
Copy link
Contributor Author

Ah your right, that would argue that we can safely remove those two calls! That sounds good to me, will try to get it tested on mainnet soon! (@czarcas7ic is working on some automation for this, so that way we can also be getting benchmarks that adapt for the fixes we've already gotten in as well!)

From my understanding though, this would save those calls and be a notable time reduction!

czarcas7ic pushed a commit to osmosis-labs/cometbft that referenced this issue May 2, 2024
…k (backport cometbft#2928) (cometbft#2945)

Simplest component of cometbft#2854 

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in cometbft#2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
czarcas7ic added a commit to osmosis-labs/cometbft that referenced this issue May 2, 2024
#39)

* perf(consensus/state): Change finalizeCommit to use applyVerifiedBlock (backport cometbft#2928) (cometbft#2945)

Simplest component of cometbft#2854 

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in cometbft#2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>

* fix merge conflict

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
mergify bot added a commit to osmosis-labs/cometbft that referenced this issue May 2, 2024
#39)

* perf(consensus/state): Change finalizeCommit to use applyVerifiedBlock (backport cometbft#2928) (cometbft#2945)

Simplest component of cometbft#2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in cometbft#2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>

* fix merge conflict

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
(cherry picked from commit 6fe6ee1)
mergify bot added a commit to osmosis-labs/cometbft that referenced this issue May 2, 2024
#39)

* perf(consensus/state): Change finalizeCommit to use applyVerifiedBlock (backport cometbft#2928) (cometbft#2945)

Simplest component of cometbft#2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in cometbft#2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>

* fix merge conflict

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
(cherry picked from commit 6fe6ee1)
czarcas7ic added a commit to osmosis-labs/cometbft that referenced this issue May 3, 2024
#39) (#46)

* perf(consensus/state): Change finalizeCommit to use applyVerifiedBlock (backport cometbft#2928) (cometbft#2945)

Simplest component of cometbft#2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in cometbft#2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>

* fix merge conflict

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
(cherry picked from commit 6fe6ee1)

Co-authored-by: Adam Tucker <adam@osmosis.team>
czarcas7ic added a commit to osmosis-labs/cometbft that referenced this issue May 3, 2024
#39) (#47)

* perf(consensus/state): Change finalizeCommit to use applyVerifiedBlock (backport cometbft#2928) (cometbft#2945)

Simplest component of cometbft#2854

We already run ValidateBlock in finalizeCommit, so this PR removes one
extra redundant call by using ApplyVerifiedBlock. (The other call is
also redundant, but that likely requires a more complex caching strategy
as noted in cometbft#2854 to remedy)

From my understanding of these benchmarks, at Osmosis 150 validators,
this should be saving ~13ms of execution time per block.

---

#### PR checklist

- [X] Tests written/updated - Theres no test to update, as its
impossible to reach the difference in codepaths!
- [X] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request cometbft#2928 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>

* fix merge conflict

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
(cherry picked from commit 6fe6ee1)

Co-authored-by: Adam Tucker <adam@osmosis.team>
@cason
Copy link
Contributor
cason commented May 8, 2024

The change in #2928 is nonetheless really relevant.

@cason
Copy link
Contributor
cason commented May 8, 2024

@cason what do you think?

I added my comments/concerns to #2960.

@sergio-mena
Copy link
Contributor
sergio-mena commented May 13, 2024

Following @cason's observations and comments, and an internal discussion, this is how we agreed to move forward:

  • We keep the part where we align the checks in defaultDoPrevote
  • But we revert the hunks that are removing the defensive panics
  • And, in order to keep the performance improvement that motivated this issue initially, we'll add a cache in memory as @ValarDragon was suggesting

github-merge-queue bot pushed a commit that referenced this issue May 13, 2024
…d `isTimely` (#2960)

~~This change is an implementation of the alignment of `ValidateBlock`
to `ProcessProposal` explained
[here](#2854 (comment)

We need to:

* Check if that helps, perf-wise
* Carefully make we're not compromising algorithm's correctness

EDIT:

In the end, we are implementing this as agreed
[here](#2854 (comment))

EDIT2:

This PR will just deal with alignment of `ValidateBlock`,
`ProcessProposal` and `isTimely` (so it's no longer closing #2854)

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
github-merge-queue bot pushed a commit that referenced this issue May 14, 2024
Closes #2854

Follow up from #2960

This PR adds a simplistic 1-element block validation cache in
`BlockExecutor`. This addresses a performance bottleneck raised as part
of #2854

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
@github-project-automation github-project-automation bot moved this from In Progress to Done in CometBFT May 14, 2024
ValarDragon pushed a commit to osmosis-labs/cometbft that referenced this issue May 25, 2024
Closes cometbft#2854

Follow up from cometbft#2960

This PR adds a simplistic 1-element block validation cache in
`BlockExecutor`. This addresses a performance bottleneck raised as part
of cometbft#2854

---

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
mergify bot pushed a commit to osmosis-labs/cometbft that referenced this issue May 28, 2024
Closes cometbft#2854

Follow up from cometbft#2960

This PR adds a simplistic 1-element block validation cache in
`BlockExecutor`. This addresses a performance bottleneck raised as part
of cometbft#2854

---

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
(cherry picked from commit 2dd4e03)
PaddyMc pushed a commit to osmosis-labs/cometbft that referenced this issue May 28, 2024
#78)

Closes cometbft#2854

Follow up from cometbft#2960

This PR adds a simplistic 1-element block validation cache in
`BlockExecutor`. This addresses a performance bottleneck raised as part
of cometbft#2854

---

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
(cherry picked from commit 2dd4e03)

Co-authored-by: Sergio Mena <sergio@informal.systems>
PaddyMc pushed a commit to osmosis-labs/cometbft that referenced this issue Aug 19, 2024
Closes cometbft#2854

Follow up from cometbft#2960

This PR adds a simplistic 1-element block validation cache in
`BlockExecutor`. This addresses a performance bottleneck raised as part
of cometbft#2854

---

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Andy Nogueira <me@andynogueira.dev>
ValarDragon pushed a commit to osmosis-labs/cometbft that referenced this issue Aug 19, 2024
#133)

Closes cometbft#2854

Follow up from cometbft#2960

This PR adds a simplistic 1-element block validation cache in
`BlockExecutor`. This addresses a performance bottleneck raised as part
of cometbft#2854

---

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Sergio Mena <sergio@informal.systems>
Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus enhancement New feature or request
Projects
No open projects
Status: Done
4 participants
0