Skip to content

Commit

Permalink
refactor: remove slots per epoch (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Oct 11, 2023
1 parent aabb9ad commit df27a8e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 27 deletions.
9 changes: 4 additions & 5 deletions .circleci/tests/nimbus-mev.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
{
"participants": [{
"el_client_type": "geth",
"cl_client_type": "nimbus"
}],
}],
"network_params": {
"network_id": "3151908",
"deposit_contract_address": "0x4242424242424242424242424242424242424242",
"seconds_per_slot": 12,
"slots_per_epoch": 32,
"num_validator_keys_per_node": 64,
"preregistered_validator_keys_mnemonic": "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete",
"capella_fork_epoch": 1
},
},
"global_client_log_level": "info",
"mev_type": "full"
}
}
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ To configure the package behaviour, you can modify your `network_params.json` fi
// Number of seconds per slot on the Beacon chain
"seconds_per_slot": 12,

// Number of slots in an epoch on the Beacon chain
"slots_per_epoch": 32,

// The number of validator keys that each CL validator node should get
"num_validator_keys_per_node": 64,

Expand Down
3 changes: 0 additions & 3 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def run(plan, args={}):
genesis_validators_root,
builder_uri,
network_params.seconds_per_slot,
network_params.slots_per_epoch,
)
mev_flood_module.spam_in_background(
plan,
Expand Down Expand Up @@ -237,7 +236,6 @@ def run(plan, args={}):
all_cl_client_contexts[0],
network_params.deneb_fork_epoch,
network_params.seconds_per_slot,
network_params.slots_per_epoch,
network_params.genesis_delay,
)
plan.print("Succesfully launched blob spammer")
Expand All @@ -249,7 +247,6 @@ def run(plan, args={}):
genesis_constants.PRE_FUNDED_ACCOUNTS,
all_el_client_contexts,
all_cl_client_contexts[0],
network_params.slots_per_epoch,
goomy_blob_params,
)
plan.print("Succesfully launched goomy the blob spammer")
Expand Down
1 change: 0 additions & 1 deletion network_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"network_id": "3151908",
"deposit_contract_address": "0x4242424242424242424242424242424242424242",
"seconds_per_slot": 12,
"slots_per_epoch": 32,
"num_validator_keys_per_node": 64,
"preregistered_validator_keys_mnemonic": "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete",
"genesis_delay": 120,
Expand Down
5 changes: 1 addition & 4 deletions src/blob_spammer/blob_spammer.star
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def launch_blob_spammer(
cl_client_context,
deneb_fork_epoch,
seconds_per_slot,
slots_per_epoch,
genesis_delay,
):
config = get_config(
Expand All @@ -20,7 +19,6 @@ def launch_blob_spammer(
cl_client_context,
deneb_fork_epoch,
seconds_per_slot,
slots_per_epoch,
genesis_delay,
)
plan.add_service(SERVICE_NAME, config)
Expand All @@ -32,10 +30,9 @@ def get_config(
cl_client_context,
deneb_fork_epoch,
seconds_per_slot,
slots_per_epoch,
genesis_delay,
):
dencunTime = (deneb_fork_epoch * slots_per_epoch * seconds_per_slot) + genesis_delay
dencunTime = (deneb_fork_epoch * 32 * seconds_per_slot) + genesis_delay
return ServiceConfig(
image=IMAGE_NAME,
entrypoint=ENTRYPOINT_ARGS,
Expand Down
2 changes: 0 additions & 2 deletions src/mev_relay/mev_relay_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def launch_mev_relay(
validator_root,
builder_uri,
seconds_per_slot,
slots_per_epoch=32,
):
redis = redis_module.run(plan)
# making the password postgres as the relay expects it to be postgres
Expand All @@ -50,7 +49,6 @@ def launch_mev_relay(
"DENEB_FORK_VERSION": "0x50000038",
"GENESIS_VALIDATORS_ROOT": validator_root,
"SEC_PER_SLOT": str(seconds_per_slot),
"SLOTS_PER_EPOCH": str(slots_per_epoch),
}

redis_url = "{}:{}".format(redis.hostname, redis.port_number)
Expand Down
15 changes: 6 additions & 9 deletions src/package_io/parse_input.star
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ HIGH_DENEB_VALUE_FORK_VERKLE = 20000
FLASHBOTS_MEV_BOOST_PORT = 18550
MEV_BOOST_SERVICE_NAME_PREFIX = "mev-boost-"

# Minimum number of validators required for a network to be valid is 64
MIN_VALIDATORS = 64

DEFAULT_ADDITIONAL_SERVICES = [
"tx_spammer",
"blob_spammer",
Expand Down Expand Up @@ -139,7 +142,6 @@ def parse_input(plan, input_args):
"deposit_contract_address"
],
seconds_per_slot=result["network_params"]["seconds_per_slot"],
slots_per_epoch=result["network_params"]["slots_per_epoch"],
genesis_delay=result["network_params"]["genesis_delay"],
capella_fork_epoch=result["network_params"]["capella_fork_epoch"],
deneb_fork_epoch=result["network_params"]["deneb_fork_epoch"],
Expand Down Expand Up @@ -273,9 +275,6 @@ def parse_network_params(input_args):
"preregistered_validator_keys_mnemonic is empty or spaces it needs to be of non zero length"
)

if result["network_params"]["slots_per_epoch"] == 0:
fail("slots_per_epoch is 0 needs to be > 0 ")

if result["network_params"]["seconds_per_slot"] == 0:
fail("seconds_per_slot is 0 needs to be > 0 ")

Expand All @@ -295,15 +294,14 @@ def parse_network_params(input_args):
):
fail("electra can only happen with capella genesis not bellatrix")

required_num_validators = 2 * result["network_params"]["slots_per_epoch"]
actual_num_validators = (
total_participant_count
* result["network_params"]["num_validator_keys_per_node"]
)
if required_num_validators > actual_num_validators:
if MIN_VALIDATORS > actual_num_validators:
fail(
"required_num_validators - {0} is greater than actual_num_validators - {1}".format(
required_num_validators, actual_num_validators
"We require at least {0} validators but got {1}".format(
MIN_VALIDATORS, actual_num_validators
)
)

Expand Down Expand Up @@ -346,7 +344,6 @@ def default_network_params():
"network_id": "3151908",
"deposit_contract_address": "0x4242424242424242424242424242424242424242",
"seconds_per_slot": 12,
"slots_per_epoch": 32,
"genesis_delay": 120,
"capella_fork_epoch": 0,
"deneb_fork_epoch": 500,
Expand Down

0 comments on commit df27a8e

Please sign in to comment.