-
Notifications
You must be signed in to change notification settings - Fork 23
feat: require 2/3 subscription confirmation #681
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
Conversation
Manual Deploy AvailableYou can trigger a manual deploy of this PR branch to testnet: Alternative: Comment
Comment updated automatically when the PR is synchronized. |
📝 WalkthroughWalkthroughThis change introduces multi-client confirmation requirements for subscriptions in the SubMux module. A new Possibly related PRs
Suggested reviewers
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2025-10-21T14:00:54.642ZApplied to files:
📚 Learning: 2025-11-07T14:20:31.457ZApplied to files:
📚 Learning: 2025-11-19T09:34:37.917ZApplied to files:
🧬 Code graph analysis (1)magicblock-chainlink/src/submux/subscription_task.rs (1)
🔇 Additional comments (11)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bmuddha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some unnecessary defensive programming (with target sucess count checks), but LGTM otherwise
| successes += 1; | ||
| if successes >= target_successes { | ||
| if let Some(tx) = tx.take() { | ||
| let _ = tx.send(Ok(())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this sends the Ok(()) multiple times potentially, on every success after target has been reached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it won't since it takes the tx, so it is only Some the first time.
GabrielePicco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
We can evaluate whether this behaves as expected in production, since it depends on the configuration. For example, if we use ten different providers, the optimal strategy might be to wait for the first two responses, or to combine the 2/3 strategy with a timeout that still allows for minority confirmation.
Just a note: LGTM as a first version that we can monitor.
Summary
Improve subscription reliability by requiring consensus from multiple clients. Instead of
accepting a subscription as successful after the first client confirms, now require 2/3 of
available clients to confirm before considering the subscription active. This makes the system
more robust to individual client failures.
Details
The subscription multiplexer now requires a configurable number of clients to confirm
subscriptions before treating them as successful. The required confirmation count is
automatically calculated as 2/3 of the total number of clients (with a minimum of 1).
Testing
Added comprehensive test coverage for the new behavior, including:
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.