-
Notifications
You must be signed in to change notification settings - Fork 43
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(l1, l2): show rich wallets on startup #2045
base: main
Are you sure you want to change the base?
Conversation
|
cmd/ethrex/ethrex.rs
Outdated
let l2_pks = include_str!("../../test_data/private_keys.txt"); | ||
show_rich_accounts(&genesis, l2_pks); |
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 use this so we can run the print independent where we execute 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.
Hi Tomi, quick question. Doesn't that mean that if you change the .txt
you have to recompile the program?
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.
Yes, that's correct. This file is for testing purposes. it's expected to be recompiled
cmd/ethrex/ethrex.rs
Outdated
let Ok(pk_h256) = pk_str.parse::<H256>() else { | ||
return; | ||
}; |
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 there is any error, don't print the addresses so we don't stop the ethrex client
cmd/ethrex/ethrex.rs
Outdated
@@ -497,3 +508,52 @@ fn read_known_peers(file_path: PathBuf) -> Result<Vec<Node>, serde_json::Error> | |||
|
|||
serde_json::from_reader(file) | |||
} | |||
|
|||
fn show_rich_accounts(genesis: &Genesis, contents: &str) { |
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 is only for --dev, can we move this to the dev crate? We're polluting this file with all kinds of random stuff.
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.
Yes, this should be in the dev
crate.
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.
Thanks for pointing it out, changed here 37e2093
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.
let me talk to the creator of the ticket
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.
- Let's do a separate PR for the L2 CLI feature
- As printing the rich wallets is a dev feature, let's move the code there
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 only thing I'm hesitant about is include_str!
Besides that, looks good to me~!
cmd/ethrex/ethrex.rs
Outdated
let l2_pks = include_str!("../../test_data/private_keys.txt"); | ||
show_rich_accounts(&genesis, l2_pks); |
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.
Hi Tomi, quick question. Doesn't that mean that if you change the .txt
you have to recompile the program?
Motivation
In this PR we show the top 10 rich accounts on startup.
Description
When Genesis file is read, sort the accounts initialized by their balance and print the top 10. We show their private keys by calculating the address from it.
The print of the addresses set in the genesis block is show this way:
Closes #1981