Skip to content

Commit

Permalink
Merge branch 'main' into move_opcodes_to_their_corresponding_folders_863
Browse files Browse the repository at this point in the history
  • Loading branch information
gsbujo committed Oct 22, 2024
2 parents f5d542e + 1921ca8 commit 6809379
Show file tree
Hide file tree
Showing 13 changed files with 473 additions and 129 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rust 1.80.1
# golang 1.23.2
50 changes: 43 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The following links, repos, companies and projects have been important in the de
- [Optimism](https://www.optimism.io/)
- [Arbitrum](https://arbitrum.io/)
- [Geth](https://github.com/ethereum/go-ethereum)
- [Taiko](https://taiko.xyz/)
- [RISC Zero](https://risczero.com/)
- [SP1](https://github.com/succinctlabs/sp1)
- [Aleo](https://aleo.org/)
- [Neptune](https://neptune.cash/)
Expand Down Expand Up @@ -71,16 +73,33 @@ The main differences between this mode and regular Ethereum Rust are:

### Table of Contents

- [Roadmap](#roadmap)
- [Lambda Ethereum Rust Execution Client](#lambda-ethereum-rust-execution-client)
- [πŸ“š References and acknowledgements](#-references-and-acknowledgements)
- [Philosophy](#philosophy)
- [Design Principles](#design-principles)
- [L1 and L2 support](#l1-and-l2-support)
- [Lambda Ethereum Rust L2](#lambda-ethereum-rust-l2)
- [Lambda Ethereum Rust L1](#lambda-ethereum-rust-l1)
- [Table of Contents](#table-of-contents)
- [Roadmap](#roadmap)
- [Milestone 1: Read-only RPC Node Support](#milestone-1-read-only-rpc-node-support)
- [Milestone 2: History & Reorgs](#milestone-2-history--reorgs)
- [Milestone 2: History \& Reorgs](#milestone-2-history--reorgs)
- [Milestone 3: Block building](#milestone-3-block-building)
- [Milestone 4: P2P Network](#milestone-4-p2p-network)
- [Milestone 5: Syncing](#milestone-5-syncing)
- [Quick Start](#quick-start-l1-localnet)
- [Dev Setup](#dev-setup)
- [CLI Commands](#cli-commands)
- [Documentation](#crates-documentation)
- [Milestone 5: State Sync](#milestone-5-state-sync)
- [Quick Start (L1 localnet)](#quick-start-l1-localnet)
- [Prerequisites](#prerequisites)
- [Dev Setup](#dev-setup)
- [Build](#build)
- [Rust](#rust)
- [Database](#database)
- [Test](#test)
- [Ethereum Foundation Tests](#ethereum-foundation-tests)
- [Crate Specific Tests](#crate-specific-tests)
- [Hive Tests](#hive-tests)
- [Run](#run)
- [CLI Commands](#cli-commands)
- [Crates documentation](#crates-documentation)

## Roadmap

Expand Down Expand Up @@ -250,6 +269,23 @@ make test CRATE="ethereum_rust-blockchain"
Finally, we have End-to-End tests with hive.
Hive is a system which simply sends RPC commands to our node,
and expects a certain response. You can read more about it [here](https://github.com/ethereum/hive/blob/master/docs/overview.md).

###### Prereqs
We need to have go installed for the first time we run hive, an easy way to do this is adding the asdf go plugin:

```shell
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git

# If you need to se GOROOT please follow: https://github.com/asdf-community/asdf-golang?tab=readme-ov-file#goroot
```

And uncommenting the golang line in the asdf `.tool-versions` file:
```
rust 1.80.1
golang 1.23.2
```

###### Running Simulations
Hive tests are categorized by "simulations', and test instances can be filtered with a regex:
```bash
make run-hive-debug SIMULATION=<simulation> TEST_PATTERN=<test-regex>
Expand Down
81 changes: 41 additions & 40 deletions crates/l2/Makefile
Original file line number Diff line number Diff line change
@@ -1,69 +1,70 @@
.PHONY: init down clean init-local-l1 down-local-l1 clean-local-l1 init-l2 down-l2 deploy-l1 deploy-block-executor deploy-inbox setup-prover
.DEFAULT_GOAL := init

.PHONY: help init down clean init-local-l1 down-local-l1 clean-local-l1 init-l2 down-l2 deploy-l1 deploy-block-executor deploy-inbox setup-prover

L2_GENESIS_FILE_PATH=../../test_data/genesis-l2.json

init: init-local-l1 contract-deps setup-prover deploy-l1 init-l2
help: ## πŸ“š Show help for each of the Makefile recipes
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

down: down-local-l1 down-l2
init: init-local-l1 contract-deps deploy-l1 init-l2 ## πŸš€ Initializes a localnet with Lambda Ethereum Rust client as both L1 and L2

clean: clean-local-l1 clean-contract-deps
down: down-local-l1 down-l2 ## πŸ›‘ Shuts down the localnet

restart: restart-local-l1 restart-contract-deps restart-l2
clean: clean-contract-deps ## 🧹 Cleans the localnet

# Contracts
restart: restart-local-l1 restart-contract-deps restart-l2 ## πŸ”„ Restarts the localnet

cli: ## πŸ› οΈ Builds the L2 Lambda Ethereum Rust CLI
cargo build --release --manifest-path ${ETHEREUM_RUST_PATH}/cmd/ethereum_rust/Cargo.toml

# Variables

ETHEREUM_RUST_PATH=$(shell pwd)/../../
ETHEREUM_RUST_BIN_PATH=$(ETHEREUM_RUST_PATH)/target/release/ethereum_rust
ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH=$(ETHEREUM_RUST_PATH)/crates/blockchain/dev/docker-compose-dev.yaml

FOUNDRY_PROJECT_HOME=$(shell pwd)/contracts
L1_RPC_URL=http://localhost:8545
L1_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924

contract-deps:
mkdir -p ${FOUNDRY_PROJECT_HOME}
forge install foundry-rs/forge-std --no-git --root ${FOUNDRY_PROJECT_HOME}
forge install succinctlabs/sp1-contracts --no-git --root ${FOUNDRY_PROJECT_HOME}
# Local L1

clean-contract-deps:
rm -rf contracts/lib
init-local-l1: ## πŸš€ Initializes an L1 Lambda Ethereum Rust Client
docker compose -f ${ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH} up -d

restart-contract-deps: clean-contract-deps contract-deps
down-local-l1: ## πŸ›‘ Shuts down the L1 Lambda Ethereum Rust Client
docker compose -f ${ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH} down

deploy-l1:
cd ${FOUNDRY_PROJECT_HOME} && \
forge script script/DeployL1.s.sol:DeployL1Script --rpc-url ${L1_RPC_URL} --private-key ${L1_PRIVATE_KEY} --broadcast
restart-local-l1: down-local-l1 init-local-l1 ## πŸ”„ Restarts the L1 Lambda Ethereum Rust Client

deploy-block-executor:
forge create ${FOUNDRY_PROJECT_HOME}/src/l1/OnChainOperator.sol:OnChainOperator --rpc-url ${L1_RPC_URL} --private-key ${L1_PRIVATE_KEY}
# Contracts

deploy-inbox:
forge create ${FOUNDRY_PROJECT_HOME}/src/l1/Inbox.sol:Inbox --rpc-url ${L1_RPC_URL} --private-key ${L1_PRIVATE_KEY}
contract-deps: ## πŸ“¦ Installs the dependencies for the L1 contracts
mkdir -p ${FOUNDRY_PROJECT_HOME}
forge install foundry-rs/forge-std --no-git --root ${FOUNDRY_PROJECT_HOME} || exit 0

# Local L1
clean-contract-deps: ## 🧹 Cleans the dependencies for the L1 contracts.
rm -rf contracts/lib

init-local-l1:
mkdir -p volumes/ volumes/reth volumes/reth/data
docker compose -f docker-compose-l2.yml up -d
restart-contract-deps: clean-contract-deps contract-deps ## πŸ”„ Restarts the dependencies for the L1 contracts.

down-local-l1:
docker compose -f docker-compose-l2.yml down
deploy-l1: ## πŸ“œ Deploys the L1 contracts
cd ${FOUNDRY_PROJECT_HOME} && \
forge script script/DeployL1.s.sol:DeployL1Script --rpc-url ${L1_RPC_URL} --private-key ${L1_PRIVATE_KEY} --broadcast --use $$(which solc)

clean-local-l1:
rm -rf volumes/
deploy-on-chain-operator: ## πŸ“œ Deploys the OnChainOperator contract in L1
forge create ${FOUNDRY_PROJECT_HOME}/src/l1/OnChainOperator.sol:OnChainOperator --rpc-url ${L1_RPC_URL} --private-key ${L1_PRIVATE_KEY}

restart-local-l1: down-local-l1 clean-local-l1 init-local-l1
deploy-bridge: ## πŸ“œ Deploys the CommonBridge contract in L1
forge create ${FOUNDRY_PROJECT_HOME}/src/l1/CommonBridge.sol:CommonBridge --rpc-url ${L1_RPC_URL} --private-key ${L1_PRIVATE_KEY}

# L2

init-l2:
init-l2: ## πŸš€ Initializes an L2 Lambda Ethereum Rust Client
cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust --features l2 -- --network ${L2_GENESIS_FILE_PATH} --http.port 1729

down-l2:
down-l2: ## πŸ›‘ Shuts down the L2 Lambda Ethereum Rust Client
pkill -f ethereum_rust || exit 0

restart-l2: down-l2 init-l2

# Prover

SP1_PROGRAM_PATH=$(shell pwd)/prover/sp1/program

setup-prover:
cd ${SP1_PROGRAM_PATH} && \
cargo prove build
restart-l2: down-l2 init-l2 ## πŸ”„ Restarts the L2 Lambda Ethereum Rust Client
Loading

0 comments on commit 6809379

Please sign in to comment.