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

Unpredictable Gas Limit when submitting merkle proof to useContractFunction #1133

Open
davinharding opened this issue Aug 1, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@davinharding
Copy link

Describe the bug

I am trying to utilize the useContractFunction to send a merkle proof bytes32 array to one of my contract functions however when I send the proof data parameter I receive the UNPREDICTABLE_GAS_LIMIT error from ethers before the transaction even gets to metamask.

To Reproduce

Here is a link to the repo and branch with the relevant work: https://github.com/davinharding/guardian-of-theta-frontend/tree/got-collection-page

The main components to look at are within pages/collect-got.js and web3/contractButton.js.

The project is built on the theta blockchain and the contract I am testing with is deployed to theta testnet. To reproduce the bug you will need to pull the project, npm install, npm run dev and connect to theta testnet chain. You will also need some test tfuel which you can get from the theta wallet site faucet or I can send you some. From there navigate to the /collect-got page and click the 'CLAIM $GOT' button. You should see the unpredictable gas limit error in the console from there.

I have tested this function with the same merkle proof array that my app generates on the theta wallet contract interaction tool (similar to etherscan contract function read and write tool) and the function works there with a successful blockchain txn and an expected revert error. Link to successful txn: https://testnet-explorer.thetatoken.org/txs/0x880e5b22322be6151bd31cb1cc92d96cff9a739458db6c6a2d3ca12697c5bd9e

I also have tested other functions on the contract through this frontend with simpler data parameters and they work successfully so I have isolated the problem to this function's data param and this frontend/library.

Here is my useDapp config object:

const config = {
  readOnlyChainId: Theta.chainId,
  readOnlyUrls: {
    [Theta.chainId]: 'https://eth-rpc-api.thetatoken.org/rpc',
    365: 'https://eth-rpc-api-testnet.thetatoken.org/rpc', // theta testnet
  },
};

I am using an injected metamask wallet.

Software versions

"@usedapp/core": "^1.1.2",
"npm": '8.19.4',
"node": '16.20.0',
"ethers": "^5.7.2",

Additional context

Here is what the proof that is being submitted looks like:

image

And the error for reference:

image

Any help would be much appreciated and thank you for providing this very useful library!

@davinharding davinharding added the bug Something isn't working label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant