From eb30b741d9d39a68acde341c1539c5ab34811fc3 Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 3 Oct 2024 15:13:44 +0000 Subject: [PATCH] bump nimbus-build-system to use Nim v2.0.10 (#6592) * bump nimbus-build-system to use Nim v2.0.10 * fix `CatchableError` leak on Windows * define ERROR_INVALID_ACCESS * trigger finding correct hashes for nix build * check checksums checksum * update nix nimble checksum * csources didn't change --- beacon_chain/winservice.nim | 13 +++++++++---- nix/checksums.nix | 2 +- nix/default.nix | 7 +++++-- nix/nimble.nix | 2 +- nix/sat.nix | 12 ++++++++++++ nix/shell.nix | 1 + vendor/nimbus-build-system | 2 +- 7 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 nix/sat.nix diff --git a/beacon_chain/winservice.nim b/beacon_chain/winservice.nim index acfcf042a..e5a131f9e 100644 --- a/beacon_chain/winservice.nim +++ b/beacon_chain/winservice.nim @@ -47,6 +47,7 @@ when defined(windows): SERVICE_CONTROL_INTERROGATE = 4 SERVICE_ACCEPT_STOP = 1 ERROR_INVALID_PARAMETER = 87 + ERROR_INVALID_ACCESS = 12 ERROR_BAD_CONFIGURATION = 1610 NO_ERROR = 0 @@ -155,11 +156,15 @@ when defined(windows): reportServiceStatus(SERVICE_STOPPED, ERROR_BAD_CONFIGURATION, 0) quit QuitFailure - argEntryPoint(config) - - info "Service thread stopped" - reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0) + try: + argEntryPoint(config) + info "Service thread stopped" # we have to report back when we stopped! + reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0) + except CatchableError: + info "Service thread crashed" + # we have to report back when we stopped! + reportServiceStatus(SERVICE_STOPPED, ERROR_INVALID_ACCESS, 0) let serviceName = newWideCString(argServiceName) diff --git a/nix/checksums.nix b/nix/checksums.nix index 2c8f2c54c..d79345d24 100644 --- a/nix/checksums.nix +++ b/nix/checksums.nix @@ -8,5 +8,5 @@ in pkgs.fetchFromGitHub { repo = "checksums"; rev = tools.findKeyValue "^ +ChecksumsStableCommit = \"([a-f0-9]+)\"$" sourceFile; # WARNING: Requires manual updates when Nim compiler version changes. - hash = "sha256-RB2IXs2xcfYHhV9d7l1mtHW51mtsrqrYRapSoTikvHw="; + hash = "sha256-Bm5iJoT2kAvcTexiLMFBa9oU5gf7d4rWjo3OiN7obWQ="; } diff --git a/nix/default.nix b/nix/default.nix index a444329eb..a84a538e2 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -59,10 +59,13 @@ in stdenv.mkDerivation rec { pushd vendor/nimbus-build-system/vendor/Nim mkdir dist cp -r ${callPackage ./nimble.nix {}} dist/nimble - cp -r ${callPackage ./checksums.nix {}} dist/checksums + chmod 777 -R dist/nimble + mkdir -p dist/nimble/dist + cp -r ${callPackage ./sat.nix {}} dist/nimble/dist/sat + cp -r ${callPackage ./checksums.nix {}} dist/checksums # need both + cp -r ${callPackage ./checksums.nix {}} dist/nimble/dist/checksums cp -r ${callPackage ./csources.nix {}} csources_v2 chmod 777 -R dist/nimble csources_v2 - sed -i 's/isGitRepo(destDir)/false/' tools/deps.nim popd ''; diff --git a/nix/nimble.nix b/nix/nimble.nix index 8eec4b414..5343aaa81 100644 --- a/nix/nimble.nix +++ b/nix/nimble.nix @@ -8,5 +8,5 @@ in pkgs.fetchFromGitHub { repo = "nimble"; rev = tools.findKeyValue "^ +NimbleStableCommit = \"([a-f0-9]+)\".+" sourceFile; # WARNING: Requires manual updates when Nim compiler version changes. - hash = "sha256-qJcDKnc+9iUvYrZCMUbBbws+Qqa9vmWyCRsvOUEmq8U="; + hash = "sha256-sa0irAZjQRZLduEMBPf7sHlY1FigBJTR/vIH4ihii/w="; } diff --git a/nix/sat.nix b/nix/sat.nix new file mode 100644 index 000000000..ca6403f68 --- /dev/null +++ b/nix/sat.nix @@ -0,0 +1,12 @@ +{ pkgs ? import { } }: + +let + tools = pkgs.callPackage ./tools.nix {}; + sourceFile = ../vendor/nimbus-build-system/vendor/Nim/koch.nim; +in pkgs.fetchFromGitHub { + owner = "nim-lang"; + repo = "sat"; + rev = tools.findKeyValue "^ +SatStableCommit = \"([a-f0-9]+)\"$" sourceFile; + # WARNING: Requires manual updates when Nim compiler version changes. + hash = "sha256-JFrrSV+mehG0gP7NiQ8hYthL0cjh44HNbXfuxQNhq7c="; +} diff --git a/nix/shell.nix b/nix/shell.nix index 5cacda064..8b5fe3c51 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -22,6 +22,7 @@ in pkgs.mkShell { lsof # for killing processes by port killall # for killing processes manually curl # for working with the node APIs + jq # for parsing beacon API for LC start openjdk # for running web3signer mkdocs-python diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index 741274439..c3241765e 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit 741274439ce72162ab3c740e7c0ef624d32725f9 +Subproject commit c3241765e3896a06ed372dddc9dd6e3c36fae8f6