Skip to content

Commit

Permalink
Merge branch 'gm/fix_proposer_duty_executer' into gm/testing_pre_fork…
Browse files Browse the repository at this point in the history
…_proposals
  • Loading branch information
guy muroch committed Aug 11, 2024
2 parents 1fe6f19 + 8b1e1de commit 27324a2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions operator/duties/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package duties
import (
"context"
"fmt"
genesisspectypes "github.com/ssvlabs/ssv-spec-pre-cc/types"
"time"

eth2apiv1 "github.com/attestantio/go-eth2-client/api/v1"
Expand Down Expand Up @@ -134,6 +135,17 @@ func (h *ProposerHandler) processExecution(epoch phase0.Epoch, slot phase0.Slot)
return
}

if !h.network.PastAlanForkAtEpoch(h.network.Beacon.EstimatedEpochAtSlot(slot)) {
toExecute := make([]*genesisspectypes.Duty, 0, len(duties)*2)
for _, d := range duties {
if h.shouldExecute(d) {
toExecute = append(toExecute, h.toGenesisSpecDuty(d, genesisspectypes.BNRoleProposer))
}
}

h.dutiesExecutor.ExecuteGenesisDuties(h.logger, toExecute)
return
}
// range over duties and execute
toExecute := make([]*spectypes.ValidatorDuty, 0, len(duties))
for _, d := range duties {
Expand Down Expand Up @@ -191,6 +203,15 @@ func (h *ProposerHandler) toSpecDuty(duty *eth2apiv1.ProposerDuty, role spectype
}
}

func (h *ProposerHandler) toGenesisSpecDuty(duty *eth2apiv1.ProposerDuty, role genesisspectypes.BeaconRole) *genesisspectypes.Duty {
return &genesisspectypes.Duty{
Type: role,
PubKey: duty.PubKey,
Slot: duty.Slot,
ValidatorIndex: duty.ValidatorIndex,
}
}

func (h *ProposerHandler) shouldExecute(duty *eth2apiv1.ProposerDuty) bool {
currentSlot := h.network.Beacon.EstimatedCurrentSlot()
// execute task if slot already began and not pass 1 slot
Expand Down

0 comments on commit 27324a2

Please sign in to comment.