From 40ca20abcb33c38f3fc54a1f88ebf4ea040df78e Mon Sep 17 00:00:00 2001 From: Angel J <78835633+iamanaws@users.noreply.github.com> Date: Sat, 8 Aug 2026 08:31:43 -0700 Subject: [PATCH] stellar-core: fix build with rustc 1.97 ethnum 1.5.0 fails after TryFromIntError stopped being a ZST. Older Soroban protocol dep-trees still pin 1.5.0, so apply the upstream 1.5.3 source fix to the vendored crate. Assisted-by: Cursor (Cursor Grok 4.5) --- pkgs/by-name/st/stellar-core/package.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/st/stellar-core/package.nix b/pkgs/by-name/st/stellar-core/package.nix index db357501e549..8131d0674dc7 100644 --- a/pkgs/by-name/st/stellar-core/package.nix +++ b/pkgs/by-name/st/stellar-core/package.nix @@ -2,7 +2,9 @@ autoconf, automake, bison, + cargo, fetchFromGitHub, + fetchpatch2, flex, gitMinimal, lib, @@ -16,7 +18,6 @@ rustPlatform, stdenv, symlinkJoin, - cargo, }: let @@ -104,6 +105,23 @@ stdenv.mkDerivation (finalAttrs: { ''; }; + # ethnum <= 1.5.2 fails on rustc 1.97+ (TryFromIntError is no longer ZST). + # Protocols p21-p26 pin ethnum 1.5.0 in Cargo.lock / dep-tree expects, so keep + # that version and apply the upstream 1.5.3 source fix in the vendored crate. + # https://github.com/nlordell/ethnum-rs/pull/58 + postPatch = '' + shopt -s nullglob + for crate in "$cargoDepsCopy"/source-registry-*/ethnum-1.5.0; do + patch -p1 -d "$crate" < ${ + fetchpatch2 { + name = "ethnum-1.5.0-rustc-1.97.patch"; + url = "https://github.com/nlordell/ethnum-rs/commit/87e3457c095c98fcac554548ee80f56e0cfb80ae.patch?full_index=1"; + hash = "sha256-xG3RQg2vF+XW9IiYWaNyOF39WipSeoZGrygsOJ3XgIs="; + } + } + done + ''; + strictDeps = true; nativeBuildInputs = [