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

test(evm-ci): Run Ethereum protocol tests across the chain in CI/CD #1978

Open
Unique-Divine opened this issue Jul 29, 2024 · 4 comments
Open
Labels
x: evm Relates to Nibiru EVM or the EVM Module

Comments

@Unique-Divine
Copy link
Member

Unique-Divine commented Jul 29, 2024

A security team that specializes in auditing Ethereum and EVM-compatible Layer 1 blockchains has made a recommendation. They suggest implementing an automated test suite that would check for consistent behavior between Nibiru and Ethereum. This aims to ensure that Nibiru's behavior aligns with Ethereum's in key areas.

Recommended Tools:

I think the entry point to start the ticket is here where it mentions testing a modified geth in the docs.

@Unique-Divine Unique-Divine added type: tests x: evm Relates to Nibiru EVM or the EVM Module labels Jul 29, 2024
@onikonychev
Copy link
Contributor

Running retesteth

First, grab the docker with tests runner and a running script:

cd ~

wget http://retesteth.ethdevops.io/dretesteth.tar

docker image load --input dretesteth.tar

wget https://raw.githubusercontent.com/ethereum/retesteth/master/dretesteth.sh
chmod +x dretesteth.sh

Run the default config for the first time to have ~/tests/config folder produced.

--datadir /tests/config path is within docker - it will be created inside ~/tests.

./dretesteth.sh -t GeneralStateTests/stExample -- \
 --testpath ~/tests --datadir /tests/config

Create folder nibiru in the ~/tests/config dir.
Put there this attached file with the name config.

Run nibiru localnet:

make localnet

Run the tests with config nibiru:

./dretesteth.sh -t GeneralStateTests/stExample -- \
 --testpath ~/tests --datadir /tests/config --clients nibiru

It'll output the error because test_setChainParams rpc method is not implemented.

Error: RPCImpl::test_setChainParamsNoGenesis is not implemented! (GeneralStateTests/stExample/add11, step: test_setChainParams: Cancun)

--------
TestOutputHelper detected 1 errors during test execution!
/retesteth/retesteth/helpers/TestOutputHelper.cpp(240): error: in "GeneralStateTests/stExample":

@onikonychev
Copy link
Contributor

RPC methods required for retesteth

https://github.com/ethereum/retesteth/wiki/RPC-Methods

@onikonychev
Copy link
Contributor

Looks like the requirements for the RPC methods are not actual and don't actually work. I implemented the first required endpoint test_setChainParams but was still getting this error. Then I opened the source code or retesteth and found that this endpoint is "Not Implemented" (link to the code):

void RPCImpl::test_setChainParamsNoGenesis(spSetChainParamsArgs const& _config)
{
    (void) _config;
    ETH_FAIL_MESSAGE("RPCImpl::test_setChainParamsNoGenesis is not implemented!");
}

Next, I tried to execute at least one test which does not do test_setChainParams. The only one I found was TransactionTests suite.

./dretesteth.sh -t TransactionTests -- --all \
 --testpath ~/tests --datadir /tests/config --clients nibiru

That test failed because it required test_rawTransaction RPC method but that method not even documented. I dummied it too following the call parameters but it requires some value inresult which format is unknown. Without any doc and just reading the source code it appears to be really hard.

@onikonychev
Copy link
Contributor

Also found a suite EOFTests but it required another non-documented call test_rawEOFCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x: evm Relates to Nibiru EVM or the EVM Module
Projects
Status: ⚡ Building 🧱
Development

No branches or pull requests

3 participants