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

Hardhat Fork testing incompatible with FEVM #11995

Open
5 of 11 tasks
parva-jain opened this issue May 15, 2024 · 2 comments
Open
5 of 11 tasks

Hardhat Fork testing incompatible with FEVM #11995

parva-jain opened this issue May 15, 2024 · 2 comments
Labels

Comments

@parva-jain
Copy link

Checklist

  • This is not a security-related bug/issue. If it is, please follow please follow the security policy.
  • I have searched on the issue tracker and the lotus forum, and there is no existing related issue or discussion.
  • I am running the Latest release, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.
  • I did not make any code changes to lotus.

Lotus component

  • lotus daemon - chain sync
  • lotus fvm/fevm - Lotus FVM and FEVM interactions
  • lotus miner/worker - sealing
  • lotus miner - proving(WindowPoSt/WinningPoSt)
  • lotus JSON-RPC API
  • lotus message management (mpool)
  • Other

Lotus Version

FEVM Issue

Repro Steps

  1. Run '...'
  2. Do '...'
  3. See error '...'
    ...

Describe the Bug

I am deploying contracts on FEVM and for testing locally, I'm trying to fork the calibration network by adding the following config in hardhat.config.js under the network attribute:

hardhat: {
      gas: 12000000,
      blockGasLimit: 0x1fffffffffffff,
      gasLimit: 5000000000,
      allowUnlimitedContractSize: true,
      timeout: 1800000,
      forking: {
        url: CALIBRATION_RPC_URL,
        blockNumber: 1386500, // change block number to latest block height - 100
      },
    }

But when I run the tests, I get the following error. (Pasted in the logging information section).

Also, this is the response from the hardhat team - NomicFoundation/hardhat#4892

Logging Information

An unexpected error occurred:

InvalidResponseError: Invalid JSON-RPC response's result.

Errors: Invalid value undefined supplied to : RpcBlockWithTransactions | null/transactions: RpcTransaction Array/0: RpcTransaction/gasPrice: QUANTITY, Invalid value undefined supplied to : RpcBlockWithTransactions | null/transactions: RpcTransaction Array/1: RpcTransaction/gasPrice: QUANTITY
@parva-jain parva-jain added the kind/bug Kind: Bug label May 15, 2024
@rvagg
Copy link
Member

rvagg commented May 15, 2024

Adding @parva-jain's comment from the hardhat thread:

The interesting thing is that till few weeks before, the tests were running in the filecoin fork as well(sometimes it was failing with same reason). But now from last 2 weeks, its falling everytime. Let me know if there's any hack around it or how should I test functionalities specific to filecoin??

My guess is that there's a parsing mismatch between Lotus output of EthBlock

https://github.com/filecoin-project/lotus/blob/master/chain/types/ethtypes/eth_types.go#L157-L180

And what hardhat is parsing:

https://github.com/NomicFoundation/hardhat/blob/af7807cf38842a4f56e7f4b966b806e39631568a/packages/hardhat-core/src/internal/core/jsonrpc/types/output/block.ts#L18-L54

But without knowing which API call it's making it's hard to see what's wrong there. Is the whole thing undefined? Is it just transactions, is it gasPrice? I think transactions comes out differently depending on what you call and how you call it.

If someone can repro this and show the API calls and responses that would be super helpful, @parva-jain I don't suppose you feel like modifying hardhard to watch HTTP traffic, or perhaps it has a debug mode where you can see it so we can narrow down the call it's making?

@parva-jain
Copy link
Author

I'm testing the contracts that interact with already deployed FEVM contracts (glif protocol). Unable to do that with hardhat although it supports fork testing for all EVM compatible networks.
Now I have integrated Foundry in my project as well and able to do the fork testing. But FEVM should also be compatible with hardhat as it is one of the most used framework. This issue wont be helpful in my case as I have moved ahead and found a work around but would be better to fix it to onboard more projects in FEVM ecosystem.

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

No branches or pull requests

3 participants