Skip to content

perf(internal/blocksync): do not ValidateBlock twice (#2026)#4

Merged
czarcas7ic merged 3 commits intoosmo/v0.37.4from
adam/avoid-val-block-twice
Feb 16, 2024
Merged

perf(internal/blocksync): do not ValidateBlock twice (#2026)#4
czarcas7ic merged 3 commits intoosmo/v0.37.4from
adam/avoid-val-block-twice

Conversation

@czarcas7ic
Copy link
Member

The first time we validate the block is by calling ValidateBlock. Then we were calling ApplyBlock, which also calls ValidateBlock. The solution is to introduce a new method - ApplyVerifiedBlock, which skips validation.

Closes cometbft#1830


  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

The first time we validate the block is by calling `ValidateBlock`. Then
we were calling `ApplyBlock`, which also calls `ValidateBlock`. The
solution is to introduce a new method - `ApplyVerifiedBlock`, which
skips validation.

Closes cometbft#1830

<!--

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

-->

---

- [ ] Tests written/updated
- [ ] 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
@czarcas7ic czarcas7ic added the S:backport/v23 backport to the osmo-v23/v0.37.4 branch label Feb 14, 2024
@czarcas7ic czarcas7ic merged commit 6e2a1c3 into osmo/v0.37.4 Feb 16, 2024
czarcas7ic added a commit that referenced this pull request Feb 16, 2024
perf(internal/blocksync): do not `ValidateBlock` twice (cometbft#2026)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S:backport/v23 backport to the osmo-v23/v0.37.4 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blocksync is triple verifying validator signatures, at real costs to sync speed

3 participants