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

IPC-520: Upgrade the IPLD Resolver for libp2p 0.53 #522

Merged
merged 23 commits into from
Jan 11, 2024

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Jan 9, 2024

Closes #520
Replaces #1
Depends on consensus-shipyard/libp2p-bitswap#1

The PR updates the libp2p dependency of the ipld-resolver crate to 0.53. It doesn't update the libipld dependency to 0.15 so that the cid version doesn't change, and thus the fvm* libraries don't need to be updated.

There are many breaking changes in libp2p, some of which this PR did not solve:

  • They made libp2p::request_response::handler::Event private, which broke the way rate limiting is done by the Resolver on top of libp2p_bitswap; I used to hijack the connection handler event going to the Bitswap behaviour, and just not propagate it if was a request and the client hit the limit. This was also the only way for me to count how many bytes have been served. Now that this is impossible, our only option is to move rate limiting into the library itself. In any case I asked for advice.
  • Swarm::ban_peer is gone, they introduced a new behaviour instead which one needs to add to their bouquet of behaviours. This new behaviour will return an error from handle_pending_outgoing_request if the peer is banned. I haven't done this.
  • SwarmBuilder is gone and with it a lot of the connection limit configuration doesn't have a home. I left them commented out, but for safety reasons we should figure out where to set them.

Test failures

Unfortunately the IPLD Resolver Bitswap test timed out:

RUST_LOG=debug cargo test -p ipc_ipld_resolver --test smoke resolve -- --nocapture

With some extra logging I can see that the bitswap requests and responses are coming, but the progress never reaches completion. I noticed that it works if I lower the number of entries in the HAMT to 100 or 500, but fails with 1000. The original repo works with 5000 keys, so I have to assume that the libp2p-bitswap PR we are building against introduced some kind of regression. We can investigate as a separate issue.

@aakoshh aakoshh marked this pull request as ready for review January 9, 2024 15:50
Copy link
Contributor

@fridrik01 fridrik01 left a comment

Choose a reason for hiding this comment

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

Happy to see this land, we should however create issues for these TODOs so we can track them.

{
pub fn new(ttl: Duration) -> Self {
Self {
cache: TimeCache::new(ttl),
cache: LruCache::with_expiry_duration(ttl),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

ipld/resolver/src/service.rs Show resolved Hide resolved
@aakoshh aakoshh merged commit 2440ac2 into main Jan 11, 2024
18 checks passed
@aakoshh aakoshh deleted the ipc-520-upgrade-libp2p branch January 11, 2024 15:33
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.

Upgrade to libp2p 0.53
2 participants