Skip to content

Latest commit

 

History

History

ethereum

Ethereum Light Client

This is a light client for the Ethereum blockchain. It is written in Rust and lives in the workspace defined in this directory. In this README we will go over a few details that need to be known before hopping into development.

For a more detailed overview of the Light Client and its components, and how to run and benchmark it, you can refer to the mdBook at https://argumentcomputer.github.io/zk-light-clients/ethereum

It can also be run locally with:

cd docs && \
  mdbook serve --open

Then navigate to localhost:3000.

Layout

The workspace is divided into the following:

  • light-client: The main library that contains the light client implementation. It has two main roles:
    • proof server: Produces proofs regarding the sync committee changes and inclusion of some account in the state Merkle Tree.
    • client: Coordinate data communication between the Ethereum chain and the proof server to generate the right proofs at the right time.
  • core: The core library that contains the data structures and utilities used by the light client.
  • ethereum-programs: A library that exposes the Sphinx programs used to generate proofs for our light client.
  • programs/*: Actual implementations of the Sphinx programs.

Logging Configuration

The light client uses two logging systems:

  • Rust logging via tokio-tracing, configured through the RUST_LOG environment variable. See the tracing documentation for detailed configuration options.
  • Go logging for FFI calls, configured through the SP1_GO_LOG environment variable.

To set a global log level (e.g. warn), configure both variables:

RUST_LOG=warn SP1_GO_LOG=warn cargo run ...

Valid log levels are: error, warn, info, debug, trace, off

Development

When developing, you might have to update the programs' implementation. The programs implementations are located in ./programs/* and the compiled binaries are located in ./ethereum-programs/artifacts. Currently, artifacts binaries are generated in two ways:

  • Automated: There is a build script located at ./ethereum-programs/build.rs that will compile all the programs and place them in the ./ethereum-programs/artifacts folder. To enable this feature, it is needed to set the environment variable LC_PROGRAM_AUTOBUILD=1.
  • Manual: You can also compile the programs manually using make by running the following command in the ./ethereum-programs folder:
      make

Testing custom serde implementations

To test the custom SSZ serialization/deserialization implementations, we use static data located in ./test-assets. Those data files come from the data located in the ./test-assets/base-data serialize through the website https://simpleserialize.com/.

The checkpoint used to fetch the data is 0xefb4338d596b9d335b2da176dc85ee97469fc80c7e2d35b9b9c1558b4602077a.