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

Make z2 work again - and incidentally, make networks more robust to stalls. #1947

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rrw-zilliqa
Copy link
Contributor

No description provided.

@rrw-zilliqa rrw-zilliqa marked this pull request as ready for review December 3, 2024 15:47
@rrw-zilliqa rrw-zilliqa force-pushed the users/richard/make-z2-work-again branch from dc85271 to 95c2b72 Compare December 5, 2024 08:56
Copy link
Contributor

@JamesHinshelwood JamesHinshelwood left a comment

Choose a reason for hiding this comment

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

Sorry for taking ages to get to this :(

Comment on lines +448 to +454
self.swarm
.behaviour_mut()
.kademlia
.add_address(peer, address.clone());
self.swarm.behaviour_mut().kademlia.bootstrap()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Kademlia already does this periodically by itself:
https://github.com/libp2p/rust-libp2p/blob/master/protocols/kad/src/behaviour.rs#L990-L996

It also has logic to do this more sanely by triggering a bootstrap when new peers are added and avoid making more than one bootstrap at once.

Does z2 work without this change? Can you see if the automatic bootstrap is working? We can also adjust the automatic_bootstrap_throttle configuration.

Copy link
Contributor Author

@rrw-zilliqa rrw-zilliqa Dec 9, 2024

Choose a reason for hiding this comment

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

z2 doesn't work without this change, sadly...

The logic here is that, at least at startup, a node starts before the bootstrap; it fails to add the peer (because it's not up yet), and drops the bootstrap. Now it won't add the peer again, even if it comes up, and z2 then deadlocks essentially forever.

I'll see if automatic_bootstrap_throttle will work, but if it's currently set to less than a few hours, I suspect it is already triggering. We could perhaps omit the .kademlia_bootstrap(), but the .add_address() definitely isn't optional.

This also relates to one of the crashing bugs which I have utterly failed (sorry!) to tag as such and now can't find, where all peers get dropped and the network then dissociates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JamesHinshelwood - OK. I've checked. You can't get away without re-adding the address, but (as expected) kademlia will eventually bootstrap itself automatically.

@rrw-zilliqa rrw-zilliqa force-pushed the users/richard/make-z2-work-again branch from 95c2b72 to 63b3e71 Compare December 12, 2024 14:53
Copy link
Contributor

github-actions bot commented Dec 12, 2024

🐰 Bencher Report

Branchusers/richard/make-z2-work-again
Testbedself-hosted
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
process-empty/process-empty📈 view plot
🚷 view threshold
8.46
(-7.82%)
10.40
(81.34%)
produce-full/produce-full📈 view plot
🚷 view threshold
2,251.10
(+10.46%)
2,632.43
(85.51%)
🐰 View full continuous benchmarking report in Bencher

@JamesHinshelwood
Copy link
Contributor

@shawn-zil Can you check if your change (#2030) also fixes z2 and thus supersedes this PR? Thanks

@shawn-zil
Copy link
Contributor

@shawn-zil Can you check if your change (#2030) also fixes z2 and thus supersedes this PR? Thanks

I can confirm that I am able to deploy the latest main (ae64d06) to perftest using the latest z2 command. So, I will close this PR for now. We can reopen if it necessary.

@shawn-zil shawn-zil closed this Dec 23, 2024
@rrw-zilliqa
Copy link
Contributor Author

rrw-zilliqa commented Dec 30, 2024

@shawn-zil - that's not what this PR attempts to fix. It fixes the behaviour when you try to run Zilliqa 2 with the z2 command locally. I'll see if current main works ..

@rrw-zilliqa rrw-zilliqa reopened this Dec 30, 2024
@rrw-zilliqa rrw-zilliqa force-pushed the users/richard/make-z2-work-again branch from 63b3e71 to 374ce51 Compare December 30, 2024 15:30
@rrw-zilliqa
Copy link
Contributor Author

rrw-zilliqa commented Dec 30, 2024

I think that if you run:

rm -rf /tmp/d
./scripts/z2 run /tmp/d 0-4

On current main a8bed8b6 , you get a network which forms but cannot move past the genesis block because none of the peers can see any other peer. If you run the same command with this PR, the network forms and starts producing blocks (judged by grepping the logs with RUST_LOG=debug for the `### proposing' log line).

@shawn-zil - are you seeing something different?

@shawn-zil
Copy link
Contributor

I'm having trouble getting z2 run to work on my setup.
But if the issue is due to libp2p's external address, I wonder if this would help?

.with_hide_listen_addrs(false)

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

Successfully merging this pull request may close these issues.

3 participants