diff --git a/runtime/near-test-contracts/test-contract-rs/src/lib.rs b/runtime/near-test-contracts/test-contract-rs/src/lib.rs index 2638be47657..10cafa22859 100644 --- a/runtime/near-test-contracts/test-contract-rs/src/lib.rs +++ b/runtime/near-test-contracts/test-contract-rs/src/lib.rs @@ -805,7 +805,7 @@ fn attach_unspent_gas_but_burn_all_gas() { gas_weight, ); loop { - gas(10_000); + gas(1_000_000_000); } } } diff --git a/runtime/near-vm-runner/src/tests/rs_contract.rs b/runtime/near-vm-runner/src/tests/rs_contract.rs index 562e9189e68..45088f14100 100644 --- a/runtime/near-vm-runner/src/tests/rs_contract.rs +++ b/runtime/near-vm-runner/src/tests/rs_contract.rs @@ -148,7 +148,7 @@ def_test_ext!(ext_block_timestamp, "ext_block_timestamp", &42u64.to_le_bytes()); def_test_ext!(ext_storage_usage, "ext_storage_usage", &12u64.to_le_bytes()); // Note, the used_gas is not a global used_gas at the beginning of method, but instead a diff // in used_gas for computing fib(30) in a loop -def_test_ext!(ext_used_gas, "ext_used_gas", &[111, 10, 200, 15, 0, 0, 0, 0]); +def_test_ext!(ext_used_gas, "ext_used_gas", &[72, 146, 120, 16, 0, 0, 0, 0]); def_test_ext!( ext_sha256, "ext_sha256", diff --git a/runtime/near-vm-runner/src/tests/runtime_errors.rs b/runtime/near-vm-runner/src/tests/runtime_errors.rs index 62a07205333..107559bc437 100644 --- a/runtime/near-vm-runner/src/tests/runtime_errors.rs +++ b/runtime/near-vm-runner/src/tests/runtime_errors.rs @@ -599,6 +599,24 @@ fn test_address_overflow() { "#]]); } +/// Load from address that is within bounds, validating that not all loads do overflow +#[test] +fn test_address_valid() { + let code = r#" +(module + (memory 1) + (func (export "main") + i32.const 10 + i64.load32_u offset=10 align=1 + drop + ) +)"#; + + test_builder().wat(code).expect(expect![[r#" + VMOutcome: balance 4 storage_usage 12 return data None burnt gas 50958989 used gas 50958989 + "#]]); +} + /// Uses `f32.copysign` to observe a sign of `NaN`. /// /// WASM specification allows different behaviors here: