Snowfork/snowbridge

TODOs for proper verification of BEEFY commitments

Closed this issue · 1 comments

In #314 proper verification steps are commented out in order to mock the complete BEEFY commitment relay lifecycle. In order for the verified relay of BEEFY commitments, the following verification steps must be re-integrated:

  1. The relayerchain's Listener needs to query the current BEEFY authorities directly from the chain. Method getBeefyAuthorities contains most of the required functionality, but the data must be properly parsed and validated. The authority addresses are currently hardcoded. In order to pass the contract's validation check, the address must be included in the latest validator set (validated against the latest root).

In store/beefy.go:

  1. Method BuildNewSignatureCommitmentMessage must properly update the signature format (Polkadot uses recovery IDs 0 or 1, Eth uses 27 or 28, so we need to add 27).
  2. Method BuildNewSignatureCommitmentMessage must correctly add bitfield information. The bitfield information is currently hardcoded to a random value.
  3. Method GenerateMerkleProofOffchain needs to generate a valid MerkleProof for the signing validator. The proof is considered valid if it is accepted by the smart contract's validation check. Currently, the generated MerkleProof passed verification in the method fails in the contract.
  4. Method BuildCompleteSignatureCommitmentMessage must use the Seed i.e. Ethereum block hash to select a set of validator positions to be used in the final transaction. Validator signatures and public keys must be selected according to the validator positons relayed to the contract in the transaction.

all completed in recent PRs