Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/7] lnwire: add new Gossip 1.75 messages #8044

Merged
merged 22 commits into from
Sep 18, 2024

Conversation

ellemouton
Copy link
Collaborator

@ellemouton ellemouton commented Sep 29, 2023

This is the first step towards the Gossip 1.75 epic

In this PR, the definitions for the new gossip messages defined in the
taproot-gossip proposal are implemented. This includes:

  • announcement_signatures_2
  • channel_announcement_2
  • channel_update_2

Various updates are also made to some existing messages such as channel_ready and gossip_timestamp_range

I expect there to still be a few updates to these messages as the proposal progresses

@ellemouton ellemouton marked this pull request as draft September 29, 2023 10:19
@saubyk saubyk added this to the v0.18.0 milestone Oct 3, 2023
@saubyk saubyk linked an issue Oct 12, 2023 that may be closed by this pull request
21 tasks
@ellemouton ellemouton mentioned this pull request Oct 26, 2023
21 tasks
@ellemouton ellemouton force-pushed the g175Messages branch 2 times, most recently from f06fad6 to ba60010 Compare October 26, 2023 13:48
@ellemouton ellemouton force-pushed the g175Messages branch 4 times, most recently from 3647e34 to 4074a8c Compare November 9, 2023 11:43
@ellemouton ellemouton changed the title lnwire: add new Gossip 1.75 messages [1/n] lnwire: add new Gossip 1.75 messages Nov 9, 2023
@ellemouton ellemouton marked this pull request as ready for review November 9, 2023 11:54
@ellemouton ellemouton force-pushed the g175Messages branch 2 times, most recently from b0d6a0e to 7d3db71 Compare December 4, 2023 10:25
@ellemouton ellemouton removed a link to an issue Dec 5, 2023
21 tasks
@ellemouton ellemouton changed the title [1/n] lnwire: add new Gossip 1.75 messages [1/7] lnwire: add new Gossip 1.75 messages Dec 6, 2023
@saubyk saubyk requested a review from Crypt-iQ December 6, 2023 17:51
Copy link
Collaborator

@Crypt-iQ Crypt-iQ left a comment

Choose a reason for hiding this comment

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

looks good, just a few questions

lnwire/lnwire_test.go Outdated Show resolved Hide resolved
lnwire/channel_update_2.go Outdated Show resolved Hide resolved
lnwire/channel_ready.go Outdated Show resolved Hide resolved
@yyforyongyu yyforyongyu self-requested a review December 25, 2023 10:28
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

Nice work! Need to cross ref with the spec, but the main comment is using tlv.RecordT in place of some of the new structs and helper functions.

channeldb/migration/lnwire21/message.go Outdated Show resolved Hide resolved
channeldb/waitingproof.go Show resolved Hide resolved
lnwire/onion_error.go Show resolved Hide resolved
lnwire/accept_channel.go Outdated Show resolved Hide resolved
lnwire/musig2.go Outdated Show resolved Hide resolved
lnwire/channel_update_2.go Outdated Show resolved Hide resolved
lnwire/channel_update_2.go Outdated Show resolved Hide resolved
lnwire/channel_update_2.go Show resolved Hide resolved
lnwire/channel_update_2.go Show resolved Hide resolved
lnwire/node_announcement_2.go Outdated Show resolved Hide resolved
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🌊

Should be g2g after a linter fix:

Error: lnwire/interfaces.go:58:1: directive `//nolint:interfacebloat` is unused for linter "interfacebloat" (nolintlint)

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Thanks for the effort in writing all those tests🙏 I think it's good to go, just a few nits. Will refresh the specs and post questions in the following PRs, if any.

discovery/gossiper.go Show resolved Hide resolved
netann/msg_hash.go Show resolved Hide resolved
}

keys = append(keys, bitcoinKey1, bitcoinKey2)
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Q: what if only one of the keys is set, like bitcoinKey1 is set but not bitcoinKey2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it will then fall to the else branch below which will fetch the on-chain script.
ie, we dont explicitly need to not allow that case I dont think. It could maybe be a valid future message potentially.

lnwire/channel_update_2.go Outdated Show resolved Hide resolved
In preparation for adding a new message, AnnounceSignatures2 along with
an AnnounceSignatures interface, we rename the existing message to
AnnounceSignatures1.
In preparation for adding the new ChannelAnnouncement2 message along
with a ChannelAnnouncement interface, we rename the existing message to
ChannelAnnouncement1.
In preparation for adding a new ChannelUpdate2 message and a
ChannelUpdate interface, we rename the existing message to
ChannelUpdate1.
In preparation for Gossip 1.75, we add new TLV's to the `ChannelReady`
message. Namely: `AnnouncementBitcoinNonce` and `AnnouncementNodeNonce`.
These will be used to exchange nones required for producing the partial
signature to be send in the `AnnouncementSignatures2` message.
The type numbers for these new fields are even because if they are set,
then a peer is expecting its peer to understand gossip 1.75 and the new
fields.
Add new FirstBlockHeight and BlockRange TLV fields to the
GossipTimestampRange message. This will be used to query for Gossip 1.75
messages which are timestamped using block height instead of Unix
timestamps.
Add a AnnounceSignatures interface and ensure that AnnounceSignatures1
implements it.
So that it can be re-used elsewhere.
This commit makes an lnwallet.BlockChainIO available to the gossiper and
uses it to construct a helper that can be used to fetch the pk script
for a given SCID. This will be used for channel announcement
verification in an upcoming commit.
Add a new ChannelAnnouncement interface and ensure that
ChannelAnnouncement1 implements it.
In this commit, a new ChannelUpdate interface is added and
ChannelUpdate1 is made to implement the new interface.
And ensure that it implements the AnnounceSignatures interface.
And ensure that it implements the ChannelAnnouncement interface.
This commit adds the MsgHash helper function which can be used to
calculate the digest of a message to be signed using schnorr signatures.
Add the new ChannelUpdate2 message and ensure that it implements the
ChannelUpdate interface.
@ellemouton
Copy link
Collaborator Author

Thanks for the review @Roasbeef & @yyforyongyu 🔈

@Roasbeef Roasbeef merged commit 13a7bec into lightningnetwork:master Sep 18, 2024
26 of 34 checks passed
@ellemouton ellemouton deleted the g175Messages branch September 19, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants