Skip to content

bls12-381: move to blst backend

Context

IMPORTANT 0: it activates env v4 in proto-alpha. 20210825: we must NOT activate v4 in proto-alpha on master, therefore we must NOT merge this MR with this commit

IMPORTANT 1 (solved): the opcodes related to BLS12-381 objects have (huge) performances changes, see dannywillems/ocaml-bls12-381!96 (merged). Most of the opcodes should get a lower gas cost for the next protocol. However, serialisation (used by PACK) are way less efficient (3.69ns -> 4_636.03ns for G2, 3.71ns -> 3_761.96ns for G1, 3.71ns -> 179.96ns for Fr). It means if this MR is merged, nodes running master (or later releases including these commits) will have a low gas cost compared to the reality, which is a problem. This problem is solved by releasing a version of the previous backend of bls12-381 (Rust) in a package not implementing the virtual package bls12-381. It is called bls12-381-legacy. In the previous environment, Bls12_381_legacy is used. It also gives a nicer integration in lib_protocol_environment/structs/v1, [...]/v2 and [...]/v3.

Dependencies order:

See dannywillems/ocaml-bls12-381!96 (merged) for more context.

  • Move Fq12 signature changes in src/lib_protocol_environment/structs/v1/, src/lib_protocol_environment/structs/v2/, src/lib_protocol_environment/structs/v3/.
  • Use Env v4 instead of v3.
  • require to recompute gas for BLS12-381 opcodes (@igarnier)

Manually testing the MR

Run the usual tests.

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 Pierre Boutillier

Merge request reports