naddison36 / sol2uml

Solidity contract visualisation tool
MIT License
1.12k stars 257 forks source link

sol2uml storage crashes when fetching large values #162

Closed alxs closed 11 months ago

alxs commented 11 months ago

I'm not sure if the issue is the value itself or that it is trying to parse a string as a number, but here is the output of sol2uml storage -d -u https://eth-mainnet.g.alchemy.com/v2/[...] 0x853d955aCEf822Db058eb8505911ED77F175b99e:

Error: Failed to add dynamic vars for section "FRAXStablecoin", var type "string" with value "0x000000000000000000000000B1748C79709F4BA2DD82834B8C82D4A505003F27" from slot 9 and section offset undefined
    at addDynamicVariables (/usr/local/lib/node_modules/sol2uml/lib/converterClasses2Storage.js:767:19)
    at Command.<anonymous> (/usr/local/lib/node_modules/sol2uml/lib/sol2uml.js:177:74)
    ... 2 lines matching cause stack trace ...
    at async main (/usr/local/lib/node_modules/sol2uml/lib/sol2uml.js:276:5) {
  [cause]: Error: Failed to calculate dynamic slot size for variable "name" of type "string" with slot value 0x000000000000000000000000B1748C79709F4BA2DD82834B8C82D4A505003F27
      at dynamicSlotSize (/usr/local/lib/node_modules/sol2uml/lib/slotValues.js:271:15)
      at addDynamicVariables (/usr/local/lib/node_modules/sol2uml/lib/converterClasses2Storage.js:658:63)
      ... 3 lines matching cause stack trace ...
      at async main (/usr/local/lib/node_modules/sol2uml/lib/sol2uml.js:276:5) {
    [cause]: Error: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="toNumber", value="1013090489922746636754423400199101958326170173223", code=NUMERIC_FAULT, version=bignumber/5.7.0)
        at Logger.makeError (/usr/local/lib/node_modules/sol2uml/node_modules/@ethersproject/logger/lib/index.js:238:21)
        at Logger.throwError (/usr/local/lib/node_modules/sol2uml/node_modules/@ethersproject/logger/lib/index.js:247:20)
        at throwFault (/usr/local/lib/node_modules/sol2uml/node_modules/@ethersproject/bignumber/lib/bignumber.js:303:19)
        at BigNumber.toNumber (/usr/local/lib/node_modules/sol2uml/node_modules/@ethersproject/bignumber/lib/bignumber.js:151:13)
        at dynamicSlotSize (/usr/local/lib/node_modules/sol2uml/lib/slotValues.js:266:72)
        at addDynamicVariables (/usr/local/lib/node_modules/sol2uml/lib/converterClasses2Storage.js:658:63)
        at Command.<anonymous> (/usr/local/lib/node_modules/sol2uml/lib/sol2uml.js:177:74)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Command.parseAsync (/usr/local/lib/node_modules/sol2uml/node_modules/commander/lib/command.js:935:5)
        at async main (/usr/local/lib/node_modules/sol2uml/lib/sol2uml.js:276:5) {
      reason: 'overflow',
      code: 'NUMERIC_FAULT',
      fault: 'overflow',
      operation: 'toNumber',
      value: '1013090489922746636754423400199101958326170173223'
    }
  }
}
naddison36 commented 11 months ago

Thanks for reporting. I'll have a look

naddison36 commented 11 months ago

This has been fixed in release v2.5.8