How to run a local EVM testnet?

Has anyone managed to use a local testnet using the instructions in the safe_network README?

I get to the point of running the tests and they pass until it fails when trying a PUT. There are a couple of points in the instructions where commands require <ETHEREUM-ADDRESS> without saying where to get that from so that may be my issue.

I tried creating a wallet and using that address with the --genesis-address option but that gives a cryptic error so I don’t know which address it is complaining about:

target/debug/evm_testnet --genesis-wallet 0x9bc80bD37A88dFa86A9580B786c28c1c908cE1F3`
Error: Address already in use (os error 98)
thread 'main' panicked at evmlib/src/testnet.rs:80:10:
Could not spawn Anvil node: Timeout
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

EDIT: That error was I already had an Ethereum node running so after killing that I do get a wallet with tokens and gas, but I still can’t get the tests to get past the first PUT because it says I don’t have enough tokens.

I started the Eth node with this:

cargo run --bin evm_testnet -- --genesis-wallet 0x9bc80bD37A88dFa86A9580B786c28c1c908cE1F3
    Finished `dev` profile [unoptimized] target(s) in 0.60s
     Running `target/debug/evm_testnet --genesis-wallet 0x9bc80bD37A88dFa86A9580B786c28c1c908cE1F3`
*************************
* Ethereum node started *
*************************
EVM testnet data saved to: "/home/mrh/.local/share/safe/evm_testnet_data.csv"
When running the Node or CLI with --feature=local, it will automatically use this network by loading the EVM Network's info from the CSV file.

RPC URL: http://localhost:4343/
Payment token address: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Data payments address: 0x8464135c8F25Da09e49BC8782676a84730C318bC
Deployer wallet private key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Genesis wallet balance (atto): (tokens: 2500000000000000000000000, gas: 9998998011376313335705)

--------------
Run the CLI or Node with the following env vars set to manually connect to this network:
RPC_URL="http://localhost:4343/" PAYMENT_TOKEN_ADDRESS="0x5FbDB2315678afecb367f032d93F642f64180aa3" DATA_PAYMENTS_ADDRESS="0x8464135c8F25Da09e49BC8782676a84730C318bC"
--------------
For CLI operations that required a payment: use the deployer secret key by providing this env var:
SECRET_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
--------------

Started my nodes with this:

cargo run --bin=safenode-manager --features=local -- local run --build --clean --rewards-address 0x5FbDB2315678afecb367f032d93F642f64180aa3 evm-local

Ran the tests with and without the SECRET_KEY setting:

SECRET_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" EVM_NETWORK=local cargo test --package=autonomi --features=local
    Finished `test` profile [unoptimized] target(s) in 0.62s
     Running unittests src/lib.rs (target/debug/deps/autonomi-6a1bc8308bfd3253)

running 2 tests
test client::address::test::test_xorname_to_str ... ok
test client::data_private::tests::test_hex ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/external_signer.rs (target/debug/deps/external_signer-90b844bf64ce683b)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/fs.rs (target/debug/deps/fs-ad4bb923a793674f)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/put.rs (target/debug/deps/put-a79ef89831c08e06)

running 1 test
test put ... FAILED

failures:

---- put stdout ----
Error: Error occurred during payment.

Caused by:
   0: Wallet error: InsufficientTokensForQuotes(0, 11)
   1: Insufficient tokens to pay for quotes. Have: 0 atto, need: 11 atto

Location:
    autonomi/tests/put.rs:26:16


failures:
    put

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.40s

error: test failed, to rerun pass `-p autonomi --test put`

…each time with the above failure.

3 Likes

could try everything :stuck_out_tongue: - looks like a conflict in the ENV parser, and the --features=local when generating the “network” object used with the put for local-evm - looks like its defaulting to “PAYMENT_TOKEN_ADDRESS_BUILD_TIME_VAL” so when calling get token balance, it can’t see any tokens as the contract address doesn’t match the one used in the genesis event in the local EVM testnet - also added some “” around EVM_NETWORK, who knows how it passes it :person_shrugging:

RPC_URL="http://localhost:4343/" PAYMENT_TOKEN_ADDRESS="0x5FbDB2315678afecb367f032d93F642f64180aa3" DATA_PAYMENTS_ADDRESS="0x8464135c8F25Da09e49BC8782676a84730C318bC" SECRET_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" EVM_NETWORK="local" cargo test --package=autonomi --features=local
3 Likes

Thanks. That appears to have overcome that issue but it is still failing. Looking at the nodes using vdash doesn’t look too healthy either (screenshot below). Here’s the test output:

running 1 test
test put has been running for over 60 seconds
test put ... FAILED

failures:

---- put stdout ----
Error: A network error occurred.

Caused by:
    Failed to verify the ChunkProof with the provided quorum

Location:
    autonomi/tests/put.rs:26:16


failures:
    put

“INACTIVE” means no output to the node log file for >20s.

1 Like

It looks like nodes are dying, maybe the CPU limit - although this is a shit-hot laptop with 32 cores and 64GB RAM. I do have a lot of stuff open.

I tried reducing the node count to 20 then 10. It does reduce but runs way more nodes than I ask for. With --count 10 it is running 35!

Anyway, the test is still failing to get a quorum for ChunkProof.

1 Like

Sorry, I can’t really deal with the larger issue right now, but, I just want to say, the chunk proof problem is being investigated at the moment, as a high priority.

8 Likes

@chriso big thanks for doing your bit to try and keep Autonomi connected to this community when we all know you are very busy! :clap:

8 Likes

Thanks. Btw, I haven’t forgotten the question you have asked me in the other thread. It’s still on my list. I will try to get a response to that very soon.

4 Likes

Thanks, I didn’t like to mention it again :laughing:. Please don’t stress, it will all come out in the wash.

2 Likes

Not if its a T-shirt I wore to a curry night.
Turmeric for Techies

This topic was automatically closed after 60 days. New replies are no longer allowed.