diff --git a/crates/cheatcodes/src/env.rs b/crates/cheatcodes/src/env.rs index d9022b16d4c1..58460ff86333 100644 --- a/crates/cheatcodes/src/env.rs +++ b/crates/cheatcodes/src/env.rs @@ -33,7 +33,7 @@ impl Cheatcode for envBool_0Call { impl Cheatcode for envUint_0Call { fn apply(&self, _state: &mut Cheatcodes) -> Result { let Self { name } = self; - env::(name, None) + env::(name, None).map_err(|e| fmt_err!("Could not parse U256 environment variable {name}. Make sure it's a valid uint, or a 0x-prefixed hex string: {e}")) } } diff --git a/testdata/cheats/Env.t.sol b/testdata/cheats/Env.t.sol index 44e5f5db71fa..a9d3ef8b93e6 100644 --- a/testdata/cheats/Env.t.sol +++ b/testdata/cheats/Env.t.sol @@ -33,7 +33,7 @@ contract EnvTest is DSTest { string[numEnvUintTests] memory values = [ "0", "115792089237316195423570985008687907853269984665640564039457584007913129639935", - "0x01", + "0x0a", "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", "0x0000000000000000000000000000000000000000000000000000000000000000", "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" @@ -41,7 +41,7 @@ contract EnvTest is DSTest { uint256[numEnvUintTests] memory expected = [ type(uint256).min, type(uint256).max, - 1, + 10, 77814517325470205911140941194401928579557062014761831930645393041380819009408, type(uint256).min, type(uint256).max