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

Adds gossippub/mdns to swarm behaviour for peering and topic subscriptions/publishings #31

Merged
merged 3 commits into from
Jan 23, 2023

Conversation

zeeshanlakhani
Copy link
Contributor

Description

Includes:

  • updates around db receipts
  • moves to libp2p master (which has a ton of changes in the pipe)
  • tokio for all runtime/swarming
  • direct floodsub capability too (if not trying to force mesh mechanics)
  • updates outdated libs

Closes #27 for now.

…tions/publishings.

Includes:

* updates around db receipts
* moves to libp2p master (which has a ton of changes in the pipe)
* tokio for all runtime/swarming
* direct floodsub capability too (if not trying to force mesh mechanics)
* updates outdated libs
@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2023

Codecov Report

Merging #31 (72af819) into main (7543fcf) will increase coverage by 1.93%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
+ Coverage   10.17%   12.10%   +1.93%     
==========================================
  Files          14       16       +2     
  Lines        4050     3642     -408     
  Branches     2056     1908     -148     
==========================================
+ Hits          412      441      +29     
+ Misses       3060     2639     -421     
+ Partials      578      562      -16     
Impacted Files Coverage Δ
src/db.rs 0.00% <ø> (ø)
src/main.rs 0.94% <0.00%> (-0.06%) ⬇️
src/network/client.rs 0.00% <0.00%> (ø)
src/network/eventloop.rs 0.00% <0.00%> (ø)
src/network/pubsub.rs 0.00% <0.00%> (ø)
src/network/swarm.rs 0.00% <0.00%> (ø)
src/workflow/closure.rs 9.23% <ø> (ø)
src/workflow/pointer.rs 0.00% <ø> (ø)
src/workflow/receipt.rs 0.00% <ø> (ø)
src/workflow/task.rs 0.00% <ø> (ø)
... and 3 more

Comment on lines +176 to 179
let link: Link<Closure> = Closure::try_into(closure)?;
let closure_cid = link
.to_string_of_base(Base::Base32HexLower)
.expect("string CID");
Copy link
Member

Choose a reason for hiding this comment

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

I have no problem with this being reworked, but could you explain a bit about what the advantage of allocating another binding here is? I don't see link used anywhere else 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I broke this from your original code, as I was running up the "demo" in its entirety now. Cid (from the multiformat library) will throw an error on try_into (when given closure_bytes) as it can't decipher the version. This is to get the cid that we need.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But, something I'd like to re-explore in how it's derived.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is leveraging the free "into" that comes from TryFrom here in closure.rs:

impl TryFrom<Closure> for Link<Closure> {
    type Error = anyhow::Error;

    fn try_from(closure: Closure) -> Result<Link<Closure>, Self::Error> {
        let ipld: Ipld = closure.into();
        let bytes = DagCborCodec.encode(&ipld)?;
        Ok(Link::new(Cid::new_v1(
            DagCborCodec.into(),
            Code::Sha3_256.digest(&bytes),
        )))
    }
}

@zeeshanlakhani zeeshanlakhani merged commit 3313c49 into main Jan 23, 2023
@zeeshanlakhani zeeshanlakhani deleted the zl/gossippub+ branch January 23, 2023 18:14
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.

impl gossipsub for receipt topic pubsub layer
3 participants