Skip to content

Gossip query extensions (EXPERIMENTAL_FEATURES)#2900

Merged
rustyrussell merged 9 commits intoElementsProject:masterfrom
rustyrussell:inv-gossip
Aug 10, 2019
Merged

Gossip query extensions (EXPERIMENTAL_FEATURES)#2900
rustyrussell merged 9 commits intoElementsProject:masterfrom
rustyrussell:inv-gossip

Conversation

@rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Aug 5, 2019

DO NOT MERGE UNTIL RFC FINALIZED (it's EXPERIMENTAL_FEATURES, so we could, but might as well wait until tomorrow's meeting). This was the agreed final form, w00t!

This brings is close to in line with lightning/bolts#557

At least, we reproduce the test vectors. We still need behavoural tests (ie. protocol tests), but the code itself is fairly straightforward.

@rustyrussell rustyrussell changed the title Gossip query extensions (EXPERIMENTAL_FEATURES) WIP: Gossip query extensions (EXPERIMENTAL_FEATURES) Aug 5, 2019
@rustyrussell rustyrussell requested a review from niftynei August 6, 2019 01:29
@rustyrussell rustyrussell changed the title WIP: Gossip query extensions (EXPERIMENTAL_FEATURES) Gossip query extensions (EXPERIMENTAL_FEATURES) Aug 6, 2019
@rustyrussell rustyrussell added this to the 0.7.2 milestone Aug 7, 2019
Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor things, other than that all good to go :-)

msgdata,reply_channel_range,chain_hash,chain_hash,
msgdata,reply_channel_range,first_blocknum,u32,
@@ -168,6 +189,20 @@
@@ -168,6 +189,19 @@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like it belongs here. Is this a diff-fragment?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is a diff file; since the size of the diff patch has been updated the range to which the diff applies updates also.

{
}

static const char *test_vectors[] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading the test vectors from file would have allowed us to update them more easily in the future, but for now that's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There'll be a rework of test vectors in the spec sometime, and we can clean up how we treat them then.

CHANGELOG.md Outdated
- JSON API: `listfunds` now returns also `funding_output` for `channels`
- plugins: plugins can now suggest `lightning-cli` default to -H for responses.
- Plugin: new notification `forward_event` offered/settled/failed/local_failed.
- Protocol: --enable-experimental-features support gossip query extensions proposal aka https://github.com/lightningnetwork/lightning-rfc/pull/557
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Protocol: --enable-experimental-features support gossip query extensions proposal aka https://github.com/lightningnetwork/lightning-rfc/pull/557
- Protocol: `--enable-experimental-features` support gossip query extensions proposal aka https://github.com/lightningnetwork/lightning-rfc/pull/557

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…XPERIMENTAL)

These indicate what fields we are to return.  If there's now TLV, or we
haven't got --enable-experimental-features, it's set to all 1s so behaviour
is unchanged.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We're about to use the for gossip extended info too, which *don't* put
the encoding byte at the beginning of the data stream.  So this removes
some "scids" from function names and separates out the "prepend a byte"
case from the "external encoding_type" case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…d (EXPERIMENTAL)

In fact, we always generate them, we only send them if asked.  And we set
the flags to 0 if not --enable-experimental-features, so we never send in
that case.

Generating checksums involves pulling the channel_update from the
gossip_store, which is suboptimal: there's a FIXME to store the
checksum in memory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Make the TLV element a simple array.  This is a bit neater, in fact, and
makes the test vectors in that 557 PR work.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
These both allow us to reproduce the test vectors in the next patch.  But
using Z_DEFAULT_COMPRESSION is a reasonable idea anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Copy link
Collaborator

@niftynei niftynei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to see the EXPERIMENTAL_FEATURES and tlv's getting a workout :)

if (encoding_end_prepend_type(&encoded_scids, max_encoded_bytes)) {
if (extension_bytes <= max_encoded_bytes
&& encoding_end_prepend_type(&encoded_scids,
max_encoded_bytes - extension_bytes)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the type the unused space? max_encoded_bytes - extension_bytes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the question?

msgdata,reply_channel_range,chain_hash,chain_hash,
msgdata,reply_channel_range,first_blocknum,u32,
@@ -168,6 +189,20 @@
@@ -168,6 +189,19 @@
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is a diff file; since the size of the diff patch has been updated the range to which the diff applies updates also.

opt = json_get_member(test_vector, obj, "extensions");
json_for_each_arr(i, t, opt) {
assert(json_tok_streq(test_vector, t,
"WANT_TIMESTAMPS | WANT_CHECKSUMS"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be worthwhile to also test these separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the test vectors are grossly insufficient. We need behavoural tests

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell
Copy link
Contributor Author

Applied @cdecker fix and rebased for CHANGELOG.md conflict.

Ack c5ac1fe

@rustyrussell rustyrussell merged commit 5e78960 into ElementsProject:master Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants