-
Notifications
You must be signed in to change notification settings - Fork 390
5067 compliance #10601
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
5067 compliance #10601
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,13 +185,16 @@ public void updateCandidateState( | |
|
|
||
| final MutableBeaconStateGloas stateGloas = MutableBeaconStateGloas.required(state); | ||
|
|
||
| // Genesis payload is EMPTY: latestBlockHash stays zero while bid.blockHash tracks the | ||
| // eth1 block hash, so the first post-genesis block is treated as having an EMPTY parent. | ||
| stateGloas.setLatestBlockHash(Bytes32.ZERO); | ||
| stateGloas.setLatestExecutionPayloadBid( | ||
| schemaDefinitionsGloas | ||
| .getExecutionPayloadBidSchema() | ||
| .create( | ||
| Bytes32.ZERO, | ||
| Bytes32.ZERO, | ||
| Bytes32.ZERO, | ||
| eth1BlockHash, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Genesis detection broken in block processor after bid changeHigh Severity Changing the genesis bid's Additional Locations (1)Reviewed by Cursor Bugbot for commit e3c30cc. Configure here. |
||
| Bytes32.ZERO, | ||
| Bytes20.ZERO, | ||
| UInt64.ZERO, | ||
|
|
@@ -219,7 +222,6 @@ public void updateCandidateState( | |
| .createFromElements(builderPendingPayments)); | ||
| stateGloas.setBuilderPendingWithdrawals( | ||
| schemaDefinitionsGloas.getBuilderPendingWithdrawalsSchema().of()); | ||
| stateGloas.setLatestBlockHash(Bytes32.ZERO); | ||
| stateGloas.setPayloadExpectedWithdrawals( | ||
| schemaDefinitionsGloas.getExecutionPayloadSchema().getWithdrawalsSchemaRequired().of()); | ||
| stateGloas.setPtcWindow(accessorsGloas.initializePtcWindow(state)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Copyright Consensys Software Inc., 2026 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package tech.pegasys.teku.spec.logic.versions.gloas.block; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import org.apache.tuweni.bytes.Bytes32; | ||
| import org.junit.jupiter.api.Test; | ||
| import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
| import tech.pegasys.teku.spec.Spec; | ||
| import tech.pegasys.teku.spec.TestSpecFactory; | ||
| import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock; | ||
| import tech.pegasys.teku.spec.datastructures.epbs.versions.gloas.ExecutionPayloadBid; | ||
| import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.gloas.MutableBeaconStateGloas; | ||
| import tech.pegasys.teku.spec.logic.common.statetransition.exceptions.BlockProcessingException; | ||
| import tech.pegasys.teku.spec.util.DataStructureUtil; | ||
|
|
||
| class BlockProcessorGloasTest { | ||
|
|
||
| private final Spec spec = TestSpecFactory.createMinimalGloas(); | ||
| private final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec); | ||
| private final UInt64 gloasSlot = UInt64.ONE; | ||
|
|
||
| @Test | ||
| void processParentExecutionPayload_genesisDoesNotUpdateLatestBlockHash() | ||
| throws BlockProcessingException { | ||
| final ExecutionPayloadBid parentBid = | ||
| dataStructureUtil.randomExecutionPayloadBid( | ||
| UInt64.ZERO, UInt64.ZERO, Bytes32.ZERO, dataStructureUtil.randomBytes32()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test uses wrong genesis bid blockHash, exercises wrong pathMedium Severity The test creates a Reviewed by Cursor Bugbot for commit 3e53a8f. Configure here. |
||
| final MutableBeaconStateGloas state = | ||
| MutableBeaconStateGloas.required( | ||
| dataStructureUtil | ||
| .stateBuilderGloas(16, 4, 4) | ||
| .slot(gloasSlot) | ||
| .latestBlockHash(Bytes32.ZERO) | ||
| .latestExecutionPayloadBid(parentBid) | ||
| .build() | ||
| .createWritableCopy()); | ||
|
|
||
| final ExecutionPayloadBid childBid = | ||
| dataStructureUtil.randomExecutionPayloadBid( | ||
| Bytes32.ZERO, gloasSlot, UInt64.ONE, UInt64.ZERO, UInt64.ZERO); | ||
| final BeaconBlock block = | ||
| dataStructureUtil.randomBeaconBlock( | ||
| gloasSlot, | ||
| dataStructureUtil.randomBeaconBlockBody( | ||
| gloasSlot, | ||
| builder -> { | ||
| builder.signedExecutionPayloadBid( | ||
| dataStructureUtil.randomSignedExecutionPayloadBid(childBid)); | ||
| builder.parentExecutionRequests(dataStructureUtil.emptyExecutionRequests()); | ||
| })); | ||
|
|
||
| spec.getBlockProcessor(gloasSlot) | ||
| .processParentExecutionPayload( | ||
| state, | ||
| block, | ||
| spec.atSlot(gloasSlot).beaconStateMutators().createValidatorExitContextSupplier(state)); | ||
|
|
||
| assertThat(state.getLatestBlockHash()).isEqualTo(Bytes32.ZERO); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * Copyright Consensys Software Inc., 2026 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package tech.pegasys.teku.spec.logic.versions.gloas.withdrawals; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import java.util.List; | ||
| import org.apache.tuweni.bytes.Bytes32; | ||
| import org.junit.jupiter.api.Test; | ||
| import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
| import tech.pegasys.teku.spec.Spec; | ||
| import tech.pegasys.teku.spec.TestSpecFactory; | ||
| import tech.pegasys.teku.spec.datastructures.epbs.versions.gloas.ExecutionPayloadBid; | ||
| import tech.pegasys.teku.spec.datastructures.state.beaconstate.versions.gloas.MutableBeaconStateGloas; | ||
| import tech.pegasys.teku.spec.schemas.SchemaDefinitionsGloas; | ||
| import tech.pegasys.teku.spec.util.DataStructureUtil; | ||
|
|
||
| class WithdrawalsHelpersGloasTest { | ||
|
|
||
| private final Spec spec = TestSpecFactory.createMinimalGloas(); | ||
| private final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec); | ||
| private final UInt64 gloasSlot = UInt64.ONE; | ||
|
|
||
| @Test | ||
| void processWithdrawals_genesisDoesNotAdvanceWithdrawalIndices() { | ||
| final SchemaDefinitionsGloas schemaDefinitions = | ||
| SchemaDefinitionsGloas.required(spec.getGenesisSpec().getSchemaDefinitions()); | ||
| final ExecutionPayloadBid parentBid = | ||
| dataStructureUtil.randomExecutionPayloadBid( | ||
| UInt64.ZERO, UInt64.ZERO, Bytes32.ZERO, dataStructureUtil.randomBytes32()); | ||
| final MutableBeaconStateGloas state = | ||
| MutableBeaconStateGloas.required( | ||
| dataStructureUtil | ||
| .stateBuilderGloas(16, 4, 4) | ||
| .slot(gloasSlot) | ||
| .latestBlockHash(Bytes32.ZERO) | ||
| .latestExecutionPayloadBid(parentBid) | ||
| .nextWithdrawalIndex(UInt64.valueOf(7)) | ||
| .builderPendingWithdrawals( | ||
| schemaDefinitions | ||
| .getBuilderPendingWithdrawalsSchema() | ||
| .createFromElements( | ||
| List.of( | ||
| schemaDefinitions | ||
| .getBuilderPendingWithdrawalSchema() | ||
| .create( | ||
| dataStructureUtil.randomEth1Address(), | ||
| UInt64.ONE, | ||
| UInt64.ZERO)))) | ||
| .build() | ||
| .createWritableCopy()); | ||
|
|
||
| final UInt64 preNextWithdrawalIndex = state.getNextWithdrawalIndex(); | ||
| final int prePendingWithdrawalsCount = state.getBuilderPendingWithdrawals().size(); | ||
|
|
||
| spec.atSlot(gloasSlot).getWithdrawalsHelpers().orElseThrow().processWithdrawals(state); | ||
|
|
||
| assertThat(state.getNextWithdrawalIndex()).isEqualTo(preNextWithdrawalIndex); | ||
| assertThat(state.getBuilderPendingWithdrawals()).hasSize(prePendingWithdrawalsCount); | ||
| } | ||
| } |


Uh oh!
There was an error while loading. Please reload this page.