Skip to content

[MICRO]: lntypes: Add Dual[A] primitive type#8996

Merged
Roasbeef merged 1 commit intolightningnetwork:masterfrom
ProofOfKeags:dual
Aug 16, 2024
Merged

[MICRO]: lntypes: Add Dual[A] primitive type#8996
Roasbeef merged 1 commit intolightningnetwork:masterfrom
ProofOfKeags:dual

Conversation

@ProofOfKeags
Copy link
Collaborator

@ProofOfKeags ProofOfKeags commented Aug 9, 2024

This commit introduces a new type Dual[A] to make it easier to manage symmetric configurations or state for lightning channels.

Change Description

I'm extracting this commit from #8755 because it is proving to be useful in #8270 as well. It has applications anywhere we have symmetric structure, which in the channel state machine is ubiquitous.

Steps to Test

N/A

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.

@ProofOfKeags ProofOfKeags added no-changelog size/micro small bug fix or feature, less than 15 mins of review, less than 250 labels Aug 9, 2024
@ProofOfKeags ProofOfKeags requested a review from a team August 9, 2024 19:27
@ProofOfKeags ProofOfKeags self-assigned this Aug 9, 2024
@ProofOfKeags ProofOfKeags requested review from morehouse and ziggie1984 and removed request for a team August 9, 2024 19:27
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 9, 2024

Important

Review skipped

Auto reviews are limited to specific labels.

Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@carlaKC
Copy link
Collaborator

carlaKC commented Aug 12, 2024

Drive by request to include d8b695a -> 77586e2 from #8270 to this PR?

@ProofOfKeags
Copy link
Collaborator Author

Drive by request to include d8b695a -> 77586e2 from #8270 to this PR?

I think those commits are better suited in the PR they are in as they are primarily motivated by the consolidation of the NumPendingUpdates function. Whenever we introduce these new fundamental structures there is a whole continuum of things that could be refactored to use them and I've been advised that incremental is the right approach. Since those specific refactors aren't just for their own sake but rather to set the stage for cae5f36, I do not believe they should be split up. Of course that commit is further motivated by the quiescer's desire to know whether it can send/receive an stfu, so the motivations cascade.

This specific commit actually did not originate in #8270 but instead from #8755 (94ccf88). I carved it off later because I realized it can be used in the #8270 work as well. All this is to say, I think it is properly scoped as is.

@carlaKC
Copy link
Collaborator

carlaKC commented Aug 14, 2024

Since those specific refactors aren't just for their own sake but rather to set the stage for cae5f36, I do not believe they should be split up.

While I'm wary of getting off the refactor tractor and never getting off, I think that pre-factor PRs are well justified when:

  1. The refactor is a reasonable unit of improvement on its own
  2. Separating it helps focus review on the core change of a larger PR/series

I think those commits are better suited in the PR they are in as they are primarily motivated by the consolidation of the NumPendingUpdates function.

Without them this PR just introduces dead code, and doesn't really shift any review burden away from subsequent PRs. I think it's totally okay for a prep-work PR to exist in the context of its followup, especially when it's a nice cleanup like this.

@ProofOfKeags
Copy link
Collaborator Author

I don't mind this, but I've also been specific guidance by other members of the team at other times that they are less likely to review code that "doesn't seem to do anything". Packing stuff into Duals on its own doesn't appear useful to people and its utility is only realized when we start to index into them in the core systems. If I can get another member of the team to co-sign your request to include those commits in a pre-factor PR, I'll do it. What I'm wary of is making changes to get your sign off that causes me to be at direct odds with the requests of other members of the team.

@yyforyongyu @guggero what do you think? If you're on board with what @carlaKC is asking, then I'm happy to make this the plan.

I don't have a preference, I just want y'all to agree with each other so we can ship stuff plz.

@ProofOfKeags ProofOfKeags removed the request for review from ziggie1984 August 14, 2024 18:57
@ProofOfKeags ProofOfKeags changed the title lntypes: Add Dual[A] primitive type [MICRO]: lntypes: Add Dual[A] primitive type Aug 14, 2024
@ProofOfKeags ProofOfKeags requested a review from guggero August 14, 2024 18:57
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM, just two nits and a naming suggestion. But non-blocking.

This commit introduces a new type Dual[A] to make it easier to
manage symmetric configurations or state for lightning channels.
@guggero
Copy link
Collaborator

guggero commented Aug 15, 2024

I don't have a preference, I just want y'all to agree with each other so we can ship stuff plz.

I think this PR is fine on its own. To me the goal/context is clear, since the PR that's going to use is already up.

@ProofOfKeags ProofOfKeags added this to the v0.19.0 milestone Aug 15, 2024
@ProofOfKeags ProofOfKeags added P1 MUST be fixed or reviewed dynamic commitments ready to merge LGTM'd, may need rebase to address conflicts, anyone can merge labels Aug 15, 2024
@ProofOfKeags ProofOfKeags removed the ready to merge LGTM'd, may need rebase to address conflicts, anyone can merge label Aug 15, 2024
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

Still feel like we should slim down the dependent PR by adding the switchover to use Dual where we need it, but lgtm!

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 🪢

@Roasbeef Roasbeef merged commit 7c24e33 into lightningnetwork:master Aug 16, 2024
@saubyk saubyk moved this from High Priority to Merged in PR Review Priority May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dynamic commitments no-changelog P1 MUST be fixed or reviewed size/micro small bug fix or feature, less than 15 mins of review, less than 250

Projects

Status: Merged
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants