EIP-7805 -- The Beacon Chain
Introduction
This is the beacon chain specification to add EIP-7805 / fork-choice enforced,
committee-based inclusion list (FOCIL) mechanism to allow forced transaction
inclusion. Refers to the following posts:
Constants
Domain types
Name |
Value |
DOMAIN_INCLUSION_LIST_COMMITTEE |
DomainType('0x0C000000') |
Preset
Inclusion List Committee
Name |
Value |
INCLUSION_LIST_COMMITTEE_SIZE |
uint64(2**4) (=16) |
Containers
New containers
InclusionList
| class InclusionList(Container):
slot: Slot
validator_index: ValidatorIndex
inclusion_list_committee_root: Root
transactions: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
|
SignedInclusionList
| class SignedInclusionList(Container):
message: InclusionList
signature: BLSSignature
|
Helper functions
Predicates
New is_valid_inclusion_list_signature
| def is_valid_inclusion_list_signature(
state: BeaconState, signed_inclusion_list: SignedInclusionList
) -> bool:
"""
Check if ``signed_inclusion_list`` has a valid signature.
"""
message = signed_inclusion_list.message
index = message.validator_index
pubkey = state.validators[index].pubkey
domain = get_domain(state, DOMAIN_INCLUSION_LIST_COMMITTEE, compute_epoch_at_slot(message.slot))
signing_root = compute_signing_root(message, domain)
return bls.Verify(pubkey, signing_root, signed_inclusion_list.signature)
|
Beacon State accessors
New get_inclusion_list_committee
| def get_inclusion_list_committee(
state: BeaconState, slot: Slot
) -> Vector[ValidatorIndex, INCLUSION_LIST_COMMITTEE_SIZE]:
epoch = compute_epoch_at_slot(slot)
seed = get_seed(state, epoch, DOMAIN_INCLUSION_LIST_COMMITTEE)
indices = get_active_validator_indices(state, epoch)
start = (slot % SLOTS_PER_EPOCH) * INCLUSION_LIST_COMMITTEE_SIZE
end = start + INCLUSION_LIST_COMMITTEE_SIZE
return Vector[ValidatorIndex, INCLUSION_LIST_COMMITTEE_SIZE](
[
indices[compute_shuffled_index(uint64(i % len(indices)), uint64(len(indices)), seed)]
for i in range(start, end)
]
)
|