foundry icon indicating copy to clipboard operation
foundry copied to clipboard

vm.serializeString might produce numbers

Open sakulstra opened this issue 1 year ago • 2 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [ ] Foundryup

What version of Foundry are you on?

No response

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

There's some unexpected behavior with vm.serializeString.

When using

string memory out = vm.serializeString(key, key, '10000000000000');
vm.writeJson(out, path);

It seems like foundry will automatically convert the string to a number if it looks like a number. This is somewhat unexpected and it hard to work with consumer languages that don't natively support big numbers.

sakulstra avatar Mar 19 '23 21:03 sakulstra

cc @odyslam just added this to #3801

mds1 avatar Mar 21 '23 20:03 mds1

We also ran into this issue -- we want to write a string value but it's instead written as a number, which the consumer (a geth fork) is unable to parse.

Thegaram avatar Apr 29 '24 10:04 Thegaram