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

Throws "Option:unwrap() on None" #5784

Closed
peersky opened this issue Sep 27, 2024 · 12 comments · Fixed by NomicFoundation/edr#693
Closed

Throws "Option:unwrap() on None" #5784

peersky opened this issue Sep 27, 2024 · 12 comments · Fixed by NomicFoundation/edr#693
Assignees

Comments

@peersky
Copy link

peersky commented Sep 27, 2024

Version of Hardhat

2.22.12

What happened?

Getting error when running my tests:

Error: called `Option::unwrap()` on a `None` value
      at EdrProviderWrapper._rawTraceToSolidityStackTrace (node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected][email protected]__typescr_fivwhmpgpti4rjcnin4liao2wi/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:584:38)
      at EdrProviderWrapper.request (node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected][email protected]__typescr_fivwhmpgpti4rjcnin4liao2wi/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:424:33)
      at async EthersProviderWrapper.send (node_modules/.pnpm/@[email protected][email protected][email protected][email protected]__hardhat@_5uj7fj26vun34ezzedn6lrmbnm/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)

Minimal reproduction steps

Likely because of 2.22.12 release (does not happen in 2.22.11).

here is my dependency list:

"devDependencies": {
    "@changesets/changelog-github": "^0.4.8",
    "@changesets/cli": "^2.26.2",
    "@nomicfoundation/hardhat-chai-matchers": "^1.0.1",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.9",
    "@nomicfoundation/hardhat-toolbox": "^2.0.2",
    "@nomiclabs/buidler": "^1.4.8",
    "@nomiclabs/buidler-web3": "^1.3.4",
    "@nomiclabs/hardhat-ethers": "^2.0.6",
    "@nomiclabs/hardhat-etherscan": "^3.1.8",
    "@peeramid-labs/eds": "^1.0.0",
    "@shopify/eslint-plugin": "^43.0.0",
    "@solidstate/contracts": "^0.0.35",
    "@typechain/ethers-v5": "^11.1.2",
    "@typechain/hardhat": "^7.0.0",
    "@typechain/web3-v1": "^6.0.1",
    "@types/cli-table": "^0.3.0",
    "@types/crypto-js": "^4.1.1",
    "@types/node-fetch": "^2.6.2",
    "@typescript-eslint/parser": "^7.16.0",
    "chai": "^4.3.6",
    "crypto-js": "^4.1.1",
    "eslint": "^9.6.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-promise": "^6.4.0",
    "eth-create2-calculator": "^1.1.5",
    "ethers": "^5.6.6",
    "globals": "^15.9.0",
    "hardhat": "=2.22.11",
    "hardhat-abi-exporter": "^2.9.0",
    "hardhat-contract-sizer": "^2.6.1",
    "hardhat-deploy": "^0.12.2",
    "hardhat-diamond-abi": "^3.0.0",
    "keccak": "^3.0.1",
    "mocha": "^10.0.0",
    "prettier-plugin-solidity": "^1.1.3",
    "solhint": "^3.6.2",
    "solidity-coverage": "^0.8.5",
    "solidity-docgen": "^0.6.0-beta.36",
    "typechain": "^8.0.0",
    "web3": "^1.8.2"
  },
  "dependencies": {
    "@aragon/osx": "^1.3.0",
    "@aragon/osx-ethers": "^1.3.0",
    "@aragon/sdk-client": "^1.26.0",
    "@ethersproject/abi": "^5.7.0",
    "@ethersproject/providers": "^5.7.2",
    "@openzeppelin/contracts": "^5.0.0",
    "@openzeppelin/contracts-upgradeable": "^5.0.0",
    "@safe-global/safe-contracts": "1.4.1-build.0",
    "@types/chai": "^4.3.1",
    "@types/mocha": "^9.1.1",
    "@types/node": "^17.0.36",
    "chalk": "^4.1.2",
    "cli-table": "^0.3.11",
    "hardhat-gas-reporter": "^1.0.9",
    "ts-node": "^10.9.1",
    "typescript": "^5.2.2"
  }

Search terms

No response

@holyhansss
Copy link

I recommend using Hardhat version 2.22.9. After updating to a newer version, I encountered an unexpected issue where my tests began throwing an 'Option:unwrap() on None' error. Reverting to the previous version should resolve this problem.

    "hardhat": "^2.22.9",

@peersky
Copy link
Author

peersky commented Sep 29, 2024

I recommend using Hardhat version 2.22.9. After updating to a newer version, I encountered an unexpected issue where my tests began throwing an 'Option:unwrap() on None' error. Reverting to the previous version should resolve this problem.

    "hardhat": "^2.22.9",

Same here, I reverted to 2.22.11

@kanej
Copy link
Member

kanej commented Oct 1, 2024

Hey @peersky, this is a likely a bug in changes around our tracing API. Do you have an example to help us reproduce the issue and put together a bug fix?

@peersky
Copy link
Author

peersky commented Oct 1, 2024

Hey @peersky, this is a likely a bug in changes around our tracing API. Do you have an example to help us reproduce the issue and put together a bug fix?

git clone https://github.com/peeramid-labs/contracts
git checkout ebd6e2192559c2a847cb2c203a7de5118292f7d5
export FORK_RPC_URL=<set_some_arbitrum>  
pnpm install 
pnpm add -D [email protected] --save-exact 
pnpm run test --bail 

You should receive

  1) DNSFacet.ts
       Transfer ownership can be done only by contract owner:
     Error: called `Option::unwrap()` on a `None` value

@Wodann
Copy link
Member

Wodann commented Oct 2, 2024

I tried running the example locally but wasn't able to. To generate a stack trace, could you please try running:

RUST_BACKTRACE=full pnpm run test --bail

@peersky
Copy link
Author

peersky commented Oct 2, 2024

called `Option::unwrap()` on a `None` value
stack backtrace:
   0:        0x11ec34210 - _napi_register_module_v1
   1:        0x11ec522d0 - _napi_register_module_v1
   2:        0x11ec31a44 - _napi_register_module_v1
   3:        0x11ec34068 - _napi_register_module_v1
   4:        0x11ec35008 - _napi_register_module_v1
   5:        0x11ec34cfc - _napi_register_module_v1
   6:        0x11ec358c0 - _napi_register_module_v1
   7:        0x11ec352c4 - _napi_register_module_v1
   8:        0x11ec34698 - _napi_register_module_v1
   9:        0x11ec35060 - _napi_register_module_v1
  10:        0x11ec959f8 - _napi_register_module_v1
  11:        0x11ec95a78 - _napi_register_module_v1
  12:        0x11ec959b0 - _napi_register_module_v1
  13:        0x11e8a6e24 - <unknown>
  14:        0x11e8a6f40 - <unknown>
  15:        0x11e616e6c - <unknown>
  16:        0x11e6c59e0 - <unknown>
  17:        0x11e806d98 - <unknown>
  18:        0x11e616eb0 - <unknown>
  19:        0x11e56018c - <unknown>

@peersky
Copy link
Author

peersky commented Oct 2, 2024

tried running the example locally but wasn't able to. T

what issue you faced?

@Wodann
Copy link
Member

Wodann commented Oct 2, 2024

Error: Trying to initialize a provider with block 257223284 but the current block is 20876867

I assumed that you're developing for Ethereum mainnet, so used a remote endpoint for that.

@peersky
Copy link
Author

peersky commented Oct 2, 2024

Error: Trying to initialize a provider with block 257223284 but the current block is 20876867

I assumed that you're developing for Ethereum mainnet, so used a remote endpoint for that.

arbitrum, forgot to mention, soz :)

@peersky
Copy link
Author

peersky commented Oct 2, 2024

tbh I have quite outdated some of my dependencies because of efforts to migrate all tests and other tooling to ethers-v6, I could think of that as one of possible reasons, as some of peer deps are not met.

But given fact that @holyhansss also reported same, could be also on your side.

@agostbiro
Copy link
Member

Thanks for the detailed bug report @peersky !

We've released EDR v0.6.3 with a fix for this issue (EDR is a dependency of Hardhat).

To upgrade to the latest EDR version immediately, you can remove your node_modules directory and npm/yarn/pnpm lock file and reinstall your dependencies. Otherwise you can wait for the next Hardhat release which will automatically use the latest EDR version.

You can verify that you’re using the latest version of EDR by running the following command: npm ls @nomicfoundation/edr.

@kanej
Copy link
Member

kanej commented Oct 10, 2024

The EDR v0.6.3 version was released in Hardhat as part of v2.22.13:

https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%402.22.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants