Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add gateway_url to EN config #2698

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ pub(crate) struct OptionalENConfig {
/// If set to 0, L1 batches will not be retained based on their timestamp. The default value is 7 days.
#[serde(default = "OptionalENConfig::default_pruning_data_retention_sec")]
pruning_data_retention_sec: u64,
/// Gateway RPC URL, needed for operating during migration.
#[allow(dead_code)]
pub gateway_url: Option<SensitiveUrl>,
}

impl OptionalENConfig {
Expand Down Expand Up @@ -663,6 +666,7 @@ impl OptionalENConfig {
.unwrap_or_else(Self::default_main_node_rate_limit_rps),
api_namespaces,
contracts_diamond_proxy_addr: None,
gateway_url: enconfig.gateway_url.clone(),
})
}

Expand Down
2 changes: 2 additions & 0 deletions core/lib/config/src/configs/en_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ pub struct ENConfig {
// Main node configuration
pub main_node_url: SensitiveUrl,
pub main_node_rate_limit_rps: Option<NonZeroUsize>,

pub gateway_url: Option<SensitiveUrl>,
}
2 changes: 2 additions & 0 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ impl Distribution<configs::en_config::ENConfig> for EncodeDist {
_ => L1BatchCommitmentMode::Validium,
},
main_node_rate_limit_rps: self.sample_opt(|| rng.gen()),
gateway_url: self
.sample_opt(|| format!("localhost:{}", rng.gen::<u16>()).parse().unwrap()),
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions core/lib/protobuf_config/src/en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ impl ProtoRepr for proto::ExternalNode {
main_node_rate_limit_rps: self
.main_node_rate_limit_rps
.and_then(|a| NonZeroUsize::new(a as usize)),
gateway_url: self
.gateway_url
.as_ref()
.map(|a| a.parse().context("gateway_url"))
.transpose()?,
})
}

Expand All @@ -46,6 +51,10 @@ impl ProtoRepr for proto::ExternalNode {
.into(),
),
main_node_rate_limit_rps: this.main_node_rate_limit_rps.map(|a| a.get() as u64),
gateway_url: this
.gateway_url
.as_ref()
.map(|a| a.expose_str().to_string()),
}
}
}
1 change: 1 addition & 0 deletions core/lib/protobuf_config/src/proto/config/en.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ message ExternalNode {
optional uint64 l1_chain_id = 3; // required
optional uint64 main_node_rate_limit_rps = 6; // optional
optional config.genesis.L1BatchCommitDataGeneratorMode l1_batch_commit_data_generator_mode = 7; // optional, default to rollup
optional string gateway_url = 8; // optional
}
3 changes: 3 additions & 0 deletions etc/env/configs/ext-node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ file_backed_base_path = "artifacts"
[en.main_node]
url = "http://127.0.0.1:3050"

[en.gateway]
url = "http://127.0.0.1:3052"

[rust]
# `RUST_LOG` environment variable for `env_logger`
# Here we use TOML multiline strings: newlines will be trimmed.
Expand Down
2 changes: 2 additions & 0 deletions etc/env/file_based/external_node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ l1_batch_commit_data_generator_mode: Rollup

main_node_url: http://localhost:3050
main_node_rate_limit_rps: 1000

gateway_url: http://localhost:3052
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn prepare_configs(
.http_url,
)?,
main_node_rate_limit_rps: None,
gateway_url: None,
};
let mut general_en = general.clone();

Expand Down
Loading