Skip to content

Commit

Permalink
review: rename remote_batch_prover to batch_prover_url
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiagoPittella committed Feb 24, 2025
1 parent 8fe8da2 commit 6ff7644
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
12 changes: 6 additions & 6 deletions bin/node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct NormalizedRpcConfig {
struct NormalizedBlockProducerConfig {
endpoint: Url,
verify_tx_proofs: bool,
remote_batch_prover: Option<Url>,
batch_prover_url: Option<Url>,
}

impl Default for NormalizedRpcConfig {
Expand All @@ -49,12 +49,12 @@ impl Default for NormalizedBlockProducerConfig {
endpoint,
store_url: _,
verify_tx_proofs,
remote_batch_prover,
batch_prover_url,
} = BlockProducerConfig::default();
Self {
endpoint,
verify_tx_proofs,
remote_batch_prover,
batch_prover_url,
}
}
}
Expand All @@ -67,7 +67,7 @@ impl NodeConfig {
endpoint: block_producer.endpoint,
store_url: store.endpoint.clone(),
verify_tx_proofs: block_producer.verify_tx_proofs,
remote_batch_prover: block_producer.remote_batch_prover,
batch_prover_url: block_producer.batch_prover_url,
};

let rpc = RpcConfig {
Expand Down Expand Up @@ -102,7 +102,7 @@ mod tests {
[block_producer]
endpoint = "http://127.0.0.1:8080"
verify_tx_proofs = true
remote_batch_prover = "http://127.0.0.1:8081"
batch_prover_url = "http://127.0.0.1:8081"
[rpc]
endpoint = "http://127.0.0.1:8080"
Expand All @@ -123,7 +123,7 @@ mod tests {
block_producer: NormalizedBlockProducerConfig {
endpoint: Url::parse("http://127.0.0.1:8080").unwrap(),
verify_tx_proofs: true,
remote_batch_prover: Some(Url::parse("http://127.0.0.1:8081").unwrap()),
batch_prover_url: Some(Url::parse("http://127.0.0.1:8081").unwrap()),
},
rpc: NormalizedRpcConfig {
endpoint: Url::parse("http://127.0.0.1:8080").unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion config/miden-node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ endpoint = "http://127.0.0.1:48046"
# transaction queue.
verify_tx_proofs = true
# address of the remote batch prover service
remote_batch_prover = "http://127.0.0.1:8082/"
batch_prover_url = "http://127.0.0.1:8082/"

[rpc]
# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-rpc', 1)) % 2**16
Expand Down
13 changes: 6 additions & 7 deletions crates/block-producer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,20 @@ pub struct BlockProducerConfig {
pub verify_tx_proofs: bool,

/// URL of the remote batch prover.
pub remote_batch_prover: Option<Url>,
pub batch_prover_url: Option<Url>,
}

impl Display for BlockProducerConfig {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{{ endpoint: \"{}\"", self.endpoint)?;
write!(f, ", store_url: \"{}\"", self.store_url)?;

let remote = self
.remote_batch_prover
let batch_prover_url = self
.batch_prover_url
.as_ref()
.map(ToString::to_string)
.unwrap_or_else(|| "None".to_string());
.map_or_else(|| "None".to_string(), ToString::to_string);

write!(f, ", remote_batch_prover: \"{}\" }}", remote)
write!(f, ", batch_prover_url: \"{batch_prover_url}\" }}")
}
}

Expand All @@ -53,7 +52,7 @@ impl Default for BlockProducerConfig {
store_url: Url::parse(format!("http://127.0.0.1:{DEFAULT_STORE_PORT}").as_str())
.unwrap(),
verify_tx_proofs: true,
remote_batch_prover: None,
batch_prover_url: None,
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions crates/block-producer/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct BlockProducer {
rpc_listener: TcpListener,
store: StoreClient,
chain_tip: BlockNumber,
remote_batch_prover: BatchProver,
batch_prover: BatchProver,
}

impl BlockProducer {
Expand Down Expand Up @@ -82,7 +82,7 @@ impl BlockProducer {

info!(target: COMPONENT, "Server initialized");

let remote_batch_prover = match config.remote_batch_prover {
let batch_prover = match config.batch_prover_url {
Some(url) => BatchProver::new_remote(url),
None => BatchProver::new_local(MIN_PROOF_SECURITY_LEVEL),
};
Expand All @@ -97,7 +97,7 @@ impl BlockProducer {
store,
rpc_listener,
chain_tip,
remote_batch_prover,
batch_prover,
})
}

Expand All @@ -112,7 +112,7 @@ impl BlockProducer {
store,
chain_tip,
expiration_slack,
remote_batch_prover,
batch_prover,
} = self;

let mempool = Mempool::shared(
Expand All @@ -136,7 +136,7 @@ impl BlockProducer {
let mempool = mempool.clone();
let store = store.clone();
async {
batch_builder.run(mempool, store, remote_batch_prover).await;
batch_builder.run(mempool, store, batch_prover).await;
Ok(())
}
})
Expand Down

0 comments on commit 6ff7644

Please sign in to comment.