Skip to content

Commit

Permalink
feat(rpc): add rpc call to query output at block (#102)
Browse files Browse the repository at this point in the history
* add rpc call to query output at block

* rpc server added

* rpc server working

* implemented endpoint

* add message passer address

* add more fields to respose

* add correct contract for Base L2toL2MessagePasser

* cleanup and error handling

* formatting fixes
  • Loading branch information
shrimalmadhur committed Apr 24, 2023
1 parent 96c9ce8 commit 7884956
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 2 deletions.
214 changes: 213 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ hex = "0.4.3"
libflate = "1.2.0"
openssl = { version = "0.10", features = ["vendored"] }
once_cell = "1"
jsonrpsee = {version = "0.17.0", features = ["server", "macros"]}

# Logging and Metrics
chrono = "0.4.22"
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
- .env
ports:
- 9200:9200
- 9545:9545
volumes:
- ./:/scripts
- data:/data
Expand Down
4 changes: 4 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ pub struct ChainConfig {
/// Network blocktime
#[serde(default = "default_blocktime")]
pub blocktime: u64,
/// L2 To L1 Message passer address
pub l2_to_l1_message_passer: Address,
}

/// Optimism system config contract values
Expand Down Expand Up @@ -210,6 +212,7 @@ impl ChainConfig {
system_config_contract: addr("0xAe851f927Ee40dE99aaBb7461C00f9622ab91d60"),
batch_inbox: addr("0xff00000000000000000000000000000000000420"),
deposit_contract: addr("0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383"),
l2_to_l1_message_passer: addr("0xEF2ec5A5465f075E010BE70966a8667c94BCe15a"),
max_channel_size: 100_000_000,
channel_timeout: 300,
seq_window_size: 3600,
Expand Down Expand Up @@ -241,6 +244,7 @@ impl ChainConfig {
system_config_contract: addr("0xb15eea247ece011c68a614e4a77ad648ff495bc1"),
batch_inbox: addr("0x8453100000000000000000000000000000000000"),
deposit_contract: addr("0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa"),
l2_to_l1_message_passer: addr("0x4200000000000000000000000000000000000016"),
max_channel_size: 100_000_000,
channel_timeout: 100,
seq_window_size: 3600,
Expand Down
5 changes: 4 additions & 1 deletion src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
driver::types::HeadInfo,
engine::{Engine, EngineApi},
l1::{BlockUpdate, ChainWatcher},
rpc,
telemetry::metrics,
};

Expand Down Expand Up @@ -81,7 +82,9 @@ impl Driver<EngineApi> {
)));

let engine_driver = EngineDriver::new(finalized_head, finalized_epoch, provider, &config)?;
let pipeline = Pipeline::new(state.clone(), config)?;
let pipeline = Pipeline::new(state.clone(), config.clone())?;

let _addr = rpc::run_server(config).await?;

Ok(Self {
engine_driver,
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ pub mod engine;

/// Application telemetry and logging
pub mod telemetry;

/// RPC module to host rpc server
pub mod rpc;
Loading

0 comments on commit 7884956

Please sign in to comment.