-
Notifications
You must be signed in to change notification settings - Fork 315
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
Stubbed implementation of GetLightClientBootstrap #6384
Stubbed implementation of GetLightClientBootstrap #6384
Conversation
request.respondError(501, "Not implemented"); | ||
} | ||
|
||
private static SerializableTypeDefinition<ObjectAndMetaData<LightClientBootstrap>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure whether to use ObjectAndMetadata
here given that this API only requires version
and not executionOptimistic
or canonical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ObjectAndMetadata is generally what's coming out of the ChainDataClient, so using that should be ok, but it's also just an interface you're using if we end up needing to change it so it's not locked in stone...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will still have all fields consumers need, and the two extra that they don't. As long as clients don't have strict response validation (i.e. allowing additive fields) then it should be okay.
...est/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/GetLightClientBootstrapTest.java
Outdated
Show resolved
Hide resolved
data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/BeaconRestApiTypes.java
Show resolved
Hide resolved
@@ -41,6 +42,7 @@ public class SchemaDefinitionsAltair extends AbstractSchemaDefinitions { | |||
private final ContributionAndProofSchema contributionAndProofSchema; | |||
private final SignedContributionAndProofSchema signedContributionAndProofSchema; | |||
private final MetadataMessageSchemaAltair metadataMessageSchema; | |||
private final LightClientBootstrapSchema lightClientBootstrapSchema; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added only for Altair schema definitions. Question whether the schema should be added for all consensus versions (i.e. lift up into SchemaDefinitions
) (though there is no change from Altair) or whether it should only be specified in SchemaDefinitionsAltair
and used this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to pull it into SchemaDefinitions
I think, rather than hard references to Altair, as that creates the altair schema definitions even though maybe only this one is used... @ajsutton may have opinions here so tagging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the light client types are defined in the spec they will be versioned with hard forks and so need to come from SchemaDefinitions
. They will still just wind up being added to SchemaDefinitionsAltair
because SchemaDefinitionsBellatrix
extends from that and doesn't need to make any changes so will just inherit the Altair definitions.
Since these types are new in Altair I think you've actually got it right that they get added to SchemaDefinitionsAltair
- they're then inherited by Bellatrix and they don't need to be in Phase0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure that comment made sense... SchemaDefinitions
is an interface that only contains the types that are common to all hard forks. For things new in Altair like this you'd call SchemaDefinitions.toVersionAltair()
to get a SchemaDefinitionsAltair
and then can use these new methods.
And Bellatrix inherits all the Altair types, then just redefines a few, so SchemaDefinitionsBellatrix
extends SchemaDefinitionsAltair
so these methods will also be available there (and Capella extends Bellatrix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly I am still a bit confused. Since SchemaDefinitions
contains types for all consensus versions (including phase0), I think we wouldn't lift LightClientBootstrap
there. The spec asks only for an Altair.LightClientBootstrap
return type on this endpoint. The other endpoint I can see that has a similar treatment is produceSyncCommitteeContribution
. This makes me inclined to retrieve the SchemaDefinitionsAltair
in the endpoint with SchemaDefinitionsAltair.required(schemaDefinitionCache.getSchemaDefinition(SpecMilestone.ALTAIR))
and from there .getLightClientBootstrapSchema()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry should have responded to this earlier, but it looks like you worked it out and done the right thing. The new method only gets added to SchemaDefinitionsAltair
. We can be a bit sloppy with terminology when saying things should be added to "SchemaDefinitions" - we mean to the schema definitions for the first milestone it's relevant to.
public class LightClientBootstrap | ||
extends Container3<LightClientBootstrap, BeaconBlockHeader, SyncCommittee, SszBytes32Vector> { | ||
|
||
// TODO: Lift into SpecConfigAltair |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I think moving this will be a whole thing...
It's a little involved to create an SSZ object against the schema for the correct milestone, but it's worthwhile in case it ever changes...
Initially a good object to look at would probably be ExecutionPayload
which exists from Bellatrix... it's not broken down into versions because there's only 1, although it may start moving very soon because there's changes marked for capella...
It might actually be worth that becoming it's own smallish PR as they're a little involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rolfyone Can this one be treated like SYNC_COMMITTEE_SIZE
from SyncCommittee
? Another Altair-specific parameter. The field would move up to SpecConfigAltair
, and then I believe it should be read from config, or a static constants file. But I'm having trouble seeing where the config is parsed (for e.g. SYNC_COMMITTEE_SIZE
).
I have an example impl on a separate branch but it fails the SpecConfigBuilder
validation, making me believe the field is not being successfully read from config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second pass, I got it working (was missing a method in the Builder
) robzajac@6b1b6a4
Just awaiting a second opinion on whether we want this in config this way, and then can write it into this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved constant up to config in the latest push.
4603123
to
7525630
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good. I think the key thing is just to provide a default so we don't break backwards compatibility with the config endpoint.
...ec/src/main/java/tech/pegasys/teku/spec/datastructures/lightclient/LightClientBootstrap.java
Outdated
Show resolved
Hide resolved
@@ -41,6 +42,7 @@ public class SchemaDefinitionsAltair extends AbstractSchemaDefinitions { | |||
private final ContributionAndProofSchema contributionAndProofSchema; | |||
private final SignedContributionAndProofSchema signedContributionAndProofSchema; | |||
private final MetadataMessageSchemaAltair metadataMessageSchema; | |||
private final LightClientBootstrapSchema lightClientBootstrapSchema; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry should have responded to this earlier, but it looks like you worked it out and done the right thing. The new method only gets added to SchemaDefinitionsAltair
. We can be a bit sloppy with terminology when saying things should be added to "SchemaDefinitions" - we mean to the schema definitions for the first milestone it's relevant to.
@@ -79,6 +79,7 @@ | |||
"SLOTS_PER_EPOCH": "32", | |||
"SLOTS_PER_HISTORICAL_ROOT": "8192", | |||
"SYNC_COMMITTEE_SIZE": "512", | |||
"SYNC_COMMITTEE_BRANCH_LENGTH": "5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly we can't just update these test files (including altairForkSpec.json
and mergeForkSpec.json
). They're a capture of the actual response the beacon node will give from the /eth/v1/node/config endpoint which the standalone validator client uses to load the spec from the beacon node. It looks like adding this new property as a required field to Altair is breaking backwards compatibility (which is what the SpecConfigLoaderTest.shouldLoadMainnetPreservingBackwardsCompatibilityWithRestApi
test is checking for.
We probably need to provide a default value in SpecConfigBuilder
instead of requiring the field be set. Could just use the mainnet value as the default which I think would be reasonable. It's not particularly ideal but better than breaking backwards compatibility since people don't always update the VC and BN together. The default probably never gets used anyway since the VC doesn't use it and the built-in presets will provide it for the BN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ajsutton I think that makes sense. I set a default in the builder, similar treatment as updateTimeout
. To check my understanding, is there a point at which the validators are updated to receive the new configs? Or will we continue to use the default for some time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validator client will load the config from the beacon node every time it starts up, so the real value should be picked up quite quickly but it's possible the VC is running against a beacon node that doesn't get updated or against a different client which doesn't yet have light client support and this config item. So we'll probably wind up keeping the default around pretty much forever (or at least until the next hard fork if all clients include it by then since that forces everyone to update). For the vast majority of setups though, they'll start loading the real value very quickly.
Oh I think that acceptance test failure is likely related to the config backwards compatibility issue as well. It's running the latest version of the validator client (with these changes) against an old release of the beacon node and it's failing to start, likely because of the incorrect config. To run locally you'll likely need to run
|
…200 response type.
Signed-off-by: Paul Harris <paul.harris@consensys.net>
56b631f
to
03d27e3
Compare
@ajsutton Recreated locally & pushed up a fix 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your patience on this and sorry we've been slow with reviews.
PR Description
This PR is a base implementation of GetLightClientBootstrap with
return 501;
. It is intended to validate the interface.Fixed Issue(s)
fixes #6287
Documentation
doc-change-required
label to this PR if updates are required.Changelog