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

Process blocks coming off of GossipSub #808

Merged
merged 21 commits into from
Nov 6, 2020
Merged

Process blocks coming off of GossipSub #808

merged 21 commits into from
Nov 6, 2020

Conversation

ec2
Copy link
Member

@ec2 ec2 commented Nov 4, 2020

Summary of changes
Changes introduced in this pull request:

  • Process GossipBlocks in ChainSyncer
  • Fetch missing messages from GossipBlocks over Bitswap
  • Queue block through inform_new_head

To test this on a Lotus devnet, you will need to edit miner and power actor policies to allow for 2K sectors and minimum consensus power to 2048 instead of 10 << 40

This is the fork of bitswap we use now: ChainSafe/libp2p-bitswap@bd7e083

Reference issue to close (if applicable)

Closes
#757
#759 (if I understand the scope of that properly)

Other information and links

@ec2
Copy link
Member Author

ec2 commented Nov 4, 2020

Oops forgot to fix unit tests that this breaks... And point to a new fork of libp2p_bitswap. Switching to draft for now. NVM, cant switch to draft

@ec2 ec2 marked this pull request as ready for review November 4, 2020 22:02
blockchain/chain_sync/src/network_context.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/network_context.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/sync.rs Outdated Show resolved Hide resolved
secp_messages: smsgs,
};
let ts = FullTipset::new(vec![block]).unwrap();
if let Err(e) = self.inform_new_head(source.clone().unwrap(), &ts).await {
Copy link
Contributor

Choose a reason for hiding this comment

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

the source isn't guaranteed because I don't believe we reject responses with no peer id set, should handle this in some way

Copy link
Member Author

Choose a reason for hiding this comment

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

The source address should be guaranteed because of the signing policies we enforce on gossipsub messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

no, actually we explicitly allow this (because with out it before it was an issue) If you want to ensure this is the case, you need to change the ValidationMode on the GossipSub config. In any case, it would be much safer if there wasn't this unwrap when dealing with inputs directly from the network as it's too easy to trigger

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed the validation mode to Strict and ive tested it against a local lotus devnet.

utils/genesis/src/lib.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
Comment on lines 132 to 146
match res {
Ok(Ok(())) => {
match self.db.get(&content) {
Ok(Some(b)) => Ok(b),
Ok(None) => Err(format!("Bitswap response successful for: {:?}, but can't find it in the database", content)),
Err(e) => Err(format!("Bitswap response successful for: {:?}, but can't retreive it from the database: {}", content, e.to_string())),
}
}
Err(e) => {
Err(format!("Bitswap get for {:?} timed out: {}", content, e.to_string()))
}
Ok(Err(e)) => {
Err(format!("Bitswap get for {:?} failed: {}", content, e.to_string()))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this have to be all matches when it's just returning errors or the result?

Copy link
Member Author

@ec2 ec2 Nov 5, 2020

Choose a reason for hiding this comment

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

Just wanted to return more detailed err messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is more confusing imo, at least for reading, I don't see why you couldn't at least return the timeout error before this match

@ec2 ec2 requested a review from austinabell November 6, 2020 16:58
blockchain/chain_sync/src/sync.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/sync.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/sync.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
@ec2 ec2 merged commit 0b7a49b into main Nov 6, 2020
@ec2 ec2 deleted the ec2/gossip_bs_blocks branch November 6, 2020 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants