Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage the lifecycle of new nodes #43

Closed
23 tasks done
guyz opened this issue Mar 1, 2020 · 6 comments
Closed
23 tasks done

Manage the lifecycle of new nodes #43

guyz opened this issue Mar 1, 2020 · 6 comments

Comments

@guyz
Copy link
Contributor

guyz commented Mar 1, 2020

New nodes should not be able to start syncing blocks UNTIL they are confirmed as a registered node. We should look into InitChainer and EndBlocker.

New node

  • register node
    • generate report for enclave
      Get quote - SafeTrace ref
    • using enigmad generate key pair inside of the enclave
    • seal + backup private key
    • handle loading of private key on node init
    • using IAS (proxy node) get report for public key (signed quote)
    • enigmacli send tx with public key as a param + report
    • bootstrap node handling (only happens for the first node)
      Initialization logic for the enclave. See the logic described here in Phase 1 (register_node()): https://forum.enigma.co/t/network-key-management-agreement/1324
      Check whether this can happen automatically inside the global InitChainer (also whether this can listen to new blocks and block execution until the new node is confirmed).

Existing nodes

New node again

  • register_node()
    • decrypt seed with pk_io and my private key (using derive_key https://forum.enigma.co/t/input-output-state-encryption-decryption-protocol/1325). With the single shared 256-bit seed generated above, we can run the CSPRNG several times to get other 256-bit pseudo-random keys:
    • First 256 bits: used to generate (sk_io, pk_io) --> a key pair whose pubkey can be used by users to derive new symmetric encryption keys for encrypting input/outputs. The protocol above needs to be changed so that the first validator also broadcasts pk_io to the network.
    • Next 256 bits: used to generate master_state_key --> a symmetric key used to encrypt contract state. In practice, this is a seed we can use to derive further keys.
    • Next 256 bits: used to generate master_iv --> this is a seed that can be used to generate fresh IVs for encrypting outputs. That’s how the network can avoid non-determinism and still maintain the security of symmetric ciphers.
    • Next 256 bits: used to generate master_rand_seed --> this is a seed that can be used to generate randomness.
    • check how to pass this to my InitChainer to be able to sync blocks
@guyz guyz added the dev Critical path development tasks label Mar 1, 2020
@assafmo
Copy link
Member

assafmo commented Apr 26, 2020

In InitChainer a node should check whether they're the first node and if so then call ecall_bootstrap (better name TBD) which runs the bootstrap protocol and returns encrypted "registration values" to be recorded on-chain.

@assafmo
Copy link
Member

assafmo commented Apr 26, 2020

From https://forum.enigma.co/t/network-key-management-agreement/1324:

  1. When the first validator joins in, they need to look at the blockchain’s state and determine that there are no existing registered validators.

  2. In the enclave, call register_validator(first_validator=True).

This should always happen for each node in InitChainer.

@assafmo
Copy link
Member

assafmo commented Apr 26, 2020

  1. Outside of the enclave, the validator should send the quote to Intel’s Attestation Service (IAS) - potentially through Enigma’s proxy as was the case with Discovery, and get a signed report.

We need to check whether this can happen offline.
Or whether we can reach a chain-of-trust without using the IAS.

@assafmo
Copy link
Member

assafmo commented Apr 26, 2020

  1. Broadcast a register_validator(pk_v, report) transaction.

I'm not sure this is still needed, as we decided the at first all nodes will share the master key, so after the initial node registration becoming a validator is the same as in a vanilla tendermint chain.

@assafmo
Copy link
Member

assafmo commented Apr 26, 2020

  1. On-chain: check that the report is valid on-chain. If it is, and because there are no other validators, immediately approve this validator.

Also isn't needed anymore ☝️

@assafmo
Copy link
Member

assafmo commented Apr 26, 2020

Any registered validator can see the pending validator’s request on chain. Let’s say the pending validator is called v2 and the registered validator is called v1. v1 should then call share_key(pk_v2, report)

This might be done in the global EndBlocker and be part of the consensus. WIll be a much better UX.

@assafmo assafmo added this to To do in April 26, 2020 -> May 10, 2020 via automation Apr 26, 2020
@assafmo assafmo changed the title Manage the lifecycle of new validators Manage the lifecycle of new nodes Apr 26, 2020
@assafmo assafmo moved this from To do to In progress in April 26, 2020 -> May 10, 2020 Apr 27, 2020
@assafmo assafmo assigned Cashmaney and reuvenpo and unassigned reuvenpo May 3, 2020
@assafmo assafmo added this to To do in May 10, 2020 -> May 24, 2020 via automation May 10, 2020
@assafmo assafmo moved this from To do to In progress in May 10, 2020 -> May 24, 2020 May 10, 2020
@Cashmaney Cashmaney moved this from In progress to In review in May 10, 2020 -> May 24, 2020 May 12, 2020
@assafmo assafmo closed this as completed May 13, 2020
May 10, 2020 -> May 24, 2020 automation moved this from In review to Done May 13, 2020
liorbond pushed a commit that referenced this issue Jan 18, 2023
…json-1.0.89

Bump serde_json from 1.0.82 to 1.0.89 in /cosmwasm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Critical path development tasks
Projects
No open projects
Development

No branches or pull requests

5 participants