Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Rust 1.85 #1526

Merged
merged 3 commits into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion ipa-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "0.1.0"
# rust:slim-bullseye docker image is available.
# 2. Update the rust version used for draft in
# https://github.com/private-attribution/draft/blob/main/sidecar/ansible/provision.yaml.
rust-version = "1.84.0"
rust-version = "1.85.0"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/ff/galois_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn clmul<GF: GaloisField>(a: GF, b: GF) -> u128 {
let a = u128::from(a);
let mut product = 0;
for i in 0..GF::BITS {
let bit = u128::from(b >> i & 1);
let bit = u128::from((b >> i) & 1);
product ^= bit * (a << i);
}
product
Expand Down
16 changes: 4 additions & 12 deletions ipa-core/src/helpers/buffers/circular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,7 @@ mod test {
assert!(buf.can_read());

while buf.can_read() {
output.extend(
CircularBuf::read_once(&mut buf)
.into_iter()
.map(usize::from),
);
output.extend(CircularBuf::read_once(&mut buf).into_iter());
}

assert!(buf.can_write());
Expand All @@ -478,11 +474,7 @@ mod test {
}

assert!(buf.can_write());
output.extend(
CircularBuf::read_once(&mut buf)
.into_iter()
.map(usize::from),
);
output.extend(CircularBuf::read_once(&mut buf));

assert!(buf.is_empty());
assert_eq!(input, output);
Expand Down Expand Up @@ -521,14 +513,14 @@ mod test {
Six::fill(&mut buf);

let mut output = Vec::new();
output.extend(Six::read_once(&mut buf).into_iter().map(usize::from));
output.extend(Six::read_once(&mut buf));
buf.next().write(&TwoBytes::from(&6));
buf.next().write(&TwoBytes::from(&7));
assert!(!buf.is_closed());
buf.close();
assert!(buf.is_closed());

output.extend(Six::read_once(&mut buf).into_iter().map(usize::from));
output.extend(Six::read_once(&mut buf));

assert_eq!((0..8).collect::<Vec<_>>(), output);
}
Expand Down
2 changes: 1 addition & 1 deletion ipa-core/src/protocol/context/dzkp_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ pub mod tests {
let bit0 = (b0 >> j) & 1_u128;
let bit1 = (b1 >> j) & 1_u128;
let bit2 = (b2 >> j) & 1_u128;
let expected = bit2 << 2 | bit1 << 1 | bit0;
let expected = (bit2 << 2) | (bit1 << 1) | bit0;
let actual = (z >> i) & 0xf;
assert_eq!(
actual, expected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mod test {
let y = y_ba64.as_u128();

let expected = (x + y) % (1 << 64);
let expected_carry = (x + y) >> 64 & 1;
let expected_carry = ((x + y) >> 64) & 1;

let (result, carry) = world
.dzkp_semi_honest((x_ba64, y_ba64), |ctx, x_y| async move {
Expand Down Expand Up @@ -266,7 +266,7 @@ mod test {
let y = y_ba32.as_u128();

let expected = (x + y) % (1 << 64);
let expected_carry = (x + y) >> 64 & 1;
let expected_carry = ((x + y) >> 64) & 1;

let (result, carry) = world
.dzkp_semi_honest((x_ba64, y_ba32), |ctx, x_y| async move {
Expand All @@ -288,7 +288,7 @@ mod test {

let x = x & ((1 << 32) - 1);
let expected = (x + y) % (1 << 32);
let expected_carry = (x + y) >> 32 & 1;
let expected_carry = ((x + y) >> 32) & 1;
let (result, carry) = world
.dzkp_semi_honest((y_ba32, x_ba64), |ctx, x_y| async move {
integer_add::<_, DefaultBitStep, 1>(
Expand Down
16 changes: 8 additions & 8 deletions ipa-core/src/secret_sharing/vector/transpose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ pub fn transpose_8x8<B: Borrow<[u8; 8]>>(x: B) -> [u8; 8] {
let mut x = u64::from_le_bytes(*x.borrow());

x = x & 0xaa55_aa55_aa55_aa55
| (x & 0x00aa_00aa_00aa_00aa) << 7
| ((x & 0x00aa_00aa_00aa_00aa) << 7)
| (x >> 7) & 0x00aa_00aa_00aa_00aa;

x = x & 0xcccc_3333_cccc_3333
| (x & 0x0000_cccc_0000_cccc) << 14
| ((x & 0x0000_cccc_0000_cccc) << 14)
| (x >> 14) & 0x0000_cccc_0000_cccc;

x = x & 0xf0f0_f0f0_0f0f_0f0f
| (x & 0x0000_0000_f0f0_f0f0) << 28
| ((x & 0x0000_0000_f0f0_f0f0) << 28)
| (x >> 28) & 0x0000_0000_f0f0_f0f0;

x.to_le_bytes()
Expand All @@ -138,11 +138,11 @@ pub fn transpose_16x16(src: &[u8; 32]) -> [u8; 32] {
let s1 = 30;
for i in 0..4 {
y0[i] = x[i] & 0xaaaa_5555_aaaa_5555
| (x[i] & 0x0000_aaaa_0000_aaaa) << s0
| ((x[i] & 0x0000_aaaa_0000_aaaa) << s0)
| (x[i] >> s0) & 0x0000_aaaa_0000_aaaa;

y1[i] = y0[i] & 0xcccc_cccc_3333_3333
| (y0[i] & 0x0000_0000_cccc_cccc) << s1
| ((y0[i] & 0x0000_0000_cccc_cccc) << s1)
| (y0[i] >> s1) & 0x0000_0000_cccc_cccc;
}

Expand All @@ -158,15 +158,15 @@ pub fn transpose_16x16(src: &[u8; 32]) -> [u8; 32] {
let s2 = 4;
let mut y2 = [0u64; 4];
for i in 0..4 {
y2[i] = y1[i] & m2a[i] | (y1_swp[i] << s2) & m2b[i] | (y1_swp[i] & m2c[i]) >> s2;
y2[i] = y1[i] & m2a[i] | (y1_swp[i] << s2) & m2b[i] | ((y1_swp[i] & m2c[i]) >> s2);
}

let mut y3 = [0u64; 4];
for i in 0..2 {
y3[i] = y2[i] & 0x00ff_00ff_00ff_00ff | (y2[i + 2] & 0x00ff_00ff_00ff_00ff) << 8;
y3[i] = y2[i] & 0x00ff_00ff_00ff_00ff | ((y2[i + 2] & 0x00ff_00ff_00ff_00ff) << 8);
}
for i in 0..2 {
y3[i + 2] = (y2[i] & 0xff00_ff00_ff00_ff00) >> 8 | y2[i + 2] & 0xff00_ff00_ff00_ff00;
y3[i + 2] = ((y2[i] & 0xff00_ff00_ff00_ff00) >> 8) | y2[i + 2] & 0xff00_ff00_ff00_ff00;
}

let mut dst = [0u8; 32];
Expand Down
Loading