trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

Allow strings and bigints instead of numbers in decoder input fields #6131

Closed haltman-at closed 1 year ago

haltman-at commented 1 year ago

PR description

Addresses #6080. This makes it so that fields in Log or Transaction that previously were number are now number | string | bigint, and fields that were number | null are now number | string | bigint | null.

Most of these fields are ignored, so the type is changed and that's all.

The one changed field that's actually used is blockNumber, so I just changed things so that if we get that and it's not null, we convert it to a number.

I do have to also discuss what happened to the DecodedLog type. For simplicity, DecodedLog extends Log. However, Log has just had its type broadened. But while that's fine for Log, because it's an input type, DecodedLog is an output type. So to broaden its type would be a breaking change. So I re-narrowed the types of the appropriate fields to prevent that.

Anyway that's it (aside from tests); this is pretty simple.

Testing instructions

I altered some decoder tests so that they pass in strings for the block number (the only part that matters), I think that should be sufficient.