Skip to content

Implement GET v2/node/version endpoint#9171

Open
chong-he wants to merge 6 commits intosigp:unstablefrom
chong-he:node-v2
Open

Implement GET v2/node/version endpoint#9171
chong-he wants to merge 6 commits intosigp:unstablefrom
chong-he:node-v2

Conversation

@chong-he
Copy link
Copy Markdown
Member

Issue Addressed

Partly #9045

Additional Info

Response with only beacon node (EC not shown at all):

{
  "data": {
    "beacon_node": {
      "code": "LH",
      "name": "Lighthouse",
      "version": "v8.1.3",
      "commit": "13dd00ab"
    }
  }
}

Response with both BN and EC:

{
  "data": {
    "beacon_node": {
      "code": "LH",
      "name": "Lighthouse",
      "version": "v8.1.3",
      "commit": "13dd00ab"
    },
    "execution_client": {
      "code": "GE",
      "name": "go-ethereum",
      "version": "1.15.11-stable",
      "commit": "36b2371c"
    }
  }
}

Comment thread common/eth2/src/types.rs
Comment on lines +602 to +609
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct JsonClientVersion {
pub code: String,
#[serde(default)]
pub name: String,
pub version: String,
pub commit: String,
}
Copy link
Copy Markdown
Member Author

@chong-he chong-he Apr 24, 2026

Choose a reason for hiding this comment

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

This is copied from:

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct JsonClientVersionV1 {
pub code: String,
// This `default` is required until Geth v1.13.x is no longer supported on mainnet.
// See: https://github.com/ethereum/go-ethereum/pull/29351
#[serde(default)]
pub name: String,
pub version: String,
pub commit: String,
}

I wanted to do: use execution_layer::json_structures::JsonClientVersionV1, but adding execution_layer in Cargo.toml under eth2 will create a cyclic dependency issue when compiling. So I ended up just created another one. Probably not ideal, so happy to revise according to the feedback about this

@chong-he chong-he added ready-for-review The code is ready for review HTTP-API labels Apr 24, 2026
.to_string();

JsonClientVersion {
code: "LH".to_string(),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure if it is ok to hardcode "LH" here? I wanted to do this:

pub static LIGHTHOUSE_JSON_CLIENT_VERSION: LazyLock<JsonClientVersionV1> =
LazyLock::new(|| JsonClientVersionV1 {
code: ClientCode::Lighthouse.to_string(),
name: "Lighthouse".to_string(),
version: VERSION.replace("Lighthouse/", ""),
commit: COMMIT_PREFIX.to_string(),
});

but it involves using ClientCode which is also from the execution_layer, which will also cause cyclic dependency issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HTTP-API ready-for-review The code is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant