ethereumjs-monorepo
ethereumjs-monorepo copied to clipboard
feat(types): implement NumericString type across the monorepo
Description
This PR implements the NumericString type across the monorepo, following the pattern established with PrefixedHexString. The NumericString type represents string values that contain only numeric characters, providing better type safety and consistency across the codebase.
Changes
- Added NumericString to TypeOutput and TypeOutputReturnType in
packages/util/src/types.ts - Added NumericString handling to the toType function
- Updated ParamsConfig type in
packages/common/src/types.tsto use NumericString - Updated SlotString type in
packages/evm/src/journal.tsto use NumericString - Updated numberToHex function in
packages/block/src/helpers.tsto handle NumericString input - Added comprehensive tests for NumericString type conversions
Testing
- Added new test cases in
packages/util/test/types.spec.tsto verify NumericString conversions - Tests cover conversions from:
- null/undefined
- Number
- BigInt
- Uint8Array
- PrefixedHexString
Related Issues
Closes #3659
Hi hi, sorry, we need to put this on hold 😬. We have problems with our original "strictification" integration with PrefixedHexString - where this issue was derived from respectively these do not work as expected, see the following explanation on this from our chat from @jochem-brouwer:
So it's likely that we do not want to follow this approach further because it seems to be a dead end eventually.
Thanks for the work and the thought on this though!! Nevertheless really appreciated! If you want to pick up further issues or just as a general advice, it is always good to drop a note before starting, we try but can't keep all issues fully up-to-date, so there is always some risk that some issues are outdated/replaced by other issues/..., stuff like that.
Actually we can nevertheless run the workflows here once.
So - also - if you have ideas or find insights on the above problem, also let us know. We have done some research ourselves though and did not come to a sufficient solution yet.
Too debated and no follow up, will close.