diff --git a/README.md b/README.md index 76fd8adea..7ffcced5e 100644 --- a/README.md +++ b/README.md @@ -580,6 +580,12 @@ network_params: # How long you want the network to wait before starting up genesis_delay: 20 + # Unix timestamp for genesis. If specified (non-zero), this overrides genesis_delay. + # When set to 0 (default), the genesis time is automatically calculated based on current time and genesis_delay. + # Use this field to set a specific genesis time for the network. + # Defaults to 0 + genesis_time: 0 + # The gas limit of the network set at genesis # Defaults to 60000000 diff --git a/network_params.yaml b/network_params.yaml index 52e1585b5..1ae668bde 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -82,6 +82,7 @@ network_params: very lucky have athlete" preregistered_validator_count: 0 genesis_delay: 20 + genesis_time: 0 genesis_gaslimit: 60000000 max_per_epoch_activation_churn_limit: 8 churn_limit_quotient: 65536 diff --git a/src/network_launcher/kurtosis.star b/src/network_launcher/kurtosis.star index 841f077bf..2d4b28c37 100644 --- a/src/network_launcher/kurtosis.star +++ b/src/network_launcher/kurtosis.star @@ -41,11 +41,16 @@ def launch( plan.print(json.indent(json.encode(validator_data))) # We need to send the same genesis time to both the EL and the CL to ensure that timestamp based forking works as expected - final_genesis_timestamp = shared_utils.get_final_genesis_timestamp( - plan, - network_params.genesis_delay - + CL_GENESIS_DATA_GENERATION_TIME - + num_participants * CL_NODE_STARTUP_TIME, + # If genesis_time is specified (non-zero), use it; otherwise, derive it from genesis_delay + final_genesis_timestamp = ( + str(network_params.genesis_time) + if network_params.genesis_time > 0 + else shared_utils.get_final_genesis_timestamp( + plan, + network_params.genesis_delay + + CL_GENESIS_DATA_GENERATION_TIME + + num_participants * CL_NODE_STARTUP_TIME, + ) ) # if preregistered validator count is 0 (default) then calculate the total number of validators from the participants diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 3eae00830..c3d563975 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -418,6 +418,7 @@ def input_parser(plan, input_args): seconds_per_slot=result["network_params"]["seconds_per_slot"], slot_duration_ms=result["network_params"]["slot_duration_ms"], genesis_delay=result["network_params"]["genesis_delay"], + genesis_time=result["network_params"]["genesis_time"], genesis_gaslimit=result["network_params"]["genesis_gaslimit"], max_per_epoch_activation_churn_limit=result["network_params"][ "max_per_epoch_activation_churn_limit" @@ -1151,6 +1152,7 @@ def default_network_params(): "preregistered_validator_keys_mnemonic": constants.DEFAULT_MNEMONIC, "preregistered_validator_count": 0, "genesis_delay": 20, + "genesis_time": 0, "genesis_gaslimit": 60000000, "max_per_epoch_activation_churn_limit": 8, "churn_limit_quotient": 65536, @@ -1232,6 +1234,7 @@ def default_minimal_network_params(): "preregistered_validator_keys_mnemonic": constants.DEFAULT_MNEMONIC, "preregistered_validator_count": 0, "genesis_delay": 20, + "genesis_time": 0, "genesis_gaslimit": 60000000, "max_per_epoch_activation_churn_limit": 4, "churn_limit_quotient": 32, diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index 1cf25c37f..3a98ebd33 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -198,6 +198,7 @@ SUBCATEGORY_PARAMS = { "preregistered_validator_keys_mnemonic", "preregistered_validator_count", "genesis_delay", + "genesis_time", "genesis_gaslimit", "max_per_epoch_activation_churn_limit", "churn_limit_quotient",