Skip to content

Commit

Permalink
Fix: Wasm size limit (#47)
Browse files Browse the repository at this point in the history
Extends the wasm size limit a bit by switching from Kibis to KBs
  • Loading branch information
maurolacy authored Aug 28, 2024
1 parent 0bd3e09 commit 2216b03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions contracts/babylon/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ use babylon_contract::msg::btc_header::{BtcHeader, BtcHeadersResponse};
use babylon_contract::msg::contract::{ExecuteMsg, InstantiateMsg};

static WASM: &[u8] = include_bytes!("../../../artifacts/babylon_contract.wasm");
const MAX_WASM_LEN: usize = 800 * 1000; // 800 kibi
/// Wasm size limit: https://github.com/CosmWasm/wasmd/blob/main/x/wasm/types/validation.go#L24-L25
const MAX_WASM_SIZE: usize = 800 * 1024; // 800 KB

const CREATOR: &str = "creator";

Expand Down Expand Up @@ -79,7 +80,7 @@ fn get_fork_msg_test_headers() -> Vec<BtcHeader> {
#[test]
fn wasm_size_limit_check() {
assert!(
WASM.len() < MAX_WASM_LEN,
WASM.len() < MAX_WASM_SIZE,
"Wasm file too large: {}",
WASM.len()
);
Expand Down
5 changes: 3 additions & 2 deletions contracts/btc-staking/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ use cosmwasm_vm::testing::{instantiate, mock_env, mock_info, mock_instance};
use btc_staking::msg::InstantiateMsg;

static WASM: &[u8] = include_bytes!("../../../artifacts/btc_staking.wasm");
const MAX_WASM_LEN: usize = 800 * 1000; // 800 kibi
/// Wasm size limit: https://github.com/CosmWasm/wasmd/blob/main/x/wasm/types/validation.go#L24-L25
const MAX_WASM_SIZE: usize = 800 * 1024; // 800 KB

const CREATOR: &str = "creator";

#[test]
fn wasm_size_limit_check() {
assert!(
WASM.len() < MAX_WASM_LEN,
WASM.len() < MAX_WASM_SIZE,
"Wasm file too large: {}",
WASM.len()
);
Expand Down

0 comments on commit 2216b03

Please sign in to comment.