Rusty Russell [ARCHIVE] on Nostr: 📅 Original date posted:2015-09-01 📝 Original message: Anthony Towns <aj at ...
📅 Original date posted:2015-09-01
📝 Original message:
Anthony Towns <aj at erisian.com.au> writes:
> On 31 August 2015 at 11:04, Rusty Russell <rusty at rustcorp.com.au> wrote:
>
>> > I was thinking it would be possible to update many HTLCs at once, so
>> > I was expecting a single PKT_UPDATE_CHANNEL rather than the ADD_HTLC,
>> > COMPLETE_HTLC, TIMEOUT_HTLC, etc variants. From a protocol POV, I guess
>> > that's something like:
>> This is the kind of optimization we may see later, but I really shy away
>> from doing it now. Your diagram looks simpler because you removed all
>> the rest of the handshaking. Try this:
>>
>
> I think the statepy.svg includes all the handshaking (including errors,
> but I think excluding internal errors) apart from the nop state
> transitions. Having a single PKT_UPDATE_CHANNEL would just combine those
> into one subgraph / one edge.
My instinct is to encode as much in the state itself as possible,
because it simplifies verification.
> I'm a bit surprised that CMD_CLOSE isn't a valid option when proposing an
> update -- it's valid during WAIT_FOR_UPDATE_SIG but not
> WAIT_FOR_HTLC_ACCEPT/WAIT_FOR_UPDATE_COMPLETE.
Looking at that git tree (I've done some work since then)... Ah, you
can't send a command while processing an existing command. Seems a
logical simplification.
> (Correspondingly, PKT_CLOSE
> doesn't seem valid during WAIT_FOR_UPDATE_SIG)
It's a corrollary of the above.
> A: ADD_HTLC --> B: DECLINE_HTLC
>> OR
>> A: ADD_HTLC --> B: ACCEPT --> A: SIGNATURE --> B: COMPLETE
>>
>> After success:
>>
>> B: FULFILL_HTLC -> A: ACCEPT --> B: SIGNATURE --> A: COMPLETE
>> OR
>> B: ROUTEFAIL_HTLC -> A: ACCEPT --> B: SIGNATURE --> A: COMPLETE
>> OR
>> A: TIMEDOUT_HTLC -> B: ACCEPT --> A: SIGNATURE --> B: COMPLETE
>>
>> This makes the constraints clearer, eg. you can't DECLINE_HTLC anything
>> but an ADD_HTLC.
>>
>
> Your states currently allow declining those though:
Not at all (or if it does, it's a bug). Each state is defined as
something which can accept inputs, and for which all those inputs are
always valid.
> If your counterparty proposes a broken HTLC update, I'm not sure there's
> harm in being allowed to decline it? They can choose to close the channel
> if they think you're unreasonable, retry the update if they found a
> mistake, or just forget it and not worry (if they were issuing a ROUTEFAIL,
> it's not /their/ funds that are on the line eg).
The simplest (and safest) system is always to error and close when they
break protocol. There's some game theory involved in whether you should
wait or not, but in the end, they're broken and there's not much you can
do.
> I also wonder if
>
> A: TIMEDOUT_HTLC -> B: DECLINE (err_time_sync_lost)
>
> might be useful.
I don't think it's useful, though if you disagree on time you might get
an error packet. (What else can you do?)
Perhaps we should add a current time field to UPDATE_ADD_HTLC so you can
defuse clock sync problems earlier?
>> AFAICS, you still have a potential deadlock atm if you think you're
>> > high priority but your counterparty also thinks they're high priority,
>> > or just missed your update packet. I think there might be a similar
>> > deadlock if both systems think they're low priority.
>> They can't get into that state.
>
> Sorry, I was assuming that one or both implementations were buggy. I meant
> to make that explicit. You're talking with strangers on the network, so
> you can't assume their software is bug free, right?
That applies to any scheme you come up with, though. Propose something
simpler, and I'll gladly rewrite.
> BTW, your states currently switch priority even when an update is declined,
> so the low bit of the current commitment id (which obviously isn't changed
> on a declined update) doesn't actually give you the priority afaics.
True! I will change that, since it's conceptually simpler.
Thanks,
Rusty.
Published at
2023-06-09 12:44:19Event JSON
{
"id": "8cdd82fb9e9247eb304f8ea8cca00a79f4f1eb63aae9f71ad27e4bb5e84a9f18",
"pubkey": "13bd8c1c5e3b3508a07c92598647160b11ab0deef4c452098e223e443c1ca425",
"created_at": 1686314659,
"kind": 1,
"tags": [
[
"e",
"7cb446ab5c4fbaa2742daa23601e2632ee497d75e0b39629952a69f13b297936",
"",
"reply"
],
[
"p",
"9456f7acb763eaab2e02bd8e60cf17df74f352c2ae579dce1f1dd25c95dd611c"
]
],
"content": "📅 Original date posted:2015-09-01\n📝 Original message:\nAnthony Towns \u003caj at erisian.com.au\u003e writes:\n\u003e On 31 August 2015 at 11:04, Rusty Russell \u003crusty at rustcorp.com.au\u003e wrote:\n\u003e\n\u003e\u003e \u003e I was thinking it would be possible to update many HTLCs at once, so\n\u003e\u003e \u003e I was expecting a single PKT_UPDATE_CHANNEL rather than the ADD_HTLC,\n\u003e\u003e \u003e COMPLETE_HTLC, TIMEOUT_HTLC, etc variants. From a protocol POV, I guess\n\u003e\u003e \u003e that's something like:\n\u003e\u003e This is the kind of optimization we may see later, but I really shy away\n\u003e\u003e from doing it now. Your diagram looks simpler because you removed all\n\u003e\u003e the rest of the handshaking. Try this:\n\u003e\u003e\n\u003e\n\u003e I think the statepy.svg includes all the handshaking (including errors,\n\u003e but I think excluding internal errors) apart from the nop state\n\u003e transitions. Having a single PKT_UPDATE_CHANNEL would just combine those\n\u003e into one subgraph / one edge.\n\nMy instinct is to encode as much in the state itself as possible,\nbecause it simplifies verification.\n\n\u003e I'm a bit surprised that CMD_CLOSE isn't a valid option when proposing an\n\u003e update -- it's valid during WAIT_FOR_UPDATE_SIG but not\n\u003e WAIT_FOR_HTLC_ACCEPT/WAIT_FOR_UPDATE_COMPLETE.\n\nLooking at that git tree (I've done some work since then)... Ah, you\ncan't send a command while processing an existing command. Seems a\nlogical simplification.\n\n\u003e (Correspondingly, PKT_CLOSE\n\u003e doesn't seem valid during WAIT_FOR_UPDATE_SIG)\n\nIt's a corrollary of the above.\n\n\u003e A: ADD_HTLC --\u003e B: DECLINE_HTLC\n\u003e\u003e OR\n\u003e\u003e A: ADD_HTLC --\u003e B: ACCEPT --\u003e A: SIGNATURE --\u003e B: COMPLETE\n\u003e\u003e\n\u003e\u003e After success:\n\u003e\u003e\n\u003e\u003e B: FULFILL_HTLC -\u003e A: ACCEPT --\u003e B: SIGNATURE --\u003e A: COMPLETE\n\u003e\u003e OR\n\u003e\u003e B: ROUTEFAIL_HTLC -\u003e A: ACCEPT --\u003e B: SIGNATURE --\u003e A: COMPLETE\n\u003e\u003e OR\n\u003e\u003e A: TIMEDOUT_HTLC -\u003e B: ACCEPT --\u003e A: SIGNATURE --\u003e B: COMPLETE\n\u003e\u003e\n\u003e\u003e This makes the constraints clearer, eg. you can't DECLINE_HTLC anything\n\u003e\u003e but an ADD_HTLC.\n\u003e\u003e\n\u003e\n\u003e Your states currently allow declining those though:\n\nNot at all (or if it does, it's a bug). Each state is defined as\nsomething which can accept inputs, and for which all those inputs are\nalways valid.\n\n\u003e If your counterparty proposes a broken HTLC update, I'm not sure there's\n\u003e harm in being allowed to decline it? They can choose to close the channel\n\u003e if they think you're unreasonable, retry the update if they found a\n\u003e mistake, or just forget it and not worry (if they were issuing a ROUTEFAIL,\n\u003e it's not /their/ funds that are on the line eg).\n\nThe simplest (and safest) system is always to error and close when they\nbreak protocol. There's some game theory involved in whether you should\nwait or not, but in the end, they're broken and there's not much you can\ndo.\n\n\u003e I also wonder if\n\u003e\n\u003e A: TIMEDOUT_HTLC -\u003e B: DECLINE (err_time_sync_lost)\n\u003e\n\u003e might be useful.\n\nI don't think it's useful, though if you disagree on time you might get\nan error packet. (What else can you do?)\n\nPerhaps we should add a current time field to UPDATE_ADD_HTLC so you can\ndefuse clock sync problems earlier?\n\n\u003e\u003e AFAICS, you still have a potential deadlock atm if you think you're\n\u003e\u003e \u003e high priority but your counterparty also thinks they're high priority,\n\u003e\u003e \u003e or just missed your update packet. I think there might be a similar\n\u003e\u003e \u003e deadlock if both systems think they're low priority.\n\u003e\u003e They can't get into that state.\n\u003e\n\u003e Sorry, I was assuming that one or both implementations were buggy. I meant\n\u003e to make that explicit. You're talking with strangers on the network, so\n\u003e you can't assume their software is bug free, right?\n\nThat applies to any scheme you come up with, though. Propose something\nsimpler, and I'll gladly rewrite.\n\n\u003e BTW, your states currently switch priority even when an update is declined,\n\u003e so the low bit of the current commitment id (which obviously isn't changed\n\u003e on a declined update) doesn't actually give you the priority afaics.\n\nTrue! I will change that, since it's conceptually simpler.\n\nThanks,\nRusty.",
"sig": "0c717eb2757e487bc42735388e82b741837f254856453b5635cd51b2fa65760cb3fc015e0df81b5c695b1dcbd8bfa6152ebe8d378f331492818ba52db1ff9912"
}