-
Notifications
You must be signed in to change notification settings - Fork 268
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
add flag to bake non bootstrap validator stakes into genesis #2704
add flag to bake non bootstrap validator stakes into genesis #2704
Conversation
3f80b31
to
ddf1681
Compare
ddf1681
to
4a44bd0
Compare
I'm wondering if we want a more flexible interface here. I know you're reusing a lot of the What if
Oh, just saw the help text; it looks like you were originally headed that direction? https://github.com/anza-xyz/agave/pull/2704/files#diff-4ba9fb9faa2132f5a4b9dde7b311023011c423c34c21bebf6c8f6f638fae0bf3R321 |
omg i forgot to update the comment lol. and yesss I was. I was thinking it made it more confusing to have pubkeys and lamports in the same argument. But if we want this level of flexibility (sounds like we do), then it makes sense to add lamports to the end of that arg |
Alternately, we could read a yaml file that defines a list of validators with their keys and different funding levels. But I wasn't sure if this would be confusing alongside the primordial-accounts file, and/or harder to use than a long, multi-type CLI arg... What do you think? |
I do think that a yaml file is a little easier to manage. But, ya not sure it makes sense along side of primordial accounts file. I assume we do NOT want to change the functionality of the primordial-accounts file, right? Or would that be an option? |
I'd say it's an option if we can do it in a backward compatible way; ie. still parse files written with the existing format. There are various ways I can think to do that. One way might be to replace But I'm also not totally opposed to a 2nd yaml for validator defs. I think we could make it distinct enough and clear enough to work... This crate probably needs a readme to explain stuff like the primodial-accounts file syntax anyway. |
i think the backwards compatibility makes the most sense since it's somewhat similar logic (Adding accounts into genesis). I'll take a stab at it. |
@yihau - pardon my ignorance. How do we do this on invalidator today? Should we adopt what @gregcusack is doing? What does it buy us? |
I hacked for solana-genesis to handle different stakes for validators. for now, all the stakes are the same, so it's quite easy to manage. and yeah, we do have some |
ya as @yihau mentioned, the main motivations are:
|
84798e7
to
e81425f
Compare
e81425f
to
8ec7ec7
Compare
8ec7ec7
to
20155f9
Compare
20155f9
to
b6ce58c
Compare
I ended up going with option 2 here. I felt it would be more clear to separate these yaml files. added a README as discussed that briefly outlines the different cli flags for baking accounts into genesis |
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.
Awesome, api looks great to me. Just a couple suggestions for naming things and docs.
genesis/README.md
Outdated
@@ -0,0 +1,75 @@ | |||
# Genesis | |||
|
|||
## There are a few ways to bake validator accounts and staked into genesis: |
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.
## There are a few ways to bake validator accounts and staked into genesis: | |
## There are a few ways to bake validator accounts and delegated stake into genesis: |
genesis/README.md
Outdated
The validator accounts file is an alternative to the primordial accounts file. The main goal with the validator accounts file is to: | ||
- Bake validator stakes into genesis with different stake and acount distributions | ||
- Remove the overhead of forcing the user to serialize and deserialize validator stake and vote account state if they want varying stake distributions - as required by (2) |
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 validator accounts file is an alternative to the primordial accounts file. The main goal with the validator accounts file is to: | |
- Bake validator stakes into genesis with different stake and acount distributions | |
- Remove the overhead of forcing the user to serialize and deserialize validator stake and vote account state if they want varying stake distributions - as required by (2) | |
The main goal with the validator accounts file is to: | |
- Bake validator stakes into genesis with different stake and account distributions | |
- Remove the overhead of forcing the user to serialize and deserialize validator stake and vote account state, as required by a primordial accounts file. |
genesis/README.md
Outdated
data: <BAS64_ENCODED_DATA_N> | ||
executable: true | ||
``` | ||
The `data` portion of the yaml file holds BASE64 encoded data about the account. `data` can include both vote and stake account information. |
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 `data` portion of the yaml file holds BASE64 encoded data about the account. `data` can include both vote and stake account information. | |
The `data` portion of the yaml file holds BASE64 encoded data about the account, which can be vote or stake account information. |
genesis/src/lib.rs
Outdated
/// A validator account where the data is encoded as a Base64 string. | ||
/// Includes the vote account and stake account. | ||
#[derive(Serialize, Deserialize, Debug)] | ||
pub struct Base64ValidatorAccount { |
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 think this struct needs a new name (and comment) now, right? There isn't any base64-encoded data.
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.
/// A validator account where the data is encoded as a Base64 string. | |
/// Includes the vote account and stake account. | |
#[derive(Serialize, Deserialize, Debug)] | |
pub struct Base64ValidatorAccount { | |
/// Info needed to create a staked validator account, including relevant balances and vote- and stake-account addresses | |
#[derive(Serialize, Deserialize, Debug)] | |
pub struct StakedValidatorInfo { |
Not totally set on this struct name, if you can think of something better. I originally had Data
in there, but kind of confusing wrt account data.
genesis/src/main.rs
Outdated
.value_name("FILENAME") | ||
.takes_value(true) | ||
.multiple(true) | ||
.help("The location of identity, vote, and stake pubkeys and balances for validator accounts to bake into genesis") |
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.
.help("The location of identity, vote, and stake pubkeys and balances for validator accounts to bake into genesis") | |
.help("The location of a file containing a list of identity, vote, and stake pubkeys and balances for validator accounts to bake into genesis") |
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.
With the caveat that I haven't actually tried running this, LGTM!
i have tested on distributed cluster + unit tests! |
Problem
There is currently no efficient way of to bake validator stakes into genesis without requiring the user to serialize and deserialize validator accounts into and out of a
primordial-accounts-file
file.Summary of Changes
add
--validator-accounts-file <path-to-file>
cli arg that reads in validator accounts from a yaml file. These accounts and associated lamports are then baked into genesis.validator-accounts-file format: