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

chore: Upgrade libp2p and bitswap #2154

Merged
merged 46 commits into from
Nov 17, 2022
Merged

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Nov 2, 2022

Summary of changes
Changes introduced in this pull request:

  • Upgrade libp2p to 0.49.0
  • Upgrade libp2p-bitswap to 0.24
  • Fix and verify new bitswap logic
  • Install protoc in CI env and Dockerfile which is required by libp2p 0.47+ It reduces build time by not building protoc from source)
  • Remove tiny-cid
  • Fix build on MacOS
  • Improve prometheus metrics by splitting inbound/outbound request/response
  • Verify metrics at http://localhost:6116/metrics
  • Manual test on calibnet calibnet sync check CI job passes
  • Manual test on mainnet

Reference issue to close (if applicable)

Closes #1924 #1920

Other information and links

@hanabi1224 hanabi1224 force-pushed the upgrade-libp2p branch 9 times, most recently from 46fee9e to 0fa8772 Compare November 2, 2022 16:51
@lemmih
Copy link
Contributor

lemmih commented Nov 15, 2022

This branch work for connecting to calibnet but I'm having difficulties with mainnet. Seeing a lot of this error:

message hasn't set send_dont_have: skipping

@lemmih
Copy link
Contributor

lemmih commented Nov 15, 2022

Hmm, the DO droplet is too slow to match up to the most recent tipset. But it hasn't failed so far. Just a lots of notices that seem to be harmless.

@lemmih
Copy link
Contributor

lemmih commented Nov 15, 2022

@hanabi1224 Can we do something about the error messages and warnings? I see lots of these for every validated tipset:

ERROR libp2p_bitswap::compat::message > message hasn't set send_dont_have: skipping
ERROR libp2p_bitswap::behaviour > bitswap inbound failure 12D3KooWNcDPk1VNpDY9QUqAC7bkdjDypeApEQDCTa5weAPLjFWC 2796966 UnsupportedProtocols
WARN libp2p_yamux > dropping (Stream 62a74c82/55610) because buffer is full
WARN forest_libp2p::service > RPCResponse receive failed
WARN forest_libp2p::service > ChainExchange outbound error (peer: PeerId("12D3KooWP1AVPp7jwNk6tU2MvsnBYStGY9qLEvMyvqFQcUMPepLL")) (id: RequestId(153)): UnsupportedProtocols

@hanabi1224
Copy link
Contributor Author

hanabi1224 commented Nov 15, 2022

Can we do something about the error messages and warnings?

Sure, let me confirm the error message does not mean libp2p-bitswap not working and I will set its log level to fatal.

Update:
@lemmih According to the spec, send_dont_have is sth new in protocol v1.2, the error message is caused by inbound messages via protocol v1.1 and v1.0. I tried stop accepting old protocols the error is gone and we still have successful response from the network. So I will just go ahead and disable v1.0 and v1.1

libp2p_messsage_total{libp2p_message_kind="bitswap_block_request_out"} 1659
libp2p_messsage_total{libp2p_message_kind="bitswap_block_response_in"} 1168

@lemmih
Copy link
Contributor

lemmih commented Nov 16, 2022

I'm completely synced to mainnet and everything appears to be in order! Nice!

Copy link
Contributor

@lemmih lemmih left a comment

Choose a reason for hiding this comment

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

Works great. But let's use protobuf-compiler from Ubuntu and let's update the build instructions for ubuntu and fedora.

Cargo.toml Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

In general, looks quite solid!

self.put_keyed(block.cid(), block.data())
}

fn missing_blocks(&mut self, cid: &Cid) -> anyhow::Result<Vec<Cid>> {
Copy link
Member

Choose a reason for hiding this comment

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

Can we extract this method? Seems it will be exactly the same for all structs implementing Store.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, fixed

}

#[allow(clippy::too_many_arguments)]
async fn handle_forest_behaviour_event<DB, P: StoreParams>(
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to refactor such oversized methods so there's a single match calling methods. 300 LoC for a method isn't ideal.

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 have created #2220 to track this refactoring

@lemmih lemmih merged commit 9e45e3f into ChainSafe:main Nov 17, 2022
@hanabi1224 hanabi1224 deleted the upgrade-libp2p branch November 17, 2022 15:23
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.

Update libp2p dependency Update tiny-cid dependency
6 participants