obsidiansystems / hydra-pay

An open-source library for Cardano developers using Hydra (Head)
38 stars 6 forks source link

Head initialization failure #10

Closed v0d1ch closed 1 year ago

v0d1ch commented 1 year ago

When running the demo locally (tag c9de54b1d452e42a9e106f71a4397e3b2ac54377) I am experiencing error:

   Failed to submit tx, check participants fuel

This happens both on the demo frontend and when trying to send socket messages using postman.

Initially I though that just the readme sections are a bit out of order since it makes sense to fund the address/es first before initializing the head, but funding and then initializing didn't work. When initializing the head I can see addresses are not funded:

{
    "tagged_payload": {
        "tag": "HeadInfo",
        "contents": {
            "headStatus_name": "test",
            "headStatus_balances": {
                "addr_test1vq8lkpxf42m9k4e7f34dmhdutquhvakwyyqqqkq5a82v6rcqenqh3": 0,
                "addr_test1vr747rl3x752krr86v2laglz4h2pfwh05xud04q5h874wucu8k3c3": 0
            },
            "headStatus_running": true,
            "headStatus_status": "Status_Pending"
        }
    },
    "tagged_id": 0
}
Yasuke commented 1 year ago

@v0d1ch It looks like not enough fuel was given to the proxy addresses to be able to initialize the head. Can you tell me who much fuel was given to each participant?

The order is purposeful: Funding/Fuel must happen first, then you may Initialize the Head as that requires an L1 operation.

The error failed to submit tx, check participants fuel tells me that one or more participants didn't have fuel and thus the Hydra Node complained with NotEnoughFuel.

I would say try again and ensure you give adequate fuel to each participant you want in the head, and please let me know if the issue persists.

To be clear if you want a Head that will have 2 participants, and you are on a fresh devnet: You must request and submit 4 transactions:

Yasuke commented 1 year ago
{
    "tagged_payload": {
        "tag": "HeadInfo",
        "contents": {
            "headStatus_name": "test",
            "headStatus_balances": {
                "addr_test1vq8lkpxf42m9k4e7f34dmhdutquhvakwyyqqqkq5a82v6rcqenqh3": 0,
                "addr_test1vr747rl3x752krr86v2laglz4h2pfwh05xud04q5h874wucu8k3c3": 0
            },
            "headStatus_running": true,
            "headStatus_status": "Status_Pending"
        }
    },
    "tagged_id": 0
}

This doesn't mean the addresses weren't funded, when a Head is Pending there is no proper way to get the balance, as nobody has commited yet. You should only expect valid balances when the head status is Open.

v0d1ch commented 1 year ago

Thanks for looking at this @Yasuke

I basically followed the instructions in the readme and experienced this error locally. I have tried it tree times with the same outcome. If need be we can arrange a meeting so I show you this in my local setup.

parenthetical commented 1 year ago

@v0d1ch this might be because the readme lists the commands in the wrong order. You should first add funds and fuel to your proxy address (see https://github.com/obsidiansystems/hydra-pay#add-funds, don't forget to submit the transactions the API endpoint returns).

v0d1ch commented 1 year ago

Oh, sorry. I wanted to say I followed the instructions in the live documentation after running the demo. Those should work and be in the right order right?

parenthetical commented 1 year ago

Yes, that's right. Are you able to run through the live docs in order, funding both fuel and regular while pressing the green button to submit the transaction? This is different from the button which queries the API for a funding transaction. If you're trying to make a head with two addresses you'll have to press both the "get transaction" and green "submit transaction" buttons four times in total.

v0d1ch commented 1 year ago

Ok at first I thought the tag I am using is broken tag c9de54b1d452e42a9e106f71a4397e3b2ac54377 but then I pulled the latest develop branch 3437c408c09f4b3fbf50c9ad56a320a2243375dd and still have problems running the demo locally.

I am attaching the video so you guys can have easier time figuring out what could have gone wrong here.

This is the redacted error message since it is huge, looks like argument is missing when calling cardano-cli:

...
    "contents": "Cardano CLI: Missing: (--tx-in TX-IN)
...
Yasuke commented 1 year ago

@v0d1ch You have been copying the example addresses from the expected response, and not the actual addresses generated by your hydra pay instance. Here is a video on the same hash showing things working:

video

There is convenience copy paste buttons for any and all the addresses at any point they are returned from Hydra Pay, so using those will save you a lot of trouble in the future.

v0d1ch commented 1 year ago

Thanks, I'll give it another shot. Copy button didn't work for me for whatever reason, I'll try different browser and report back.

v0d1ch commented 1 year ago

Ok, tried it on firefox and works really nicely, good job!

I am not sure why copy button on chrome didn't work for me but that is probably something on my end. I tested nixos and docker workflow and both work fine.