fn available_memory_isnt_updated_from_failed_message() {
    let available_memory = ic_replicated_state::num_bytes_try_from(NumWasmPages::from(9)).unwrap();
    with_hypervisor(|hypervisor, tmp_path| {
        let subnet_available_memory = SubnetAvailableMemory::new(1_000_000_000);
        let initial_subnet_available_memory = subnet_available_memory.get();
        let _ = execute_update_with_cycles_memory_time_subnet_memory(
            &hypervisor,
            r#"
                (module
                  (func (;0;)
                    i32.const 1
                    memory.grow ;; Try to grow by 1 wasm page
                    drop
                    unreachable
                  )
                  (memory (;0;) 1 20)
                  (export "memory" (memory 0))
                  (export "canister_update test" (func 0)))"#,
            "test",
            EMPTY_PAYLOAD,
            MAX_NUM_INSTRUCTIONS,
            available_memory,
            mock_time(),
            tmp_path,
            subnet_available_memory.clone(),
        );
        assert_eq!(
            initial_subnet_available_memory,
            subnet_available_memory.get()
        );
    });
}
// Verifies that subnet available memory doesn't decrease when execution fails.
Verifies that subnet available memory doesn't decrease when execution fails.
Verifies that subnet available memory doesn ' t decrease when execution fails .
fn available_memory_isnt_updated_from_failed_message() {
    let available_memory = ic_replicated_state::num_bytes_try_from(NumWasmPages::from(9)).unwrap();
    with_hypervisor(|hypervisor, tmp_path| {
        let subnet_available_memory = SubnetAvailableMemory::new(1_000_000_000);
        let initial_subnet_available_memory = subnet_available_memory.get();
        let _ = execute_update_with_cycles_memory_time_subnet_memory(
            &hypervisor,
            r#"
                (module
                  (func (;0;)
                    i32.const 1
                    memory.grow ;; Try to grow by 1 wasm page
                    drop
                    unreachable
                  )
                  (memory (;0;) 1 20)
                  (export "memory" (memory 0))
                  (export "canister_update test" (func 0)))"#,
            "test",
            EMPTY_PAYLOAD,
            MAX_NUM_INSTRUCTIONS,
            available_memory,
            mock_time(),
            tmp_path,
            subnet_available_memory.clone(),
        );
        assert_eq!(
            initial_subnet_available_memory,
            subnet_available_memory.get()
        );
    });
}
fn available_memory_isnt_updated_from_failed_message ( ) { let available_memory = ic_replicated_state :: num_bytes_try_from ( NumWasmPages :: from ( 9 ) ) . unwrap ( ) ; with_hypervisor ( | hypervisor , tmp_path | { let subnet_available_memory = SubnetAvailableMemory :: new ( 1_000_000_000 ) ; let initial_subnet_available_memory = subnet_available_memory . get ( ) ; let _ = execute_update_with_cycles_memory_time_subnet_memory ( & hypervisor , r#"
                (module
                  (func (;0;)
                    i32.const 1
                    memory.grow ;; Try to grow by 1 wasm page
                    drop
                    unreachable
                  )
                  (memory (;0;) 1 20)
                  (export "memory" (memory 0))
                  (export "canister_update test" (func 0)))"# , " " , EMPTY_PAYLOAD , MAX_NUM_INSTRUCTIONS , available_memory , mock_time ( ) , tmp_path , subnet_available_memory . clone ( ) , ) ; assert_eq ! ( initial_subnet_available_memory subnet_available_memory get ( ) ) ; } ) ; }
Verifies that subnet available memory doesn't decrease when execution fails.
Verifies that subnet available memory doesn ' t decrease when execution fails .