Skip to content
Draft
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
1 change: 1 addition & 0 deletions Cargo.lock

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

9 changes: 9 additions & 0 deletions crates/full-node/full-node-configs/src/runner.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::net::IpAddr;
use std::num::NonZero;
use std::path::Path;

Expand Down Expand Up @@ -53,6 +54,12 @@ pub struct HttpServerConfig {
/// public_address = "https://rollup.example.com"
/// ```
pub public_address: Option<String>,
/// Reverse proxies whose `X-Forwarded-For` headers should be trusted.
///
/// Requests coming from other peers will ignore `X-Forwarded-For` and use the direct socket
/// address instead.
#[serde(default = "Vec::<IpAddr>::new")]
pub trusted_proxies: Vec<IpAddr>,
/// Enable or disable CORS policy headers. Enabled by default.
#[serde(default)]
pub cors: CorsConfiguration,
Expand Down Expand Up @@ -92,6 +99,7 @@ impl HttpServerConfig {
bind_host: "127.0.0.1".to_string(),
bind_port: port,
public_address: None,
trusted_proxies: Vec::new(),
cors: CorsConfiguration::Permissive,
}
}
Expand All @@ -103,6 +111,7 @@ impl HttpServerConfig {
bind_host: host.into(),
bind_port: port,
public_address: None,
trusted_proxies: Vec::new(),
cors: CorsConfiguration::Permissive,
}
}
Expand Down
39 changes: 39 additions & 0 deletions crates/full-node/full-node-configs/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub enum SequencerKindConfig<Address: Copy> {
Standard(StdSequencerConfig),
/// A "Preferred" sequencer which is allowed to give soft confirmations.
Preferred(PreferredSequencerConfig<Address>),
/// A "Forwarding" sequencer that serves reads locally and forwards tx submissions to a
/// remote preferred sequencer.
Forwarding(ForwardingSequencerConfig),
}

impl<Address: Copy + serde::Serialize + serde::de::DeserializeOwned> Default
Expand Down Expand Up @@ -107,6 +110,14 @@ impl<Addr: Copy> SequencerConfig<Addr> {
SequencerKindConfig::Preferred(_)
)
}

/// Returns true if the sequencer uses [`SequencerKindConfig::Forwarding`].
pub fn is_forwarding_sequencer(&self) -> bool {
matches!(
self.sequencer_kind_config,
SequencerKindConfig::Forwarding(_)
)
}
}

fn default_sequencer_dropped_tx_ttl_secs() -> u64 {
Expand Down Expand Up @@ -334,6 +345,34 @@ pub struct StdSequencerConfig {
pub max_batch_size_bytes: Option<NonZero<usize>>,
}

/// Configuration for a `ForwardingSequencer`, a read-only sequencer that forwards tx submissions
/// to a remote preferred sequencer while serving reads from the local node.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct ForwardingSequencerConfig {
/// Base URL of the upstream preferred sequencer (e.g. `http://leader:12346`).
/// Transaction submissions are forwarded to this endpoint.
pub upstream_url: String,
/// DA address of the upstream preferred sequencer.
/// This is used by local read/simulation APIs so they match the upstream's preferred
/// sequencer behavior.
pub upstream_da_address: String,
/// HTTP request timeout in milliseconds for calls to the upstream sequencer.
#[serde(default = "default_forwarding_request_timeout_ms")]
pub request_timeout_ms: u64,
/// TTL in milliseconds for the cached readiness result from the upstream sequencer.
#[serde(default = "default_forwarding_readiness_cache_ms")]
pub readiness_cache_ms: u64,
}

const fn default_forwarding_request_timeout_ms() -> u64 {
10_000
}

const fn default_forwarding_readiness_cache_ms() -> u64 {
200
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq, JsonSchema)]
pub struct SovRateLimiterConfig<Address: Copy> {
/// The cache size for the rate limiter.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
source: crates/full-node/full-node-configs/src/runner.rs
assertion_line: 242
expression: config
---
{
"storage": {
"path": "/tmp",
"ledger_db_path": null,
"state_cache_size": null,
"user_commit_concurrency": null,
"user_hashtable_buckets": null,
"user_preallocate_ht": null,
"user_page_cache_size": null,
"user_leaf_cache_size": null,
"user_page_cache_upper_levels": null,
"kernel_commit_concurrency": null,
"kernel_hashtable_buckets": null,
"kernel_preallocate_ht": null,
"kernel_page_cache_size": null,
"kernel_leaf_cache_size": null,
"kernel_page_cache_upper_levels": null,
"pruner_block_interval": null,
"pruner_versions_to_keep": null,
"pruner_max_batch_size": null
},
"runner": {
"da_polling_interval_ms": 10000,
"http_config": {
"bind_host": "127.0.0.1",
"bind_port": 12346,
"public_address": "https://rollup.sovereign.xyz",
"trusted_proxies": [],
"cors": "restrictive"
},
"concurrent_sync_tasks": 18,
"pre_fetched_blocks_capacity": 20,
"save_tx_bodies": false
},
"da": {
"connection_string": "sqlite:///tmp/mockda.sqlite?mode=rwc",
"sender_address": "0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f",
"finalization_blocks": 0,
"block_producing": {
"periodic": {
"block_time_ms": 1000
}
},
"randomization": null,
"failure_behavior": "none"
},
"proof_manager": {
"aggregated_proof_block_jump": 22,
"prover_address": "sov1lzkjgdaz08su3yevqu6ceywufl35se9f33kztu5cu2spja5hyyf",
"max_number_of_transitions_in_db": 1025,
"max_number_of_transitions_in_memory": 768,
"eager_proof_submission": true
},
"sequencer": {
"automatic_batch_production": true,
"max_allowed_node_distance_behind": 5,
"dropped_tx_ttl_secs": 60,
"rollup_address": "sov1lzkjgdaz08su3yevqu6ceywufl35se9f33kztu5cu2spja5hyyf",
"admin_addresses": [],
"standard": {
"mempool_max_txs_count": null,
"max_batch_size_bytes": null
},
"max_batch_size_bytes": 1048576,
"max_concurrent_blobs": 16,
"blob_processing_timeout_secs": 60,
"extension": null
},
"monitoring": {
"telegraf_address": "udp://192.168.4.5:8543",
"max_datagram_size": 1024,
"max_pending_metrics": 2560,
"tokio_runtime_metrics_interval_millis": 500
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
source: crates/full-node/full-node-configs/src/runner.rs
assertion_line: 296
expression: config
---
{
"storage": {
"path": "/tmp",
"ledger_db_path": "/tmp/ledger-db",
"state_cache_size": null,
"user_commit_concurrency": null,
"user_hashtable_buckets": null,
"user_preallocate_ht": null,
"user_page_cache_size": null,
"user_leaf_cache_size": null,
"user_page_cache_upper_levels": null,
"kernel_commit_concurrency": null,
"kernel_hashtable_buckets": null,
"kernel_preallocate_ht": null,
"kernel_page_cache_size": null,
"kernel_leaf_cache_size": null,
"kernel_page_cache_upper_levels": null,
"pruner_block_interval": null,
"pruner_versions_to_keep": null,
"pruner_max_batch_size": null
},
"runner": {
"da_polling_interval_ms": 10000,
"http_config": {
"bind_host": "127.0.0.1",
"bind_port": 12346,
"public_address": "https://rollup.sovereign.xyz",
"trusted_proxies": [],
"cors": "restrictive"
},
"concurrent_sync_tasks": 18,
"pre_fetched_blocks_capacity": 20,
"save_tx_bodies": false
},
"da": {
"connection_string": "sqlite:///tmp/mockda.sqlite?mode=rwc",
"sender_address": "0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f",
"finalization_blocks": 0,
"block_producing": {
"periodic": {
"block_time_ms": 1000
}
},
"randomization": null,
"failure_behavior": "none"
},
"proof_manager": {
"aggregated_proof_block_jump": 22,
"prover_address": "sov1lzkjgdaz08su3yevqu6ceywufl35se9f33kztu5cu2spja5hyyf",
"max_number_of_transitions_in_db": 1025,
"max_number_of_transitions_in_memory": 768,
"eager_proof_submission": true
},
"sequencer": {
"automatic_batch_production": true,
"max_allowed_node_distance_behind": 5,
"dropped_tx_ttl_secs": 60,
"rollup_address": "sov1lzkjgdaz08su3yevqu6ceywufl35se9f33kztu5cu2spja5hyyf",
"admin_addresses": [],
"preferred": {
"minimum_profit_per_tx": 0,
"events_channel_size": 10000,
"postgres_config": {
"postgres_connection_string": "postgresql://postgres:pass@localhost:5432/db",
"node_id": "node_1",
"node_role": "Leader",
"leader_election": {
"leader_timeout_millis": 500,
"grace_period_millis": 10000,
"heartbeat_interval_millis": 100
}
},
"disable_state_root_consistency_checks": true,
"ideal_lag_behind_finalized_slot": 3,
"db_event_channel_size": 10000,
"recovery_strategy": "TryToSave",
"batch_execution_time_limit_millis": 2000,
"num_cache_warmup_workers": 0,
"rate_limiter": null,
"maximum_future_nonce_delta": 100,
"future_nonce_transaction_timeout_millis": 2000
},
"max_batch_size_bytes": 1048576,
"max_concurrent_blobs": 16,
"blob_processing_timeout_secs": 60,
"extension": null
},
"monitoring": {
"telegraf_address": "udp://192.168.4.5:8543",
"max_datagram_size": 1024,
"max_pending_metrics": 2560,
"tokio_runtime_metrics_interval_millis": 500
}
}
Loading
Loading