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

RPC #927

Merged
merged 8 commits into from
Feb 24, 2023
Merged

RPC #927

merged 8 commits into from
Feb 24, 2023

Conversation

arcz
Copy link
Member

@arcz arcz commented Jan 30, 2023

This is a very early RPC preview.

Set required config (the exact block number required for mint() in the example contract below to work):
export ECHIDNA_RPC_BLOCK=15947726
export ECHIDNA_RPC_URL="https://eth-mainnet.alchemyapi.io/v2/<token>"
Other providers, such as Infura should also work although I haven't tested it.

Check out this example contract: https://github.com/crytic/echidna/blob/d9e832c3464eb9478a7389cb535287e9a39344e2/tests/solidity/rpc/rpc.sol.

Running with --format text will print fetch queries (HTTP requests) as they happen that are not in the cache.
echidna-test tests/solidity/rpc/rpc.sol --contract TestRPC --format text

@arcz arcz marked this pull request as draft January 30, 2023 21:26
@arcz
Copy link
Member Author

arcz commented Jan 30, 2023

@rappie you might be interested in trying this out

@rappie
Copy link

rappie commented Jan 30, 2023

Awesome, thanks! I'm definatly interested in this :)

I will do some tests soon.

@rappie
Copy link

rappie commented Jan 31, 2023

I'm getting a segfault 😞

❯ echidna-test EchidnaForkTest.sol --contract TestRPC  --format text
Analyzing contract: /home/rappie/Desktop/echidna-fork-test/EchidnaForkTest.sol:TestRPC
<EVM.Query: fetch contract 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5>
zsh: segmentation fault (core dumped)  echidna-test EchidnaForkTest.sol --contract TestRPC --format text

@rappie
Copy link

rappie commented Feb 2, 2023

You can use ganache as a local RPC server to cache contract data and point echidna to it.

ganache --fork https://bsc-mainnet.nodereal.io/v1/<token>
export ECHIDNA_RPC_URL="http://127.0.0.1:8545/"

(mind the http without s)

@arcz arcz force-pushed the queries branch 3 times, most recently from 963bc63 to 68c04e5 Compare February 21, 2023 20:43
@arcz arcz force-pushed the queries branch 4 times, most recently from 72ddcd2 to dc4bb35 Compare February 24, 2023 00:39
@arcz arcz marked this pull request as ready for review February 24, 2023 00:40
@arcz arcz changed the title RPC WIP RPC Feb 24, 2023
RPC test

More complex RPC example, metadata memo and logging

Display the number of fetched contracts/slots

Fetched contracts popup

RPC errors WIP

Show fetch errors to the user

Move metadata cache to IORef
Basic logging for Etherscan fetches

Fix fetch cache populated from constructor

Persist and load fetch cache

Save fetch cache per block

Code cleanup

Fetch contract name from Etherscan
@arcz arcz merged commit 06e5c7f into master Feb 24, 2023
@arcz arcz deleted the queries branch February 24, 2023 18:46
@arcz arcz mentioned this pull request Feb 24, 2023
This pull request was closed.
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

Successfully merging this pull request may close these issues.

3 participants