Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

[feat] Implement test and debug APIs to support ethereum/tests for state transitions #558

Open
e00dan opened this issue Oct 20, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@e00dan
Copy link
Contributor

e00dan commented Oct 20, 2022

Is your feature request related to a problem? Please describe.

Creating additional tests for Godwoken state transitions should be a priority. There is retesteth which runs ethereum/tests and can use TCP connection that it already leverages to test Besu client. However, Godwoken would need to implement additional RPC methods like Besu does.

Describe the solution you'd like

Implement RPC APIs listed in: https://ethereum-tests.readthedocs.io/en/latest/rpc-ref.html#the-rpc-interface similar to how Besu does it, eg. test_setChainParams. Besu implementation: https://github.com/hyperledger/besu/tree/451bb7a80c4f9ad32314a1e3116df514cc03f367/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth

Describe alternatives you've considered

Alternative is to write more tests natively for Godwoken and Polyjuice.

Additional context

Currently trying to run ethereum/tests against Godwoken Devnet fails:

$ ./retesteth -t GeneralStateTests -- --testpath "/home/kuzi/projects/tests" --clients godwoken

...

Error: Error on JSON-RPC call ( (stCallCodes/callcallcodecall_010_SuicideMiddle, step: GeneralStateTest)):
Request: '{"jsonrpc":"2.0","method":"test_setChainParams","params":[{
    "params" : {
        "homesteadForkBlock" : "0x00",
        "EIP150ForkBlock" : "0x00",
        "EIP158ForkBlock" : "0x00",
        "byzantiumForkBlock" : "0x00",
        "constantinopleForkBlock" : "0x00",
        "constantinopleFixForkBlock" : "0x00",
        "istanbulForkBlock" : "0x00",
        "berlinForkBlock" : "0x00",
        "chainID" : "0x01"
    },
    "accounts" : {
        "0x1000000000000000000000000000000000000000" : {
            "balance" : "0x0de0b6b3a7640000",
            "code" : "0x60406000604060006000731000000000000000000000000000000000000001620249f0f160005500",
            "nonce" : "0x00",
            "storage" : {
            }
        },
        "0x1000000000000000000000000000000000000001" : {
            "balance" : "0x02540be400",
            "code" : "0x60406000604060006000731000000000000000000000000000000000000002620186a0f260015500",
            "nonce" : "0x00",
            "storage" : {
            }
        },
        "0x1000000000000000000000000000000000000002" : {
            "balance" : "0x02540be400",
            "code" : "0x731000000000000000000000000000000000000000ff6040600060406000600073100000000000000000000000000000000000000361c350f160025500",
            "nonce" : "0x00",
            "storage" : {
            }
        },
        "0x1000000000000000000000000000000000000003" : {
            "balance" : "0x02540be400",
            "code" : "0x600160035500",
            "nonce" : "0x00",
            "storage" : {
            }
        },
        "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
            "balance" : "0x0de0b6b3a7640000",
            "code" : "0x",
            "nonce" : "0x00",
            "storage" : {
            }
        }
    },
    "sealEngine" : "NoReward",
    "genesis" : {
        "author" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
        "difficulty" : "0x020000",
        "gasLimit" : "0x01c9c380",
        "extraData" : "0x00",
        "timestamp" : "0x00",
        "nonce" : "0x0000000000000000",
        "mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000"
    }
}],"id":1}'
Result: 'Method not found'
 (stCallCodes/callcallcodecall_010_SuicideMiddle, step: GeneralStateTest)

--------
TestOutputHelper detected 1 errors during test execution!
/home/kuzi/projects/retesteth/retesteth/TestOutputHelper.cpp(226): error: in "GeneralStateTests/stCallCodes": 
Skipping stQuadraticComplexityTest because --all option is not specified.
Skipping stTimeConsuming because --all option is not specified.
Skipping stExpectSection because --filltests option is not specified.
Skipping vmPerformance because --all option is not specified.

*** 1 failure is detected in the test module "EthereumTests"
@e00dan e00dan added the enhancement New feature or request label Oct 20, 2022
@Flouse Flouse removed the P-Medium label Oct 27, 2022
@magicalne
Copy link
Contributor

Actually, we did integrate some parts of ethereum/tests in polyjuice. Currently, only 'VMTests' are added and you can find them in polyjuice. It's just mocking state, executing tx and comparing logs.
I'm going to integrate all of the tests in https://github.com/ethereum/tests/tree/develop/GeneralStateTests.

It's a little bit difficult to implement debug RPCs, but we will impl them in the future.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants