From 57c3712bb84d08ce93a98aa076096975f03c7b88 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Fri, 17 Jul 2026 18:48:57 -0300 Subject: [PATCH] fix(amm): align wallet RPC with public testnet Pin wallet FFI to the rc6 sequencer contract while retaining the Darwin xcrun workaround. Add a regression check and matching core LGX outputs. --- apps/amm/README.md | 11 +++-- apps/amm/flake.lock | 8 ++-- apps/amm/flake.nix | 101 ++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 101 insertions(+), 19 deletions(-) diff --git a/apps/amm/README.md b/apps/amm/README.md index cd93533..95a7e93 100644 --- a/apps/amm/README.md +++ b/apps/amm/README.md @@ -79,12 +79,10 @@ nix build '.#lgx' --out-link result-lgx # Portable variant (self-contained, works without nix) nix build '.#lgx-portable' --out-link result-lgx-portable -# The core wallet module it depends on. These are the same immutable upstream -# revisions used by this app's flake, including the merged macOS Metal fix. -nix build 'github:logos-blockchain/logos-execution-zone-module?rev=d70225ced646934d2294fd9e8f8b03615c104b80#lgx' \ - --override-input logos-execution-zone \ - 'github:logos-blockchain/logos-execution-zone?rev=a7e06a660940a00093b1760560d37ff84aff5a05' \ - --out-link result-core +# The matching core wallet module. This uses the public-testnet RPC contract +# and carries the macOS Metal workaround without pulling newer wallet RPCs. +nix build '.#logos_execution_zone-lgx' --out-link result-core +nix build '.#logos_execution_zone-lgx-portable' --out-link result-core-portable ``` ### 2. Install into Basecamp @@ -106,6 +104,7 @@ lgpm --ui-plugins-dir "$BASECAMP_DIR/plugins" \ ``` > **Note:** Use matching variants throughout — dev with dev, portable with portable. Mixing variants causes loading failures. The portable build uses the `LogosBasecamp` data directory instead of `LogosBasecampDev`. +> For the portable pair, install the core module from `result-core-portable/`. ### 3. Launch Basecamp diff --git a/apps/amm/flake.lock b/apps/amm/flake.lock index c272fd5..da8aca6 100644 --- a/apps/amm/flake.lock +++ b/apps/amm/flake.lock @@ -2254,17 +2254,17 @@ "rust-rapidsnark": "rust-rapidsnark" }, "locked": { - "lastModified": 1784202021, - "narHash": "sha256-BG94Ob5tbJyw7GclNBdnOWqcBLRld8sc+xeOU8LI5RQ=", + "lastModified": 1782428741, + "narHash": "sha256-ltLcysXUdVUXAe25Tl8x7e7ZsTzj1sHlyS3glp97TAo=", "owner": "logos-blockchain", "repo": "logos-execution-zone", - "rev": "a7e06a660940a00093b1760560d37ff84aff5a05", + "rev": "e37876a64028a335eb693198a1ed6a0e875ec5b4", "type": "github" }, "original": { "owner": "logos-blockchain", "repo": "logos-execution-zone", - "rev": "a7e06a660940a00093b1760560d37ff84aff5a05", + "rev": "e37876a64028a335eb693198a1ed6a0e875ec5b4", "type": "github" } }, diff --git a/apps/amm/flake.nix b/apps/amm/flake.nix index 06c0fa2..d5da892 100644 --- a/apps/amm/flake.nix +++ b/apps/amm/flake.nix @@ -8,27 +8,77 @@ # Core wallet module (the LEZ wallet FFI Qt plugin). The input name must # match the metadata.json `dependencies` entry so the builder can resolve - # it as a module dependency. This revision exposes generic transaction - # submission by deployed program ID. + # it as a module dependency. Public testnet still exposes the v0.2.0-rc6 + # wallet RPC contract. logos_execution_zone = { url = "github:logos-blockchain/logos-execution-zone-module?rev=d70225ced646934d2294fd9e8f8b03615c104b80"; - - # The module pins the monorepo at v0.2.0-rc6 (e37876a). Override that - # transitive input with the merged macOS xcrun-cache fix. inputs.logos-execution-zone.url = - "github:logos-blockchain/logos-execution-zone?rev=a7e06a660940a00093b1760560d37ff84aff5a05"; + "github:logos-blockchain/logos-execution-zone?rev=e37876a64028a335eb693198a1ed6a0e875ec5b4"; }; }; - outputs = inputs@{ logos-module-builder, nixpkgs, crane, ... }: + outputs = inputs@{ + logos-module-builder, + logos_execution_zone, + nixpkgs, + crane, + ... + }: let + # Preserve the macOS Metal workaround without moving the wallet past the + # RPC contract currently deployed on public testnet. Crane builds the + # dependency artifacts separately, so both derivations need the setting. + withXcrunNoCache = package: + package.overrideAttrs (previous: + { + xcrun_nocache = "1"; + } + // (if previous ? cargoArtifacts && previous.cargoArtifacts ? overrideAttrs + then { + cargoArtifacts = previous.cargoArtifacts.overrideAttrs (_: { + xcrun_nocache = "1"; + }); + } + else { })); + + executionZone = logos_execution_zone.inputs.logos-execution-zone; + testnetExecutionZone = executionZone // { + packages = builtins.mapAttrs + (system: packages: + if builtins.match ".*-darwin" system == null then packages + else + let + wallet = withXcrunNoCache packages.wallet; + in + packages // { + inherit wallet; + default = wallet; + }) + executionZone.packages; + }; + + # Evaluate the pinned module source with the testnet-compatible wallet. + # This is ordinary flake composition, not a relative flake input, keeping + # Nix 2.25 lock and build behavior portable. + logosExecutionZoneModule = + (import "${logos_execution_zone.outPath}/flake.nix").outputs { + logos-module-builder = logos_execution_zone.inputs.logos-module-builder; + logos-execution-zone = testnetExecutionZone; + nix-bundle-lgx = logos_execution_zone.inputs.nix-bundle-lgx; + }; + + # Name must match metadata.json so the builder resolves the core module. + moduleInputs = inputs // { + logos_execution_zone = logosExecutionZoneModule; + }; + ammClientInput = (import ../../flake.nix).outputs { inherit nixpkgs crane; }; moduleBuild = logos-module-builder.lib.mkLogosQmlModule { src = ./.; configFile = ./metadata.json; - flakeInputs = inputs; + flakeInputs = moduleInputs; preConfigure = '' cmakeFlagsArray+=("-DLOGOS_WALLET_SOURCE_DIR=${../shared/wallet}") ''; @@ -68,12 +118,45 @@ moduleDeps = logos-module-builder.lib.common.collectAllModuleDeps - system inputs moduleBuild.config.dependencies; + system moduleInputs moduleBuild.config.dependencies; }; } ); + + publicPackages = builtins.mapAttrs + (system: packages: packages // { + logos_execution_zone-lgx = + logosExecutionZoneModule.packages.${system}.lgx; + logos_execution_zone-lgx-portable = + logosExecutionZoneModule.packages.${system}.lgx-portable; + }) + moduleBuild.packages; + + linuxChecks = + let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + walletModule = logosExecutionZoneModule.packages.x86_64-linux.lib; + in + { + wallet-rpc-contract = pkgs.runCommand "amm-wallet-rpc-contract" { } '' + wallet="${walletModule}/lib/libwallet_ffi.so" + test -f "$wallet" + ${pkgs.binutils}/bin/strings "$wallet" > methods + ${pkgs.gnugrep}/bin/grep -Fq sendTransaction methods + ${pkgs.gnugrep}/bin/grep -Fq getProofForCommitment methods + if ${pkgs.gnugrep}/bin/grep -Fq getProofsAndRoot methods; then + echo "wallet uses unsupported testnet RPC method getProofsAndRoot" + exit 1 + fi + touch "$out" + ''; + }; in moduleBuild // { apps = publicApps; + packages = publicPackages; + checks = (moduleBuild.checks or { }) // { + x86_64-linux = (moduleBuild.checks.x86_64-linux or { }) // linuxChecks; + }; }; }