Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

BOLT #2: wire protocol: YA acknowledgement change.

3 messages, May 17 to 23, 2016. Started by Rusty Russell.

Rusty Russell (2), Pierre

Permalink First message in the Wayback Machine

Rusty Russell permalink original

"This time for sure!"

OK, there's another revision to the 02-wire-protocol.md draft; this time I implemented a protocol simulator to make sure it's reasonable. As a bonus, it spits out timing diagrams!

The summary is that we don't need acknowledgement numbers; the revocation reply gives us everything we need. The draft expresses it in terms of local & remote commitment transactions, and acked and non-acked changesets for both.

Basically, the revocation reply is the moment at which you add incoming changes ("unacked") to the other side (as "acked"). It seems to work pretty well in all the corner cases, and it's wire-optimal AFAICT.

I've aimed for a layman's writeup here:

  https://medium.com/@rusty_lightning/lightning-inter-node-protocol-a-primer-c642816c8b8#.8skw6hfar

The spec is here:

https://github.com/rustyrussell/lightning-rfc/blob/master/bolts/02-wire-protocol.md

And tests are here:

  https://github.com/ElementsProject/lightning/blob/test-protocol/test/test_protocol.c
  https://github.com/ElementsProject/lightning/tree/test-protocol/test/commits

Feedback certainly welcome! Rusty.

Pierre in reply to Rusty Russell permalink original

I like it! Let's hope it will suit everyone and we can converge on something soon.

FWIW I was able to independently implement a toy version of the protocol and pass your scripted tests [*] so I guess there are no obvious issues (duh). Maybe it could be the first step towards a LN nonreg test set?

Just one thing about the "nocommitwait", I wonder why you make it optional in your test: why would you forbid the sending of two successive commits, given that the more permissive approach is perfectly well defined?

Cheers, Pierre

PS: what does YA mean?

[*] For those interested: https://gist.github.com/pm47/0c87329dbc5d43d35857e5ba3a20400c

Rusty Russell in reply to Pierre permalink original

Pierre <pm+lists at acinq.fr> writes:

Quoted text (7 lines)
> I like it! Let's hope it will suit everyone and we can converge on
> something soon.
>
> FWIW I was able to independently implement a toy version of the
> protocol and pass your scripted tests [*] so I guess there are no
> obvious issues (duh). Maybe it could be the first step towards a LN
> nonreg test set?

Great! That's a really good idea. Eventually I'd like to have some "canned conversations" to go with the BOLTs for testing against.

Quoted text (4 lines)
> Just one thing about the "nocommitwait", I wonder why you make it
> optional in your test: why would you forbid the sending of two
> successive commits, given that the more permissive approach is
> perfectly well defined?

Because it's a little simpler if you don't let yourself do multiple in-flight commits. You only need one set of outstanding changes, rather than keeping them for every commit. This code makes doubly-sure that is true (it is true in my C implementation).

Quoted text (1 line)
> PS: what does YA mean?

Yet Another. I found a pretty good description on Wikipedia:

  Among programmers, yet another (often abbreviated ya, Ya or YA in the
  initial part of an acronym) is an idiomatic qualifier in the name of a
  computer program, organisation, or event that is confessedly
  unoriginal.
  Stephen C. Johnson is credited with establishing the naming convention
  in the late 1970s when he named his compiler-compiler yacc (Yet
  Another Compiler-Compiler), since he felt there were already numerous
  compiler-compilers in circulation at the time.

Cheers, Rusty.