Skip to content

Commit

Permalink
Define block production process
Browse files Browse the repository at this point in the history
  • Loading branch information
adiasg committed Nov 20, 2021
1 parent 9c37328 commit 60ab1fc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
6 changes: 6 additions & 0 deletions eth2_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def bn_produce_block(slot: Slot, randao_reveal: BLSSignature, graffiti: Bytes32)
"""
pass

def bn_submit_block(block: SignedBeaconBlock) -> None:
"""Submit block to BN for p2p gossip.
Uses https://ethereum.github.io/beacon-APIs/#/ValidatorRequiredApi/publishBlock
"""
pass


# Validator Client Interface

Expand Down
23 changes: 19 additions & 4 deletions spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
bn_submit_attestation,
bn_get_proposer_duties_for_epoch,
bn_produce_block,
bn_submit_block,
vc_is_slashable_attestation_data,
vc_sign_attestation,
vc_is_slashable_block,
Expand Down Expand Up @@ -61,8 +62,9 @@ def consensus_on_block(proposer_duty: ProposerDuty) -> AttestationData:
"""

def serve_attestation_duty(attestation_duty):
# Obtain lock on consensus process here - only a single consensus instance
# should be running at any given time
# Obtain lock on consensus_on_attestation here.
# Only a single consensus_on_attestation instance should be
# running at any given time
attestation_data = consensus_on_attestation(attestation_duty)

# 1. Threshold sign attestation from local VC
Expand All @@ -73,7 +75,7 @@ def serve_attestation_duty(attestation_duty):
# 4. Send complete signed attestation to BN for broadcast
bn_submit_attestation(complete_signed_attestation)

# Release lock on consensus process here
# Release lock on consensus_on_attestation here.

"""
Block Production Process:
Expand All @@ -87,4 +89,17 @@ def serve_attestation_duty(attestation_duty):
"""

def serve_proposer_duty(proposer_duty):
pass
# Obtain lock on consensus_on_block here.
# Only a single consensus_on_block instance should be
# running at any given time
block = consensus_on_block(proposer_duty)

# 1. Threshold sign block from local VC
threshold_signed_block = vc_sign_block(block, proposer_duty)
# 2. Broadcast threshold signed block
# 3. Reconstruct complete signed block by combining threshold signed blocks
complete_signed_block = threshold_signed_block
# 4. Send complete signed block to BN for broadcast
bn_submit_block(complete_signed_block)

# Release lock on consensus_on_block here.

0 comments on commit 60ab1fc

Please sign in to comment.