hashgraph / hedera-json-rpc-relay

Implementation of Ethereum JSON-RPC APIs for Hedera
Apache License 2.0
68 stars 72 forks source link

Add Foundy Support #1494

Open georgi-l95 opened 1 year ago

georgi-l95 commented 1 year ago

Problem

As a developer I'd like to be able to use Foundry with the Hedera JSON-RPC Relay.

Solution

We'd want to test out all available scenarios with the tool, document and add example in the tools folder.

If we encounter any missing functionality, list it down below, so it can be addressed.

### Tasks

Alternatives

No response

Ivo-Yankov commented 1 year ago

There are many use cases for Foundry - running scripts written in Solidity, using the cli tools to deploy contracts or call existing ones, but the main one is testing contracts with Solidity tests. Unfortunatelly Foundry can be used with the Hedera network for all use cases, except for testing, because it runs the tests against it's own internal evm. It can be configured to call the relay during testing, but it only uses it to read the current state of the network and never actually calls eth_sendRawTransaction. This means that if users want to test their contracts that use the Hedera precompiles, they wouldn't be able to do that with Foundry. On the other hand if they want to test regular Solidity contracts, that do not call any precompiles - they can just use the default configuration, there is no need to connect to the Hedera network to test those contracts, they will work the same way on any evm.

However Foundry can be used with the relay for all of its other use cases. It's possible to run Solidity scripts, deploy and invoke contracts, etc.

We can add a new foundry-example directory with an example configuration and script, and explain in a readme that it's not feasible to use forge test with the relay.

Ivo-Yankov commented 1 year ago

Upon further testing running scripts against the relay is also unfeasible.

Nana-EC commented 7 months ago

We added some extensive examples here https://github.com/hashgraph/hedera-json-rpc-relay/tree/main/tools/foundry-example @Ivo-Yankov Can we add some limitation quotes to that README and close this ticket?