From 2eb83a0ebb4f80984baf65d41e6b68d90e9866de Mon Sep 17 00:00:00 2001 From: Ben Bierens <39762930+benbierens@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:32:32 +0200 Subject: [PATCH] Codex-contracts hash in version information. (#1207) * Adds revision hash of codex-contracts to version information. * Update codex/conf.nim Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Ben Bierens <39762930+benbierens@users.noreply.github.com> * Update codex/conf.nim Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Ben Bierens <39762930+benbierens@users.noreply.github.com> * Update codex/rest/api.nim Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Ben Bierens <39762930+benbierens@users.noreply.github.com> * simplified git command * Remove space Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Giuliano Mega * Updates openapi.yaml --------- Signed-off-by: Ben Bierens <39762930+benbierens@users.noreply.github.com> Signed-off-by: Giuliano Mega Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Giuliano Mega --- codex/conf.nim | 7 ++++++- codex/rest/api.nim | 6 +++++- openapi.yaml | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/codex/conf.nim b/codex/conf.nim index 986a53d6..af55861f 100644 --- a/codex/conf.nim +++ b/codex/conf.nim @@ -477,17 +477,22 @@ proc getCodexRevision(): string = var res = strip(staticExec("git rev-parse --short HEAD")) return res +proc getCodexContractsRevision(): string = + let res = strip(staticExec("git rev-parse --short HEAD:vendor/codex-contracts-eth")) + return res + proc getNimBanner(): string = staticExec("nim --version | grep Version") const codexVersion* = getCodexVersion() codexRevision* = getCodexRevision() + codexContractsRevision* = getCodexContractsRevision() nimBanner* = getNimBanner() codexFullVersion* = "Codex version: " & codexVersion & "\p" & "Codex revision: " & codexRevision & "\p" & - nimBanner + "Codex contracts revision: " & codexContractsRevision & "\p" & nimBanner proc parseCmdArg*( T: typedesc[MultiAddress], input: string diff --git a/codex/rest/api.nim b/codex/rest/api.nim index ee493e03..7c7dcd34 100644 --- a/codex/rest/api.nim +++ b/codex/rest/api.nim @@ -914,7 +914,11 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = "", "announceAddresses": node.discovery.announceAddrs, "table": table, - "codex": {"version": $codexVersion, "revision": $codexRevision}, + "codex": { + "version": $codexVersion, + "revision": $codexRevision, + "contracts": $codexContractsRevision, + }, } # return pretty json for human readability diff --git a/openapi.yaml b/openapi.yaml index 551e2fe2..0c3ca9fe 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -124,6 +124,9 @@ components: revision: type: string example: 0c647d8 + contracts: + type: string + example: 0b537c7 PeersTable: type: object