-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement constructor, initial bootstrap, and tests, for PropagationNetwork
.
#41
Conversation
This PR is good in terms of that it is self-contained, though, it is too big. |
cfd4844
to
0a8a624
Compare
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.
- Please use
does ~
instead ofdo ~
for doc-comments. - What is
K_VALUE
?
} | ||
|
||
impl PropagationNetwork { | ||
#[allow(dead_code)] |
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.
If this will be only for the tests ever, then just move it in mod tests
.
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.
moved it
Automatically rebased on the latest commit of main. |
|
network/Cargo.toml
Outdated
|
||
[dev-dependencies] | ||
rand = "0.8.5" |
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.
Add newline.
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.
fixed
floodsub: Floodsub::new(local_peer_id), | ||
} | ||
} | ||
// Todo: Add constructor taking a configuration as an argument. |
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.
TODO
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 removed the comment because it is already achieved (config.rs
).
/// Returns a default. | ||
/// | ||
/// To customize configurations, call `default` and chain the functions with the name of `with_<fieldname>`. | ||
pub fn default() -> 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.
Why not trait Default
?
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.
Moved it into impl Default
block.
if let Ok(keypair_inner) = ed25519::Keypair::decode(&mut keypair_bytes) { | ||
Ok(Keypair::Ed25519(keypair_inner)) | ||
} else { | ||
Err("Invalid public/private keypair was given.".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.
Using a non-capitalized sentence is the (loose) convention for error msgs. Please apply it.
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.
Applied it to all err messages and panic messages.
pub(crate) peer_discovery_interval: Duration, | ||
/// Capacity for the message queue that passes messages from other nodes | ||
/// to its simperby node. | ||
pub(crate) message_queue_capacity: usize, |
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.
It is common to refer struct fields with The
in the doc comments.
(e.g., The addresses to ..
)
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.
Applied it to all structs.
Type of this PR
Describe your changes
Interface implementations
Among the following interfaces,
async fn new
(the constructor) andasync fn create_recv_queue
are implemented. The rest will be available after broadcasting logic is implemented.Other implemented features
PropagationNetwork
is being constructed.PropagationNetwork
and the background task.Unit tests
The following unit tests for initial bootstrap are added.
Remaining works
The followings are ordered by priority but can be changed.
simperby-network
)