Skip to content

Commit

Permalink
rename gateway_url
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed Nov 27, 2024
1 parent 5cec8b4 commit 013815f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
5 changes: 4 additions & 1 deletion core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,10 @@ impl OptionalENConfig {
.unwrap_or_else(Self::default_main_node_rate_limit_rps),
api_namespaces,
contracts_diamond_proxy_addr: None,
gateway_url: secrets.l1.as_ref().and_then(|l1| l1.gateway_url.clone()),
gateway_url: secrets
.l1
.as_ref()
.and_then(|l1| l1.gateway_rpc_url.clone()),
bridge_addresses_refresh_interval_sec: enconfig.bridge_addresses_refresh_interval_sec,
timestamp_asserter_min_time_till_end_sec: general_config
.timestamp_asserter_config
Expand Down
2 changes: 1 addition & 1 deletion core/bin/zksync_server/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl MainNodeBuilder {
let query_eth_client_layer = QueryEthClientLayer::new(
genesis.settlement_layer_id(),
eth_config.l1_rpc_url,
eth_config.gateway_url,
eth_config.gateway_rpc_url,
);
self.node.add_layer(query_eth_client_layer);
Ok(self)
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config/src/configs/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct DatabaseSecrets {
#[derive(Debug, Clone, PartialEq)]
pub struct L1Secrets {
pub l1_rpc_url: SensitiveUrl,
pub gateway_url: Option<SensitiveUrl>,
pub gateway_rpc_url: Option<SensitiveUrl>,
}

#[derive(Debug, Clone, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ impl Distribution<configs::secrets::L1Secrets> for EncodeDist {
use configs::secrets::L1Secrets;
L1Secrets {
l1_rpc_url: format!("localhost:{}", rng.gen::<u16>()).parse().unwrap(),
gateway_url: Some(format!("localhost:{}", rng.gen::<u16>()).parse().unwrap()),
gateway_rpc_url: Some(format!("localhost:{}", rng.gen::<u16>()).parse().unwrap()),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/lib/env_config/src/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl FromEnv for L1Secrets {
.context("ETH_CLIENT_WEB3_URL")?
.parse()
.context("ETH_CLIENT_WEB3_URL")?,
gateway_url: std::env::var("ETH_CLIENT_GATEWAY_WEB3_URL")
gateway_rpc_url: std::env::var("ETH_CLIENT_GATEWAY_WEB3_URL")
.ok()
.map(|url| url.parse().expect("ETH_CLIENT_GATEWAY_WEB3_URL")),
})
Expand Down Expand Up @@ -100,7 +100,7 @@ mod tests {
},
L1Secrets {
l1_rpc_url: "http://127.0.0.1:8545".to_string().parse().unwrap(),
gateway_url: Some("http://127.0.0.1:8547".to_string().parse().unwrap()),
gateway_rpc_url: Some("http://127.0.0.1:8547".to_string().parse().unwrap()),
},
)
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/protobuf_config/src/proto/config/secrets.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ message DatabaseSecrets {

message L1Secrets {
optional string l1_rpc_url = 1; // required
optional string gateway_url = 2; // optional
optional string gateway_rpc_url = 2; // optional
}

message ConsensusSecrets {
Expand Down
10 changes: 5 additions & 5 deletions core/lib/protobuf_config/src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ impl ProtoRepr for proto::L1Secrets {
fn read(&self) -> anyhow::Result<Self::Type> {
Ok(Self::Type {
l1_rpc_url: SensitiveUrl::from_str(required(&self.l1_rpc_url).context("l1_rpc_url")?)?,
gateway_url: self
.gateway_url
gateway_rpc_url: self
.gateway_rpc_url
.clone()
.map(|url| SensitiveUrl::from_str(&url))
.transpose()
.context("gateway_url")?,
.context("gateway_rpc_url")?,
})
}

fn build(this: &Self::Type) -> Self {
Self {
l1_rpc_url: Some(this.l1_rpc_url.expose_str().to_string()),
gateway_url: this
.gateway_url
gateway_rpc_url: this
.gateway_rpc_url
.as_ref()
.map(|url| url.expose_url().to_string()),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn prepare_configs(
}),
l1: Some(L1Secrets {
l1_rpc_url: SensitiveUrl::from_str(&args.l1_rpc_url).context("l1_rpc_url")?,
gateway_url: None,
gateway_rpc_url: None,
}),
data_availability: None,
};
Expand Down

0 comments on commit 013815f

Please sign in to comment.