Skip to content

Comments

swap parent_root for il_committee_root and introduce timing logic#6

Merged
terencechain merged 3 commits intoterencechain:focilfrom
fradamt:focil-patch
Oct 29, 2024
Merged

swap parent_root for il_committee_root and introduce timing logic#6
terencechain merged 3 commits intoterencechain:focilfrom
fradamt:focil-patch

Conversation

@fradamt
Copy link

@fradamt fradamt commented Oct 23, 2024

No description provided.

store: Store, signed_inclusion_list: SignedInclusionList) -> None:
store: Store,
signed_inclusion_list: SignedInclusionList,
inclusion_list_committee: Vector[ValidatorIndex, IL_COMMITTEE_SIZE]]) -> None:

Choose a reason for hiding this comment

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

Suggested change
inclusion_list_committee: Vector[ValidatorIndex, IL_COMMITTEE_SIZE]]) -> None:
inclusion_list_committee: List[ValidatorIndex, IL_COMMITTEE_SIZE]]) -> None:

Copy link
Owner

Choose a reason for hiding this comment

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

I believe Vector is right here

Choose a reason for hiding this comment

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

What's difference between Vector and List? Is the Vector from Numpy?

Copy link
Owner

Choose a reason for hiding this comment

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

nope, these are ssz types: https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md
we want a fixed list here

| Name | Value | Unit | Duration |
| - | - | :-: | :-: |
| `inclusion_list_CUT_OFF` | `uint64(9)` | seconds | 9 seconds |
| `attestation_deadline` | `uint64(4)` | seconds | 4 seconds |

Choose a reason for hiding this comment

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

Is this better to be capitalized? Besides, do we want to rename PROPOSER_INCLUSION_LIST_CUT_OFF using DEADLINE for better consistency?

if validator_index in [il.validator_index for il in inclusion_lists[(message.slot, root)]]
il = [il for il in inclusion_lists[(message.slot, root)] if il.validator_index == validator_index][0]
if not il == message:
# We have equivocation evidence for `validator_index`, record it as equivocator

Choose a reason for hiding this comment

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

Do we want to remove il from inclusion_lists[(message.slot, root)] following the description at L72?

Copy link
Owner

Choose a reason for hiding this comment

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

The comment is outdated, as that's the old design. This new design uses inclusion_list_equivocators so no longer required to remove inclusion_lists

# Verify inclusion list slot is bounded to the current slot
assert get_current_slot(store) == message.slot
# Verify inclusion list slot is either from the current or previous slot
assert get_current_slot(store) in [message.slot, message.slot + 1]

Choose a reason for hiding this comment

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

wouldn't it be message.slot - 1 if it's from either the current or the previous slot?

Choose a reason for hiding this comment

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

If message is from previous slot, message.slot + 1 == get_current_slot(store).

Choose a reason for hiding this comment

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

ah right that makes sense :)

process_slots(state, message.slot)
inclusion_list_committee = get_inclusion_list_committee(state, message.slot)
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT

Choose a reason for hiding this comment

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

wouldn't it be easier to define the attestation deadline like this?

ATTESTATION_DEADLINE = uint64(4)  # seconds
is_before_attestation_deadline = time_into_slot < ATTESTATION_DEADLINE

# If the inclusion list is from the previous slot, ignore it if already past the attestation deadline
if get_current_slot(store) == message.slot + 1:
    assert is_before_attestation_deadline

Copy link
Owner

Choose a reason for hiding this comment

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

I dont think we want to hard code uint64(4), we want to use INTERVALS_PER_SLOT so it's not a breaking change to the spec if we were to adjust the interval deadlines later

is_before_freeze_deadline = get_current_slot(store) == message.slot and time_into_slot < VIEW_FREEZE_DEADLINE

# Do not process inclusion lists from known equivocators
if validator_index not in inclusion_list_equivocators[(message.slot, root)]:
Copy link

@soispoke soispoke Oct 23, 2024

Choose a reason for hiding this comment

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

I think here you might need to introduce a time window, so you only record equivocation evidence only if before the attestation deadline (t=4s)?

if validator_index not in inclusion_list_equivocators[(message.slot, root)]:
    if validator_index in [il.validator_index for il in inclusion_lists[(message.slot, root)]]:
        il = next(
            il for il in inclusion_lists[(message.slot, root)] if il.validator_index == validator_index
        )
        if il != message:
            # Record equivocation evidence if within the allowed time window
            if get_current_slot(store) <= message.slot + 1 and (
                get_current_slot(store) != message.slot + 1 or is_before_attestation_deadline
            ):
                inclusion_list_equivocators[(message.slot, root)].add(validator_index)
    else:
        # This inclusion list is not an equivocation. Store it if prior to the view freeze deadline
        if is_before_freeze_deadline:
            inclusion_lists[(message.slot, root)].append(message)

Copy link
Author

Choose a reason for hiding this comment

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

If it's after the attestation deadline, we won't even get here because of line 82

Co-authored-by: terence <terence@prysmaticlabs.com>
@terencechain terencechain merged commit 2861684 into terencechain:focil Oct 29, 2024
@fradamt fradamt deleted the focil-patch branch May 2, 2025 12:42
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.

4 participants