-
Notifications
You must be signed in to change notification settings - Fork 144
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
Conversation
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 |
blockchain/chain_sync/src/sync.rs
Outdated
secp_messages: smsgs, | ||
}; | ||
let ts = FullTipset::new(vec![block]).unwrap(); | ||
if let Err(e) = self.inform_new_head(source.clone().unwrap(), &ts).await { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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())) | ||
} | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Summary of changes
Changes introduced in this pull request:
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