-
-
Notifications
You must be signed in to change notification settings - Fork 106
feat: harden subscription routing #2064
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
base: main
Are you sure you want to change the base?
Conversation
|
@claude Please review PR |
|
Claude finished @sanity's task —— View job PR Review CompleteTodo List
SummaryThis PR significantly enhances subscription routing reliability by adding contract code fetching, improved candidate peer logging, and router distance defaults adjustments. The changes are generally well-structured and improve the robustness of subscription operations. Key Improvements
Detailed Findings1. Subscription Routing Logic (
|
|
Took another pass over Claude’s feedback:
On the potential recursion: when a seek request can’t find any candidates we attempt a single GET via Testing:
|
apps/freenet-ping/app/Cargo.toml
Outdated
| chrono = { workspace = true, features = ["default"] } | ||
| clap = { version = "4.5", features = ["derive"] } | ||
| freenet-stdlib = { version = "0.1.24", features = ["net"] } | ||
| freenet-stdlib = { version = "0.1.22", features = ["net"] } |
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.
this is a downgrade (!), why?
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.
[Codex] Rebased the stack and restored this dependency to 0.1.24 so the app stays aligned with the workspace and the newer stdlib APIs that the upper PRs expect.
apps/freenet-ping/Cargo.toml
Outdated
| [workspace.dependencies] | ||
| # freenet-stdlib = { path = "./../../stdlib/rust", features = ["contract"] } | ||
| freenet-stdlib = { version = "0.1.24" } | ||
| freenet-stdlib = { version = "0.1.14" } |
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.
this is a downgrade (!), why?
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.
[Codex] Same here—reset to 0.1.24 so the workspace definition matches the app crate and the rest of the stack. This keeps the stdlib bump intact for the dependent PRs.
| .filter_map(|peer| { | ||
| peer.location | ||
| .map(|loc| (peer, target_location.distance(loc))) | ||
| .map(|peer| { |
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.
I have a dejavuh with this, already commented in a previous PR, let's not make upa. distance, filter_map will filter on collect peers which dont have a distance setup anyway, which in any case is not gonna happen in practice, unless is some sort of transient connection
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.
[Codex] Thanks for flagging. I dropped the synthetic distance helper and restored the original filter_map behaviour so we only consider peers with a recorded location—matching the prior implementation and avoiding any made-up distances.
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.
Why are we trying to route an update while the node has not joined the network? that sounds wrong.
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.
@iduartgomez You mean if the node is not part of the subscription tree for that contract? The idea was that the update would be routed towards the contract in the hope that it would hit a subscribed node. Is that incorrect?
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.
During bootstrap we still pass PeerKeyLocations without a real location (e.g. from connection_manager.own_location() before the node has joined), so dropping them leaves us with no routing candidates.
If the node has no real location is because it hasn't joined yet no? There is no other way.
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.
[Codex] Right—the only time we lack a location is before the join completes, and we do issue ops during that pre-join window while connection_manager.own_location() is PeerKeyLocation { location: None }. When I switched back to filter_map to drop those entries, test_put_contract_three_hop_returns_response started timing out because routing never had a candidate (CI hit the 120‑second put timeout). The midpoint fallback just keeps those provisional peers eligible until update_location(Some(Location::from_address(&addr))) runs; after that they carry the real location and get ranked normally.
117dac9 to
f4ad769
Compare
c3fdf36 to
e161690
Compare
4103ba5 to
e1f507b
Compare
Summary
Testing