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

[Decoupling] Implement BlockFactoryDeneb (part 2) #7161

Merged
merged 13 commits into from
May 22, 2023

Conversation

StefanBratanov
Copy link
Contributor

@StefanBratanov StefanBratanov commented May 19, 2023

PR Description

Next part of #7129

  • Introduce BlockFactoryDeneb which creates BlockContents or BlindedBlockContents instead of BeaconBlock.
  • BlockFactoryDeneb is only used when slot is Deneb one
  • Made getOptionalBlsToExecutionChanges in BeaconBlockBody to act in a similar way to other optional fields.

Next parts:

  • Unblinding of BlockContainer in AbstractBlockPublisher (in order to publish and import blobs)
  • Signing of blob sidecars in BlockProductionDuty
  • Implement remote calls (VC -> BN)

Fixed Issue(s)

when next parts are done, it will fix couple of tasks in #6822

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@StefanBratanov StefanBratanov marked this pull request as ready for review May 20, 2023 09:19
assertThat(block.getBody().getOptionalBlsToExecutionChanges())
.isPresent()
.hasValue(blsToExecutionChanges);
} else {
assertThat(block.getBody().getOptionalBlsToExecutionChanges()).isEmpty();
}

return block;
if (milestone.isGreaterThanOrEqualTo(SpecMilestone.DENEB)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry on broad usage of such complex milestone based assertions in big methods. There is a chance we could assert not the thing we expect in tests. For example here, input block and milestone variable could be from different milestones etc.
Just a feeling

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the milestone is based on the new block created, so will always align. Changed the test a little bit to mimic the blsExecutionChanges for Capella

Copy link
Contributor

@tbenr tbenr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanted to share a couple of comments while reviewing

import tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.BlockContents;
import tech.pegasys.teku.spec.util.DataStructureUtil;

public class BlockFactoryDenebTest extends AbstractBlockFactoryTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could follow the same production class hierarchy so the deneb tests will run phase0 tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried that, the issue is BlockFactoryDeneb is expected to have SchemaDefinitionsDeneb which are not retrievable from a spec pre-Deneb. And there is no way to create BlockContents without the schema definitions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.. maybe we can generify some checks and move them to the Abstract test so we can call them from deneb too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I find it hard to think of a way to generify it though since BlockFactoryDeneb requires some stuff like prepareBlobsBundle() which needs the deneb spec as well

@StefanBratanov StefanBratanov enabled auto-merge (squash) May 22, 2023 12:00
Copy link
Contributor

@tbenr tbenr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StefanBratanov StefanBratanov merged commit 87d7095 into Consensys:master May 22, 2023
@StefanBratanov StefanBratanov deleted the block_factory_deneb branch May 22, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants