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

Rename EIP-4844 to Deneb #6783

Merged
merged 4 commits into from
Feb 8, 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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public SafeFuture<FetchBlockResult> fetchBlock(final Eth2Peer peer) {
final Throwable rootException = Throwables.getRootCause(throwable);
if (rootException instanceof RpcException) {
final RpcException rpcException = (RpcException) rootException;
// TODO: update link for Deneb
// based on behaviour described at
// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/p2p-interface.md#beaconblocksbyroot-v2
if (rpcException.getResponseCode() == RpcResponseStatus.RESOURCE_UNAVAILABLE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

import java.util.Optional;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.eip4844.SignedBeaconBlockAndBlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.SignedBeaconBlockAndBlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

public final class FetchBlockResult {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public MilestoneBasedFetchBlockTaskFactory(
.forEach(
forkAndSpecMilestone -> {
final SpecMilestone milestone = forkAndSpecMilestone.getSpecMilestone();
if (milestone.isGreaterThanOrEqualTo(SpecMilestone.EIP4844)) {
if (milestone.isGreaterThanOrEqualTo(SpecMilestone.DENEB)) {
registeredFetchBlockTaskFactories.put(
milestone, blockAndBlobsSidecarTaskFactory.get());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import tech.pegasys.teku.networking.eth2.peers.SyncSource;
import tech.pegasys.teku.networking.p2p.peer.DisconnectReason;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.logic.common.statetransition.results.BlockImportResult;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;
import tech.pegasys.teku.statetransition.block.BlockImporter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.networking.eth2.peers.SyncSource;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

/** A section of a particular target chain that can be downloaded in parallel. */
public interface Batch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.networking.eth2.peers.SyncSource;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

public class EventThreadOnlyBatch implements Batch {
private final EventThread eventThread;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener;
import tech.pegasys.teku.spec.datastructures.blocks.MinimalBeaconBlockSummary;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;

public class SyncSourceBatch implements Batch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import tech.pegasys.teku.networking.p2p.reputation.ReputationAdjustment;
import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

public class ThrottlingSyncSource implements SyncSource {
private static final Logger LOG = LogManager.getLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.eip4844.BeaconBlockBodyEip4844;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.BeaconBlockBodyDeneb;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;

public class BlockAndBlobsSidecarMatcher {
Expand Down Expand Up @@ -77,8 +77,8 @@ private boolean isSidecarRequired(final SignedBeaconBlock block, final UInt64 sl
block
.getMessage()
.getBody()
.toVersionEip4844()
.map(BeaconBlockBodyEip4844::getBlobKzgCommitments)
.toVersionDeneb()
.map(BeaconBlockBodyDeneb::getBlobKzgCommitments)
.map(kzgCommitments -> !kzgCommitments.isEmpty())
.orElse(false);
return blockHasKzgCommitments && blobsSidecarManager.isStorageOfBlobsSidecarRequired(slot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.logic.common.statetransition.results.BlockImportResult.FailureReason;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;
import tech.pegasys.teku.statetransition.block.BlockImporter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.Optional;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

public interface BlockSubscriber {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.service.serviceutils.Service;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.statetransition.util.PendingPool;

public class FetchRecentBlocksService extends Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlockSummary;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.state.Fork;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.logic.common.util.AsyncBLSSignatureVerifier;
import tech.pegasys.teku.spec.logic.versions.eip4844.blobs.BlobsSidecarAvailabilityChecker;
import tech.pegasys.teku.spec.logic.versions.eip4844.blobs.BlobsSidecarAvailabilityChecker.BlobsSidecarAndValidationResult;
import tech.pegasys.teku.spec.logic.versions.deneb.blobs.BlobsSidecarAvailabilityChecker;
import tech.pegasys.teku.spec.logic.versions.deneb.blobs.BlobsSidecarAvailabilityChecker.BlobsSidecarAndValidationResult;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;
import tech.pegasys.teku.storage.api.StorageUpdateChannel;
import tech.pegasys.teku.storage.client.CombinedChainDataClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class AbstractFetchBlockTask {

protected final DataStructureUtil dataStructureUtil =
new DataStructureUtil(TestSpecFactory.createMinimalEip4844());
new DataStructureUtil(TestSpecFactory.createMinimalDeneb());
protected final Eth2P2PNetwork eth2P2PNetwork = mock(Eth2P2PNetwork.class);
protected final List<Eth2Peer> peers = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import tech.pegasys.teku.networking.eth2.rpc.core.RpcException.DeserializationFailedException;
import tech.pegasys.teku.networking.eth2.rpc.core.RpcException.ResourceUnavailableException;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.eip4844.SignedBeaconBlockAndBlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.SignedBeaconBlockAndBlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

public class FetchBlockAndBlobsSidecarTaskTest extends AbstractFetchBlockTask {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class MilestoneBasedFetchBlockTaskFactoryTest {

private final Spec spec = TestSpecFactory.createMinimalWithEip4844ForkEpoch(UInt64.ONE);
private final Spec spec = TestSpecFactory.createMinimalWithDenebForkEpoch(UInt64.ONE);

private final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
import tech.pegasys.teku.networking.p2p.peer.DisconnectReason;
import tech.pegasys.teku.spec.TestSpecFactory;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.logic.common.statetransition.results.BlockImportResult;
import tech.pegasys.teku.spec.util.DataStructureUtil;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;
import tech.pegasys.teku.statetransition.block.BlockImporter;

class BatchImporterTest {
private final DataStructureUtil dataStructureUtil =
new DataStructureUtil(TestSpecFactory.createMinimalEip4844());
new DataStructureUtil(TestSpecFactory.createMinimalDeneb());
private final BlockImporter blockImporter = mock(BlockImporter.class);
private final BlobsSidecarManager blobsSidecarManager = mock(BlobsSidecarManager.class);
private final StubAsyncRunner asyncRunner = new StubAsyncRunner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
import tech.pegasys.teku.spec.TestSpecFactory;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SlotAndBlockRoot;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.util.DataStructureUtil;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;

public class SyncSourceBatchTest {

private final DataStructureUtil dataStructureUtil =
new DataStructureUtil(TestSpecFactory.createMinimalEip4844());
new DataStructureUtil(TestSpecFactory.createMinimalDeneb());
private final TargetChain targetChain =
chainWith(new SlotAndBlockRoot(UInt64.valueOf(1000), Bytes32.ZERO));
private final InlineEventThread eventThread = new InlineEventThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import tech.pegasys.teku.networking.p2p.peer.DisconnectReason;
import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;

class ThrottlingSyncSourceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.TestSpecFactory;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.StatusMessage;
import tech.pegasys.teku.spec.util.DataStructureUtil;
import tech.pegasys.teku.statetransition.blobs.BlobsSidecarManager;
Expand All @@ -45,16 +45,16 @@

public abstract class AbstractSyncTest {

protected final UInt64 eip4844ForkEpoch = UInt64.valueOf(112260);
protected final Spec spec = TestSpecFactory.createMinimalWithEip4844ForkEpoch(eip4844ForkEpoch);
protected final UInt64 denebForkEpoch = UInt64.valueOf(112260);
protected final Spec spec = TestSpecFactory.createMinimalWithDenebForkEpoch(denebForkEpoch);
protected final Eth2Peer peer = mock(Eth2Peer.class);
protected final BlockImporter blockImporter = mock(BlockImporter.class);
protected final BlobsSidecarManager blobsSidecarManager = mock(BlobsSidecarManager.class);
protected final RecentChainData storageClient = mock(RecentChainData.class);

private final DataStructureUtil preEip4844DataStructureUtil = new DataStructureUtil(spec);
private final DataStructureUtil preDenebDataStructureUtil = new DataStructureUtil(spec);
protected final DataStructureUtil dataStructureUtil =
new DataStructureUtil(TestSpecFactory.createMinimalEip4844());
new DataStructureUtil(TestSpecFactory.createMinimalDeneb());
protected final StubAsyncRunner asyncRunner = new StubAsyncRunner();

@BeforeEach
Expand Down Expand Up @@ -98,10 +98,10 @@ protected List<SignedBeaconBlock> respondWithBlocksAtSlots(
final List<SignedBeaconBlock> blocks = new ArrayList<>();
for (final UInt64 slot : slots) {
final SignedBeaconBlock block;
if (spec.computeEpochAtSlot(slot).isGreaterThanOrEqualTo(eip4844ForkEpoch)) {
if (spec.computeEpochAtSlot(slot).isGreaterThanOrEqualTo(denebForkEpoch)) {
block = dataStructureUtil.randomSignedBeaconBlock(slot);
} else {
block = preEip4844DataStructureUtil.randomSignedBeaconBlock(slot);
block = preDenebDataStructureUtil.randomSignedBeaconBlock(slot);
}

blocks.add(block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import tech.pegasys.teku.networking.p2p.peer.DisconnectReason;
import tech.pegasys.teku.networking.p2p.rpc.RpcResponseListener;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.StatusMessage;
import tech.pegasys.teku.spec.logic.common.statetransition.exceptions.StateTransitionException;
import tech.pegasys.teku.spec.logic.common.statetransition.results.BlockImportResult;
Expand Down Expand Up @@ -574,14 +574,14 @@ void sync_invalidResponseResultWhenMalformedResponse() {
}

@Test
void sync_withEip4844BlobsSidecars() {
void sync_withDenebBlobsSidecars() {
when(blobsSidecarManager.isStorageOfBlobsSidecarRequired(any())).thenReturn(true);

// peer has finalized 35 epochs after the EIP-4844 fork epoch
final UInt64 peerFinalizedEpoch = eip4844ForkEpoch.plus(35);
// peer has finalized 35 epochs after the Deneb fork epoch
final UInt64 peerFinalizedEpoch = denebForkEpoch.plus(35);
withPeerFinalizedEpoch(peerFinalizedEpoch);
// Teku has finalized until the EIP-4844 fork epoch
when(storageClient.getFinalizedEpoch()).thenReturn(eip4844ForkEpoch);
// Teku has finalized until the Deneb fork epoch
when(storageClient.getFinalizedEpoch()).thenReturn(denebForkEpoch);
// current epoch is 1 ahead of the peer
when(storageClient.getCurrentEpoch()).thenReturn(Optional.of(peerFinalizedEpoch.plus(1)));

Expand Down Expand Up @@ -618,19 +618,19 @@ void sync_withEip4844BlobsSidecars() {
}

@Test
void sync_withRequestDuringTheEip4844ForkTransition() {
void sync_withRequestDuringTheDenebForkTransition() {
when(blobsSidecarManager.isStorageOfBlobsSidecarRequired(any()))
.thenAnswer(
i -> {
final UInt64 slot = i.getArgument(0);
return spec.computeEpochAtSlot(slot).isGreaterThanOrEqualTo(eip4844ForkEpoch);
return spec.computeEpochAtSlot(slot).isGreaterThanOrEqualTo(denebForkEpoch);
});

// peer has finalized 1 epoch after the EIP-4844 fork epoch
final UInt64 peerFinalizedEpoch = eip4844ForkEpoch.plus(1);
// peer has finalized 1 epoch after the Deneb fork epoch
final UInt64 peerFinalizedEpoch = denebForkEpoch.plus(1);
withPeerFinalizedEpoch(peerFinalizedEpoch);
// Teku has finalized until the 1 epoch before EIP-4844 fork epoch
when(storageClient.getFinalizedEpoch()).thenReturn(eip4844ForkEpoch.minusMinZero(1));
// Teku has finalized until the 1 epoch before Deneb fork epoch
when(storageClient.getFinalizedEpoch()).thenReturn(denebForkEpoch.minusMinZero(1));
// current epoch is 1 ahead of the peer
when(storageClient.getCurrentEpoch()).thenReturn(Optional.of(peerFinalizedEpoch.plus(1)));

Expand All @@ -645,7 +645,7 @@ void sync_withRequestDuringTheEip4844ForkTransition() {
// updating the finalized epoch
when(storageClient.getFinalizedEpoch()).thenReturn(peerFinalizedEpoch);

// the requests will span Capella and EIP-4844
// the requests will span Capella and Deneb
completeRequestsWithBlocksAndBlobsSidecars(
List.of(blocksRequest), List.of(blobsSidecarsRequest));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.TestSpecFactory;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.eip4844.SignedBeaconBlockAndBlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.eip4844.BlobsSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.blockbody.versions.deneb.SignedBeaconBlockAndBlobsSidecar;
import tech.pegasys.teku.spec.datastructures.execution.versions.deneb.BlobsSidecar;
import tech.pegasys.teku.spec.util.DataStructureUtil;
import tech.pegasys.teku.statetransition.util.PendingPool;

public class FetchRecentBlocksServiceTest {

private final DataStructureUtil dataStructureUtil =
new DataStructureUtil(TestSpecFactory.createMinimalEip4844());
new DataStructureUtil(TestSpecFactory.createMinimalDeneb());

@SuppressWarnings("unchecked")
private final PendingPool<SignedBeaconBlock> pendingBlocksPool = mock(PendingPool.class);
Expand Down
Loading