Skip to content

Use linear representation for round durations in Tenderbake

Richard Bonichon requested to merge rb@round_repr_simplify into master

Context

Fixes: #2144 (closed)

Instead of the initial encoding using a list of specified round durations (of length >= 2) and deriving the value for other unspecified round, we use two new parameters: minimal_block_delay and delay_increment_per_round so that round_duration is a linear function of these

round_duration(n) = minimal_block_delay + n * delay_increment_per_round

This MR is deliberately made as simple as possible. For example, I have kept the Round.Durations module even though its use may be unnecessary now, if we make sure that the invariants on constants minimal_block_delay and delay_increment_per_round are enforced by suitable interfaces/types. This keeps the interface of module Round relatively stable.

Manually testing the MR

All unit and integration tests that were relying on specific round duration specifications have been updated accordingly (see the specific commit dedicated to that)

New unit tests have been added to test Round_repr.level_offset_of_round. These can be run, along with other Round_repr unit tests with

dune exec src/proto_alpha/lib_protocol/test/main.exe -- test "^round$"

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, the Development Version section of CHANGES.md for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Richard Bonichon

Merge request reports