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

fix: reduce magic numbers to prevent stack overflow in wasm call to bhp #455

Merged
merged 1 commit into from Oct 22, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion algorithms/src/crh/bhp.rs
Expand Up @@ -31,7 +31,7 @@ use rayon::prelude::*;
// The stack is currently allocated with the following size
// because we cannot specify them using the trait consts.
const MAX_WINDOW_SIZE: usize = 256;
const MAX_NUM_WINDOWS: usize = 4096;
const MAX_NUM_WINDOWS: usize = 2048;

pub const BOWE_HOPWOOD_CHUNK_SIZE: usize = 3;
pub const BOWE_HOPWOOD_LOOKUP_SIZE: usize = 2usize.pow(BOWE_HOPWOOD_CHUNK_SIZE as u32);
Expand Down
2 changes: 1 addition & 1 deletion marlin/src/constraints/error.rs
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the snarkVM library. If not, see <https://www.gnu.org/licenses/>.

use crate::{ahp::AHPError, marlin::MarlinError, String};
use crate::{ahp::AHPError, marlin::MarlinError, String, ToString};

use core::fmt::{Debug, Display, Formatter};

Expand Down
2 changes: 1 addition & 1 deletion marlin/src/fiat_shamir/fiat_shamir_poseidon_sponge.rs
Expand Up @@ -25,7 +25,7 @@ use crate::{fiat_shamir::AlgebraicSponge, Vec};
use snarkvm_algorithms::crypto_hash::{CryptographicSponge, PoseidonDefaultParametersField};
use snarkvm_fields::PrimeField;

use std::sync::Arc;
use snarkvm_utilities::sync::Arc;

/// The sponge for Poseidon
#[derive(Clone, Debug)]
Expand Down
1 change: 1 addition & 0 deletions wasm/Cargo.toml
Expand Up @@ -56,6 +56,7 @@ default-features = false
path = "../marlin"
version = "0.7.5"
optional = true
default-features = false
features = ["wasm"]

[dependencies.snarkvm-polycommit]
Expand Down