Open jeffywu opened 9 months ago
We first try to parse it as a JSON value, so "0"
parses as the number 0: https://github.com/foundry-rs/foundry/blob/f0166ccf0c8dc3ff626eed3c0a060804d8b94cb1/crates/cheatcodes/src/json.rs#L457-L459
You can get around this for now by wrapping the number in another pair of quotes like '"0"'
.
cc @mattsse @Evalir @klkvr @odyslam
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (fdad9fb 2023-12-06T00:17:31.361933000Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Apple Silicon)
Describe the bug
Attempting to serialize a number as a string will still serialize it to a number: vm.serializeString(t, "value", "0");
will still serialize it to: "value": 0
Full gist here: https://gist.github.com/jeffywu/882111d670faaacc7a0541989bb46fb2
Use case: gnosis txn builder requires all numbers to be serialized as strings.