naddison36 / sol2uml

Solidity contract visualisation tool
MIT License
1.15k stars 273 forks source link

Storage diagrams to handle aliased imports #142

Closed naddison36 closed 1 year ago

naddison36 commented 1 year ago

Generating a storage diagram for the 0x4306c088fa31fe77da9f513ea31823e877417243 contract on Polygon with proxy contract 0x829363736a5A9080e05549Db6d1271f070a7e224 fails with

  sol2uml Added contract L2WormholeRouter +0ms
  sol2uml Found contract "L2Vault" in src/polygon/L2Vault.sol +0ms
Error: Failed to find user defined type "Strategy" in attribute "userDefined" of type "1""
    at findTypeClass (/Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:390:15)
    at calcStorageByteSize (/Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:474:36)
    at calcStorageByteSize (/Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:441:70)
    at /Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:97:77
    at Array.forEach (<anonymous>)
    at parseVariables (/Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:93:25)
    at /Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:90:9
    at Array.forEach (<anonymous>)
    at parseVariables (/Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:84:27)
    at convertClasses2StorageSections (/Users/nicholasaddison/Documents/workspaces/sol2uml/lib/converterClasses2Storage.js:51:23)

This is because Strategy is an alias for BaseStrategy in the BaseStrategy.sol file.

import {BaseStrategy as Strategy} from "./BaseStrategy.sol";

Like the associations in the class diagrams, storage diagrams need to be able to handle aliased imports

naddison36 commented 1 year ago

This has been fixed with release v2.5.1