Skip to content

feat(abci): move timeout_commit into FinalizeBlockResponse#3089

Merged
melekes merged 14 commits intomainfrom
2655-predictable-block-times-impl
May 21, 2024
Merged

feat(abci): move timeout_commit into FinalizeBlockResponse#3089
melekes merged 14 commits intomainfrom
2655-predictable-block-times-impl

Conversation

@melekes
Copy link
Collaborator

@melekes melekes commented May 16, 2024

as next_block_delay

ADR-115: #2966
Closes #2655


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
  • Title follows the Conventional Commits spec

@melekes melekes self-assigned this May 16, 2024
@melekes melekes marked this pull request as ready for review May 16, 2024 13:29
@melekes melekes requested review from a team as code owners May 16, 2024 13:29
@melekes melekes requested a review from a team May 16, 2024 13:29
// that execution of the transactions was deterministic.
// It is up to the application to decide which algorithm to use.
bytes app_hash = 5;
// delay between the time when this block is committed and the next height is started.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@andynog and I had a discussion last night about how we are modifying protobufs on main and/or v1.x. We have added a point to discuss this in next week's meeting, as it is complex and we'd like everyone in the team to be aware of it, and provide feedback.
If you want to know what this is all about, take a look at #3090.
This shouldn't be blocking this PR, it's just to raise awareness.

// delay between the time when this block is committed and the next height is started.
// previously `timeout_commit` in config.toml
google.protobuf.Duration next_block_delay = 6 [
(gogoproto.nullable) = false,
Copy link
Collaborator

@sergio-mena sergio-mena May 17, 2024

Choose a reason for hiding this comment

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

We may need nil here to achieve our upgrade path:

  • if nil the app doesn't know about this (new) feature, fall back to timeout_commit
  • If non-nil and value is 0, don't wait any time (and ignore value of timeout_commit)

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The current upgrade path should also work.

  • if 0 and timeout_commit=0s, then skip timeout
  • if 0 and timeout_commit is not zero, then use timeout_commit
  • if not-0, then use it

Copy link
Collaborator

@sergio-mena sergio-mena May 17, 2024

Choose a reason for hiding this comment

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

Yeah, I was thinking about this and I think you're right, no need to "leverage" nil here. This is my reasoning:

If the app (and app's community) is aware of this feature, they have to be aware of the whole feature (including its upgrade path!).
So if you are setting next_block_delay to 0, you have to make sure timeout_commit is also 0 (or absent from the config). If you don't do that, you can't blame us for bad UX.

Do you agree? If yes, then, this thread can be dismissed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you agree? If yes, then, this thread can be dismissed.

Exactly.

proposer a chance to receive some more precommits, even though it
already has +2/3). Set to 0 if you want a proposer to make progress as
soon as it has all the precommits. Previously `timeout_commit` in
CometBFT config. **Set to constant 1s to preserve the old (v0.34 - v1.0) behavior**.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Set to constant 1s to preserve the old (v0.34 - v1.0) behavior

See my comments above about an operator -- oblivious to this -- that wants to upgrade, and has e.g. their timeout_commit set to 0 (or to 3).
Also see my comment above about the possibility of using nil in this field to allow an app to signal "I'm not aware of this, please fall back to timeout_commit"

Copy link
Collaborator

@sergio-mena sergio-mena May 17, 2024

Choose a reason for hiding this comment

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

Update: I'm now convinced we don't need to use nil here. But the first sentence of my comment above still applies

Co-authored-by: Sergio Mena <sergio@informal.systems>
Copy link
Collaborator

@sergio-mena sergio-mena left a comment

Choose a reason for hiding this comment

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

Awesome work! 🙏

@melekes melekes changed the title feat(abci)!: move timeout_commit into FinalizeBlockResponse feat(abci): move timeout_commit into FinalizeBlockResponse May 19, 2024
@melekes melekes added this pull request to the merge queue May 21, 2024
@melekes
Copy link
Collaborator Author

melekes commented May 21, 2024

@cason please review once you're back 🙏

Merged via the queue into main with commit 259793a May 21, 2024
@melekes melekes deleted the 2655-predictable-block-times-impl branch May 21, 2024 07:17
teddyding pushed a commit to dydxprotocol/cometbft that referenced this pull request Jun 19, 2024
…bft#3089)

as `next_block_delay`

ADR-115: cometbft#2966
Closes cometbft#2655

---

- [ ] ~~Tests written/updated~~
- [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

---------

Co-authored-by: Sergio Mena <sergio@informal.systems>
teddyding pushed a commit to dydxprotocol/cometbft that referenced this pull request Jun 19, 2024
…bft#3089)

as `next_block_delay`

ADR-115: cometbft#2966
Closes cometbft#2655

---

- [ ] ~~Tests written/updated~~
- [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

---------

Co-authored-by: Sergio Mena <sergio@informal.systems>
Copy link

@cason cason left a comment

Choose a reason for hiding this comment

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

Just triple-checking, from an orthogonal view looks good.

@cason
Copy link

cason commented Jun 24, 2024

What I maybe miss, from a documentation point of view, is to make it clear that is the commit_time that is considered to "start" the configured delay. Not when FinalizeBlock is called. Although the time difference should not be that relevant.

@sergio-mena
Copy link
Collaborator

@cason thanks for triple-checking. Regarding your last comment? If you create a PR with the improved doc, I can take a look and approve

@cason
Copy link

cason commented Jul 22, 2024

@sergio-mena, here: #3542

@VAIBHAVJINDAL3012
Copy link

Where do we set the next_block_delay? Is it done in the application and returned to cometBFT?

@melekes
Copy link
Collaborator Author

melekes commented Nov 21, 2024

Where do we set the next_block_delay? Is it done in the application and returned to cometBFT?

Remember, it's not in v1 nor v0.38. It's currently on main. From v1.1 it will be in FinalizeBlockResponse https://docs.cometbft.com/v1.0/spec/abci/abci++_methods#finalizeblock

@VAIBHAVJINDAL3012
Copy link

Thanks @melekes for your quick reply. I am trying to cherry pick these changes as I want const block time. Btw is it safe to do so as I can see there is no consensus breaking change. My question is who set the next_block_delay in FinalizeBlockResponse?

melekes added a commit that referenced this pull request Dec 13, 2024
as `next_block_delay`

ADR-115: #2966
Closes #2655

---

- [ ] ~~Tests written/updated~~
- [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

---------

Co-authored-by: Sergio Mena <sergio@informal.systems>
melekes added a commit to informalsystems/beacon-kit that referenced this pull request Feb 12, 2025
using FinalizeBlockResponse.NextBlockDelay feature
cometbft/cometbft#3089
hubcycle pushed a commit to 0xElder/cometbft that referenced this pull request Feb 14, 2025
…bft#3089)

as `next_block_delay`

ADR-115: cometbft#2966
Closes cometbft#2655

---

- [ ] ~~Tests written/updated~~
- [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

---------

Co-authored-by: Sergio Mena <sergio@informal.systems>
(cherry picked from commit 259793a)
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.

PBTS: Allow Application to Set BlockTimestamp

4 participants