txpipe / dolos

Cardano Data Node
https://dolos.txpipe.io
Apache License 2.0
71 stars 21 forks source link

Docker init - Failed to extract snapshot when using Dolos snapshot #378

Open mrabdibdi-anvil opened 3 weeks ago

mrabdibdi-anvil commented 3 weeks ago

Platform: MacOS Docker Desktop : 4.29.0

Morning I tried the following commands:

docker run -it -v ./dolos:/etc/dolos ghcr.io/txpipe/dolos:latest init
docker run -it -v ./dolos/daemon.toml:/etc/dolos/daemon.toml ghcr.io/txpipe/dolos:latest init
docker run -it ghcr.io/txpipe/dolos:latest init

All of them returns this message when I select the following options (didn't try other options, I wanted to test it quickly to experiment with the gRPC implementation and the node socket (ouroboros))

> Which network are you connecting to? Cardano Mainnet
> Do you want to use included genesis files? Yes
> Which remote peer (relay) do you want to use? backbone.mainnet.cardanofoundation.org:3001
> How much history of the chain do you want to keep in disk? 1 day
> Do you want to serve clients via gRPC? Yes
> Do you want to serve clients via Ouroboros (aka: node socket)? Yes
> Do you want to act as a relay for other nodes? Yes
config saved to dolos.toml
> which bootstrap method would you like to use? Dolos snapshot (a few mins, trust me bro)
> which variant of the snapshot would you like to use? ledger snapshot (just the ledger)
Error:   x Failed to extract snapshot
  |-> failed to unpack `/data/ledger`
  |-> failed to unpack `ledger` into `/data/ledger`
  |-> error decoding response body
  `-> operation timed out

Goal: is to evaluate if we can fetch UTXOs and create transaction quickly

Thank you !

scarmuega commented 1 week ago

@mrabdibdi-anvil we're not able to reproduce. Can you please try using a docker image tag fixed to a version?

Eg: docker run -it ghcr.io/txpipe/dolos:latestdolos:v0.18

This will help us debug any version-specific errors.

mrabdibdi-anvil commented 1 week ago

Hello @scarmuega

Issue persists on MacOS (15.0.1) even with fixed version.

docker run -it --rm -v ./dolos:/etc/dolos ghcr.io/txpipe/dolos:v0.18 init
Unable to find image 'ghcr.io/txpipe/dolos:v0.18' locally
v0.18: Pulling from txpipe/dolos
Digest: sha256:d7b544501c22cf5e5642a251e759310e9d0b0c1470090c43e67edc0c18b92886
Status: Downloaded newer image for ghcr.io/txpipe/dolos:v0.18
> Which network are you connecting to? Cardano Mainnet
> Do you want to use included genesis files? Yes
> Which remote peer (relay) do you want to use? backbone.mainnet.cardanofoundat
on.org:3001
> How much history of the chain do you want to keep in disk? 1 day
> Do you want to serve clients via gRPC? Yes
> Do you want to serve clients via Ouroboros (aka: node socket)? Yes
> Do you want to act as a relay for other nodes? Yes
config saved to dolos.toml
> which bootstrap method would you like to use? Dolos snapshot (a few mins, tru
t me bro)
> which variant of the snapshot would you like to use? ledger snapshot (just th
Error:   x Failed to extract snapshot
  |-> failed to unpack `/data/ledger`
  |-> failed to unpack `ledger` into `/data/ledger`
  |-> error decoding response body
  `-> operation timed out

Can it be a macos / docker desktop limitation ?


Tested successfully with v0.18 on Linux host

docker run -it --rm -v ./dolos:/etc/dolos ghcr.io/txpipe/dolos:v0.18 init
Unable to find image 'ghcr.io/txpipe/dolos:v0.18' locally
v0.18: Pulling from txpipe/dolos
a480a496ba95: Already exists 
df96f99efb88: Pull complete 
d0ccff60652d: Pull complete 
ae0adb3062cd: Pull complete 
355be3b1d524: Pull complete 
5daa3e8d926c: Pull complete 
Digest: sha256:d7b544501c22cf5e5642a251e759310e9d0b0c1470090c43e67edc0c18b92886
Status: Downloaded newer image for ghcr.io/txpipe/dolos:v0.18
> Which network are you connecting to? Cardano Mainnet
> Do you want to use included genesis files? Yes
> Which remote peer (relay) do you want to use? backbone.mainnet.cardanofoundation.org:3001
> How much history of the chain do you want to keep in disk? 1 day
> Do you want to serve clients via gRPC? Yes
> Do you want to serve clients via Ouroboros (aka: node socket)? Yes
> Do you want to act as a relay for other nodes? Yes
config saved to dolos.toml
> which bootstrap method would you like to use? Dolos snapshot (a few mins, trust me bro)
> which variant of the snapshot would you like to use? ledger snapshot (just the ledger)

Dolos is ready!
- run `dolos daemon` to start the node

Tested with the latest tag with linux and working as expected:

docker run -it --rm -v ./dolos1:/etc/dolos ghcr.io/txpipe/dolos:latest init

Thanks for your time

mrabdibdi-anvil commented 6 days ago

Was able to successfully test fetching the utxos using UTXORPC and dolos using linux + docker. Setup took literally 5 minutes and was able to get the correct CSL output 🎉

import { CardanoQueryClient } from "npm:@utxorpc/sdk";
import { Buffer } from "node:buffer";
import {
  TransactionUnspentOutput,
  TransactionInput,
  TransactionOutput,
  TransactionHash,
  TransactionUnspentOutputs,
} from "npm:@emurgo/cardano-serialization-lib-nodejs@13.2.0";

const queryClient = new CardanoQueryClient({
  // Dolos Endpoint
  uri: "http://127.0.0.1:50051",
});

const utxos = await queryClient.searchUtxosByAddress(
  Buffer.from(
    // Fetched from browser using wallet.getChangeAddress()
    "01748db2058acba59a4cac60ea2169d052276e1c7f97a8d03bfb1d0e638156ab4c0083b4f0bc41b18573a76151498101c764737e62fe7bcea1",
    "hex",
  ),
);

const parsedUtxo: TransactionUnspentOutputs = TransactionUnspentOutputs.new();
for (const utxo of utxos) {
  // UTXOs from browser
  if (typeof utxo === "string") {
    parsedUtxo.add(TransactionUnspentOutput.from_hex(utxo));
  } else {
    // UTXOs from dolos
    const bytes = utxo.nativeBytes;
    if (!bytes) {
      throw new Error("No native bytes");
    }
    parsedUtxo.add(
      TransactionUnspentOutput.new(
        TransactionInput.new(
          TransactionHash.from_bytes(utxo.txoRef.hash),
          utxo.txoRef.index,
        ),
        TransactionOutput.from_bytes(bytes),
      ),
    );
  }
}

console.log("Parsed UTXO", parsedUtxo.to_json());

Deno.exit(0);

Do you think it is pertinent to add this in the docs / examples ? @scarmuega

This comment is unrelated to my issue on macos.