Skip to content

Commit

Permalink
fix(stages,docker): fix batcher and proposer launching, delete TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
steph-rs committed Oct 11, 2023
1 parent 2e0fc32 commit bfc66eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions crates/primitives/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub fn dev_accounts() -> GenesisAlloc {
pub fn genesis_template(timestamp: u64) -> Option<Genesis> {
let mut genesis_allocations = genesis_allocations();
genesis_allocations.extend(dev_accounts());
// It's neccesary here, something wrong with the lazy_static initialization
Lazy::<Genesis>::force(&GENESIS_TEMPLATE);
let genesis = Lazy::get(&GENESIS_TEMPLATE);
genesis.map(|genesis| {
Expand Down
16 changes: 11 additions & 5 deletions crates/stages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ impl Stages<'_> {
// Step 1.
// Create prestate and allocs

// TODO: is this condition correct?
if !genesis_l2_file.exists() {
tracing::info!(target: "opup", "Making prestate and allocs...");
let bin_dir = op_monorepo_dir.join("op-program/bin");
Expand All @@ -114,7 +113,7 @@ impl Stages<'_> {
.output()?;
check_command(make_command, "Failed to do cannon prestate")?;
}
// TODO: check is allocs here actually do what we want

let allocs = Command::new("make")
.args(["devnet-allocs"])
.current_dir(&op_monorepo_dir)
Expand Down Expand Up @@ -176,7 +175,8 @@ impl Stages<'_> {

check_command(start_l1, "Failed to start L1 execution client")?;
net::wait_up(L1_PORT, 10, 1)?;
// TODO: is this sleep necessary?

// block entire thread, because we don't have tokio, or any similar dependency
std::thread::sleep(std::time::Duration::from_secs(10));

// Step 5.
Expand Down Expand Up @@ -221,13 +221,19 @@ impl Stages<'_> {

tracing::info!(target: "opup", "Bringing up everything else...");
let rollup_config = json::read_json(&genesis_rollup_file)?;
let l2oo_address = addresses["L2OutputOracleProxy"]
.as_str()
.unwrap_or_default();
let sequencer_batch_inbox_address = rollup_config["batch_inbox_address"]
.as_str()
.unwrap_or_default();
let start_rollup = Command::new("docker-compose")
.args(["up", "-d", "node", "proposer", "batcher"])
.env("PWD", docker_dir.to_str().unwrap())
.env("L2OO_ADDRESS", addresses["L2OutputOracleProxy"].to_string())
.env("L2OO_ADDRESS", l2oo_address)
.env(
"SEQUENCER_BATCH_INBOX_ADDRESS",
rollup_config["batch_inbox_address"].to_string(),
sequencer_batch_inbox_address,
)
.current_dir(&docker_dir)
.output()?;
Expand Down
5 changes: 2 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ services:
- "7302:7300"
environment:
OP_PROPOSER_L1_ETH_RPC: http://l1:8545
OP_PROPOSER_ROLLUP_RPC: http://op-node:8545
OP_PROPOSER_ROLLUP_RPC: http://node:8545
OP_PROPOSER_POLL_INTERVAL: 1s
OP_PROPOSER_NUM_CONFIRMATIONS: 1
OP_PROPOSER_MNEMONIC: test test test test test test test test test test test junk
Expand All @@ -105,7 +105,6 @@ services:
OP_PROPOSER_PPROF_ENABLED: "true"
OP_PROPOSER_METRICS_ENABLED: "true"
OP_PROPOSER_ALLOW_NON_FINALIZED: "true"

batcher:
build:
context: ../optimism
Expand All @@ -117,7 +116,7 @@ services:
environment:
OP_BATCHER_L1_ETH_RPC: http://l1:8545
OP_BATCHER_L2_ETH_RPC: http://l2:8545
OP_BATCHER_ROLLUP_RPC: http://rollup-client:8545
OP_BATCHER_ROLLUP_RPC: http://node:8545
OP_BATCHER_MAX_CHANNEL_DURATION: 1
OP_BATCHER_SUB_SAFETY_MARGIN: 4 # SWS is 15, ChannelTimeout is 40
OP_BATCHER_POLL_INTERVAL: 1s
Expand Down

0 comments on commit bfc66eb

Please sign in to comment.