Skip to content

Commit

Permalink
Ensure that snapshotting is fallable and prepare for persistable cont…
Browse files Browse the repository at this point in the history
…ainer
  • Loading branch information
ryardley committed Dec 26, 2024
1 parent 8ec745d commit ac8d108
Show file tree
Hide file tree
Showing 19 changed files with 589 additions and 26 deletions.
1 change: 1 addition & 0 deletions packages/ciphernode/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/ciphernode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cipher = { path = "./cipher" }
compile-time = "0.2.0"
dirs = "5.0.1"
data = { path = "./data" }
enclave-core = { path = "./core" }
shellexpand = "3.1.0"
figment = { version = "0.10.19", features = ["yaml", "test"] }
fhe_rs = { package = "fhe", git = "https://github.com/gnosisguild/fhe.rs", version = "0.1.0-beta.7" }
Expand Down
4 changes: 2 additions & 2 deletions packages/ciphernode/aggregator/src/plaintext_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ impl Handler<Die> for PlaintextAggregator {
impl Snapshot for PlaintextAggregator {
type Snapshot = PlaintextAggregatorState;

fn snapshot(&self) -> Self::Snapshot {
self.state.clone()
fn snapshot(&self) -> Result<Self::Snapshot> {
Ok(self.state.clone())
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ciphernode/aggregator/src/publickey_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ impl Handler<Die> for PublicKeyAggregator {
impl Snapshot for PublicKeyAggregator {
type Snapshot = PublicKeyAggregatorState;

fn snapshot(&self) -> Self::Snapshot {
self.state.clone()
fn snapshot(&self) -> Result<Self::Snapshot> {
Ok(self.state.clone())
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/ciphernode/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ figment = { workspace = true }
alloy = { workspace = true }
shellexpand = { workspace = true }
url = { workspace = true }
enclave-core = { workspace = true }

[dev-dependencies]
tempfile = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions packages/ciphernode/config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mod app_config;
mod yaml;
mod store_keys;

pub use app_config::*;
53 changes: 53 additions & 0 deletions packages/ciphernode/config/src/store_keys.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use enclave_core::E3id;

pub struct StoreKeys;

impl StoreKeys {
pub fn keyshare(e3_id: &E3id) -> String {
format!("//keyshare/{e3_id}")
}

pub fn plaintext(e3_id: &E3id) -> String {
format!("//plaintext/{e3_id}")
}

pub fn publickey(e3_id: &E3id) -> String {
format!("//publickey/{e3_id}")
}

pub fn fhe(e3_id: &E3id) -> String {
format!("//fhe/{e3_id}")
}

pub fn meta(e3_id: &E3id) -> String {
format!("//meta/{e3_id}")
}

pub fn context(e3_id: &E3id) -> String {
format!("//context/{e3_id}")
}

pub fn router() -> String {
String::from("//router")
}

pub fn sortition() -> String {
String::from("//sortition")
}

pub fn eth_private_key() -> String {
String::from("//eth_private_key")
}

pub fn libp2p_keypair() -> String {
String::from("//libp2p/keypair")
}

pub fn enclave_sol_reader(chain_id: u64) -> String {
format!("//evm_readers/enclave/{chain_id}")
}

pub fn ciphernode_registry_reader(chain_id: u64) -> String {
format!("//evm_readers/ciphernode_registry/{chain_id}")
}
}
1 change: 1 addition & 0 deletions packages/ciphernode/data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod into_key;
mod repository;
mod sled_store;
mod snapshot;
mod persistable;

pub use data_store::*;
pub use in_mem::*;
Expand Down
Loading

0 comments on commit ac8d108

Please sign in to comment.