# Week2 Update ## Summary - Completed the first edition of proposal, and preliminary discussions with Mario and Saulius - Prepare the slide for EPF Day ## Dig deeper duties of roles in FOCIL According to the spec, I have sorted out the 6 duties of the following 4 roles. - Duties for validator - Look ahead Inclusion list committee assignment - Validate, store and forward signed inclusion list - Validate block with inclusion list txs - Duty for inclusion list committee - Build and gossip inclusion list - Duty for proposer/builder - Include inclusion list txs into Block - Duty for attester/sync committee - Vote block which include all inclusion list txs ### Validator duty flows #### Look ahead Inclusion list committee assignment ```mermaid sequenceDiagram participant Validator participant Controller participant OwnBeaconCommitteeMembers participant OwnSyncCommitteeSubscriptions participant SubnetService Validator->>Controller: preprocessed_state_at_current_slot() Controller-->>Validator: beacon_state par Beacon Committee Subscriptions Validator->>Validator: update_beacon_committee_subscriptions(beacon_state) activate Validator note right of Validator: Spawns a background task to compute<br/>subscriptions for future slots. Validator->>OwnBeaconCommitteeMembers: needs_to_compute_members_at_slot() OwnBeaconCommitteeMembers-->>Validator: true/false Validator->>OwnBeaconCommitteeMembers: get_or_init_at_slot(beacon_state) OwnBeaconCommitteeMembers-->>Validator: members Validator->>SubnetService: ToSubnetService::UpdateBeaconCommitteeSubscriptions deactivate Validator and Sync Committee Subscriptions Validator->>Validator: update_sync_committee_subscriptions(beacon_state) activate Validator Validator->>OwnSyncCommitteeSubscriptions: build(beacon_state) Validator->>OwnSyncCommitteeSubscriptions: take_epoch_subscriptions() OwnSyncCommitteeSubscriptions-->>Validator: subscriptions Validator->>SubnetService: ToSubnetService::UpdateSyncCommitteeSubscriptions deactivate Validator end ``` > inclusion list committee assignment should similar with beacon committee assignment but no need to update subnet subsciptions since it is a global topic #### Validate, store and forward signed inclusion list ```mermaid sequenceDiagram participant Libp2pService participant Network participant Slasher participant Sync participant ForkChoice Note over Libp2pService, Sync: System components running concurrently Libp2pService->>+Network: send(NetworkEvent::PubsubMessage(beacon_block)) Note over Network: Receives event from channel in run loop Network->>Network: handle_pubsub_message(beacon_block, source, message_id) opt Slasher service is configured Network->>+Slasher: send(P2pToSlasher::Block(beacon_block)) deactivate Slasher end Network->>+Sync: send(P2pToSync::GossipBlock(...)) deactivate Network Note over Sync: Receives message from channel Sync->>Sync: Perform initial validation Sync->>+ForkChoice: on_block(beacon_block) Note over ForkChoice: Validates block, runs fork choice rule, and imports block ForkChoice-->>Sync: Block processing result Note over Sync: Determines MessageAcceptance based on result Sync->>+Network: send(SyncToP2p::Report(gossip_id, outcome)) deactivate Sync Note over Network: Receives report from channel in run loop Network->>Network: report_outcome(gossip_id, outcome) Network->>Libp2pService: send(ServiceInboundMessage::ReportOutcome(...)) deactivate Network Note over Libp2pService: Receives outcome report Libp2pService->>Libp2pService: Update peer score based on outcome ``` #### Validate block with inclusion list ```mermaid sequenceDiagram participant Caller participant combined as combined::process_block participant phase_specific as phase_specific::process_block Caller->>combined: process_block(config, state, block, verifier, slot_report) activate combined note over combined: Dispatches based on the current phase of the state and block. alt Phase-specific processing opt state is Phase0 combined->>phase_specific: phase0::process_block(...) activate phase_specific note right of phase_specific: Processes block header,<br/>operations, and updates state<br/>according to Phase 0 rules. phase_specific-->>combined: Ok deactivate phase_specific end opt state is Altair combined->>phase_specific: altair::process_block(...) activate phase_specific note right of phase_specific: Processes block according to<br/>Altair rules (adds sync committees, etc.). phase_specific-->>combined: Ok deactivate phase_specific end opt state is Bellatrix combined->>phase_specific: bellatrix::process_block(...) activate phase_specific note right of phase_specific: Processes block according to<br/>Bellatrix rules (adds execution payload). phase_specific-->>combined: Ok deactivate phase_specific end opt ...and so on for Capella, Deneb, Electra, Fulu note over combined: The pattern repeats for each subsequent phase. end else Mismatched Phases combined-->>Caller: Err(PhaseError) end combined-->>Caller: Ok deactivate combined ``` ## Contribute I've created a series of [issues](https://github.com/grandinetech/grandine/issues/236) to implement the development plan step by step, also have a draft PR in my local. ## Next Start to make PRs for implementing.