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

Deprecate client envelope AAD originator in favor of is_commit #242

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

mkysel
Copy link
Contributor

@mkysel mkysel commented Feb 3, 2025

No description provided.

@mkysel mkysel requested a review from a team as a code owner February 3, 2025 18:39
@mkysel mkysel requested a review from fbac February 3, 2025 18:39
@mkysel mkysel merged commit 08c8053 into main Feb 4, 2025
4 checks passed
@mkysel mkysel deleted the mkysel/remove-aad branch February 4, 2025 14:04
mkysel added a commit to xmtp/xmtpd that referenced this pull request Feb 10, 2025
Stable hashing in the payer to pick the correct node to send the write
to. Hash is calculated based on the largest known ID and the topic.

This also pulls the changes to protos to stop using the originator_id
and use is_commit instead.

Right now the client does not implement is_commit correctly. And hard
codes the nodeID to 100 in all cases.

In the case of off-chain messages, this still guarantees that the
message was written on that particular node.
In case of on-chain commits, the guarantee introduced in #418 somewhat
holds. Since the client is no longer selecting a node, the payer will
automatically detect which node should be seen as the preferred node and
will block until that node has read the chain.

In neither case can we guarantee that any other node has read any write.

The stable hashing algorithm is pretty naive and might eventually need
some enhancements. There are two issues that I see with it as is (which
is the standard implementation):
- if there are node ID gaps, the next nodeID gets double or more of the
traffic
- if we issue a new node ID it might rehash

The payer does not yet have any retry logic, it does not check the
liveness of the nodes, etc. All of that has to happen in a future PR.

Relates to:
- xmtp/XIPs#85
- xmtp/proto#242

Fixes xmtp/libxmtp#1455

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Introduced an enhanced routing mechanism that leverages stable hashing
for more optimal node selection and balanced message distribution.

- **Refactor**
- Standardized how routing data is assigned, ensuring consistent
handling of message originators.
- Refined criteria for routing validation and blockchain publishing,
improving overall reliability.

- **Tests**
- Expanded test coverage to verify stable node selection, robust message
routing, and balanced topic assignments.
- Enhanced test setup to utilize a mock registry for improved clarity
and control over interactions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy link

🎉 This PR is included in version 3.74.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants