Skip to content

Commit c3edee7

Browse files
authored
Merge pull request #3157 from o1-labs/dw/tmp-bump-up-again
Reverting some commits...
2 parents f1c47f6 + bc92b42 commit c3edee7

File tree

11 files changed

+16
-42
lines changed

11 files changed

+16
-42
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
CARGO_TERM_COLOR: always
1818
# 30 MB of stack for Keccak tests
1919
RUST_MIN_STACK: 31457280
20+
CARGO_EXTRA_ARGS: "--workspace --exclude plonk_wasm --exclude saffron"
2021

2122
jobs:
2223
run_mdbook:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ O1VM_MIPS_BIN_FILES = $(patsubst ${O1VM_MIPS_SOURCE_DIR}/%.asm,${O1VM_MIPS_BIN_D
3131
# In addition to that, the version in the CI (see file
3232
# .github/workflows/wasm.yml) should be changed accordingly.
3333
NIGHTLY_RUST_VERSION = "nightly-2024-06-13"
34-
WASM_RUSTFLAGS = "-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296"
34+
WASM_RUSTFLAGS = "-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--no-check-features -C link-arg=--max-memory=4294967296"
3535
PLONK_WASM_NODEJS_OUTDIR ?= target/nodejs
3636
PLONK_WASM_WEB_OUTDIR ?= target/web
3737

plonk-wasm/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ wasm-opt = false
7373
rustflags = [
7474
"-C",
7575
"target-feature=+atomics,+bulk-memory",
76+
"-C",
77+
"link-arg=--no-check-features",
7678
]
7779

7880
[target.wasm32-unknown-unknown]
7981
rustflags = [
8082
"-C",
8183
"target-feature=+atomics,+bulk-memory",
84+
"-C",
85+
"link-arg=--no-check-features",
8286
]

plonk-wasm/src/arkworks/pasta_fp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub fn caml_pasta_fp_domain_generator(log2_size: i32) -> WasmPastaFp {
224224
#[wasm_bindgen]
225225
pub fn caml_pasta_fp_to_bytes(x: WasmPastaFp) -> Vec<u8> {
226226
let len = core::mem::size_of::<Fp>();
227-
let mut str: Vec<u8> = vec![0; len];
227+
let mut str: Vec<u8> = Vec::with_capacity(len);
228228
str.resize(len, 0);
229229
let str_as_fp: *mut Fp = str.as_mut_ptr().cast::<Fp>();
230230
unsafe {

plonk-wasm/src/arkworks/pasta_fq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub fn caml_pasta_fq_domain_generator(log2_size: i32) -> WasmPastaFq {
224224
#[wasm_bindgen]
225225
pub fn caml_pasta_fq_to_bytes(x: WasmPastaFq) -> Vec<u8> {
226226
let len = core::mem::size_of::<Fq>();
227-
let mut str: Vec<u8> = vec![0; len];
227+
let mut str: Vec<u8> = Vec::with_capacity(len);
228228
str.resize(len, 0);
229229
let str_as_fq: *mut Fq = str.as_mut_ptr().cast::<Fq>();
230230
unsafe {

plonk-wasm/src/lib.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,13 @@ pub fn create_zero_u32_ptr() -> *mut u32 {
4343
Box::into_raw(std::boxed::Box::new(0))
4444
}
4545

46-
/// Free a pointer. This method is exported in the WebAssembly module to be used
47-
/// on the JavaScript side, see `web-backend.js`.
48-
///
49-
/// # Safety
50-
///
51-
/// See
52-
/// `<https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref>`
5346
#[wasm_bindgen]
54-
pub unsafe fn free_u32_ptr(ptr: *mut u32) {
47+
pub fn free_u32_ptr(ptr: *mut u32) {
5548
let _drop_me = unsafe { std::boxed::Box::from_raw(ptr) };
5649
}
5750

58-
/// Set the value of a pointer. This method is exported in the WebAssembly
59-
/// module to be used on the JavaScript side, see `web-backend.js`.
60-
///
61-
/// # Safety
62-
///
63-
/// See
64-
/// `<https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref>`
6551
#[wasm_bindgen]
66-
pub unsafe fn set_u32_ptr(ptr: *mut u32, arg: u32) {
52+
pub fn set_u32_ptr(ptr: *mut u32, arg: u32) {
6753
// The rust docs explicitly forbid using this for cross-thread syncronization. Oh well, we
6854
// don't have anything better. As long as it works in practice, we haven't upset the undefined
6955
// behavior dragons.
@@ -72,16 +58,9 @@ pub unsafe fn set_u32_ptr(ptr: *mut u32, arg: u32) {
7258
}
7359
}
7460

75-
/// This method is exported in the WebAssembly to be used on the JavaScript
76-
/// side, see `web-backend.js`.
77-
///
78-
/// # Safety
79-
///
80-
/// See
81-
/// `<https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref>`
8261
#[allow(unreachable_code)]
8362
#[wasm_bindgen]
84-
pub unsafe fn wait_until_non_zero(ptr: *const u32) -> u32 {
63+
pub fn wait_until_non_zero(ptr: *const u32) -> u32 {
8564
// The rust docs explicitly forbid using this for cross-thread syncronization. Oh well, we
8665
// don't have anything better. As long as it works in practice, we haven't upset the undefined
8766
// behavior dragons.

plonk-wasm/src/pasta_fp_plonk_index.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use ark_poly::EvaluationDomain;
2-
use base64::{engine::general_purpose, Engine};
32
use kimchi::circuits::lookup::runtime_tables::RuntimeTableCfg;
43

54
use crate::{
@@ -271,7 +270,7 @@ pub fn caml_pasta_fp_plonk_index_write(
271270
#[wasm_bindgen]
272271
pub fn caml_pasta_fp_plonk_index_serialize(index: &WasmPastaFpPlonkIndex) -> String {
273272
let serialized = rmp_serde::to_vec(&index.0).unwrap();
274-
general_purpose::STANDARD.encode(serialized)
273+
base64::encode(serialized)
275274
}
276275

277276
// helpers

plonk-wasm/src/pasta_fq_plonk_index.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use ark_poly::EvaluationDomain;
2-
use base64::{engine::general_purpose, Engine};
32
use kimchi::circuits::lookup::runtime_tables::RuntimeTableCfg;
43

54
use crate::{
@@ -270,5 +269,5 @@ pub fn caml_pasta_fq_plonk_index_write(
270269
#[wasm_bindgen]
271270
pub fn caml_pasta_fq_plonk_index_serialize(index: &WasmPastaFqPlonkIndex) -> String {
272271
let serialized = rmp_serde::to_vec(&index.0).unwrap();
273-
general_purpose::STANDARD.encode(serialized)
272+
base64::encode(serialized)
274273
}

plonk-wasm/src/plonk_proof.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::{
44
};
55
use ark_ec::AffineRepr;
66
use ark_ff::One;
7-
use base64::{engine::general_purpose, Engine};
87
use core::{array, convert::TryInto};
98
use groupmap::GroupMap;
109
use kimchi::{
@@ -619,7 +618,7 @@ macro_rules! impl_proof {
619618
pub fn serialize(&self) -> String {
620619
let (proof, _public_input) = self.into();
621620
let serialized = rmp_serde::to_vec(&proof).unwrap();
622-
general_purpose::STANDARD.encode(serialized)
621+
base64::encode(serialized)
623622
}
624623
}
625624

plonk-wasm/src/plonk_verifier_index.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ macro_rules! impl_verification_key {
587587
#[wasm_bindgen]
588588
impl [<Wasm $field_name:camel PlonkVerifierIndex>] {
589589
#[wasm_bindgen(constructor)]
590-
#[allow(clippy::too_many_arguments)]
591590
pub fn new(
592591
domain: &WasmDomain,
593592
max_poly_size: i32,
@@ -643,7 +642,7 @@ macro_rules! impl_verification_key {
643642
}
644643
}
645644

646-
pub fn to_wasm(
645+
pub fn to_wasm<'a>(
647646
srs: &Arc<SRS<$G>>,
648647
vi: DlogVerifierIndex<$G, OpeningProof<$G>>,
649648
) -> WasmPlonkVerifierIndex {

0 commit comments

Comments
 (0)