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

Clarify docs on provide_channel_parameters #1903

Merged
merged 2 commits into from Dec 16, 2022

Conversation

TheBlueMatt
Copy link
Collaborator

Its very confusing to say that LDK will call
provide_channel_parameters more than once - its true for a channel, but not for a given instance. Instead, phrase the docs with reference to a specific instance, which is much clearer.

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2022

Codecov Report

Base: 90.77% // Head: 90.76% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (2059190) compared to base (d4dc05b).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1903      +/-   ##
==========================================
- Coverage   90.77%   90.76%   -0.02%     
==========================================
  Files          94       94              
  Lines       49603    49603              
  Branches    49603    49603              
==========================================
- Hits        45025    45020       -5     
- Misses       4578     4583       +5     
Impacted Files Coverage Δ
lightning/src/chain/keysinterface.rs 83.14% <ø> (ø)
lightning/src/chain/onchaintx.rs 95.17% <0.00%> (-0.21%) ⬇️
lightning/src/ln/functional_tests.rs 97.07% <0.00%> (-0.07%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wpaulino
Copy link
Contributor

wpaulino commented Dec 6, 2022

I had something similar in a previous iteration and @devrandom thought otherwise #1867 (comment).

@TheBlueMatt
Copy link
Collaborator Author

Added a note that the "instance" here includes calling again if the object was created by read_chan_signer. I don't buy that we should just say "LDK calls this more than once", because it precisely does not, and saying that it can call this more than once but users need to somehow handle that and ignore the new state is even more confusing - if there's multiple instances of a given signer now you have to have some shared state across them.

///
/// This data is static, and will never change for a channel once set. For a given [`BaseSign`]
/// instance, LDK will call this method exactly once - either immediately after construction
/// (including if done via [`KeysInterface::read_chan_signer`]) or when the funding information
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't ever call it immediately after read_chan_signer, it either must have been called in the past and was serialized, or it will be called once funding occurs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, lol, right.

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

LGTM after squash.

@devrandom
Copy link
Member

I'm OK with the doc in this PR.

however, I have some thoughts about the BaseSign docs in general, which may affect the thinking here.

when a dev is looking at the BaseSign docs, it seems likely they are actually trying to implement their own signer. if so, the docs should guide the dev towards best practices, which includes making the signer properly enforcing. as an example, one consequence of the signer being enforcing is the need for signer persistence.

so if that's the most likely use case that the docs should focus on, then the docs should probably be adjusted to address it, rather than implicitly focusing on how to use InMemorySigner.

@TheBlueMatt
Copy link
Collaborator Author

I don't think the wording here is wrong given that, either, though? I suppose, indeed, we should include a little more guidance on enforcement (or, honestly, just link to VLS, cause its a ton of work lol), but I also think someone may implement the sign trait with a goal of using different keys, learning when a transaction is being signed, or just doing naive policy checks (like closing transaction pays to the right place).

@TheBlueMatt
Copy link
Collaborator Author

Will address #1892 (comment) here

Its very confusing to say that LDK will call
`provide_channel_parameters` more than once - its true for a
channel, but not for a given instance. Instead, phrase the docs
with reference to a specific instance, which is much clearer.
03de059 appeared to revert updated
docs due to a rebase error. This reverts the docs on
`generate_channel_keys` to the state they were in prior to that
commit, with one additional doc.
@TheBlueMatt
Copy link
Collaborator Author

Rebased and did so.

@TheBlueMatt TheBlueMatt merged commit 08d296a into lightningdevkit:main Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants