-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat: include EL client info in graffiti #6753
base: unstable
Are you sure you want to change the base?
Conversation
Performance Report✔️ no performance regression detected 🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
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.
General approach of having the default moved from validator client to beacon node looks good to me, just need to make sure to always respect graffiti if explicitly set by user.
I haven't looked at the spec PR, will do more detailed review once the high-level concerns are addressed.
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Co-authored-by: Cayman <caymannava@gmail.com>
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
return this.executionClientVersion; | ||
} | ||
|
||
getConsensusClientVersion(): ClientVersion { |
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's a bit strange that this is part of execution engine
return {code, name: cv.name, version: cv.version, commit: cv.commit}; | ||
}); | ||
|
||
this.logger.debug(`executionClientVersion is set to ${JSON.stringify(this.executionClientVersion)}`); |
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.
just dumping the data like this doesn't seem too useful, maybe we could include the version info in a nicely formatted way in the state logs (likely just the online one)
* Not to be confused with `getClientVersion`. This method returns cached client version | ||
* from `getClientVersion` which is a rpc call to EL client | ||
*/ | ||
getExecutionClientVersion(): ClientVersion[]; |
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.
instead of using a function for this, could have a public property and use a getter in the implementation
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.
instead of using a function for this, could have a public property and use a getter in the implementation
It was to conform with the getState()
function. But I agree using a getter. We don't need property to be public though.
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 don't need property to be public though.
I mean on the interface, like
readonly clientVersion?: ClientVersion;
and the implementation would use a getter
I don't like that getState()
is a method if it just returns a property
@@ -429,6 +474,9 @@ export class ExecutionEngineHttp implements IExecutionEngine { | |||
switch (newState) { | |||
case ExecutionEngineState.ONLINE: | |||
this.logger.info("Execution client became online", {oldState, newState}); | |||
this.getClientVersion().catch((e) => { |
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 online state is good place to trigger this as the online time this will be the newState
if el was offline but there is a small issue on startup with this as initial state is online, see
private state: ExecutionEngineState = ExecutionEngineState.ONLINE; |
I would assume it's currently not fetched on startup, other than handling inital fetch this looks good to me
@@ -335,6 +332,26 @@ export function getValidatorApi({ | |||
); | |||
} | |||
|
|||
function getDefaultGraffiti(): string { |
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 at code in this PR, it seems a bit scattered around, we should consider moving this into utils file and having graffiti related code there. Would also allow to add unit tests for this which would document the expected format as well.
The execution engine is responsible for providing the version of the connected EL client and shouldn't have to know more than that. I guess the execution engine needs to lodestar version, maybe we can just import that statically, similar to the previous graffiti util
* Client code as defined in https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/identification.md#clientcode | ||
* ClientCode.XX is dedicated to other clients which do not have their own code | ||
*/ | ||
export enum ClientCode { |
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.
this is not really related to execution engine as it's specific to format in graffiti ah nvm this is relevant to the engine api format
const response = await this.rpc.fetchWithRetries< | ||
EngineApiRpcReturnTypes[typeof method], | ||
EngineApiRpcParamTypes[typeof method] | ||
>({method, params: [clientVersion ?? this.getConsensusClientVersion()]}); |
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.
Need to confirm that we sent 8 bytes as the commit hash, I think we currently use 7 to match github hashes
Depending how strict the ELs validate this request it might cause issues, see related
This PR shifts the responsibility of setting the default graffiti from
validator
tobeacon-node
and also definesengine_getClientVersionV1
.Due to
validator
package no longer determines default graffiti, graffitiValidatorStore
is now marked as optional (typestring | undefined
). This implies produce block endpoints in validator api accepts optional graffiti andgetGraffiti
in key manager api now may throw error if no graffiti is available for the queried pubkey.When the api module first starts.
engine_getClientVersionV1
will be called to determine the default graffiti and store it in memory. Afterwards this endpoint will be called inprepareNextSlot
if proposing next slot.Default graffiti will be used during produceBlock api call when the block graffiti is undefined and
private
flag is unset.Closes #6463