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

Errors on the ccipRecieve side are ambiguous #15

Open
Andriy-Kulak opened this issue Jul 19, 2024 · 4 comments
Open

Errors on the ccipRecieve side are ambiguous #15

Andriy-Kulak opened this issue Jul 19, 2024 · 4 comments

Comments

@Andriy-Kulak
Copy link

First off, thanks for the hard work on this repo!

I got the local testing to work, but it took a little bit of effort (& a ton of console.logging 😅 ) to get it to work.

The main reason is that once the receiving contract was able to get the message, there were a few bugs on my code (i.e I wasn't decoding properly, set gas limit too small, etc.) For any error on Receiver contract, no matter, what it was, I got the same exact error below.

Not sure the best way to have the error pinpoint exact culprit, but in the meantime maybe the error can at least be more descriptive. I.e. Something along the lines. There is likely a code error somewhere on receiver side, also check the gasLimit, etc. this would save people a little bit of time in future.

     Error: VM Exception while processing transaction: reverted with custom error 'ReceiverError("0x")'
    at MockCCIPRouter.ccipSend (@chainlink/contracts-ccip/src/v0.8/ccip/test/mocks/MockRouter.sol:75)
    at MyContractStorage._sendMessagePayNative (contracts/MyContractStorage.sol:420)
    at MyContractStorage.createCampaign (contracts/MyContractStorage.sol:227)
    at EdrProviderWrapper.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:429:41)
    at async HardhatEthersSigner.sendTransaction (node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:125:18)
    at async send (node_modules/ethers/src.ts/contract/contract.ts:313:20)
    at async Proxy.createCampaign (node_modules/ethers/src.ts/contract/contract.ts:352:16)
    at async Context.<anonymous> (test/dummy.test.ts:51:17) 
@andrejrakic
Copy link
Collaborator

Thank you for the nice words, @Andriy-Kulak, we appreciate that! If possible, I would also like to hear later why the initial setup wasn't a smooth experience for you and how we can improve the Chainlink Local docs

But now let's solve this issue first :)

You are right, this is a generic error returned from the CCIP contracts when they call the ccipReceive() function on your receiver contract. The reason why it is custom is because when calling an arbitrary contract, one can't easily decode why it failed. This error message means either you set up the gasLimit value too low or there is some kind of issue or a flaw in your receiver contract.

Can you please paste me here the piece of code where you send the CCIP message from the Sender contract and the ccipReceive function of the Receiver contract? Thank you

@VishnuramRajkumarSecurrency
Copy link

VishnuramRajkumarSecurrency commented Jul 29, 2024

Hi @andrejrakic !

I'm facing the same error in MockRouter's 75th line. When I traced back in my hardhat test I found out error was with EvmError(reason: "OUT_OF_GAS"). I have also included the gasLimit with the function call.

@VishnuramRajkumarSecurrency

Issue is resolved for me after following this - https://docs.chain.link/ccip/tutorials/ccipreceive-gaslimit. Increased the gasLimit.

@Andriy-Kulak
Copy link
Author

Andriy-Kulak commented Aug 20, 2024

Quote reply

Thank you for the nice words, @Andriy-Kulak, we appreciate that! If possible, I would also like to hear later why the initial setup wasn't a smooth experience for you and how we can improve the Chainlink Local docs

But now let's solve this issue first :)

You are right, this is a generic error returned from the CCIP contracts when they call the ccipReceive() function on your receiver contract. The reason why it is custom is because when calling an arbitrary contract, one can't easily decode why it failed. This error message means either you set up the gasLimit value too low or there is some kind of issue or a flaw in your receiver contract.

Can you please paste me here the piece of code where you send the CCIP message from the Sender contract and the ccipReceive function of the Receiver contract? Thank you

Yeah I was able to resolve the issue. I was just saying that the error is ambiguous & can have some additional clues to pinpoint potential culprits (i.e., check gas limit, check the receiver code, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants