cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
763 stars 211 forks source link

cardano-wallet NixOS module not working with cardano-node NixOS module #4522

Open koslambrou opened 6 months ago

koslambrou commented 6 months ago

Just checking...

Version

v2024-03-27 (git revision 08ab303b0e111ba8a96ab3d2634adcee230766e4)

Platform

Linux desjardins 6.1.63 #1-NixOS SMP PREEMPT_DYNAMIC Mon Nov 20 10:52:19 UTC 2023 x86_64 GNU/Linux

Installation method

Nix

Network configuration

mainnet

Context

No response

Description

Steps to Reproduce

Here are the relevant parts of my initial configuration.nix with a working cardano-node:

let
cardano-node = import
  (builtins.fetchTarball {
    url = https://github.com/IntersectMBO/cardano-node/archive/refs/tags/8.9.1.tar.gz;
 }) {};
in
{
  imports = [
    cardano-node.nixosModules.cardano-node
  ];

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users = {
    xxx = {
      isNormalUser = true;
      extraGroups = [ "wheel" ... "cardano-node" ];
    };

  services.cardano-node = {
    enable = true;
    environment = "mainnet";
    stateDir = "/var/lib/cardano-node/mainnet";
    runtimeDir = i: "/var/lib/cardano-node/mainnet";
    socketPath = i : "${config.services.cardano-node.runtimeDir i}/cardano-node.socket";
    databasePath = i : "${config.services.cardano-node.stateDir i}/db";
  };

  ...

}

Then, as I wanted to add the cardano-wallet NixOS module, I changed it as follows:

let
# cardano-wallet needs to use a version compatible with cardano-node.
cardano-node = import
  (builtins.fetchTarball {
    url = https://github.com/IntersectMBO/cardano-node/archive/refs/tags/8.9.1.tar.gz;
 }) {};
+ cardano-wallet = import
+  (builtins.fetchTarball {
+   url = https://github.com/cardano-foundation/cardano-wallet/archive/refs/tags/v2024-03-27.tar.gz;
+ }) {};
in
{
  imports = [
    cardano-node.nixosModules.cardano-node
+    cardano-wallet.nixosModule
  ];

+  services.cardano-wallet = {
+     enable = true;
+     walletMode = config.services.cardano-node.environment;
+     nodeSocket = config.services.cardano-node.socketPath 0;
+     poolMetadataFetching = {
+       enable = true;
+       smashUrl = "https://smash.cardano-mainnet.iohk.io";
+     };
+     tokenMetadataServer = "https://tokens.cardano.org";
+   };

  ...
}

These steps come directly from cardano-wallet documentation: https://cardano-foundation.github.io/cardano-wallet/user/installation/use-nixos.html#nixos-module

Expected behavior

A working cardano-wallet systemd service which syncs with the installed cardano-node.

Actual behavior

Without adding the cardano-wallet NixOS module, my cardano-node service would successfully sync on mainnet. When adding the cardano-wallet NixOS module, the cardano-node service fails.

Here is the output of journalctl -u cardano-node.service

Apr 03 11:54:49 desjardins systemd[1]: Failed to start cardano-node node 0 service.
Apr 03 11:54:50 desjardins systemd[1]: cardano-node.service: Scheduled restart job, restart counter is at 12.
Apr 03 11:54:50 desjardins systemd[1]: Starting cardano-node node 0 service...
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: Starting: exec /nix/store/vxwqzhjp4wfj42cm3ff42z3cgr7244vp-cardano-wallet-2024.3.27/bin/cardano-node run
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --config /nix/store/76zh2cy72zz8bxh7k5c4v7rgiba9qrk1-config-0-0.json
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --database-path /var/lib/cardano-node/mainnet/db
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --topology /nix/store/czj80vj5a9vg1xdg3sgqpfj0hc8zv3pb-topology.yaml
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --host-addr 127.0.0.1
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --port 3001
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --socket-path /var/lib/cardano-node/mainnet/cardano-node.socket
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: +RTS
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: -N2
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: -I0
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: -A16m
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: -qg
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: -qb
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: --disable-delayed-os-memory-return
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: -RTS
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: ..or, once again, in a single line:
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: exec /nix/store/vxwqzhjp4wfj42cm3ff42z3cgr7244vp-cardano-wallet-2024.3.27/bin/cardano-node run --config /nix/store/76zh2cy72zz8bxh7k5c4v7rgiba9qrk1-config-0-0.json --database-path /var/lib/cardano-node/mainnet/db --topology /nix/store/czj80vj5a9vg1xdg3s>
Apr 03 11:54:50 desjardins cardano-node-start[2090387]: /nix/store/z92lwrkckp23r8rf8j5xgmxjgj7dgwf2-unit-script-cardano-node-start/bin/cardano-node-start: line 26: /nix/store/vxwqzhjp4wfj42cm3ff42z3cgr7244vp-cardano-wallet-2024.3.27/bin/cardano-node: No such file or directory
Apr 03 11:54:50 desjardins systemd[1]: cardano-node.service: Main process exited, code=exited, status=127/n/a

The output of journalctl -u cardano-wallet.service

Apr 03 11:58:40 desjardins cardano-wallet[2080409]: [cardano-wallet.pools-engine:Warning:23] [2024-04-03 15:58:40.41 UTC] Still not syncing. Applied 0 blocks, 0 rollbacks in the last 30.00141581s. Current tip is [point genesis]. (not applying blocks)
Apr 03 11:58:40 desjardins cardano-wallet[2080409]: [cardano-wallet.network:Warning:16] [2024-04-03 15:58:40.62 UTC] Delegation Rewards node client: Couldn't connect to node (x187). Retrying in a bit...
Apr 03 11:58:40 desjardins cardano-wallet[2080409]: [cardano-wallet.network:Warning:22] [2024-04-03 15:58:40.62 UTC] Chain Sync node client: Couldn't connect to node (x187). Retrying in a bit...
Apr 03 11:58:40 desjardins cardano-wallet[2080409]: [cardano-wallet.network:Warning:14] [2024-04-03 15:58:40.62 UTC] Node Tip node client: Couldn't connect to node (x187). Retrying in a bit...
Apr 03 11:58:42 desjardins cardano-wallet[2080409]: [cardano-wallet.network:Warning:14] [2024-04-03 15:58:42.62 UTC] Node Tip node client: Couldn't connect to node (x188). Retrying in a bit...
Apr 03 11:58:42 desjardins cardano-wallet[2080409]: [cardano-wallet.network:Warning:22] [2024-04-03 15:58:42.62 UTC] Chain Sync node client: Couldn't connect to node (x188). Retrying in a bit...

Looking at the logs, the cardano-wallet service doesn't use the cardano-node that I have installed.

koslambrou commented 6 months ago

Not the same error, but this seems related to https://github.com/cardano-foundation/cardano-wallet/issues/3179