Skip to content

Commit

Permalink
test with local-l1
Browse files Browse the repository at this point in the history
  • Loading branch information
fborello-lambda committed Nov 8, 2024
1 parent d23c3a4 commit d593323
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
10 changes: 7 additions & 3 deletions crates/l2/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ETH_RPC_URL=http://localhost:8545
DEPLOYER_CONTRACT_VERIFIER=0x0000000000000000000000000000000000000037
# If set to 0xAA skip proof verification.
# Only use in dev mode.
DEPLOYER_CONTRACT_VERIFIER=0x00000000000000000000000000000000000000AA
DEPLOYER_ADDRESS=0x3d1e15a1a55578f7c920884a9943b3b35d0d885b
DEPLOYER_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924
L1_WATCHER_BRIDGE_ADDRESS=0xca829334b66d86ea2c35ca4c4fa94e99851ef587
Expand All @@ -8,7 +10,7 @@ L1_WATCHER_CHECK_INTERVAL_MS=5000
L1_WATCHER_MAX_BLOCK_STEP=5000
L1_WATCHER_L2_PROPOSER_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924
L1_WATCHER_L2_PROPOSER_ADDRESS=0x3d1e15a1a55578f7c920884a9943b3b35d0d885b
ENGINE_API_RPC_URL=http://localhost:8551
ENGINE_API_RPC_URL=http://localhost:8552
ENGINE_API_JWT_PATH=./jwt.hex
PROVER_SERVER_LISTEN_IP=127.0.0.1
PROVER_SERVER_LISTEN_PORT=3000
Expand All @@ -17,7 +19,9 @@ PROPOSER_ON_CHAIN_PROPOSER_ADDRESS=0xe9927d77c931f8648da4cc6751ef4e5e2ce74608
PROPOSER_L1_ADDRESS=0x3d1e15a1a55578f7c920884a9943b3b35d0d885b
PROPOSER_L1_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924
PROPOSER_INTERVAL_MS=5000
# SEPOLIA Used to "bypass" the ON_CHAIN_PROPOSER, only for testing purposes
PROPOSER_VERIFIER_ADDRESS=0xd9b0d07CeCd808a8172F21fA7C97992168f045CA
# https://dev.risczero.com/api/generating-proofs/dev-mode
# 1/true means fake proofs
# The RISC0_DEV_MODE=1 should only be used with DEPLOYER_CONTRACT_VERIFIER=0xAA
RISC0_DEV_MODE=1
RUST_LOG="[executor]=info"
9 changes: 7 additions & 2 deletions crates/l2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.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
L1_GENESIS_FILE_PATH=../../test_data/genesis-l1.json

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}'
Expand Down Expand Up @@ -30,8 +31,12 @@ L1_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b7492

# Local L1

init-local-l1: ## 🚀 Initializes an L1 Lambda Ethereum Rust Client
init-local-l1: ## 🚀 Initializes an L1 Lambda Ethereum Rust Client with Docker
docker compose -f ${ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH} up -d

init-l1: ## 🚀 Initializes an L1 Lambda Ethereum Rust Client
cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust -- removedb --datadir dev_ethereum_rust_l1 && \
cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust --features dev -- --network ${L2_GENESIS_FILE_PATH} --http.port 8545 --http.addr 0.0.0.0 --datadir dev_ethereum_rust_l1

down-local-l1: ## 🛑 Shuts down the L1 Lambda Ethereum Rust Client
docker compose -f ${ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH} down
Expand All @@ -52,7 +57,7 @@ deploy-l1: ## 📜 Deploys the L1 contracts
# 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
cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust --features l2 -- --network ${L2_GENESIS_FILE_PATH} --http.port 1729 --authrpc.port 8552

down-l2: ## 🛑 Shuts down the L2 Lambda Ethereum Rust Client
pkill -f ethereum_rust || exit 0
Expand Down
3 changes: 2 additions & 1 deletion crates/l2/proposer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ impl Proposer {
}
Err(error) => {
error!("Failed to send commitment to block {head_block_hash:#x}. Manual intervention required: {error}");
panic!("Failed to send commitment to block {head_block_hash:#x}. Manual intervention required: {error}");
// TODO uncomment
//panic!("Failed to send commitment to block {head_block_hash:#x}. Manual intervention required: {error}");
}
}

Expand Down
8 changes: 7 additions & 1 deletion crates/l2/proposer/prover_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ struct ProverServer {
store: Store,
eth_client: EthClient,
on_chain_proposer_address: Address,
/// Only for testing purposes, used to override
/// the on_chain_proposer. address
verifier_address: Address,
l1_address: Address,
l1_private_key: SecretKey,
latest_proven_block: u64,
Expand All @@ -113,6 +116,7 @@ impl ProverServer {
store,
eth_client: EthClient::new(&eth_config.rpc_url),
on_chain_proposer_address: proposer_config.on_chain_proposer_address,
verifier_address: proposer_config.verifier_address,
l1_address: proposer_config.l1_address,
l1_private_key: proposer_config.l1_private_key,
latest_proven_block: 0,
Expand Down Expand Up @@ -267,6 +271,7 @@ impl ProverServer {

Err(e) => {
error!("Failed to send proof to block {block_number:#x}. Manual intervention required: {e}");
// TODO: uncomment
panic!("Failed to send proof to block {block_number:#x}. Manual intervention required: {e}");
}
}
Expand Down Expand Up @@ -347,7 +352,8 @@ impl ProverServer {
&self.eth_client,
self.l1_address,
self.l1_private_key,
self.on_chain_proposer_address,
// Change it back to self.on_chain_proposer_address
self.verifier_address,
calldata.into(),
)
.await?;
Expand Down
1 change: 1 addition & 0 deletions crates/l2/utils/config/proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::errors::ConfigError;
#[derive(Deserialize)]
pub struct ProposerConfig {
pub on_chain_proposer_address: Address,
pub verifier_address: Address,
pub l1_address: Address,
#[serde(deserialize_with = "secret_key_deserializer")]
pub l1_private_key: SecretKey,
Expand Down
2 changes: 1 addition & 1 deletion crates/l2/utils/eth_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl EthClient {
};
let data = json!({
"to": format!("{to:#x}"),
"input": format!("{:#x}", transaction.input),
"input": format!("0x{:#x}", transaction.input),
"from": format!("{:#x}", transaction.from),
"nonce": format!("{:#x}", transaction.nonce),
});
Expand Down

0 comments on commit d593323

Please sign in to comment.