Encode Execution Engine Client Version In Graffiti (#5290)

* Add `engine_clientVersionV1` structs

* Implement `engine_clientVersionV1`

* Update to latest spec changes

* Implement GraffitiCalculator Service

* Added Unit Tests for GraffitiCalculator

* Address Mac's Comments

* Remove need to use clap in beacon chain

* Merge remote-tracking branch 'upstream/unstable' into el_client_version_graffiti

* Merge branch 'unstable' into el_client_version_graffiti

# Conflicts:
#	beacon_node/beacon_chain/Cargo.toml
This commit is contained in:
ethDreamer
2024-04-24 01:02:48 -05:00
committed by GitHub
parent c38b05d640
commit 4a48d7b546
20 changed files with 847 additions and 81 deletions

View File

@@ -747,3 +747,36 @@ pub mod serde_logs_bloom {
.map_err(|e| serde::de::Error::custom(format!("invalid logs bloom: {:?}", e)))
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct JsonClientVersionV1 {
pub code: String,
pub name: String,
pub version: String,
pub commit: String,
}
impl From<ClientVersionV1> for JsonClientVersionV1 {
fn from(client_version: ClientVersionV1) -> Self {
Self {
code: client_version.code.to_string(),
name: client_version.name,
version: client_version.version,
commit: client_version.commit.to_string(),
}
}
}
impl TryFrom<JsonClientVersionV1> for ClientVersionV1 {
type Error = String;
fn try_from(json: JsonClientVersionV1) -> Result<Self, Self::Error> {
Ok(Self {
code: json.code.try_into()?,
name: json.name,
version: json.version,
commit: json.commit.try_into()?,
})
}
}