From e4b39ef2727d9f5bd508b54840121b615f9a91e6 Mon Sep 17 00:00:00 2001 From: Alimzy Date: Wed, 29 Jul 2026 14:04:18 +0100 Subject: [PATCH] Add integration-level test for upgrade_stream_wasm zero-hash rejection Addresses #232, which flagged that tests/factory_deploy.rs has no dedicated test calling upgrade_stream_wasm with an all-zero BytesN<32> to confirm is_zero_wasm_hash rejects it end-to-end. Note: this guard is already covered at the unit level by upgrade_stream_wasm_rejects_zero_hash in contracts/factory/src/tests.rs (added for issue #86), so this is not a true coverage gap. #232 specifically named tests/factory_deploy.rs though, so this adds the equivalent integration-level test there for completeness and to satisfy the issue's specific ask, following the existing upgrade_stream_wasm_extends_instance_ttl pattern in this file. Verification: - cargo test --test factory_deploy: 31 passed, 0 failed - cargo fmt --check: clean --- tests/factory_deploy.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/factory_deploy.rs b/tests/factory_deploy.rs index 77b73d9..6da0e3d 100644 --- a/tests/factory_deploy.rs +++ b/tests/factory_deploy.rs @@ -636,3 +636,16 @@ fn enforce_bounds_with_equal_start_and_end_time_returns_arithmetic_overflow() { ); assert_eq!(result, Err(Ok(Error::InvalidDuration))); } + +// ── Issue #232: upgrade_stream_wasm zero-hash guard, integration-level ───── +// Note: contracts/factory/src/tests.rs already covers this guard at the unit +// level (upgrade_stream_wasm_rejects_zero_hash, added for issue #86). This +// adds the equivalent check here since #232 specifically flagged this file. +#[test] +fn upgrade_stream_wasm_rejects_all_zero_hash() { + let env = base_env(); + let client = deploy_factory(&env); + let zero_hash = BytesN::from_array(&env, &[0u8; 32]); + let result = client.try_upgrade_stream_wasm(&zero_hash); + assert_eq!(result, Err(Ok(Error::InvalidWasmHash))); +}