Skip to content

Commit

Permalink
state upgrade fix
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Sep 16, 2024
1 parent fb36439 commit 4a61433
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ public BeaconStateEip7732 upgrade(final BeaconState preState) {
builder
.parentBlockHash(() -> Bytes32.ZERO)
.parentBlockRoot(() -> Bytes32.ZERO)
.blockHash(Bytes32.ZERO)
.gasLimit(UInt64.ZERO)
.blockHash(
preStateElectra
.getLatestExecutionPayloadHeader()
.getBlockHash())
.gasLimit(
preStateElectra
.getLatestExecutionPayloadHeader()
.getGasLimit())
.builderIndex(() -> UInt64.ZERO)
.slot(() -> UInt64.ZERO)
.value(() -> UInt64.ZERO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private SafeFuture<DutyResult> produceBlock(final ForkInfo forkInfo) {
.thenCompose(
signedBlockContainer ->
validatorDutyMetrics.record(
() -> sendBlock(signedBlockContainer), this, ValidatorDutyMetricsSteps.SEND))
() -> sendBlock(signedBlockContainer, milestone),
this,
ValidatorDutyMetricsSteps.SEND))
.thenCompose(
dutyResult -> {
if (milestone.isGreaterThanOrEqualTo(SpecMilestone.EIP7732)) {
Expand Down Expand Up @@ -203,9 +205,16 @@ private SafeFuture<SignedBlockContainer> signBlockContainer(
return blockContainerSigner.sign(blockContainer, validator, forkInfo);
}

private SafeFuture<DutyResult> sendBlock(final SignedBlockContainer signedBlockContainer) {
private SafeFuture<DutyResult> sendBlock(
final SignedBlockContainer signedBlockContainer, final SpecMilestone milestone) {
return validatorApiChannel
.sendSignedBlock(signedBlockContainer, BroadcastValidationLevel.GOSSIP)
.sendSignedBlock(
signedBlockContainer,
// EIP7732 TODO: need to make sure block is imported for ePBS (at least for the "naive"
// flow)
milestone.isGreaterThanOrEqualTo(SpecMilestone.EIP7732)
? BroadcastValidationLevel.CONSENSUS
: BroadcastValidationLevel.GOSSIP)
.thenApply(
result -> {
if (result.isPublished()) {
Expand Down

0 comments on commit 4a61433

Please sign in to comment.