Skip to content

Commit

Permalink
Merge pull request #455 from AleoHQ/fix/wasm-bhp-stack-overflow
Browse files Browse the repository at this point in the history
fix: reduce magic numbers to prevent stack overflow in wasm call to bhp
  • Loading branch information
amousa11 committed Oct 22, 2021
2 parents 6e24723 + 9adf0a3 commit a4f01d1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
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

0 comments on commit a4f01d1

Please sign in to comment.