Skip to content
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
6 changes: 6 additions & 0 deletions clients/execution/chainstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func (cache *ChainState) getBlobScheduleForTimestampFromConfig(timestamp time.Ti
type BlobScheduleEntry struct {
Timestamp time.Time
Schedule rpc.EthConfigBlobSchedule
IsBpo bool
}

func (cache *ChainState) GetFullBlobSchedule() []BlobScheduleEntry {
Expand Down Expand Up @@ -273,6 +274,7 @@ func (cache *ChainState) GetFullBlobSchedule() []BlobScheduleEntry {
Target: uint64(cache.config.Config.BlobScheduleConfig.BPO1.Target),
BaseFeeUpdateFraction: uint64(cache.config.Config.BlobScheduleConfig.BPO1.UpdateFraction),
},
IsBpo: true,
})
}

Expand All @@ -284,6 +286,7 @@ func (cache *ChainState) GetFullBlobSchedule() []BlobScheduleEntry {
Target: uint64(cache.config.Config.BlobScheduleConfig.BPO2.Target),
BaseFeeUpdateFraction: uint64(cache.config.Config.BlobScheduleConfig.BPO2.UpdateFraction),
},
IsBpo: true,
})
}

Expand All @@ -295,6 +298,7 @@ func (cache *ChainState) GetFullBlobSchedule() []BlobScheduleEntry {
Target: uint64(cache.config.Config.BlobScheduleConfig.BPO3.Target),
BaseFeeUpdateFraction: uint64(cache.config.Config.BlobScheduleConfig.BPO3.UpdateFraction),
},
IsBpo: true,
})
}

Expand All @@ -306,6 +310,7 @@ func (cache *ChainState) GetFullBlobSchedule() []BlobScheduleEntry {
Target: uint64(cache.config.Config.BlobScheduleConfig.BPO4.Target),
BaseFeeUpdateFraction: uint64(cache.config.Config.BlobScheduleConfig.BPO4.UpdateFraction),
},
IsBpo: true,
})
}

Expand All @@ -317,6 +322,7 @@ func (cache *ChainState) GetFullBlobSchedule() []BlobScheduleEntry {
Target: uint64(cache.config.Config.BlobScheduleConfig.BPO5.Target),
BaseFeeUpdateFraction: uint64(cache.config.Config.BlobScheduleConfig.BPO5.UpdateFraction),
},
IsBpo: true,
})
}

Expand Down
73 changes: 55 additions & 18 deletions handlers/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,25 +291,62 @@ func buildIndexPageData() (*models.IndexPageData, time.Duration) {
}

// Add BPO forks from BLOB_SCHEDULE
for i, blobSchedule := range specs.BlobSchedule {
// BPO forks use the fork version that's active at the time of BPO activation
forkVersion := chainState.GetForkVersionAtEpoch(phase0.Epoch(blobSchedule.Epoch))
blobParams := &consensus.BlobScheduleEntry{
Epoch: blobSchedule.Epoch,
MaxBlobsPerBlock: blobSchedule.MaxBlobsPerBlock,
}
forkDigest := chainState.GetForkDigest(forkVersion, blobParams)
elBlobSchedule := services.GlobalBeaconService.GetExecutionChainState().GetFullBlobSchedule()
if len(elBlobSchedule) > 0 {
// get blob schedule from el config (we have the full blob schedule available)
bpoIdx := 0
for _, blobSchedule := range elBlobSchedule {
if !blobSchedule.IsBpo {
continue
}

pageData.NetworkForks = append(pageData.NetworkForks, &models.IndexPageDataForks{
Name: fmt.Sprintf("BPO%d", i+1),
Epoch: blobSchedule.Epoch,
Version: nil, // BPO forks don't have fork versions
Time: uint64(chainState.EpochToTime(phase0.Epoch(blobSchedule.Epoch)).Unix()),
Active: uint64(currentEpoch) >= blobSchedule.Epoch,
Type: "bpo",
MaxBlobsPerBlock: &blobSchedule.MaxBlobsPerBlock,
ForkDigest: forkDigest[:],
})
bpoIdx++

bpoEpoch := phase0.Epoch(0)
if blobSchedule.Timestamp.After(networkGenesis.GenesisTime) {
bpoEpoch = chainState.EpochOfSlot(chainState.TimeToSlot(blobSchedule.Timestamp))
}

forkVersion := chainState.GetForkVersionAtEpoch(bpoEpoch)
blobParams := &consensus.BlobScheduleEntry{
Epoch: uint64(bpoEpoch),
MaxBlobsPerBlock: blobSchedule.Schedule.Max,
}
forkDigest := chainState.GetForkDigest(forkVersion, blobParams)

pageData.NetworkForks = append(pageData.NetworkForks, &models.IndexPageDataForks{
Name: fmt.Sprintf("BPO%d", bpoIdx),
Epoch: uint64(bpoEpoch),
Version: nil,
Time: uint64(blobSchedule.Timestamp.Unix()),
Active: currentEpoch >= bpoEpoch,
Type: "bpo",
MaxBlobsPerBlock: &blobSchedule.Schedule.Max,
ForkDigest: forkDigest[:],
})
}
} else {
// get blob schedule from cl specs (no el config available, so we only get the deduplicated blob schedule from the cl specs)
for i, blobSchedule := range specs.BlobSchedule {
// BPO forks use the fork version that's active at the time of BPO activation
forkVersion := chainState.GetForkVersionAtEpoch(phase0.Epoch(blobSchedule.Epoch))
blobParams := &consensus.BlobScheduleEntry{
Epoch: blobSchedule.Epoch,
MaxBlobsPerBlock: blobSchedule.MaxBlobsPerBlock,
}
forkDigest := chainState.GetForkDigest(forkVersion, blobParams)

pageData.NetworkForks = append(pageData.NetworkForks, &models.IndexPageDataForks{
Name: fmt.Sprintf("BPO%d", i+1),
Epoch: blobSchedule.Epoch,
Version: nil, // BPO forks don't have fork versions
Time: uint64(chainState.EpochToTime(phase0.Epoch(blobSchedule.Epoch)).Unix()),
Active: uint64(currentEpoch) >= blobSchedule.Epoch,
Type: "bpo",
MaxBlobsPerBlock: &blobSchedule.MaxBlobsPerBlock,
ForkDigest: forkDigest[:],
})
}
}

// Sort all forks by epoch
Expand Down