Skip to content

Commit

Permalink
feat: Versioned timeouts CIP draft (#216)
Browse files Browse the repository at this point in the history
* feat: add 6 second block CIP draft

* docs: edits

* Apply suggestions from code review

Co-authored-by: Rootul P <[email protected]>

* docs: add suggestions from review part 1

* suggestion from code review

* docs: fix lint

* docs: suggestion from code review

* docs: fix lint

* Apply suggestions from code review

* docs: remove unecessary spec point

* docs: remove another repetitive point

* Apply suggestions from code review

* docs: suggestions from review

* docs: clarify upgrade path and why params moved

* docs: rearrange spec

* Apply suggestions from code review

Co-authored-by: Rootul P <[email protected]>

* Apply suggestions from code review

Co-authored-by: Sanaz Taheri <[email protected]>

* docs: edit CIP-25 to include this CIP-26

* Apply suggestions from code review

Co-authored-by: Sanaz Taheri <[email protected]>

* Apply suggestions from code review

* Update cips/README.md

* Apply suggestions from code review

* Apply suggestions from code review

* fix: linting

* Apply suggestions from code review

Co-authored-by: Sanaz Taheri <[email protected]>

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Rootul P <[email protected]>
Co-authored-by: Sanaz Taheri <[email protected]>
  • Loading branch information
3 people authored Oct 17, 2024
1 parent dcf7ff6 commit edd2e09
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 3 deletions.
1 change: 1 addition & 0 deletions cips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Read [CIP-1](./cip-1.md) for information on the CIP process.
| [23](./cip-23.md) | Coordinated prevote times | Callum Waters ([@cmwaters](https://github.com/cmwaters)) |
| [24](./cip-24.md) | Versioned Gas Scheduler Variable | Nina Barbakadze ([@ninabarbakadze](https://github.com/ninabarbakadze)) |
| [25](./cip-25.md) | Ginger Network Upgrade | Josh Stein ([@jcstein](https://github.com/jcstein)), Nina Barbakadze ([@ninabarbakadze](https://github.com/ninabarbakadze)) |
| [26](./cip-26.md) | Versioned timeouts | Josh Stein ([@jcstein](https://github.com/jcstein)), Rootul Patel ([@rootulp](https://github.com/rootulp)), Sanaz Taheri ([@staheri14](https://github.com/staheri14) |

## Contributing

Expand Down
1 change: 1 addition & 0 deletions cips/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [CIP-23](./cip-23.md)
- [CIP-24](./cip-24.md)
- [CIP-25](./cip-25.md)
- [CIP-26](./cip-26.md)

- [Core Devs Call notes](./notes/README.md)
- [CDC #14](./notes/cdc-14.md)
Expand Down
7 changes: 4 additions & 3 deletions cips/cip-25.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| status | Draft |
| type | Meta |
| created | 2024-10-01 |
| requires | CIP-21, CIP-24, CIP-TBD-1, CIP-TBD-2 |
| requires | CIP-21, CIP-24, CIP-26, CIP-TBD-2 |

## Abstract

Expand All @@ -19,8 +19,9 @@ This Meta CIP lists the CIPs included in the Ginger network upgrade.

- [CIP-21](./cip-21.md): Introduce blob type with verified signer
- [CIP-24](./cip-24.md): Versioned Gas Scheduler Variables
- CIP-TBD-1: Reduce block time to six seconds
- CIP-TBD-2: Limiting compute per block
- [CIP-26](./cip-26.md): Versioned timeouts
- CIP-TBD-1: Block limits for number of PFBs and non-PFBs
- CIP-TBD-2: Transaction size limit

All of the above CIPs are state breaking, and thus require a breaking network upgrade. The activation of this network upgrade will be different from previous network upgrades, as described in [CIP-10](./cip-10.md).

Expand Down
69 changes: 69 additions & 0 deletions cips/cip-26.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
| cip | 26 |
| - | - |
| title | Versioned timeouts |
| description | Timeouts are now controlled by the application version. |
| author | Josh Stein ([@jcstein](https://github.com/jcstein)), Rootul Patel ([@rootulp](https://github.com/rootulp)), Sanaz Taheri ([@staheri14](https://github.com/staheri14)) |
| discussions-to | <https://forum.celestia.org/t/cip-decrease-block-time-to-6-seconds/1836> |
| status | Draft |
| type | Standards Track |
| category | Core |
| created | 2024-10-09 |

## Abstract

This CIP proposes making timeouts application-version dependent. Starting from v3, timeouts will be controlled by the application version, rendering manual timeout configurations ineffective unless the implementation changes in the future.

This change enables automated block time adjustments, eliminating the need for validators to modify configurations manually, as the adjustments (if any) will occur automatically with each celestia-app version upgrade.

Updating the timeouts will naturally impact block time, block rate, and network throughput. For v3 of celestia-app, the timeout values are set to reduce the block time from 12 seconds to 6 seconds. This means block time is cut in half which, consequently, will nearly double the block rate and throughput (considering other network factors).

Additionally, this CIP proposes increasing the `ttl-num-blocks` parameter in the mempool configuration from 5 to 12 to align with the reduced block time.

## Motivation

The motivation for this CIP stems from a discussion in Core Devs Call 17, where it was proposed to reduce the block time to 6 seconds from 12 seconds.

## Specification

1. The block time in celestia-app SHOULD be reduced from 12 seconds to 6 seconds. Concretely, this implies decreasing `TimeoutCommit` to 4.2 seconds and `TimeoutPropose` to 3.5 seconds.
1. The `TimeoutCommit` and `TimeoutPropose` parameters were moved from local config parameters into versioned parameters controlled by the state machine. The timeouts will be managed by the application and communicated with Celestia-core through the following ABCI interfaces: `InitChain`, `EndBlock`, and `Info`, now extended with `TimeoutsInfo`, which encapsulates `TimeoutPropose` and `TimeoutCommit`. The timeouts obtained through these interfaces are utilized by the Celestia-core side as needed.
1. Celestia consensus nodes SHOULD update their software to accommodate this change prior to the agreed-upon block height.
1. Client applications interacting with the Celestia network SHOULD be updated to account for the faster block time, particularly in areas related to transaction confirmation and block finality.

1. The default `ttl-num-blocks` parameter in the mempool configuration SHALL be increased from 5 to 12. This change is necessary to maintain consistency with the new block time and ensure that transactions remain in the mempool for a similar duration as before.
1. Current default: `ttl-num-blocks = 5`
1. New default: `ttl-num-blocks = 12`
1. This change SHALL NOT be implemented alongside the block time reduction. The default increase from 5 to 12 will occur when users upgrade to celestia-app v3.0.0 and regenerate their config files. The block time reduction will happen one week later when the v2 to v3 activation height occurs. This approach ensures consistent behavior of the mempool across the network upgrade.
1. All validator nodes SHOULD update their configuration files to reflect this new `ttl-num-blocks` value before the agreed-upon implementation block height.

1. Documentation and APIs related to block time and block production MUST be updated to reflect these changes.

## Rationale

The rationale for this change is to increase the throughput of the Celestia network by doubling the number of blocks produced per unit of time. This will reduce the time it takes for transactions to be finalized and improve the overall user experience on the network.

The increase in `ttl-num-blocks` from 5 to 12 is necessary to maintain consistent mempool behavior with the new block time. This change ensures that transactions remain in the mempool for approximately 72 seconds (12 blocks times 6 seconds), which closely matches the previous behavior of about 60 seconds (5 blocks times 12 seconds).

## Backwards Compatibility

This upgrade requires all participants to update their software to v3 to accommodate the new block time and `ttl-num-blocks`. Nodes running older versions may not function correctly with the new network parameters. All validators and node operators should update to v3 before the agreed-upon implementation block height to ensure network consistency and optimal performance.

## Test Cases

This will be tested on Arabica devnet and Mocha testnet before going live on Celestia Mainnet Beta.

## Security Considerations

While the reduction in block time itself does not introduce significant new security risks to the network, there are important considerations:

1. Participants should ensure that their systems are capable of handling the increased throughput from faster block times.
1. The increase of `ttl-num-blocks` from 5 to 12 is crucial for maintaining the security and efficiency of the mempool:
1. It prevents premature removal of valid transactions, reducing the risk of unintended exclusion from blocks.
1. Without this adjustment, transactions would be pruned from the mempool after only 30 seconds, potentially leading to increased transaction failures and a poor user experience.
1. Validators and node operators should update their configurations to reflect the new `ttl-num-blocks` value to maintain network consistency and security.

These changes require careful implementation and testing to ensure network stability during and after the transition.

## Copyright

Copyright and related rights waived via [CC0](https://github.com/celestiaorg/CIPs/blob/main/LICENSE).

0 comments on commit edd2e09

Please sign in to comment.