Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Update libp2p to version 0.16 #2072

Merged
merged 2 commits into from
Feb 24, 2020
Merged

Update libp2p to version 0.16 #2072

merged 2 commits into from
Feb 24, 2020

Conversation

thomaseizinger
Copy link
Contributor

Resolves #1941.

@mergify
Copy link
Contributor

mergify bot commented Feb 21, 2020

Are you sure the changelog does not need updating?

}
}
None
}

#[cfg(test)]
mod tests {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check the commit messages to learn why this is gone.

/// Waiting for a request from the remote.
WaitingMessage { stream: Frames<TSubstream> },
WaitingMessage { stream: Pin<Box<Frames>> },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have to Pin the stream to a specific location in memory.

The current code here does what async/await would do under the hood: It represents the state as an enum and each variant is a check (await) point.

async functions automatically use Pin if necessary.
We have to use it here, to be able to access the poll APIs on the stream.

@thomaseizinger thomaseizinger mentioned this pull request Feb 24, 2020
3 tasks
We have to depend on libp2p in cnd anyway, so the compile times are
not really affected by this and simplifies the versioning by
removing a dependency.
Unfortunately, I had to trash all the tests in libp2p-comit because
I just couldn't get them to work. The e2e tests work though and we
are going to trash this communication protocol soon anyway. Hence,
in the interest of not wasting more time, I deleted them.

On the upside, libp2p 0.16 offers a lot of very nice things:

1. The TSubstream type variable is gone which reduces the overall
verbosity of the code.
2. The update to futures 0.3 and async/await is obviously nice.
3. We no longer need to print the errors of a ProtocolHandler
ourselves, this is now done in the Swarm (on level TRACE).
Copy link
Contributor

@luckysori luckysori left a comment

Choose a reason for hiding this comment

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

Thank you for doing this, Thomas 😄

LGTM and makes sense to give up on those tests if they would have to go away soon anyway.

Can you comment on this note in the original issue?

Note that the goal here is to avoid bringing async-std into our dependency tree (check with cargo tree). It seems like it is not possible to completely achieve that as mdns still depends on async-std without providing a feature-flag.

@thomaseizinger
Copy link
Contributor Author

Can you comment on this note in the original issue?

Sure!
I didn't manage to do this but I opened an issue on the libp2p repository for resolving this (libp2p/rust-libp2p#1464).

@mergify
Copy link
Contributor

mergify bot commented Feb 24, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 24, 2020

Build succeeded

@bors bors bot merged commit a306795 into dev Feb 24, 2020
@mergify mergify bot deleted the 1941-update-libp2p branch February 24, 2020 06:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update libp2p to latest version
3 participants