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

G2 #138

Closed
wants to merge 31 commits into from
Closed

G2 #138

wants to merge 31 commits into from

Conversation

ellemouton
Copy link
Owner

Change Description

Description of change / link to associated issue.

Steps to Test

Steps for reviewers to follow to test the change.

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

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 we can reuse the code elsewhere.
This commit passes through the server's FetchTxBySCID method to the
AuthenticatedGossiper and uses it to construct a helper that can be used
to get the pk script for a given SCID. This will be used for channel
announcement verification in an upcoming commit.
Remove the ValidateChanAnn function from `routing` and instead add a
`Validate` method on the `ChannelAnnouncement1` itself.
Add a new ChannelAnnouncement interface and ensure that
ChannelAnnouncement1 implements it.
In this commit, the ChannelUpdate message verification and validation
functions are moved from `routing` to methods on the ChannelUpdate
struct in `lnwire`.
In this commit, a new ChannelUpdate interface is added and
ChannelUpdate1 is made to implement the new interface.
This commit adds the MsgHash helper funcion which can be used to
calculate the digest of a message to be signed using schnorr signatures.
And ensure that it implements the AnnounceSignatures interface.
And ensure that it implements the ChannelAnnouncement interface.
This type, when used as a tlv record can have the following formats:
1. If the record is omitted entirely, then this represents: false.
2. If the record is included but with a zero length, this represents:
   true.
3. Then, the record may also have a length of 1 with true or false
   encoded explicitly.
Add the new ChannelUpdate2 message and ensure that it implements the
ChannelUpdate interface.
To prepare for the addition of ChannelAuthProof2 along with a
ChannelAuthProof interface, rename ChannelAuthProof to
ChannelAuthProof1.
Copy link

Pull reviewers stats

Stats of the last 30 days for lnd:

User Total reviews Time to review Total comments

@coveralls
Copy link

coveralls commented Aug 23, 2024

Pull Request Test Coverage Report for Build 10524422673

Details

  • 1348 of 2203 (61.19%) changed or added relevant lines in 54 files are covered.
  • 434 unchanged lines in 24 files lost coverage.
  • Overall coverage decreased (-0.2%) to 58.531%

Changes Missing Coverage Covered Lines Changed/Added Lines %
htlcswitch/link.go 7 8 87.5%
lnwire/features.go 15 17 88.24%
lnwire/lnwire.go 9 11 81.82%
rpcserver.go 8 10 80.0%
graph/validation_barrier.go 13 16 81.25%
lnrpc/devrpc/dev_server.go 0 3 0.0%
discovery/message_store.go 6 10 60.0%
lnwire/gossip_timestamp_range.go 36 40 90.0%
lnwire/msat.go 21 25 84.0%
channeldb/models/channel_auth_proof.go 1 7 14.29%
Files with Coverage Reduction New Missed Lines %
server.go 2 63.76%
lnrpc/websocket_proxy.go 2 84.34%
contractcourt/htlc_timeout_resolver.go 2 88.87%
chainntnfs/btcdnotify/btcd.go 2 82.78%
watchtower/wtdb/range_index.go 2 95.61%
chainntnfs/interface.go 2 70.2%
rpcserver.go 2 71.73%
watchtower/wtdb/migration4/range_index.go 3 50.9%
routing/payment_lifecycle.go 3 91.55%
chainntnfs/mempool.go 3 89.19%
Totals Coverage Status
Change from base Build 10505137340: -0.2%
Covered Lines: 126793
Relevant Lines: 216624

💛 - Coveralls

In preparation for the addition of ChannelEdgePolicy2 and a
ChannelEdgePolicy interface, rename ChannelEdgePolicy to
ChannelEdgePolicy1.
In preparaion for adding ChannelEdgeInfo2 and a ChannelEdgeInfo
interface, rename ChannelEdgeInfo to ChannelEdgeInfo1.
Add new ChannelEdgeInfo and ChannelAuthProof interfaces and ensure that
they are implemented by ChannelEdgeInfo1 and ChannelAuthProof
respectively.
And ensure that ChannelEdgePolicy1 implements it.
And ensure that it implements the ChannelEdgeInfo interface.
And ensure that it implements the ChannelEdgePoicy interface.
This commit moves the serialisation, deserialisation and update
functions for ChannelEdgePolicy1 and ChannelEdgeInfo1 into their own
files.
In this commit, we update the `putChanEdgeInfo` function to take in the
models.ChannelEdgeInfo interface. If the passed value is the legacy
models.ChannelEdgeInfo1, then the encoding and decoding remains the same
but if it is the new models.ChannelEdgeInfo2 then:
- the encoding will be prefixed with a 0xff byte. This should not clash
  with the encoding of the legacy struct since that encoding will always
  start with a pub key (of node 1) which means it will always start with
  0x02 or 0x03.
- The 0xff is then followed by a type-byte which will be used to
  identify the encoding that follows (this is to make it future proof).
  For now, there is only one possible type-byte here.
- This is then followed by the TLV encoding of ChannelEdgeInfo2.
Similarly to the previous commit, here we add the encoding for the new
ChannelEdgePolicy2. This is done in the same was as for
ChannelEdgeInfo2:
- a 0xff prefix
- followed by a type-byte
- followed by the TLV encoding of the ChannelEdgePolicy2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants