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
4 changes: 1 addition & 3 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ jobs:
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-02-01
uses: dtolnay/rust-toolchain@nightly

- name: Set up rust cache
uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion field/src/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ mod tests {
// "random", the last degree_padded-degree of them are zero.
let coeffs = (0..degree)
.map(|i| F::from_canonical_usize(i * 1337 % 100))
.chain(core::iter::repeat(F::zero()).take(degree_padded - degree))
.chain(core::iter::repeat_n(F::zero(), degree_padded - degree))
.collect::<Vec<_>>();
assert_eq!(coeffs.len(), degree_padded);
let coefficients = PolynomialCoeffs { coeffs };
Expand Down
2 changes: 1 addition & 1 deletion field/src/prime_field_testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ macro_rules! test_prime_field_arithmetic {
type F = $field;

let (a, b) = (
F::from_canonical_u64((F::ORDER_U64 + 1u64) / 2u64),
F::from_canonical_u64((F::ORDER_U64).div_ceil(2u64)),
F::two(),
);
let x = a * b;
Expand Down
188 changes: 130 additions & 58 deletions plonky2/src/gates/poseidon2_babybear.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plonky2/src/gates/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'a, P: PackedField> StridedConstraintConsumer<'a, P> {

/// Emit one constraint.
pub fn one(&mut self, constraint: P) {
if self.start != self.end {
if !core::ptr::eq(self.start, self.end) {
// # Safety
// The checks in `new` guarantee that this points to valid space.
unsafe {
Expand Down
3 changes: 2 additions & 1 deletion plonky2/src/hash/poseidon2_babybear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ impl<F: RichField> AlgebraicHasher<F, 8> for Poseidon2BabyBearHash {
F: RichField + HasExtension<D>,
<F as HasExtension<D>>::Extension: TwoAdicField,
{
let gate_type: Poseidon2BabyBearGate<F, D> = Poseidon2BabyBearGate::<F, D>::new();
let gate_type: Poseidon2BabyBearGate<F, D> =
Poseidon2BabyBearGate::<F, D>::new(&builder.config);
let (row, op) = builder.find_slot(gate_type.clone(), &[], &[]);

let swap_wire = Poseidon2BabyBearGate::<F, D>::wire_swap(op);
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/recursion/recursive_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ where {
builder.add_gate_to_gate_set(GateRef::new(PoseidonGate::new()))
}
BabyBear::ORDER_U64 => {
builder.add_gate_to_gate_set(GateRef::new(Poseidon2BabyBearGate::new()))
builder.add_gate_to_gate_set(GateRef::new(Poseidon2BabyBearGate::new(config)))
}
_ => panic!(),
};
Expand Down
4 changes: 2 additions & 2 deletions plonky2/src/util/strided_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<'a, P: PackedField> Iterator for PackedStridedViewIter<'a, P> {
"start and end pointers should be separated by a multiple of stride"
);

if self.start != self.end {
if !core::ptr::eq(self.start, self.end) {
let res = unsafe { &*self.start.cast() };
// See comment in `PackedStridedView`. Below will point more than one byte past the end
// of the buffer if the offset is not 0 and we've reached the end.
Expand All @@ -224,7 +224,7 @@ impl<P: PackedField> DoubleEndedIterator for PackedStridedViewIter<'_, P> {
"start and end pointers should be separated by a multiple of stride"
);

if self.start != self.end {
if !core::ptr::eq(self.start, self.end) {
// See comment in `PackedStridedView`. `self.end` starts off pointing more than one byte
// past the end of the buffer unless `offset` is 0.
self.end = self.end.wrapping_sub(self.stride);
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly
nightly