Skip to content

Commit

Permalink
Fix nightly test build (for miri)
Browse files Browse the repository at this point in the history
  • Loading branch information
akoshelev committed Feb 8, 2024
1 parent 9ec756b commit 0cc0922
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions ipa-core/src/protocol/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,33 +290,24 @@ mod tests {
test_fixture::{Reconstruct, Runner, TestWorld, TestWorldConfig},
};

trait AsReplicatedTestOnly<F: Field> {
trait ReplicatedLeftValue<F: Field> {
fn l(&self) -> F;
fn r(&self) -> F;
}

impl<F: Field> AsReplicatedTestOnly<F> for Replicated<F> {
impl<F: Field> ReplicatedLeftValue<F> for Replicated<F> {
fn l(&self) -> F {
(self as &Replicated<F>).left()
}

fn r(&self) -> F {
(self as &Replicated<F>).right()
}
}

/// This looks weird because it uses `MaliciousReplicated::rx()` value instead of `x`.
/// Malicious context intentionally disallows access to `x` without validating first and
/// here it does not matter at all. It needs just some value to send (any value would do just
/// fine)
impl<F: ExtendableField> AsReplicatedTestOnly<F::ExtendedField> for MaliciousReplicated<F> {
impl<F: ExtendableField> ReplicatedLeftValue<F::ExtendedField> for MaliciousReplicated<F> {
fn l(&self) -> F::ExtendedField {
(self as &MaliciousReplicated<F>).rx().left()
}

fn r(&self) -> F::ExtendedField {
(self as &MaliciousReplicated<F>).rx().right()
}
}

/// Toy protocol to execute PRSS generation and send/receive logic
Expand All @@ -325,7 +316,7 @@ mod tests {
F: Field,
Standard: Distribution<F>,
C: Context,
S: AsReplicatedTestOnly<F>,
S: ReplicatedLeftValue<F>,
{
let ctx = ctx.narrow("metrics");
let (left_peer, right_peer) = (
Expand Down

0 comments on commit 0cc0922

Please sign in to comment.