cerc-io / go-ethereum

Read-only mirror of https://git.vdb.to/cerc-io/go-ethereum (Statediffing-fork of the official Go implementation of the Ethereum protocol)
https://git.vdb.to/cerc-io/go-ethereum
GNU Lesser General Public License v3.0
13 stars 4 forks source link

Improve Testing for Geth #207

Closed abdulrabbani00 closed 2 years ago

abdulrabbani00 commented 2 years ago

Current Testing

Currently, there are two sorts of tests that developers can run for vulcanize-geth.

  1. Unit Tests
  2. Manual Integration Tests

Unit Tests

The unit tests are written directly in the vulcanize-geth code base. They follow the same standard as ethereum-geth unit tests.

Manual Integration Tests

If we want to test the behavior of a running vulcanize-geth node, on a private network, we need to do the following:

  1. Utilize dapptools to run geth and create a private network.
  2. Manually study behaviors of our running geth node.

Although manual integration tests are helpful in many contexts, primarily to study code change behavior at the start of development, they don’t provide full code coverage. Furthermore, the current process for standing up a private network and connecting it to Geth spans two repositories and takes and takes a long time to build.

Improvements

@Ian Norden and I propose the following two solutions:

  1. Adding Hive (or another framework) for programmatic integration tests for geth.
  2. Utilizing Foundry to build a private network, perform manual integration tests, and test smart contacts (down the road).

Ideology

Programmatic Integration Tests

There is no way to write proper programmatic integration tests against the geth codebase. There are various issues open now that could leverage programmatic integration testing.

Proposal

  1. Look into Hive and see if it will cover our needs for writing programmatic integration tests.
    1. Look into other integration testing frameworks for geth.
  2. Once a framework has been decided, include why it was chosen in this document. This reasoning will provide insight to future developers.
  3. Fork the testing framework.
  4. Create a generic pipeline/process for being able to test vulcanize-geth.
    1. This process will need to include a connection to the ipld-eth-db.
  5. Add a simple “dummy” test to ensure that the testing of vulcanize-geth works.

Immediate Use Cases

Replace Dapptools with Foundry for Manual Integration Testing on a Private Network

Currently, the pain point with dapptools is:

  1. It is in a completely separate repository as vulcanize-geth.
  2. It is very slow to build. It contains a lot of “fluff,” which doesn’t provide a great deal of value.

The benefits to Foundry are:

  1. It is more robust and faster to “spin up.”
  2. It allows a built-in capability to test smart contacts in solidity.
  3. We don’t need to maintain a fork to use it.

Proposal

  1. Create a folder in vulcanize-geth for foundry.
  2. Include a process that will create a private network for manual integration testing. The process will more than likely do the following:
    1. Compile the local version of geth.
    2. Creates a container with the ipld-eth-db
    3. Create a container that contains Foundry. In this container, we will mimic the actions that dapptools performs to create a private network:
      1. Start geth
      2. Deploy contracts
      3. Send transactions.

Immediate Use Cases

Estimated Time

The following captures the estimated time and effort required to make both changes.

Foundry

Hive or Hive-Like Solution

i-norden commented 2 years ago

LGTM!

For the Foundry proposal 2.ii. "Creates a container with the ipld-eth-server" not sure I follow why the container in this rpeo would need to include ipld-eth-server.

abdulrabbani00 commented 2 years ago

Good catch, I meant the ipd-eth-db not server.

abdulrabbani00 commented 2 years ago

Status Updates

Going Forward

Currently, this framework works for local testing, but it's not great and hasn't been standardized. The next steps are:

Once we have gotten appropriate feedback and used both frameworks for real-world testing, we can do the following:

i-norden commented 2 years ago

Reopen more specific task issues