INFURA / infura

Official Public Repository for INFURA
https://infura.io
381 stars 62 forks source link

Consistantly failing w/ "Could not find block" #222

Closed kevinweaver closed 2 years ago

kevinweaver commented 2 years ago

Issue

Re-opening this issue as I am able to reproduce is consistently with Infura. As mentioned in that thread, switching to another RPC provider like Alchemy resolves it.

Steps to Reproduce

I can add you to this private repo:

git clone https://github.com/truffle-box/optimism-bridge-box
git checkout could-not-find-block
yarn install
cp .env.example .env

Open .env and add Infura keys and a mnemonic that holds both kovan and optimism-kovan eth. Use this faucet if you need some.

Finally, run

yarn deploy

This will run 4 migrations, deploying contracts to both kovan and optimism-kovan. The last migration, 4_set_L1_greeting.js polls kovan every 10 seconds, which seems to offer enough of a chance to consistently re-create this behavior.

When you've made it past the first 2 migrations once, you can also run only the offending migration with:

truffle migrate --network=optimistic_kovan --config=truffle-config.ovm --f 4 --to 4 --skip-dry-run  

Expected Behavior

The 4th migration should complete, displaying:

📬 Message received! Finalizing...
🎉 Message finalized.

Actual Results

The migration typically fails after 5-10 kovan polls with:

optimism-bridge-box/node_modules/@trufflesuite/web3-provider-engine/index.js:163
        cb(null, null)
        ^
Error: Could not find block
/optimism-bridge-box/node_modules/@trufflesuite/web3-provider-engine/index.js:62:28
    at afterRequest (/optimism-bridge-box/node_modules/@trufflesuite/web3-provider-engine/index.js:163:9)

If you switch to another RPC provider, you will not see this error and the migration will succeed. To see this succeed with Alchemy, add an ALCHEMY_KOVAN_KEY to your .env file and in truffle-config.js, uncomment line 78 and comment line 79.

Environment

kevinweaver commented 2 years ago

Infura has recently made some improvements to Optimism nodes and I am now no longer able to reproduce this issue. Closing this issue!