Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cannon): Correct slot calculations #210

Merged
merged 4 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/attester_slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (a *AttesterSlashingDeriver) lookAheadAtLocations(ctx context.Context, loca
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand All @@ -181,7 +181,7 @@ func (a *AttesterSlashingDeriver) processEpoch(ctx context.Context, epoch phase0

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := a.processSlot(ctx, slot)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/beacon_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (b *BeaconBlockDeriver) lookAheadAtLocation(ctx context.Context, locations
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand All @@ -184,7 +184,7 @@ func (b *BeaconBlockDeriver) processEpoch(ctx context.Context, epoch phase0.Epoc

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/bls_to_execution_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (b *BLSToExecutionChangeDeriver) lookAheadAtLocation(ctx context.Context, l
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand All @@ -184,7 +184,7 @@ func (b *BLSToExecutionChangeDeriver) processEpoch(ctx context.Context, epoch ph

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (b *DepositDeriver) lookAheadAtLocation(ctx context.Context, locations []*x
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand All @@ -182,7 +182,7 @@ func (b *DepositDeriver) processEpoch(ctx context.Context, epoch phase0.Epoch) (

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/execution_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (b *ExecutionTransactionDeriver) processEpoch(ctx context.Context, epoch ph

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand All @@ -186,7 +186,7 @@ func (b *ExecutionTransactionDeriver) lookAheadAtLocation(ctx context.Context, l
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/proposer_slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (b *ProposerSlashingDeriver) processEpoch(ctx context.Context, epoch phase0

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand Down Expand Up @@ -259,7 +259,7 @@ func (b *ProposerSlashingDeriver) lookAheadAtLocation(ctx context.Context, locat
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/voluntary_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (b *VoluntaryExitDeriver) lookAheadAtLocation(ctx context.Context, location
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand All @@ -182,7 +182,7 @@ func (b *VoluntaryExitDeriver) processEpoch(ctx context.Context, epoch phase0.Ep

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cannon/deriver/beacon/eth/v2/withdrawal.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (b *WithdrawalDeriver) processEpoch(ctx context.Context, epoch phase0.Epoch

allEvents := []*xatu.DecoratedEvent{}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

events, err := b.processSlot(ctx, slot)
Expand Down Expand Up @@ -218,7 +218,7 @@ func (b *WithdrawalDeriver) lookAheadAtLocation(ctx context.Context, locations [
return
}

for i := uint64(0); i <= uint64(sp.SlotsPerEpoch); i++ {
for i := uint64(0); i <= uint64(sp.SlotsPerEpoch-1); i++ {
slot := phase0.Slot(i + uint64(epoch)*uint64(sp.SlotsPerEpoch))

// Add the block to the preload queue so it's available when we need it
Expand Down
Loading