Ejemplo n.º 1
0
def _parse_block_proposal_duty(
    duty_data: Dict[str, Any],
    validator_public_key: BLSPubkey,
    current_tick: Tick,
    target_epoch: Epoch,
    genesis_time: int,
    seconds_per_slot: int,
    ticks_per_slot: int,
) -> BlockProposalDuty:
    target_tick = Tick.computing_t_from(
        Slot(duty_data["block_proposal_slot"]),
        target_epoch,
        BlockProposalDuty.tick_count,
        genesis_time,
        seconds_per_slot,
        ticks_per_slot,
    )
    return BlockProposalDuty(
        validator_public_key=validator_public_key,
        tick_for_execution=target_tick,
        discovered_at_tick=current_tick,
    )
Ejemplo n.º 2
0
def _parse_attestation_duty(
    duty_data: Dict[str, Any],
    validator_public_key: BLSPubkey,
    current_tick: Tick,
    target_epoch: Epoch,
    genesis_time: int,
    seconds_per_slot: int,
    ticks_per_slot: int,
) -> AttestationDuty:
    target_tick = Tick.computing_t_from(
        Slot(duty_data["attestation_slot"]),
        target_epoch,
        AttestationDuty.tick_count,
        genesis_time,
        seconds_per_slot,
        ticks_per_slot,
    )
    return AttestationDuty(
        validator_public_key=validator_public_key,
        tick_for_execution=target_tick,
        discovered_at_tick=current_tick,
        committee_index=CommitteeIndex(duty_data["committee_index"]),
    )