Skip to content

Commit

Permalink
chore: Ignore wasmtime validation errors (#3338)
Browse files Browse the repository at this point in the history
  • Loading branch information
berestovskyy authored and daniel-wong-dfinity-org committed Jan 7, 2025
1 parent b185870 commit 9a1cd36
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
7 changes: 2 additions & 5 deletions rs/embedders/src/wasm_utils/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,11 +1491,8 @@ fn can_compile(
) -> Result<(), WasmValidationError> {
let config = wasmtime_validation_config(embedders_config);
let engine = wasmtime::Engine::new(&config).expect("Failed to create wasmtime::Engine");
wasmtime::Module::validate(&engine, wasm.as_slice()).map_err(|err| {
WasmValidationError::WasmtimeValidation(format!(
"wasmtime::Module::validate() failed with {}",
err
))
wasmtime::Module::validate(&engine, wasm.as_slice()).map_err(|_err| {
WasmValidationError::WasmtimeValidation("wasmtime::Module::validate() failed".into())
})
}

Expand Down
17 changes: 17 additions & 0 deletions rs/embedders/src/wasmtime_embedder/wasmtime_embedder_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ fn test_wasmtime_system_api() {
.expect("call failed");
}

#[ignore]
#[test]
fn test_initial_wasmtime_config() {
// The following proposals should be disabled: simd, relaxed_simd,
Expand Down Expand Up @@ -237,3 +238,19 @@ fn test_initial_wasmtime_config() {
);
}
}

#[test]
fn test_wasmtime_validation_error_is_ignored() {
let wat = r#"(module (import "env" "memory" (memory 1 1 shared)))"#;
let wasm_binary = BinaryEncodedWasm::new(wat::parse_str(wat).unwrap());
let err = validate_and_instrument_for_testing(
&WasmtimeEmbedder::new(EmbeddersConfig::default(), no_op_logger()),
&wasm_binary,
)
.err()
.unwrap();
assert_eq!(
format!("{:?}", err),
r#"InvalidWasm(WasmtimeValidation("wasmtime::Module::validate() failed"))"#
);
}
1 change: 1 addition & 0 deletions rs/execution_environment/tests/execution_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2055,6 +2055,7 @@ fn system_subnets_are_not_rate_limited() {
);
}

#[ignore]
#[test]
fn toolchain_error_message() {
let sm = StateMachine::new();
Expand Down

0 comments on commit 9a1cd36

Please sign in to comment.