Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature request allow me to initialize the p2p private key file with new flag #7181 #7191

Open
wants to merge 12 commits into
base: unstable
Choose a base branch
from

Conversation

Ayushdubey86
Copy link

@Ayushdubey86 Ayushdubey86 commented Mar 21, 2025

Issue Addressed

#7181

##Changes

This PR introduces a new command‑line flag --p2p-priv-key that lets users supply a hex‑encoded p2p private key via a file. The key loading function is updated to first check for this flag and decode the hex input, while falling back to the existing binary key file behavior if not provided, and the call sites are updated accordingly.

@Ayushdubey86
Copy link
Author

Ayushdubey86 commented Mar 21, 2025

Hello @barnabasbusa @michaelsproul , do check out this pr, once free!

@@ -178,7 +178,7 @@ impl<E: EthSpec> Network<E> {
let config = ctx.config.clone();
trace!("Libp2p Service starting");
// initialise the node's ID
let local_keypair = utils::load_private_key(&config);
let local_keypair = utils::load_private_key(&config, &cli_args);
Copy link
Member

Choose a reason for hiding this comment

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

Have you run this yourself? cli_args doesn't exist in this scope, so this should result in a compile error.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @ackintosh , my local pipeline does not works for some reason, but do check out this pr once again, have pushed further changes!

Copy link

Choose a reason for hiding this comment

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

Just a heads-up — it’s hard to review if the PR doesn’t compile. Can you make sure everything builds locally before pushing changes?

@jimmygchen jimmygchen added the waiting-on-author The reviewer has suggested changes and awaits thier implementation. label Mar 23, 2025
@barnabasbusa
Copy link

@Ayushdubey86
Copy link
Author

Hey @barnabasbusa , can you rerun it , i think beside swarm builder rest should be resolved.

}
local_private_key.into()
let key_path = config.network_dir.join("key");
load_or_create_keypair(key_path)
Copy link

Choose a reason for hiding this comment

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

It looks like the implementation of load_or_create_keypair might be missing—did you forget to include it?"

@@ -49,6 +49,7 @@ tracing-subscriber = { workspace = true }
types = { workspace = true }
unsigned-varint = { version = "0.8", features = ["codec"] }
unused_port = { workspace = true }
clap = { version = "4", features = ["derive"] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Un-intended change?

Comment on lines +184 to +186
pub fn initialize_network(config: NetworkConfig, cli_args: &ArgMatches) {
let local_keypair = utils::load_private_key(&config, cli_args);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems out of place, you don't have access to cli_args here. You should pass CLI data through the network config

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
waiting-on-author The reviewer has suggested changes and awaits thier implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants