mithril icon indicating copy to clipboard operation
mithril copied to clipboard

New STM registration procedure

Open iquerejeta opened this issue 2 years ago • 1 comments

This PR implements the new registration procedure and closes #301 and closes #384 . When a registration procedure is initialised, we have to give as input the cardano stake distribution, which is a set of pairs (PoolId, Stake). This would be the stake distribution of all SPOs, and not only the mithril nodes. Then, when an SPO wants to register as a Mithril node, it must provide:

  • The operational certificate
  • The cold verification key
  • KES signature of the Mithril key
  • The KES period (we need to figure out how we are going to get this)
  • The Mithril key

To this end, this PR introduces the OpCert structure, which contains the KES verification key and a signature using the cold key. There certainly is more fields, but we can complete than once we know which fields a OpCert has. The registration procedure takes as input the raw cbor bytes of the OpCert and parses them to extract the required data. Then, it can verify the validity of OpCert, check that the hash of the cold VK (i.e. the PoolId) is indeed in the stake distribution of cardano, verify the KES signature of the mithril key, and finally verify the validity of the Mithril key.

A few things remaining in this PR:

  • [ ] Introduce a KesSignature of the Mithril key in the StmInitialiser. We therefore need to access the bytes of the KES signing key (probably through the mithril client cli)
  • [x] Implement parsing of the OpCert
  • [x] Handle KES deserialisation with serde
  • [x] Compute PoolID from cold verification key

iquerejeta avatar Aug 18 '22 19:08 iquerejeta

Unit Test Results

    7 files  ±0    24 suites  ±0   2m 6s :stopwatch: -13s 340 tests +3  340 :heavy_check_mark: +3  0 :zzz: ±0  0 :x: ±0  341 runs  +3  341 :heavy_check_mark: +3  0 :zzz: ±0  0 :x: ±0 

Results for commit d49cdb45. ± Comparison against base commit 329d6fab.

This pull request removes 2 and adds 5 tests. Note that renamed tests count towards both.
crypto_helper::conversions::tests ‑ test_stake_signers_from_into
src/stm.rs - stm::StmSigner<D> ‑ new_epoch (line 405)
chain_observer::cli_observer::tests ‑ test_get_current_kes_period
crypto_helper::cardano::cold_key::tests ‑ test_generate_deterministic_genesis_keypair
crypto_helper::cardano::key_certification::test ‑ test_vector_key_reg
crypto_helper::cardano::opcert::tests ‑ test_vector_opcert
entities::signer::tests ‑ test_stake_signers_from_into

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Aug 18 '22 19:08 github-actions[bot]