optimism
optimism copied to clipboard
integration-test: nft-bridge fail
Describe the bug $ npx hardhat --network testlocal test test/nft-bridge.spec.ts
- "before each" hook for "bridgeERC721"
0 passing (8s) 1 failing
- ERC721 Bridge
"before each" hook for "bridgeERC721":
NomicLabsHardhatPluginError: 0x5E67BdF9A839808bAe76E4fAa04889ED8FD0172e is not a contract account.
at getContractAt (/home/etd/l2/optimism/integration-tests/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:307:11)
at runMicrotasks (
) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Context. (/home/etd/l2/optimism/integration-tests/test/nft-bridge.spec.ts:130:30)
To Reproduce Steps to reproduce the behavior:
- using local layer1
- using local l2-geth
- deploy the contracts to layer1
- enter into integration-tests, run: npx hardhat --network testlocal test test/nft-bridge.spec.ts
Additional context when checking the error point in nft-bridge.spec.ts: const erc721CreatedEvent = receipt.events[0] expect(erc721CreatedEvent.event).to.be.eq('OptimismMintableERC721Created')
OptimismMintableERC721 = await ethers.getContractAt(
Artifact__OptimismMintableERC721.abi,
erc721CreatedEvent.args.localToken //hardhat said this address is not a contract account !
)
await OptimismMintableERC721.deployed()
I suspect hardhat the getContractAt() does not support the address with new a contract. when changing the code: /* OptimismMintableERC721 = await ethers.getContractAt( Artifact__OptimismMintableERC721.abi, erc721CreatedEvent.args.localToken //hardhat said this address is not a contract account ! ) await OptimismMintableERC721.deployed() */ //the following works well . OptimismMintableERC721 = new ethers.Contract(erc721CreatedEvent.args.localToken, Artifact__OptimismMintableERC721.abi,bobWalletL2)
I haven't observed this bug in CI, wondering why its happening