ethereumjs-monorepo icon indicating copy to clipboard operation
ethereumjs-monorepo copied to clipboard

feat(types): implement NumericString type across the monorepo

Open VolodymyrBg opened this issue 6 months ago • 2 comments

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.ts to use NumericString
  • Updated SlotString type in packages/evm/src/journal.ts to use NumericString
  • Updated numberToHex function in packages/block/src/helpers.ts to handle NumericString input
  • Added comprehensive tests for NumericString type conversions

Testing

  • Added new test cases in packages/util/test/types.spec.ts to verify NumericString conversions
  • Tests cover conversions from:
    • null/undefined
    • Number
    • BigInt
    • Uint8Array
    • PrefixedHexString

Related Issues

Closes #3659

VolodymyrBg avatar May 19 '25 14:05 VolodymyrBg

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:

grafik

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.

holgerd77 avatar May 21 '25 07:05 holgerd77

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.

holgerd77 avatar May 21 '25 07:05 holgerd77

Too debated and no follow up, will close.

holgerd77 avatar Aug 26 '25 09:08 holgerd77