ava-labs / avalanchego

Go implementation of an Avalanche node.
https://avax.network
BSD 3-Clause "New" or "Revised" License
2.09k stars 646 forks source link

ACP-113 : Provable Virtual Machine Randomness #3143

Open tsachiherman opened 6 days ago

tsachiherman commented 6 days ago

Why this should be merged

This is the implementatinon of ACP-113, as described here.

How this works

(taken from the design doc) Existing avalanche protocol breaks the block building into two parts : external and internal. The external block is the SnowMan++ block, whereas the internal block is the actual virtual machine block.

To support randomness, a BLS based VRF implementation is used, that would be recursively signing its own signatures as its message. Since the BLS signatures are deterministic, they provide a great way to construct a reliable VRF.

For proposers that do not have a BLS key associated with their node, the hash of the signature from the previous round.

In order to bootstrap the signatures chain, a missing signature would be replaced with a byte slice that is the hash product of a verifiable and trustable seed.

The changes proposed here would affect the way a block is being validated. Therefore, when this change gets implemented, it needs to be deployed as a mandatory upgrade.

How this was tested

  1. Existing tests were extended to cover new code.
  2. Manual testing against fuji.
  3. Passed all existing unit tests.