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

Static invoice server prefactor #3667

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

valentinewallace
Copy link
Contributor

Prepares for #3618, some commits reference commits in that upcoming PR.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 14, 2025

👋 Thanks for assigning @jkczyz as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@valentinewallace valentinewallace added the weekly goal Someone wants to land this this week label Mar 14, 2025
@valentinewallace valentinewallace force-pushed the 2025-03-inv-server-prefactor branch 2 times, most recently from 165c88d to 9079c41 Compare March 14, 2025 17:51
@ldk-reviews-bot ldk-reviews-bot requested a review from arik-so March 14, 2025 17:54
@valentinewallace valentinewallace force-pushed the 2025-03-inv-server-prefactor branch 2 times, most recently from feb9a8f to 0b7f7d8 Compare March 15, 2025 16:08
@arik-so
Copy link
Contributor

arik-so commented Mar 15, 2025

Really clean refactor! There's a typo in the third commit message of "and and," but otherwise looks really good.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @arik-so! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@valentinewallace valentinewallace requested a review from jkczyz March 17, 2025 20:48
@valentinewallace
Copy link
Contributor Author

@jkczyz would you mind taking a look a the last commit since you requested the refactor? Thank you!

arik-so
arik-so previously approved these changes Mar 17, 2025
Copy link
Contributor

@arik-so arik-so left a comment

Choose a reason for hiding this comment

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

Very straightforward. Approving explicitly for the bot.

@valentinewallace
Copy link
Contributor Author

Looks like there are some silent rebase conflicts causing CI to fail, will rebase now

We need to add a Vec to the config as part of async receive support, see
upcoming commits. The vec will contain blinded paths to reach an always-online
node that will serve static invoices on our behalf. None of those things
implement Copy so remove support for the trait.
@valentinewallace valentinewallace force-pushed the 2025-03-inv-server-prefactor branch 3 times, most recently from 95f934d to 4a7d7e3 Compare March 26, 2025 15:58
@valentinewallace
Copy link
Contributor Author

Pushed a super trivial fix for rustfmt

@valentinewallace valentinewallace requested a review from jkczyz March 26, 2025 15:59
Previously when reading a BOLT 12 message from bytes, if it resulted in a
DecodeError then that error would be overridden by DecodeError::InvalidValue
specifically. Better to return to underlying specific error.
For context, many of our higher level ser macros such as impl_writeable_msg
support the syntax:

impl_writeable_msg!(StructName, { .. }, {
   (42, tlv_field, (option, encoding: (Vec<u8>, WithoutLength>),
})

i.e. specifying an encoding wrapper around an optional field being serialized.

Here we add add similar support for an encoding wrapper around required_vecs
that are being serialized, eg (42, tlv_field, (required_vec: (encoding: (..)))).

One difficulty here is that some ser macros such as impl_writeable_msg and tlv_stream
will call the underlying macro _encode_tlv_stream with each struct field passed in as
a reference, whereas others such as impl_writeable_tlv_based will call _encode_tlv_stream
with each struct field passed in as a value.

This difference led to compilation issues because the WithoutLength ser wrapper
expects to wrap a reference to a Vec, not a value.

As a result, here we also modify the macros that were previously passing in
struct values as values to pass in references instead.
The new utility will be used in upcoming commits as part of supporting static
invoice server.
Previously the compiler would not enforce that a peeled onion message had a
corresponding context that matched, e.g. an offers message needs an offers
blinded path context. Refactor PeeledOnion to have multiple Receive message
types such that this is now enforced.
Prior to this commit we would allow DNSSEDQuery onion messages that were sent
over blinded paths that were created for other purposes. This could be used to
correlate identities and unblind a path, so disallow this.

For consistency we also add a log on receipt of a DNSSECProof message with a
missing context.
@valentinewallace valentinewallace force-pushed the 2025-03-inv-server-prefactor branch from 4a7d7e3 to 92f0718 Compare March 27, 2025 16:43
@valentinewallace valentinewallace requested a review from jkczyz March 27, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
weekly goal Someone wants to land this this week
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants