Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support custom seconds per slot and slots per epoch #97

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cbermudez97
Copy link

Load SLOTS_PER_EPOCH and SECONDS_PER_SLOT specification params from Beacon API instead of using constants. This change gives support for Gnosis Chain based networks.

@@ -20,6 +20,7 @@ def process_future_blocks_proposal(
our_pubkeys: set[str],
slot: int,
is_new_epoch: bool,
slots_per_epoch: int = NB_SLOT_PER_EPOCH,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It'd be better to not default to something here and unconditionally use the value from the spec ; happy to do a pass on top of your PR to force this parameter :)

@@ -29,6 +29,7 @@ def process_suboptimal_attestations(
block: Block,
slot: int,
our_active_validators_index_to_validator: dict[int, Validators.DataItem.Validator],
slots_per_epoch: int = NB_SLOT_PER_EPOCH,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ditto

next_slot = int((time() - genesis_time_sec) / NB_SECOND_PER_SLOT) + 1
def slots(
genesis_time_sec: int,
seconds_per_slot: int = NB_SECOND_PER_SLOT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ditto

@aimxhaisse
Copy link
Member

Thanks a lot for your contribution and sorry for the delay on this review; happy to help with the comments / help moving this forward :)

@aimxhaisse
Copy link
Member

Just a quick update here, I'm revamping part of the watcher in #93 ; part of it introduces a configuration file and the seconds_per_slots will be configurable

@aimxhaisse
Copy link
Member

Just a quick note here: next version of the watcher (beta) polls the slot time from the ethereum specs of the beacon, so it will adapt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants