-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
The circuit crate defines traits and utilities for defining Boolean circuits for use in garbling.
ExecuteMode is defines with the following method:
#[inline]
fn feed_wire(&mut self, wire_id: WireId, value: Self::WireValue) {
if matches!(wire_id, TRUE_WIRE | FALSE_WIRE | WireId::UNREACHABLE) {
return;
}
self.storage
.set(wire_id, |entry| *entry = Some(value))
.unwrap();
}The value in storage corresponding to a given wire ID is Some or None depending on if it has been
already set. This method directly sets the value of a gate's output wire in storage, without checking
if it has been already set. But it should not be possible for gates to share output wires; otherwise,
the gate that gets evaluated second would overwrite the output of the first one. So feed_wire
should check if the entry being written to is Some or None and panic if it is Some already