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

Add EIP-7805 (FOCIL) specs #4003

Open
wants to merge 45 commits into
base: dev
Choose a base branch
from

Conversation

terencechain
Copy link
Contributor

@terencechain terencechain commented Nov 4, 2024

This PR introduces a preliminary version of the EIP-7805 consensus specs, covering the beacon chain, fork choice, and validator. While there are still open questions regarding the consensus design, we believe it's early enough to open this up for broader community feedback. Major credit to @soispoke, @fradamt, @Ma-Julian, @jihoonsong, and everyone else who provided feedback along the way

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

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

Some comments from an initial skim.

specs/_features/eip7805/beacon-chain.md Outdated Show resolved Hide resolved
specs/_features/eip7805/fork-choice.md Outdated Show resolved Hide resolved
specs/_features/eip7805/fork-choice.md Outdated Show resolved Hide resolved
specs/_features/eip7805/fork-choice.md Outdated Show resolved Hide resolved
specs/_features/eip7805/beacon-chain.md Outdated Show resolved Hide resolved
specs/_features/eip7805/p2p-interface.md Outdated Show resolved Hide resolved
specs/_features/eip7805/validator.md Outdated Show resolved Hide resolved
specs/_features/eip7805/validator.md Outdated Show resolved Hide resolved
specs/_features/eip7805/validator.md Outdated Show resolved Hide resolved
specs/_features/eip7805/p2p-interface.md Outdated Show resolved Hide resolved
specs/_features/eip7805/beacon-chain.md Outdated Show resolved Hide resolved
specs/_features/eip7805/beacon-chain.md Outdated Show resolved Hide resolved
specs/_features/eip7805/validator.md Outdated Show resolved Hide resolved
specs/_features/eip7805/validator.md Outdated Show resolved Hide resolved
specs/_features/eip7805/fork-choice.md Outdated Show resolved Hide resolved
specs/_features/eip7805/fork-choice.md Outdated Show resolved Hide resolved
inclusion_list_committee: Vector[ValidatorIndex, IL_COMMITTEE_SIZE]]) -> None:
"""
``on_inclusion_list`` verify the inclusion list before importing it to fork choice store.
If there exists more than 1 inclusion list in store with the same slot and validator index, remove the original one.
Copy link
Member

@jtraglia jtraglia Nov 5, 2024

Choose a reason for hiding this comment

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

I believe this is an out-of-date comment. Where is "remove the original one" happening exactly? It appears that it adds the validator to inclusion_list_equivocators instead now.

Copy link
Contributor

@ensi321 ensi321 Nov 8, 2024

Choose a reason for hiding this comment

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

I believe this is an out-of-date comment. Where is "remove the original one" happening exactly? It appears that it adds the validator to inclusion_list_equivocators instead now.

I thought it's the other way around?

p2p only accepts an IL if it's the first or second IL broadcasted by the peer.

The responsibility of picking out the equivocators should be on the p2p side. Beacon node just replace the first IL with the second IL if that happens

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The comments are outdated, and different client implementations may handle this differently. Essentially, we want to:

  • Cache at least one inclusion list
  • Re-broadcast up to two inclusion lists over P2P
  • Track which inclusion lists have been equivocated (e.g., identify the specific validator)
  • When calling the EL to validate inclusion lists, ignore those that have been equivocated (discard them from being sent to the EL)
  • Regarding whether to prioritize the first or second inclusion list, I'm leaning towards the first as it seems simpler

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is outdated, yeah. It doesn't really matter which one we keep, we could also not keep either since anyway we ignore them once we know that it is an equivocation. For spec simplicity it seemed easier to just not do anything instead of removing, and also perhaps it makes sense to keep the first, just because if you're the builder you would probably rather use it even if there's an equivocation, just in case, and you'd rather use the first since you saw it earlier and from your perspective it is more likely to be enforced by someone

specs/_features/eip7805/fork-choice.md Outdated Show resolved Hide resolved

This topic is used to propagate signed inclusion list as `SignedInclusionList`.
The following validations MUST pass before forwarding the `inclusion_list` on the network, assuming the alias `message = signed_inclusion_list.message`:

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't we also limiting IL size by MAX_BYTES_PER_INCLUSION_LIST = 8192 bytes as indicated in the EIP?


#### Messages

##### InclusionListByCommitteeIndices v1
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need another endpoint like InclusionListByRange since recently joined nodes need to request past ILs to sync blocks since the last checkpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not. Inclusion lists only matter for the current slot. When a node is syncing blocks from past slots, the inclusion list check can be skipped

Co-authored-by: Justin Traglia <[email protected]>
add MAX_BYTES_PER_INCLUSION_LIST, fix the related check

- _[REJECT]_ The size of `message` is within upperbound `MAX_BYTES_PER_INCLUSION_LIST`.
- _[REJECT]_ The slot `message.slot` is equal to the previous or current slot.
- _[IGNORE]_ The slot `message.slot` is equal to the current slot, or it is equal to the previous slot and the current time is less than `attestation_deadline` seconds into the slot.

Choose a reason for hiding this comment

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

Suggested change
- _[IGNORE]_ The slot `message.slot` is equal to the current slot, or it is equal to the previous slot and the current time is less than `attestation_deadline` seconds into the slot.
- _[IGNORE]_ The slot `message.slot` is equal to the previous slot and the current time is less than `attestation_deadline` seconds into the slot.

ensure valid committee with <16 validators
@nflaig nflaig mentioned this pull request Jan 9, 2025
37 tasks
specs/_features/eip7805/beacon-chain.md Outdated Show resolved Hide resolved
specs/_features/eip7805/validator.md Outdated Show resolved Hide resolved

Some validators are selected to submit signed inclusion list. Validators should call `get_inclusion_committee_assignment` at the beginning of an epoch to be prepared to submit their inclusion list during the next epoch.

A validator should create and broadcast the `signed_inclusion_list` to the global `inclusion_list` subnet by `PROPOSER_INCLUSION_LIST_CUT_OFF` seconds into the slot, unless a block for the current slot has been processed and is the head of the chain and broadcast to the network.
Copy link
Member

Choose a reason for hiding this comment

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

In FOCIL CL & EL workflow there is the following note

If no block is received by t = 8s, they should run get_head and build and release their local ILs based on their node’s canonical head.

Is this something that should be part of the spec or up to the implementation when it should start building the IL on the block of previous slot?

Choose a reason for hiding this comment

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

Same logic, but you should use the EIP as a reference with the following timings:

Slot N, t=0 to 8s: IL committee members construct their ILs by including transactions pending in the public mempool, and broadcast them over the P2P network after processing the block for slot N and confirming it as the head. If no block is received by t=7s, they should run get_head and build and release their ILs based on the node’s local head.

Choose a reason for hiding this comment

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


#### Update execution client with inclusion lists

The proposer should call `engine_updateInclusionListV1` at `PROPOSER_INCLUSION_LIST_CUT_OFF` into the slot with the list of the inclusion lists that gathered since `PROPOSER_INCLUSION_LIST_CUT_OFF`.
Copy link
Member

@nflaig nflaig Jan 14, 2025

Choose a reason for hiding this comment

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

@jtraglia shouldn't this say something like "up to" instead of "since"? I think this is related to https://github.com/ethereum/consensus-specs/pull/4003/files#r1912551318, there is no specific time when we start to build the inclusion list as it depends on when the node receives the block or some other cutoff we might wanna define if the block for current slot is late.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, "up to" is correct. Thanks I'll make that change.

And hmm. Would a late block change this? Wouldn't we always build the IL at PROPOSER_INCLUSION_LIST_CUT_OFF (11) seconds into the slot?

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't we always build the IL at PROPOSER_INCLUSION_LIST_CUT_OFF (11) seconds into the slot?

Yes, the cutoff for the proposer is always the same. The other cutoff I mean is for IL committee members but this one does not matter for the proposer as it would just collect all ILs it received for the slot until PROPOSER_INCLUSION_LIST_CUT_OFF

Copy link
Member

Choose a reason for hiding this comment

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

Ah got it. Well I will leave it to someone else (maybe @terencechain) to clarify.

Choose a reason for hiding this comment

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

To clarify: The proposer cutoff is always the same (11sec), but for IL committee members:

  • They receive a block, and can build their ILs right after they saw it
  • They don't receive a block until 7s, in which case they should run get_head and build and release their ILs based on the node’s local head, so they can propagate their ILs to the rest of the network before their stop doing so (at 8s).

The rest of validators (not the proposer, and not IL committee members) have the freeze deadline cutoff 1sec later, at 9s, at which point they stop storing new ILs.


| Name | Value | Unit | Duration |
| - | - | :-: | :-: |
| `ATTESTATION_DEADLINE` | `uint64(4)` | seconds | 4 seconds |
Copy link
Member

Choose a reason for hiding this comment

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

should time parameters be defined as a fraction of SECONDS_PER_SLOT instead, or do we just define them as part of presets to work with minimal as well?

Copy link
Member

Choose a reason for hiding this comment

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

Oh you're right, this wouldn't work with minimal... I'll look into the best way to handle this later.

Copy link
Member

Choose a reason for hiding this comment

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

Is the solution something as simple as this?

Suggested change
| `ATTESTATION_DEADLINE` | `uint64(4)` | seconds | 4 seconds |
| `ATTESTATION_DEADLINE` | `SECONDS_PER_SLOT // 3` | seconds | 4 seconds |

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that would work here. But not for other time values like:

| `PROPOSER_INCLUSION_LIST_CUT_OFF` | `uint64(11)` | seconds | 11 seconds |

Maybe that could be SECONDS_PER_SLOT - 1 instead.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @bleesherman. I've done just that. Please see: 7a2cb7a

Copy link
Member

Choose a reason for hiding this comment

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

Thinking about this more, not sure if having those values defined in preset will get us where we want as during testing we might use mainnet preset and just reduce seconds per slot. This would also make reducing seconds per slot in the future harder as you need to update a bunch of time parameters. But this might be something to worry about later

Copy link
Member

Choose a reason for hiding this comment

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

To be clear, these are configuration values now. As of that commit I shared.

Copy link
Member

Choose a reason for hiding this comment

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

Might be specific to how we handle this in Lodestar but even if it's part of config we can't derive the value from SECONDS_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.

Ah dang. Well I suppose clients could use the values without deriving them.

ATTESTATION_DEADLINE: 4
PROPOSER_INCLUSION_LIST_CUT_OFF: 11
VIEW_FREEZE_DEADLINE: 9

ATTESTATION_DEADLINE: 2
PROPOSER_INCLUSION_LIST_CUT_OFF: 5
VIEW_FREEZE_DEADLINE: 3

Copy link
Member

Choose a reason for hiding this comment

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

Well I suppose clients could use the values without deriving them.

That's what I did for now but will break if we change seconds per slot with mainnet config but it's possible to adapt these values as well now since we have them in config

@ethereum ethereum deleted a comment from cheyenne-bot Jan 24, 2025
@ethereum ethereum deleted a comment from cheyenne-bot Jan 24, 2025
@ethereum ethereum deleted a comment from cheyenne-bot Jan 24, 2025
@ethereum ethereum deleted a comment from cheyenne-bot Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.