scaffold-eth/scaffold-eth-2

bug: NESTED DEPLOYS FAIL: When using the scaffold's frontend to call a contract function which deploys another contract, it fails.

chadxeth opened this issue · 3 comments

Is there an existing issue for this?

Which method was used to setup Scaffold-ETH 2 ?

git clone

Current Behavior

I have contract A that has function deploy() that deploys contract B. When using the frontend to call that smart contract function, I suspect that the nonce handling is not optimal, as a normal script calling the function works.
The exact error is: Nonce too high. Expected nonce to be 4 but got 6. Note that transactions can't be queued when automining.

Expected Behavior

There should not be any reverts when calling a function that works also with a script.

Steps To Reproduce

Deploy contract A which has a function that deploys another contract. Use the scaffold's frontend to interact with your deploy() function. It should show JSON-RPC error on the frontend, and "Nonce too high. Expected nonce to be 4 but got 6. Note that transactions can't be queued when automining." similar error on the terminal which you are running yarn chain.

Anything else?

No response

Hey could you please provide a minimal SE-2 repo with the contracts you are using, or at least could you please pass the contracts so that it's easy to reproduce on our system locally

I believe this could be related to an issue with MetaMask rather than SE-2.

I don't know exactly how to reproduce it, but it is possible for MetaMask to think that you are operating at the incorrect nonce when spinning up a local chain. This is a MetaMask issue, but you can temporarily fix the issue by going to the MetaMask extension -> Settings -> Advanced -> Press "Clear Activity Tab Data". Then spin up a local chain again. You should be able to interact properly with the smart contracts again.

Closing this for now 🙌