Skip to content

Commit

Permalink
chore(papyrus_base_layer): add eth base layer config to node infra
Browse files Browse the repository at this point in the history
`ser_required_param` seems to be unsupported by the current infra tests
and unused elsewhere, using regular `ser_param` instead.
  • Loading branch information
Gilad Chase committed Dec 24, 2024
1 parent 7b11a24 commit 83be466
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.lock

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

10 changes: 10 additions & 0 deletions config/sequencer/default_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"base_layer_config.node_url": {
"description": "A required param! Ethereum node URL. A schema to match to Infura node: https://mainnet.infura.io/v3/<your_api_key>, but any other node can be used.",
"param_type": "String",
"privacy": "Private"
},
"base_layer_config.starknet_contract_address": {
"description": "Starknet contract address in ethereum.",
"privacy": "Public",
"value": "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4"
},
"batcher_config.block_builder_config.bouncer_config.block_max_capacity.builtin_count.add_mod": {
"description": "Max number of add mod builtin usage in a block.",
"privacy": "Public",
Expand Down
1 change: 1 addition & 0 deletions crates/papyrus_base_layer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ tempfile = { workspace = true, optional = true }
thiserror.workspace = true
tokio = { workspace = true, features = ["full", "sync"] }
url = { workspace = true, features = ["serde"] }
validator.workspace = true

[dev-dependencies]
ethers-core.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use starknet_api::block::{BlockHash, BlockHashAndNumber, BlockNumber};
use starknet_api::hash::StarkHash;
use starknet_api::StarknetApiError;
use url::Url;
use validator::Validate;

use crate::{BaseLayerContract, L1Event};

Expand Down Expand Up @@ -122,7 +123,7 @@ pub enum EthereumBaseLayerError {
FeeOutOfRange(alloy_primitives::ruint::FromUintError<u128>),
}

#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Validate)]
pub struct EthereumBaseLayerConfig {
pub node_url: Url,
pub starknet_contract_address: EthereumContractAddress,
Expand Down
1 change: 1 addition & 0 deletions crates/starknet_sequencer_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ clap.workspace = true
const_format.workspace = true
futures.workspace = true
infra_utils.workspace = true
papyrus_base_layer.workspace = true
papyrus_config.workspace = true
papyrus_proc_macros = { workspace = true, optional = true }
papyrus_protobuf.workspace = true
Expand Down
4 changes: 4 additions & 0 deletions crates/starknet_sequencer_node/src/config/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::vec::Vec;

use clap::Command;
use infra_utils::path::resolve_project_relative_path;
use papyrus_base_layer::ethereum_base_layer_contract::EthereumBaseLayerConfig;
use papyrus_config::dumping::{
append_sub_config_name,
generate_struct_pointer,
Expand Down Expand Up @@ -116,6 +117,8 @@ pub struct SequencerNodeConfig {
#[validate]
pub consensus_manager_config: ConsensusManagerConfig,
#[validate]
pub base_layer_config: EthereumBaseLayerConfig,
#[validate]
pub gateway_config: GatewayConfig,
#[validate]
pub http_server_config: HttpServerConfig,
Expand Down Expand Up @@ -144,6 +147,7 @@ impl SerializeConfig for SequencerNodeConfig {
),
append_sub_config_name(self.gateway_config.dump(), "gateway_config"),
append_sub_config_name(self.http_server_config.dump(), "http_server_config"),
append_sub_config_name(self.base_layer_config.dump(), "base_layer_config"),
append_sub_config_name(self.rpc_state_reader_config.dump(), "rpc_state_reader_config"),
append_sub_config_name(self.compiler_config.dump(), "compiler_config"),
append_sub_config_name(self.mempool_p2p_config.dump(), "mempool_p2p_config"),
Expand Down

0 comments on commit 83be466

Please sign in to comment.