Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 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 crates/aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ e3-data = { workspace = true }
e3-events = { workspace = true }
e3-evm = { workspace = true }
e3-fhe = { workspace = true }
e3-fhe-params = { workspace = true }
e3-multithread = { workspace = true }
e3-trbfv = { workspace = true }
e3-bfv-client = { workspace = true }
Expand Down
34 changes: 28 additions & 6 deletions crates/aggregator/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ use e3_events::{prelude::*, E3id};
use e3_events::{BusHandle, EType, EnclaveEvent, EnclaveEventData};
use e3_fhe::ext::FHE_KEY;
use e3_fhe::Fhe;
use e3_fhe_params::BfvPreset;
use e3_request::{E3Context, E3ContextSnapshot, E3Extension, META_KEY};
use e3_sortition::Sortition;

pub struct PublicKeyAggregatorExtension {
bus: BusHandle,
params_preset: BfvPreset,
}

impl PublicKeyAggregatorExtension {
pub fn create(bus: &BusHandle) -> Box<Self> {
Box::new(Self { bus: bus.clone() })
pub fn create(bus: &BusHandle, params_preset: BfvPreset) -> Box<Self> {
Box::new(Self {
bus: bus.clone(),
params_preset,
})
}
}

Expand Down Expand Up @@ -62,10 +67,17 @@ impl E3Extension for PublicKeyAggregatorExtension {
let repo = ctx.repositories().publickey(&e3_id);
let sync_state = repo.send(Some(PublicKeyAggregatorState::init(
meta.threshold_n,
meta.threshold_m,
meta.seed,
)));

let value = create_publickey_aggregator(fhe.clone(), self.bus.clone(), e3_id, sync_state);
let value = create_publickey_aggregator(
fhe.clone(),
self.bus.clone(),
e3_id,
sync_state,
self.params_preset.clone(),
);

ctx.set_event_recipient("publickey", Some(value));
}
Expand Down Expand Up @@ -98,6 +110,7 @@ impl E3Extension for PublicKeyAggregatorExtension {
self.bus.clone(),
ctx.e3_id.clone(),
sync_state,
self.params_preset.clone(),
);

// send to context
Expand All @@ -112,11 +125,20 @@ fn create_publickey_aggregator(
bus: BusHandle,
e3_id: E3id,
sync_state: Persistable<PublicKeyAggregatorState>,
params_preset: BfvPreset,
) -> Recipient<EnclaveEvent> {
KeyshareCreatedFilterBuffer::new(
PublicKeyAggregator::new(PublicKeyAggregatorParams { fhe, bus, e3_id }, sync_state)
.start()
.into(),
PublicKeyAggregator::new(
PublicKeyAggregatorParams {
fhe,
bus,
e3_id,
params_preset,
},
sync_state,
)
.start()
.into(),
)
.start()
.into()
Expand Down
Loading
Loading