[go: up one dir, main page]

Proto/Compiler: allow alternative protocol hashes

What

Adds an hardcoded table of protocol hash to protocol hash.

Why

As shown in !15400 (merged), the old protocols need some backports to be compilable. This MR adds a table that maps a protocol hashes to protocol hashes. This allows mapping mapping the newly found protocol hash to their representent in their respective TEZOS_PROTOCOL file. This is hardcoded for now, but this file would be generated similarly to the protocol registerer.

How

Protocol hashes are made explicititely equivalent: when checking that two protocol hashes are equivalent, the protocol hash equality is checked on their direct representative. These equality are not transitive : there is no reason that a protocol hash is represented by another protocol hash being itself represented by another hash. This doesn't need to be a full fledged union-find algorithm.

TODO:

  • Add at least a test

Manually testing the MR

There are multiple ways to check that the table works:

  • Try !15400 (merged) that would change the hash and check it still works with dune build @runtest_compile_protocol. It only works for OCaml 4.14 though, as these patches are needed for OCaml 5.
  • You can modify any frozen protocol and compile it with dune @src/proto_XXX/lib_protocol/runtest. It should fail as the new hash produced is not recognized (and not part of the table). Add it to the table and run it again: it will now be accepted by the compiler.

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, CHANGES.rst at the root of the repository 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 Pierrick Couderc

Merge request reports

Loading