Monorepo implementing the Optimistic Ethereum protocol
Extensive documentation is available here
packages
: Contains all the typescript packages and contractscontracts
: Solidity smart contracts implementing the OVMcore-utils
: Low-level utilities and encoding packagescommon-ts
: Common tools for TypeScript code that runs in Nodehardhat-ovm
: Hardhat plugin which enables the OVM Compilersmock
: Testing utility for mocking smart contract return values and storagedata-transport-layer
: Event indexer, allowing thel2geth
node to access L1 databatch-submitter
: Daemon for submitting L2 transaction and state root batches to L1message-relayer
: Service for relaying L2 messages to L1
l2geth
: Fork of go-ethereum v1.9.10 implementing the OVM.integration-tests
: Integration tests between a L1 testnet,l2geth
,ops
: Contains Dockerfiles for containerizing each service involved in the protocol, as well as a docker-compose file for bringing up local testnets easily
Dependency management is done using yarn
.
git clone [email protected]:ethereum-optimism/optimism.git
cd optimism
yarn
After installing the dependencies, you must also build them so that the typescript is compiled down to javascript:
yarn build
When changing branches, be sure to clean the repo before building.
yarn clean
All tests are run in parallel using lerna
:
yarn test
When you want to run tests only for packages that have changed since master
(or any other branch)
you can run yarn lerna run test --parallel --since master
The integration tests first require bringing up the Optimism stack. This is done via a Docker Compose network. For better performance, we also recommend enabling Docker BuildKit
cd ops
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
docker-compose build
cd ../integration-tests
yarn build:integration
yarn test:integration
If you want to make changes to any of the containers, you'll have to bring one down, rebuild it, and then bring it back up.
For example, if you make a change in l2geth:
cd ops
docker-compose stop -- l2geth
docker-compose build -- l2geth
docker-compose start l2geth
For the typescript services, you'll need to rebuild the builder
so that the compiled
files are re-generated, and then your service, e.g. for the batch submitter
cd ops
docker-compose stop -- batch_submitter
docker-compose build -- builder batch_submitter
docker-compose start batch_submitter
By default, the docker-compose up
command will show logs from all services, and that
can be hard to filter through. In order to view the logs from a specific service, you can run:
docker-compose logs --follow <service name>