Consensys / besu-sequencer-plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Besu Plugins relating to tracer and sequencer functionality

A Linea tracing implementation for Hyperledger Besu based on an existing implementation in Go.

Quickstart - Running Besu with Linea Plugins

  • compile linea-plugins gradlew installDist
  • copy jar file to besu runtime plugins/ directory (where you will run besu from, not where you're building besu)
  • add ROLLUP to besu config to enable the plugin RPC methods
    • rpc-http-api=["ADMIN","ETH","NET","WEB3","ROLLUP"]
  • start besu (command line or from IDE) and you should see plugins registered at startup
  • call the RPC endpoint eg
  curl --location --request POST 'http://localhost:8545' --data-raw '{
    "jsonrpc": "2.0",
    "method": "rollup_generateConflatedTracesToFileV0",
    "params": [0, 0, "6.16.0"],
    "id": 1
  }'

Development Setup

Install Java 17

brew install openjdk@17

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Use local git executable to fetch from repos (needed for private repos)
echo "net.git-fetch-with-cli=true" >> .cargo/config.toml

Install Corset

cargo install --git ssh://git@github.com/Consensys/corset

Update Constraints Submodule

git submodule update --init --recursive

Install pre-commit

pip install --user pre-commit

# For macOS users.
brew install pre-commit

Then run pre-commit install to set up git hook scripts. Used hooks can be found here.


NOTE

pre-commit aids in running checks (end of file fixing, markdown linting, linting, runs tests, json validation, etc.) before you perform your git commits.


Run tests

# Run all tests
./gradlew clean test

# Run only unit tests
./gradlew clean unitTests

# Run only acceptance tests
./gradlew clean acceptanceTests

# Run EVM test suite BlockchainTests
./gradlew clean referenceBlockchainTests

# Run EVM test suite GeneralStateTests
./gradlew clean referenceGeneralStateTests

# Run all EVM test suite reference tests
./gradlew clean referenceTests

# Run single reference test via gradle, e.g for net.consensys.linea.generated.blockchain.BlockchainReferenceTest_583
./gradlew :reference-tests:referenceTests --tests "net.consensys.linea.generated.blockchain.BlockchainReferenceTest_583"

NOTE

Please be aware if the reference test code generation tasks blockchainReferenceTests and generalStateReferenceTests do not generate any java code, than probably you are missing the Ethereum tests submodule which you can clone via git submodule update --init --recursive.


IntelliJ IDEA Setup

Enable Annotation Processing

  • Go to Settings | Build, Execution, Deployment | Compiler | Annotation Processors and tick the following checkbox:

    idea_enable_annotation_processing_setting.png


NOTE

This setting is required to avoid IDE compilation errors because of the Lombok library used for code generation of boilerplate Java code such as:

Learn more about how Java annotation processing works here.


Set Up IDE Code Re-formatting

  • Install Checkstyle plugin and set IDE code reformatting to comply with the project's Checkstyle configuration:

    • Go to Settings | Editor | Code Style | Java | <hamburger menu> | Import Scheme | Checkstyle configuration:

      idea_checkstyle_reformat.png

      and select <project_root>/config/checkstyle.xml.

Install Optional Plugins

  • Install Spotless Gradle plugin to re-format through the IDE according to spotless configuration.

Debugging Traces

  • JSON files can be debugged with the following command:
corset check -T <JSON_FILE> -v zkevm-constraints/zkevm.bin

Continuous Tracing

The continuous tracing plugin is documented here.

Release Process

Here are the steps for releasing a new version of the plugin:

  1. Create a tag with the release version number in the format vX.Y.Z (e.g., v0.2.0 creates a release version 0.2.0).
  2. Push the tag to the repository.
  3. GitHub Actions will automatically create a draft release for the release tag.
  4. Once the release workflow completes, update the release notes, uncheck "Draft", and publish the release.

Note: Release tags (of the form v*) are protected and can only be pushed by organization and/or repository owners.

About


Languages

Language:Java 98.9%Language:Solidity 0.7%Language:Groovy 0.3%Language:Smarty 0.1%Language:Shell 0.0%Language:Nix 0.0%