Skip to content

[Zellic] 7 Circuit framework allows overwriting wires #52

@manishbista28

Description

@manishbista28

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions