gnosisguild / enclave

Enclave is an open-source protocol for Encrypted Execution Environments (E3).
GNU Lesser General Public License v3.0
10 stars 3 forks source link

Evm event should add FHE params #61

Closed ryardley closed 1 month ago

ryardley commented 1 month ago

In the Ciphernode Poc the CommitteeSelected event looks like the following:

pub struct CommitteeRequested {
    pub e3_id: E3id,
    pub nodecount: usize,
    pub threshold: usize,
    pub sortition_seed: u64, // Should actually be much larger eg [u8;32]

    // fhe params
    pub moduli: Vec<u64>,
    pub degree: usize,
    pub plaintext_modulus: u64,
    pub crp: Vec<u8>,
}

We can get away with hard coding for demo but should try to aim for parity with evm.

auryn-macmillan commented 1 month ago

@hmzakhalid, how are we handling this for the RiscZero prototype? Are you just decoding the FHE params from the e3PragramParams emitted in the Encalve.e3Requested() event?

Wondering how best to generalize this.

What I'm thinking is that perhaps we add an extra parameter to that event to define which encryption scheme is being used. This way, we can concretely know how to decode the e3ProgramParams based on which encryption scheme was selected, and we can just always assume that the FHE params are encoded at the start of the E3PragramParams.

auryn-macmillan commented 1 month ago

Had a first crack at this in #101

hmzakhalid commented 1 month ago

@hmzakhalid, how are we handling this for the RiscZero prototype? Are you just decoding the FHE params from the e3PragramParams emitted in the Encalve.e3Requested() event?

Yes I'm using the params emitted by e3Requested() and passing that onto the Risc0 guest code.

ryardley commented 1 month ago

This has been closed by https://github.com/gnosisguild/enclave/pull/117 and https://github.com/gnosisguild/enclave/pull/119