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
feat: use hash based record verification for chunks #1059
Conversation
sn_networking/src/event.rs
Outdated
sender | ||
.send(current_closest) | ||
.map_err(|_| Error::InternalMsgChannelDropped)?; | ||
// TODO: consider order the result and terminate when reach any of the |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
7d93dac
to
518a7ac
Compare
f9c1ec1
to
7eaf652
Compare
sn_networking/src/lib.rs
Outdated
debug!("send_and_get_responses for {req:?}"); | ||
let mut list_of_futures = peers | ||
.iter() | ||
.map(|peer| Box::pin(self.send_request(req.clone(), *peer))) | ||
.map(|peer| { | ||
Box::pin(async { |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
8794b70
to
ebb01b0
Compare
ebb01b0
to
4e8912c
Compare
added DoNotMerge as breaking change we may not want in juusst yet |
4e8912c
to
2cd2bc9
Compare
Reviewpad Report
|
8d6880b
to
751fbcf
Compare
- during hash based verification
131cf8c
to
a42f04e
Compare
pub struct ChunkProof([u8; 32]); | ||
|
||
impl ChunkProof { | ||
pub fn new(record_value: &[u8], nonce: Nonce) -> Self { |
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.
by making ChunkProof
constructor taking a chunk_name instead of whole content will be enough,
and has the benefit of avoid un-necessary access to the whole content?
especialy at the previous place of
// make sure the chunk is stored;
let chunk = Chunk::new(Bytes::from(std::fs::read(&chunk_path)?));
let res = client.verify_chunk_stored(&chunk).await;
which has to read from disk ?
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 can lead to dishonest nodes just storing the keys and discarding the content. And the proof that they create would be valid.
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.
ah, right, make sense.
Description
Summary generated by Reviewpad on 07 Dec 23 15:52 UTC
This pull request includes changes to multiple files.
mod.rs
file in themessages
module adds support for chunk proofs and organizes message-related components.FilesCmds
enum,upload_files
andupload_chunk
functions remove theshow_holders
functionality.QueryResponse
enum adds new variants forGetStoreCost
andGetChunkExistenceProof
queries.Node
implementation in thenode.rs
file adds support for handlingGetChunkExistenceProof
queries.Cargo.toml
file adds thetiny-keccak
dependency.query.rs
file update imports and add new variants to theQuery
enum.chunk_proof.rs
file adds theChunkProof
struct and associated methods.Files
implementation simplify parameter passing and remove unusedshow_holders
functionality.ChunkProof
and modify functionality related to chunk storage and verification.event.rs
file modify theSwarmDriver
implementation for handling Kademlia events.error.rs
file import types and add new error variants for chunk existence and register not found.Please review these changes and let me know if you have any questions.