From 5f0bfe8abd87f04dc26671bd2b70552bb543187f Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Wed, 13 Sep 2023 17:19:17 +1000 Subject: [PATCH] fix(cannon): Correctly calculate slot (#189) --- pkg/cannon/deriver/beacon/eth/v2/attester_slashing.go | 2 +- pkg/cannon/deriver/beacon/eth/v2/bls_to_execution_change.go | 2 +- pkg/cannon/deriver/beacon/eth/v2/execution_transaction.go | 2 +- pkg/cannon/deriver/beacon/eth/v2/proposer_slashing.go | 2 +- pkg/cannon/deriver/beacon/eth/v2/voluntary_exit.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cannon/deriver/beacon/eth/v2/attester_slashing.go b/pkg/cannon/deriver/beacon/eth/v2/attester_slashing.go index 4491dc7d..fad5a783 100644 --- a/pkg/cannon/deriver/beacon/eth/v2/attester_slashing.go +++ b/pkg/cannon/deriver/beacon/eth/v2/attester_slashing.go @@ -156,7 +156,7 @@ func (a *AttesterSlashingDeriver) processEpoch(ctx context.Context, epoch phase0 allEvents := []*xatu.DecoratedEvent{} for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ { - slot := phase0.Slot(i + uint64(epoch)) + slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch)) events, err := a.processSlot(ctx, slot) if err != nil { diff --git a/pkg/cannon/deriver/beacon/eth/v2/bls_to_execution_change.go b/pkg/cannon/deriver/beacon/eth/v2/bls_to_execution_change.go index 2f4101c8..d9f60b77 100644 --- a/pkg/cannon/deriver/beacon/eth/v2/bls_to_execution_change.go +++ b/pkg/cannon/deriver/beacon/eth/v2/bls_to_execution_change.go @@ -159,7 +159,7 @@ func (b *BLSToExecutionChangeDeriver) processEpoch(ctx context.Context, epoch ph allEvents := []*xatu.DecoratedEvent{} for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ { - slot := phase0.Slot(i + uint64(epoch)) + slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch)) events, err := b.processSlot(ctx, slot) if err != nil { diff --git a/pkg/cannon/deriver/beacon/eth/v2/execution_transaction.go b/pkg/cannon/deriver/beacon/eth/v2/execution_transaction.go index d5d27ce6..46e1981c 100644 --- a/pkg/cannon/deriver/beacon/eth/v2/execution_transaction.go +++ b/pkg/cannon/deriver/beacon/eth/v2/execution_transaction.go @@ -160,7 +160,7 @@ func (b *ExecutionTransactionDeriver) processEpoch(ctx context.Context, epoch ph allEvents := []*xatu.DecoratedEvent{} for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ { - slot := phase0.Slot(i + uint64(epoch)) + slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch)) events, err := b.processSlot(ctx, slot) if err != nil { diff --git a/pkg/cannon/deriver/beacon/eth/v2/proposer_slashing.go b/pkg/cannon/deriver/beacon/eth/v2/proposer_slashing.go index 80758819..76637ed0 100644 --- a/pkg/cannon/deriver/beacon/eth/v2/proposer_slashing.go +++ b/pkg/cannon/deriver/beacon/eth/v2/proposer_slashing.go @@ -156,7 +156,7 @@ func (b *ProposerSlashingDeriver) processEpoch(ctx context.Context, epoch phase0 allEvents := []*xatu.DecoratedEvent{} for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ { - slot := phase0.Slot(i + uint64(epoch)) + slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch)) events, err := b.processSlot(ctx, slot) if err != nil { diff --git a/pkg/cannon/deriver/beacon/eth/v2/voluntary_exit.go b/pkg/cannon/deriver/beacon/eth/v2/voluntary_exit.go index be4fd331..ed88446e 100644 --- a/pkg/cannon/deriver/beacon/eth/v2/voluntary_exit.go +++ b/pkg/cannon/deriver/beacon/eth/v2/voluntary_exit.go @@ -157,7 +157,7 @@ func (b *VoluntaryExitDeriver) processEpoch(ctx context.Context, epoch phase0.Ep allEvents := []*xatu.DecoratedEvent{} for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ { - slot := phase0.Slot(i + uint64(epoch)) + slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch)) events, err := b.processSlot(ctx, slot) if err != nil {