Closed CrazyNorman closed 1 year ago
Hey @CrazyNorman, sorry for not responding sooner.
I tried to reproduce your example and I did get the same error, but then I make the same thing with ethers like this (it's not exactly the same because I'm not sending the tx, but since your example doesn't await for it then it's kind of the same):
const contract = await ethers.getContractAt(abi, worldAddress);
const value = await contract.getField.staticCall(tableId, [], 0);
and I didn't get an error. So maybe there's something weird going on with web3? That wouldn't explain why it works on ganache though.
Closing for lack of response, but will re-open if we get more info.
Version of Hardhat
2.17.1
What happened?
When I invoke the call function in nodejs to get a value from the world contract like this
It will raise an error below
However when I change to Ganache or anyother test net, everything works fine.
I think this maybe has some relations to the issue: https://github.com/NomicFoundation/hardhat/issues/3798
The
getField
function is defined here: https://github.com/latticexyz/mud/blob/e9258dae33053eb837f54c4a5d74059cea693f61/packages/store/src/StoreCore.sol#L469Minimal reproduction steps
Init a mud project
Choose vanilla mode
start a hardhat node (install hardhat dependencies before)
Add hardhat node to the
packages/contracts/foundry.toml
change the private key in the
packages/contracts/.env
to the hardhat node funded private key.Get world address from the log like this
Now the contract has been deployed and we can create a new project to test this contract.
Now paste the code below to the test.js
Now we can run the test
We can see the transaction sent successfully, however the
.call()
raise the error:Now we close the hardhat node, and start a gananche node
And we deploy the contract again, change the world address and private key in the
test.js
, then runnode test.js
again.Now increment function works fine, no errors .
Search terms
No response