openzeppelin-foundry-upgrades icon indicating copy to clipboard operation
openzeppelin-foundry-upgrades copied to clipboard

Cannot read properties of undefined (reading 'ast')

Open geolffreym opened this issue 1 year ago • 3 comments

Hello guys i have been getting this issue since yesterday :( Anyone having the same issue?


[FAIL: setup failed: revert: Failed to run upgrade safety validation: /home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/validate/run.js:169
    for (const node of solcOutput.sources[source].ast.nodes) {
                                                  ^

TypeError: Cannot read properties of undefined (reading 'ast')
    at checkNamespacesOutsideContract (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/validate/run.js:169:51)
    at validate (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/validate/run.js:94:9)
    at runValidations (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/cli/validate/validations.js:22:41)
    at validateBuildInfoContracts (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/cli/validate/validations.js:14:29)
    at validateUpgradeSafety (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/cli/validate/validate-upgrade-safety.js:31:74)
    at async main (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/cli/validate.js:34:24)
    at async run (/home/gmena/.npm/_npx/e9c2fe9985ed1095/node_modules/@openzeppelin/upgrades-core/dist/cli/cli.js:6:5)

Node.js v20.14.0
] setUp() (gas: 0)

geolffreym avatar Oct 28 '24 21:10 geolffreym

I have the same in own realization of checker based on oz:

/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/node_modules/@openzeppelin/upgrades-core/src/validate/run.ts:268
  for (const node of solcOutput.sources[source].ast.nodes) {
                                                ^


TypeError: Cannot read properties of undefined (reading 'ast')
    at checkNamespacesOutsideContract (/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/node_modules/@openzeppelin/upgrades-core/src/validate/run.ts:268:49)
    at validate (/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/node_modules/@openzeppelin/upgrades-core/src/validate/run.ts:167:5)
    at runValidations (/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/node_modules/@openzeppelin/upgrades-core/src/cli/validate/validations.ts:31:[30](https://github.com/fluencelabs/compute-marketplace/actions/runs/12504047463/job/34885257323?pr=739#step:7:31))
    at validateBuildInfoContracts (/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/node_modules/@openzeppelin/upgrades-core/src/cli/validate/validations.ts:22:25)
    at validateUpgradeSafety (/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/node_modules/@openzeppelin/upgrades-core/src/cli/validate/validate-upgrade-safety.ts:45:53)
    at <anonymous> (/home/runner/work/compute-marketplace/compute-marketplace/storage-checker/index.ts:48:16)

I get this on

const report = await validateUpgradeSafety(
  join(__dirname, "..", "out", "build-info"),
  undefined,
  undefined,
  undefined,
  [join(__dirname, "..", "out-stable", "build-info-stable")]
);

crystalbit avatar Dec 26 '24 16:12 crystalbit

Related discussion: https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/1126

@geolffreym If you are still encountering this issue, would you be able to share the following?

  • Output of forge --version
  • Which version of openzeppelin-foundry-upgrades you are using.
  • If you are comfortable with doing so, please provide the contents of the out/build-info directory from your Foundry project. Note that these contents will include all of your contracts' source code.

ericglau avatar Feb 13 '25 19:02 ericglau

Fyi in my case this was the problem:

Image

crystalbit avatar Feb 15 '25 18:02 crystalbit