Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Overrides layer for the `testing/all-constructs` overlay (hybrid layout).
//
// `all-constructs` is a STRUCTURE-validation stub: the cdk8s synth it feeds is only `kubectl
// validate`d for manifest structure, never for config content. Its YAML `config.sequencerConfig`
// carries no real applicative values (only `components.fake_field`, which folds away). Native synth,
// however, hard-requires the per-environment `overrides.*` reads that `applicative_config.libsonnet`
// performs unconditionally and that the base `common` layer does not already supply (every service's
// component config is assembled, including the l1/batcher/state-sync paths). This layer supplies the
// minimum for `build()` to succeed with clearly-dummy values; NONE of these values are deployed
// anywhere, so they are immaterial.
//
// Because this layer intentionally carries fields its YAMLs lack, it is NOT subject to the strict
// per-layer YAML-mirror invariant the env/dummy layers obey; the regression test for it only asserts
// that native synth succeeds (see `test_all_constructs_native_config_synthesizes`).
{
chain_id: 'SN_DUMMY',
native_classes_whitelist: 'All',
recorder_url: 'http://dummy-recorder/',
starknet_url: 'http://dummy-starknet/',
validator_id: '0x64',

base_layer_config: {
bpo1_start_block_number: 0,
bpo2_start_block_number: 0,
fusaka_no_bpo_start_block_number: 0,
starknet_contract_address: '0x0',
},

batcher_config: {
dynamic_config: {
n_concurrent_txs: 1,
},
static_config: {
block_builder_config: {
bouncer_config: {
block_max_capacity: {
state_diff_size: 4000,
},
},
execute_config: {
n_workers: 1,
},
},
first_block_with_partial_block_hash: null,
},
},

committer_config: {
storage_config: {
cache_size: 1000000,
},
},

consensus_manager_config: {
context_config: {
dynamic_config: {
min_l2_gas_price_per_height: '',
},
},
network_config: {
advertised_multiaddr: null,
bootstrap_peer_multiaddr: null,
},
staking_manager_config: {
dynamic_config: {
default_committee: '0,10:0x64,1,0x1,true',
},
},
},

gateway_config: {
static_config: {
proof_archive_writer_config: {
bucket_name: '',
},
},
},

mempool_p2p_config: {
network_config: {
advertised_multiaddr: null,
bootstrap_peer_multiaddr: null,
},
},

sierra_compiler_config: {
audited_libfuncs_only: false,
},

state_sync_config: {
static_config: {
central_sync_client_config: null,
network_config: null,
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
// Overrides layer for the `testing/node-0` overlay (hybrid layout).
// Full value-parity translation of the combined `config.sequencerConfig` across this overlay's
// `common.yaml` + `services/*.yaml` (folded: `#is_none` applied, `components.*` dropped). This is a
// FUNCTIONAL overlay deployed live by `hybrid_system_test.yaml`, so the values are load-bearing and
// must stay byte-for-byte aligned with the YAMLs (enforced by `test_native_config.py`).
{
chain_id: 'CHAIN_ID_SUBDIR',
eth_fee_token_address: '0x1001',
native_classes_whitelist: 'All',
recorder_url: 'http://dummy-recorder-service.dummy-recorder.svc.cluster.local:8080',
starknet_url: 'https://integration-sepolia.starknet.io/',
strk_fee_token_address: '0x1002',
validator_id: '0x64',
versioned_constants_overrides: null,

base_layer_config: {
bpo1_start_block_number: 13205504,
bpo2_start_block_number: 13410304,
fusaka_no_bpo_start_block_number: 13164544,
starknet_contract_address: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
},

batcher_config: {
dynamic_config: {
n_concurrent_txs: 100,
proposer_idle_detection_delay_millis: 2000,
},
static_config: {
block_builder_config: {
bouncer_config: {
block_max_capacity: {
n_events: 5000,
receipt_l2_gas: 5800000000,
state_diff_size: 4000,
},
},
execute_config: {
n_workers: 28,
},
},
first_block_with_partial_block_hash: null,
},
},

class_manager_config: {
static_config: {
class_manager_config: {
max_compiled_contract_class_object_size: 4089446,
},
},
},

committer_config: {
storage_config: {
cache_size: 1000000,
inner_storage_config: {
cache_size: 8589934592,
},
},
verify_state_diff_hash: true,
},

consensus_manager_config: {
consensus_manager_config: {
dynamic_config: {
require_virtual_proposer_vote: false,
timeouts: {
proposal: {
base: 9.1,
max: 15.0,
},
},
},
},
context_config: {
dynamic_config: {
build_proposal_margin_millis: 1000,
compare_retrospective_block_hash: false,
min_l2_gas_price_per_height: '',
override_eth_to_fri_rate: null,
override_l1_data_gas_price_fri: null,
override_l1_gas_price_fri: null,
override_l2_gas_price_fri: null,
},
},
network_config: {
advertised_multiaddr: null,
bootstrap_peer_multiaddr: null,
port: 53080,
},
staking_manager_config: {
dynamic_config: {
default_committee: '0,100:0x64,1,0x1,true',
override_committee: null,
},
},
},

gateway_config: {
static_config: {
authorized_declarer_accounts: null,
proof_archive_writer_config: {
bucket_name: '',
},
stateful_tx_validator_config: {
max_allowed_nonce_gap: 200,
},
stateless_tx_validator_config: {
max_contract_bytecode_size: 81920,
min_gas_price: 3000000000,
},
},
},

http_server_config: {
static_config: {
port: 8080,
},
},

mempool_config: {
dynamic_config: {
transaction_ttl: 300,
},
},

mempool_p2p_config: {
network_config: {
advertised_multiaddr: null,
bootstrap_peer_multiaddr: null,
port: 53200,
},
},

monitoring_endpoint_config: {
port: 8082,
},

sierra_compiler_config: {
audited_libfuncs_only: false,
max_bytecode_size: 81920,
},

state_sync_config: {
static_config: {
central_sync_client_config: null,
network_config: {
port: 55010,
},
rpc_config: {
port: 8090,
},
},
},
}
40 changes: 39 additions & 1 deletion deployments/sequencer/test/test_native_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

import _jsonnet
import yaml
from src.config.native import JSONNET_DIR, deep_merge_preserving_null
from src.config.native import JSONNET_DIR, build_native_config, deep_merge_preserving_null

DEPLOYMENTS_SEQUENCER = Path(__file__).resolve().parents[1]

LAYOUT = "hybrid"
CORE_SERVICE = "core"

# Per-layer override-file dirs: each layer holds a `sequencer_config.jsonnet` that must mirror the
# combined `config.sequencerConfig` of the YAMLs in the same dir (see
Expand All @@ -26,6 +27,13 @@
SEPOLIA_ALPHA_LAYER_DIR = HYBRID_OVERLAYS_DIR / "sepolia-alpha"
MAINNET_LAYER_DIR = HYBRID_OVERLAYS_DIR / "mainnet"
DUMMY_FOR_TESTING_LAYER_DIR = HYBRID_OVERLAYS_DIR / "common" / "dummy_for_testing"
# Functional testing overlay deployed live by `hybrid_system_test.yaml`; its native layer is a full
# value-parity translation of its YAMLs (subject to the strict YAML-mirror invariant below).
NODE0_LAYER_DIR = HYBRID_OVERLAYS_DIR / "testing" / "node-0"
# Structure-validation overlay (cdk8s `kubectl validate` only); its native layer is a synth-only stub
# carrying dummy `overrides.*` values its YAMLs lack, so it is NOT a YAML-mirror layer (see
# `test_all_constructs_native_config_synthesizes`).
ALL_CONSTRUCTS_OVERLAYS = ["hybrid.testing.all-constructs"]


def test_deep_merge_preserves_explicit_null():
Expand Down Expand Up @@ -195,3 +203,33 @@ def test_dummy_for_testing_layer_jsonnet_mirrors_combined_yaml():
mirror the combined YAMLs like the env layers do.
"""
_assert_layer_jsonnet_mirrors_combined_yaml(DUMMY_FOR_TESTING_LAYER_DIR)


def test_node0_layer_jsonnet_mirrors_combined_yaml():
"""REGRESSION: same invariant for the `testing/node-0` overlay layer.

`node-0` is a FUNCTIONAL overlay deployed live by `hybrid_system_test.yaml`, so its native
override jsonnet is a full value-parity translation of its YAMLs and must mirror the combined
`config.sequencerConfig` (folded) exactly, like the env layers do.
"""
_assert_layer_jsonnet_mirrors_combined_yaml(NODE0_LAYER_DIR)


def test_all_constructs_native_config_synthesizes():
"""REGRESSION: the `testing/all-constructs` overlay synthesizes a native config.

Unlike the env/dummy layers, `all-constructs` is a STRUCTURE-validation stub: its cdk8s output is
only `kubectl validate`d for manifest structure, never for config content, and its YAML
`config.sequencerConfig` folds to empty. It is therefore NOT a YAML-mirror layer; its native
layer instead supplies the minimum dummy `overrides.*` values `build()` reads unconditionally. The
only invariant we assert is that native synth SUCCEEDS and yields a nested config (the CI
`sequencer_cdk8s-test.yml` job synths this overlay under `--config-format native`).
"""
native_nested = build_native_config(
service_name=CORE_SERVICE,
layout=LAYOUT,
overlays=ALL_CONSTRUCTS_OVERLAYS,
)
assert isinstance(native_nested, dict) and native_nested
# A nested SequencerNodeConfig (not the flat dotted preset form): top-level component sections.
assert any(isinstance(value, dict) for value in native_nested.values())
Loading