Skip to content

"Undefined" as duplicate namespace storage-ast-validator.js #1396

@ssolson

Description

@ssolson

Hey I have been running the sample-project and the hardhat-router continuously gives me the following error for multiple storage definitions

☠ Duplicate namespaces slot found!
  > undefined found in storage contracts OwnableStorage,ProxyStorage,GlobalStorage,InitializableStorage,SettingsStorage

I believe this is a bug.
A console log of the namespaces and duplicates found in storage-ast-validator.js are:

namespaces [
  { contractName: 'OwnableStorage', slot: undefined },
  { contractName: 'ProxyStorage', slot: undefined },
  { contractName: 'GlobalStorage', slot: undefined },
  { contractName: 'InitializableStorage', slot: undefined },
  { contractName: 'SettingsStorage', slot: undefined }
]
duplicates [
  {
    slot: undefined,
    contracts: [
      'OwnableStorage',
      'ProxyStorage',
      'GlobalStorage',
      'InitializableStorage',
      'SettingsStorage'
    ]
  }
]

As a hack for now I do not push the "undefined" slot to the errors starting at L36 of storage-ast-validator.js:

    if (duplicates) {
      const details = duplicates.map(
        (d) => `  > ${d.slot} found in storage contracts ${d.contracts}\n`
      );

      duplicates.map(
        (d) => {
          if (d.slot == undefined) 
            {console.log('Found undefined namespace')} 
          else {
            errors.push({
              msg: `Duplicate namespaces slot found!\n${details.join('')}`,
            });
          }
        }
      );

    }

Is the undefined namespace truly an issue?
Reproduction code ssolson/sample-project@8b4740d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions