Skip to content

Conversation

@ericsson49
Copy link
Contributor

@ericsson49 ericsson49 commented Aug 21, 2025

PR Description

This PR includes three commits from the draft #8419 PR, which affect code run in production.

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.

@github-actions
Copy link

github-actions bot commented Aug 21, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ericsson49
Copy link
Contributor Author

@lucassaldanha @mkalinin

@ericsson49
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

1 similar comment
@mkalinin
Copy link

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Aug 21, 2025
@lucassaldanha lucassaldanha self-requested a review August 21, 2025 22:25
This flag allows to run spec tests with BLS disabled flag.
The flat is particularly utilized in the following places:
* AbstractBlockProcessor.processAndValidateBlock when processing a block
* ForkChoiceUtil.validate when validating an attestation
* BeaconStateAccessorsAltair.getNextSyncCommitteeIndices when computing a sync committee aggregate pubkey

The decision to put it this way is mainly because of a lot of boilerplate code that would be required to
propagate signature verifier to the downstream method calls. Instead of propagating it is read from
the spec config instance available at hand.

TestDefinition exposes an interface to create a spec with blsDisabled flag.
This method returns viable fork choice heads as per the spec.

For instance, getChainHeads(/*includeNonViableHeads=*/ false)
would return heads that aren't necesserily justified root descendants
which isn't spec compliant.
public Spec getSpec(final Boolean blsDisabled) {
if (spec == null) {
createSpec();
createSpec(blsDisabled);
Copy link

Choose a reason for hiding this comment

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

Bug: Test Caching Ignores BLS Configuration

The TestDefinition class caches the spec field, but the caching logic doesn't account for the blsDisabled parameter. This means different blsDisabled configurations can return the same cached spec instance, potentially causing tests to run with unintended BLS settings.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

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

This caching mismatch seems to be a potential cause of problems. I am not sure of the impact but maybe we need to be mindful of caching two versions of the spec (with and without blsDisabled) and returning the appropriate one?

Copy link
Member

@lucassaldanha lucassaldanha left a comment

Choose a reason for hiding this comment

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

Overall changes are ok. Just added a few comments for discussion. I'll also ask others in the team to take a look.

final Bytes4 fuluForkVersion,
final UInt64 fuluForkEpoch) {
final UInt64 fuluForkEpoch,
final boolean blsDisabled) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can have a constructor without the blsDisabled parameter, and one constructor overload with the parameter and annotated with @VisibleForTests or something to make it clear that it is only used on tests?

This way we also don't need to change existing calls to the constructor.

Copy link
Member

Choose a reason for hiding this comment

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

We can also add a unit test to check that the default constructor (without the paramater) will always create a spec with blsDisabled = false.

int getReorgParentWeightThreshold();

// Handle spec tests with BLS disabled
boolean isBlsDisabled();
Copy link
Member

Choose a reason for hiding this comment

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

NIT: Can the double-negative be misleading? Usually we default to isSomethingEnabled. Not sure what is the answer in this case, just thought I'd raise the question :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I've got a fairly strong dislike of this kind of code where theres 'test only' stuff in production code. i think i'd make a test class that disables bls in preference to changing a production class to not use BLS.

Copy link
Contributor

Choose a reason for hiding this comment

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

should be largely addressed by #9805 if looking for the pr i merged


int getReorgParentWeightThreshold();

// Handle spec tests with BLS disabled
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to make it more explicit that this is only used when testing.

Comment on lines +164 to +170
// Copy the previous aggregatePubkey if BLS is disabled
if (altairConfig.isBlsDisabled()) {
aggregatePubkey =
BeaconStateAltair.required(state)
.getNextSyncCommittee()
.getAggregatePubkey()
.getBLSPublicKey();
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need special logic here?

Choose a reason for hiding this comment

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

The problem is that aggregatePubkey should be computed regardless of whether BLS disabled or not. Probably, we should define a SignatureVerifier that does fake signature verification only but aggregates pubkeys as usual

@rolfyone
Copy link
Contributor

Hey, I updated SpecConfig to be the place that signature verifier is coming from and the associated tests which should be a better way of doing a chunk of this #9805

Will need to think about BeaconStateAccessorsAltair. Did we want to rebase this PR? (cc @mkalinin)

@mkalinin
Copy link

Hey, I updated SpecConfig to be the place that signature verifier is coming from and the associated tests which should be a better way of doing a chunk of this #9805

Will need to think about BeaconStateAccessorsAltair. Did we want to rebase this PR? (cc @mkalinin)

Thanks a lot @rolfyone! let us rebase this one

@ericsson49 ericsson49 closed this Oct 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants