Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot convert undefined or null to object #1174

Closed
pcaversaccio opened this issue Jun 20, 2024 · 1 comment
Closed

TypeError: Cannot convert undefined or null to object #1174

pcaversaccio opened this issue Jun 20, 2024 · 1 comment

Comments

@pcaversaccio
Copy link
Contributor

pcaversaccio commented Jun 20, 2024

After upgrading to the latest package versions, I face the following error at compilation time:

Solidity 0.8.26 is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

Learn more at https://hardhat.org/hardhat-runner/docs/reference/solidity-support

Downloading zksolc 1.5.0
zksolc version 1.5.0 successfully downloaded
Downloading zkvm-solc 0.8.26-1.0.1
zkvm-solc version 0.8.26-1.0.1 successfully downloaded
Compiling contracts for zkSync Era with zksolc v1.5.0 and zkvm-solc v0.8.26-1.0.1
Compiling 3 Solidity files
Compiling contracts for zkSync Era with zksolc v1.5.0 and zkvm-solc v0.8.26-1.0.1
Compiling 3 Solidity files
An unexpected error occurred:

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at extractLinkReferences (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\@[email protected]\node_modules\@openzeppelin\upgrades-core\src\link-refs.ts:14:31)
    at validate (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\@[email protected]\node_modules\@openzeppelin\upgrades-core\src\validate\run.ts:172:51)
    at OverriddenTaskDefinition._action (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\@[email protected]_@[email protected][email protected]_buff_mhf5jz5hfjjr3rvyeyogiw372a\node_modules\@openzeppelin\hardhat-upgrades\src\index.ts:124:25)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Environment._runTaskDefinition (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\[email protected][email protected][email protected]_@[email protected][email protected]__typescri_y7l26aazsthdkqjins4ibic3zy\node_modules\hardhat\src\internal\core\runtime-environment.ts:359:14)
    at async Environment.run (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\[email protected][email protected][email protected]_@[email protected][email protected]__typescri_y7l26aazsthdkqjins4ibic3zy\node_modules\hardhat\src\internal\core\runtime-environment.ts:192:14)
    at async SimpleTaskDefinition.action (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\[email protected][email protected][email protected]_@[email protected][email protected]__typescri_y7l26aazsthdkqjins4ibic3zy\node_modules\hardhat\src\builtin-tasks\compile.ts:1024:37)
    at async Environment._runTaskDefinition (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\[email protected][email protected][email protected]_@[email protected][email protected]__typescri_y7l26aazsthdkqjins4ibic3zy\node_modules\hardhat\src\internal\core\runtime-environment.ts:359:14)
    at async Environment.run (C:\Dev\Blockchain\hardhat-project-template-ts\node_modules\.pnpm\[email protected][email protected][email protected]_@[email protected][email protected]__typescri_y7l26aazsthdkqjins4ibic3zy\node_modules\hardhat\src\internal\core\runtime-environment.ts:192:14)

Use this repo for reproduction: https://github.com/pcaversaccio/hardhat-project-template-ts. Invoke pnpm install, uncomment zksync: true in the hardhat.config.ts, and compile with hardhat compile --force.

I'm not 100% sure yet if it's related to #240 and #998, that's why I open a new issue.

@kiriyaga
Copy link
Contributor

kiriyaga commented Jun 20, 2024

Hello @pcaversaccio ,

The issue arises because tenderly, as a dependency, imports @openzeppelin/hardhat-upgrades, which invokes the validate function. Since the hardhat-zksync-upgradable plugin is not imported into your project, it generates an error. To resolve this, add hardhat-zksync-upgradable as a dependency and import it into your hardhat.config.ts file. This will make the compilation work. However, note that hardhat-zksync-upgradable only supports OpenZeppelin v4, whereas your project uses OpenZeppelin v5, so the plugin will not work properly (but compilation will be successful). The best approach is not to import @tenderly/hardhat-tenderly when using a zkSync network (e.g., add a flag to decide when to import the package and when not to). Doing so should resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants