/scroll

Scroll's Monorepo

Primary LanguageSolidityMIT LicenseMIT

Scroll Monorepo

rollup contracts bridge-history coordinator prover integration codecov

Scroll is a zkRollup Layer 2 dedicated to enhance Ethereum scalability through a bytecode-equivalent zkEVM circuit. This monorepo encompasses essential infrastructure components of the Scroll protocol. It contains the L1 and L2 contracts, the rollup node, the prover client, and the prover coordinator.

Directory Structure

├── bridge-history-api: Bridge history service that collects deposit and withdraw events from both L1 and L2 chains and generates withdrawal proofs
├── common: Common libraries and types
├── coordinator: Prover coordinator service that dispatches proving tasks to provers
├── database: Database client and schema definition
├── l2geth: Scroll execution node
├── prover: Prover client that runs proof generation for zkEVM circuit and aggregation circuit
├── rollup: Rollup-related services
├── rpc-gateway: RPC gateway external repo
└── tests: Integration tests

Contributing

We welcome community contributions to this repository. Before you submit any issues or PRs, please read the Code of Conduct and the Contribution Guideline.

Prerequisites

  • Go 1.21
  • Rust (for version, see rust-toolchain)
  • Hardhat / Foundry
  • Docker

To run the tests, it is essential to first pull or build the required Docker images. Execute the following commands in the root directory of the repository to do this:

docker pull postgres
make dev_docker

Testing Rollup & Coordinator

For Non-Apple Silicon (M1/M2) Macs

Run the tests using the following commands:

go test -v -race -covermode=atomic scroll-tech/rollup/...
go test -tags="mock_verifier" -v -race -covermode=atomic scroll-tech/coordinator/...
go test -v -race -covermode=atomic scroll-tech/database/...
go test -v -race -covermode=atomic scroll-tech/common/...

For Apple Silicon (M1/M2) Macs

To run tests on Apple Silicon Macs, build and execute the Docker image as outlined below:

Build a Docker Image for Testing

Use the following command to build a Docker image:

make build_test_docker

This command builds a Docker image named scroll_test_image using the Dockerfile found at ./build/dockerfiles/local_test.Dockerfile.

Run Docker Image

After the image is built, run a Docker container from it:

make run_test_docker

This command runs a Docker container named scroll_test_container from the scroll_test_image image. The container uses the host network and has access to the Docker socket and the current directory.

Once the Docker container is running, execute the tests using the following commands:

go test -v -race -covermode=atomic scroll-tech/rollup/...
go test -tags="mock_verifier" -v -race -covermode=atomic scroll-tech/coordinator/...
go test -v -race -covermode=atomic scroll-tech/database/...
go test -v -race -covermode=atomic scroll-tech/common/...

Testing Contracts

You can find the unit tests in contracts/src/test/, and integration tests in contracts/integration-test/.

See contracts for more details on the contracts.

License

Scroll Monorepo is licensed under the MIT license.