Skip to content

Commit c99886f

Browse files
committed
verifiable_api in config and usage
1 parent 9be23d5 commit c99886f

File tree

22 files changed

+590
-370
lines changed

22 files changed

+590
-370
lines changed

cli/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ struct EthereumArgs {
130130
#[clap(short, long, env, value_parser = parse_url)]
131131
execution_rpc: Option<Url>,
132132
#[clap(short, long, env, value_parser = parse_url)]
133+
verifiable_api: Option<Url>,
134+
#[clap(short, long, env, value_parser = parse_url)]
133135
consensus_rpc: Option<Url>,
134136
#[clap(short, long, env)]
135137
data_dir: Option<String>,
@@ -163,6 +165,7 @@ impl EthereumArgs {
163165
CliConfig {
164166
checkpoint: self.checkpoint,
165167
execution_rpc: self.execution_rpc.clone(),
168+
verifiable_api: self.verifiable_api.clone(),
166169
consensus_rpc: self.consensus_rpc.clone(),
167170
data_dir: self
168171
.data_dir
@@ -188,6 +191,8 @@ struct OpStackArgs {
188191
#[clap(short, long, env, value_parser = parse_url)]
189192
execution_rpc: Option<Url>,
190193
#[clap(short, long, env, value_parser = parse_url)]
194+
verifiable_api: Option<Url>,
195+
#[clap(short, long, env, value_parser = parse_url)]
191196
consensus_rpc: Option<Url>,
192197
#[clap(
193198
short = 'w',
@@ -227,6 +232,10 @@ impl OpStackArgs {
227232
user_dict.insert("execution_rpc", Value::from(rpc.to_string()));
228233
}
229234

235+
if let Some(api) = &self.verifiable_api {
236+
user_dict.insert("verifiable_api", Value::from(api.to_string()));
237+
}
238+
230239
if let Some(rpc) = &self.consensus_rpc {
231240
user_dict.insert("consensus_rpc", Value::from(rpc.to_string()));
232241
}

core/src/client/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ pub struct Client<N: NetworkSpec, C: Consensus<N::BlockResponse>> {
2828
impl<N: NetworkSpec, C: Consensus<N::BlockResponse>> Client<N, C> {
2929
pub fn new(
3030
execution_rpc: &str,
31+
verifiable_api: Option<&str>,
3132
consensus: C,
3233
fork_schedule: ForkSchedule,
3334
#[cfg(not(target_arch = "wasm32"))] rpc_address: Option<SocketAddr>,
3435
) -> Result<Self> {
35-
let node = Node::new(execution_rpc, consensus, fork_schedule)?;
36+
let node = Node::new(execution_rpc, verifiable_api, consensus, fork_schedule)?;
3637
let node = Arc::new(node);
3738

3839
#[cfg(not(target_arch = "wasm32"))]

core/src/client/node.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use alloy::rpc::types::{Filter, FilterChanges, Log, SyncInfo, SyncStatus};
77
use eyre::{eyre, Result};
88

99
use helios_common::{fork_schedule::ForkSchedule, network_spec::NetworkSpec, types::BlockTag};
10+
use helios_verifiable_api_client::VerifiableApiClient;
1011

1112
use crate::consensus::Consensus;
1213
use crate::errors::ClientError;
@@ -18,14 +19,15 @@ use crate::time::{SystemTime, UNIX_EPOCH};
1819

1920
pub struct Node<N: NetworkSpec, C: Consensus<N::BlockResponse>> {
2021
pub consensus: C,
21-
pub execution: Arc<ExecutionClient<N, HttpRpc<N>>>,
22+
pub execution: Arc<ExecutionClient<N, HttpRpc<N>, VerifiableApiClient>>,
2223
pub history_size: usize,
2324
fork_schedule: ForkSchedule,
2425
}
2526

2627
impl<N: NetworkSpec, C: Consensus<N::BlockResponse>> Node<N, C> {
2728
pub fn new(
2829
execution_rpc: &str,
30+
verifiable_api: Option<&str>,
2931
mut consensus: C,
3032
fork_schedule: ForkSchedule,
3133
) -> Result<Self, ClientError> {
@@ -34,7 +36,7 @@ impl<N: NetworkSpec, C: Consensus<N::BlockResponse>> Node<N, C> {
3436

3537
let state = State::new(block_recv, finalized_block_recv, 256, execution_rpc);
3638
let execution = Arc::new(
37-
ExecutionClient::new(execution_rpc, state, fork_schedule)
39+
ExecutionClient::new(execution_rpc, verifiable_api, state, fork_schedule)
3840
.map_err(ClientError::InternalError)?,
3941
);
4042

core/src/execution/client/mod.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

core/src/execution/evm.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use alloy::{
66
};
77
use eyre::{Report, Result};
88
use futures::future::join_all;
9+
use helios_verifiable_api_client::VerifiableApi;
910
use revm::{
1011
primitives::{
1112
address, AccessListItem, AccountInfo, Address, Bytecode, Bytes, Env, ExecutionResult,
@@ -24,16 +25,16 @@ use crate::execution::{
2425
ExecutionClient,
2526
};
2627

27-
pub struct Evm<N: NetworkSpec, R: ExecutionRpc<N>> {
28-
execution: Arc<ExecutionClient<N, R>>,
28+
pub struct Evm<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> {
29+
execution: Arc<ExecutionClient<N, R, A>>,
2930
chain_id: u64,
3031
tag: BlockTag,
3132
fork_schedule: ForkSchedule,
3233
}
3334

34-
impl<N: NetworkSpec, R: ExecutionRpc<N>> Evm<N, R> {
35+
impl<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> Evm<N, R, A> {
3536
pub fn new(
36-
execution: Arc<ExecutionClient<N, R>>,
37+
execution: Arc<ExecutionClient<N, R, A>>,
3738
chain_id: u64,
3839
fork_schedule: ForkSchedule,
3940
tag: BlockTag,
@@ -119,12 +120,12 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> Evm<N, R> {
119120
}
120121
}
121122

122-
struct ProofDB<N: NetworkSpec, R: ExecutionRpc<N>> {
123-
state: EvmState<N, R>,
123+
struct ProofDB<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> {
124+
state: EvmState<N, R, A>,
124125
}
125126

126-
impl<N: NetworkSpec, R: ExecutionRpc<N>> ProofDB<N, R> {
127-
pub fn new(tag: BlockTag, execution: Arc<ExecutionClient<N, R>>) -> Self {
127+
impl<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> ProofDB<N, R, A> {
128+
pub fn new(tag: BlockTag, execution: Arc<ExecutionClient<N, R, A>>) -> Self {
128129
let state = EvmState::new(execution.clone(), tag);
129130
ProofDB { state }
130131
}
@@ -136,17 +137,17 @@ enum StateAccess {
136137
Storage(Address, U256),
137138
}
138139

139-
struct EvmState<N: NetworkSpec, R: ExecutionRpc<N>> {
140+
struct EvmState<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> {
140141
basic: HashMap<Address, AccountInfo>,
141142
block_hash: HashMap<u64, B256>,
142143
storage: HashMap<Address, HashMap<U256, U256>>,
143144
block: BlockTag,
144145
access: Option<StateAccess>,
145-
execution: Arc<ExecutionClient<N, R>>,
146+
execution: Arc<ExecutionClient<N, R, A>>,
146147
}
147148

148-
impl<N: NetworkSpec, R: ExecutionRpc<N>> EvmState<N, R> {
149-
pub fn new(execution: Arc<ExecutionClient<N, R>>, block: BlockTag) -> Self {
149+
impl<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> EvmState<N, R, A> {
150+
pub fn new(execution: Arc<ExecutionClient<N, R, A>>, block: BlockTag) -> Self {
150151
Self {
151152
execution,
152153
block,
@@ -324,7 +325,7 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> EvmState<N, R> {
324325
}
325326
}
326327

327-
impl<N: NetworkSpec, R: ExecutionRpc<N>> Database for ProofDB<N, R> {
328+
impl<N: NetworkSpec, R: ExecutionRpc<N>, A: VerifiableApi<N>> Database for ProofDB<N, R, A> {
328329
type Error = Report;
329330

330331
fn basic(&mut self, address: Address) -> Result<Option<AccountInfo>, Report> {

0 commit comments

Comments
 (0)