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

issues 2721 #3122

Closed
wants to merge 1 commit into from
Closed

issues 2721 #3122

wants to merge 1 commit into from

Conversation

MerryPoppins92
Copy link

No description provided.

@qdrn
Copy link
Contributor

qdrn commented Oct 10, 2022

Hello @MerryPoppins92 !
Thanks for your contribution! Is your PR ready to be merged ?

@MerryPoppins92
Copy link
Author

MerryPoppins92 commented Oct 11, 2022 via email

@qdrn
Copy link
Contributor

qdrn commented Oct 11, 2022

I think you need to merge the main branch (at least).

Copy link
Contributor

@AurelienFT AurelienFT left a comment

Choose a reason for hiding this comment

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

I don’t see any modification on the behavior of the bootstrap or anything. The issue ask that the bootstrap server use a whitelist to allow or not people to bootstrap from this server. Your code just modify the list that is used to bootstrap as a client.
Also the code have a lot of debug prints and dead code that should not be in a PR ready to review. The code doesn’t compile because not all modifications is pushed. The code isn’t formatted also and not clippy compatible

@@ -23,9 +23,11 @@ use massa_pos_exports::{test_exports::assert_eq_pos_selection, PoSFinalState, Se
use massa_pos_worker::start_selector_worker;
use massa_signature::KeyPair;
use massa_time::MassaTime;
// use massa_node::load_file;
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is dead and should be remove before merging (same for all the other dead code)

@@ -205,10 +217,6 @@ async fn test_bootstrap_server() {
}
});

let sent_peers = wait_peers().await;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change should be reverted as it's a fix since the change in #3109

@@ -13,7 +13,7 @@ use crate::tests::tools::{
use crate::BootstrapConfig;
use crate::{
get_state, start_bootstrap_server,
tests::tools::{assert_eq_bootstrap_graph, get_bootstrap_config},
tests::tools::{assert_eq_bootstrap_graph, get_bootstrap_config, get_bootstrap_config_for_wl},
Copy link
Contributor

Choose a reason for hiding this comment

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

You imported this function that doesn't exist in our codebase you should push the modifications on tools.rs that has this change.

@@ -197,6 +192,60 @@ pub struct ProtocolSettings {
pub max_endorsements_propagation_time: MassaTime,
}

pub fn load_file() -> Vec<(SocketAddr, PublicKey)> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems not used and have a second version before so I think it should be removed.

}

pub fn load_file2() -> Vec<SocketAddr> {
use std::fs::File;
Copy link
Contributor

Choose a reason for hiding this comment

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

Imports must be done at the top of the file

@@ -180,15 +180,10 @@ pub struct ProtocolSettings {
/// Maximum number of batches in the memory buffer.
/// Dismiss the new batches if overflow
pub operation_batch_buffer_capacity: usize,
/// Maximum number of operations in the announcement buffer.
/// Immediately announce if overflow.
pub operation_announcement_buffer_capacity: usize,
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be deleted

@@ -601,6 +607,8 @@ struct Args {
/// Wallet password
#[structopt(short = "p", long = "pwd")]
password: Option<String>,
#[structopt(short = "b", long = "boot")]
boot: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Passing an argument to use a config file is complex for user. The most easy way for the user to do it it's like our config.toml. We create a file by default in your case whitelist: [] and then the user can edit it.
Sadly this doesn't match the requirements of the issue that ask this list to be live editable. I think a way to do it live executable is to use the API.

@@ -649,6 +657,17 @@ async fn main(args: Args) -> anyhow::Result<()> {
.with(tracing_layer)
.init();

let x = match args.boot {
None => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use is_some : https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some to perform this conversion


let bootstrap_list = match boot {
true => {
let x = load_file2();
Copy link
Contributor

Choose a reason for hiding this comment

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

You are not using the return of the function that read the file you are just using the number of entries in it and you are generating new public key instead of using the ones in the file.

@@ -0,0 +1,8 @@
whitelist:
Copy link
Contributor

Choose a reason for hiding this comment

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

We use toml for our config file I think we should keep toml for consistency.

Copy link
Member

@damip damip left a comment

Choose a reason for hiding this comment

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

PR rejected (see comments)

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.

4 participants