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

Bake stake into genesis #68

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gregcusack
Copy link
Collaborator

@gregcusack gregcusack commented Aug 16, 2024

Current deployment forces user to wait for stakes to warmup for multiple epochs. This lets the user bake the validator stakes into genesis so the cluster has stakes fully warmed up upon deployment.

Baking stakes into genesis is set as the default. If you want the original method that requires stake warmup, pass in --skip-primordial-stakes

Requires Agave PR anza-xyz/agave#2704 to be merged before this one

@gregcusack gregcusack marked this pull request as ready for review August 16, 2024 22:04
src/main.rs Outdated
Comment on lines 253 to 255
.help("Do not bake validator stake accounts into genesis. \
Validators will be funded and staked after the cluster boots. \
This will result in several epochs for all of the stake to warm up"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh. I was going to suggest that in the future (not in this PR), we could have rustfmt format these long help strings by adding format_strings = true to the rustfmt.toml and running cargo +nightly fmt. But it is not touching these strings when I run it locally, for some reason...

Either way, fyi that rustfmt is not styling this long command/arg list as a result of those strings.

src/genesis.rs Outdated Show resolved Hide resolved
@gregcusack gregcusack force-pushed the bake-stake-into-genesis branch from 4bde184 to b4d4fc8 Compare August 22, 2024 20:33
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

I'm going to hold off reviewing this until anza-xyz/agave#2704 is finished and merged. It's helpful to see what the interface looks like from this side, though.

@gregcusack gregcusack force-pushed the bake-stake-into-genesis branch from 336d715 to 28e51d7 Compare October 4, 2024 01:07
@gregcusack gregcusack force-pushed the bake-stake-into-genesis branch 3 times, most recently from 1d79dd1 to ec7a6ed Compare January 15, 2025 20:58
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Here are a few comments from a quick pass. I need to make a more careful read after I remind myself of the setup flow 😅

Comment on lines +48 to +62
#[derive(Serialize, Deserialize)]
struct ValidatorAccountsFile {
validator_accounts: Vec<StakedValidatorAccountInfo>,
}

/// Info needed to create a staked validator account,
/// including relevant balances and vote- and stake-account addresses
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct StakedValidatorAccountInfo {
pub balance_lamports: u64,
pub stake_lamports: u64,
pub identity_account: String,
pub vote_account: String,
pub stake_account: String,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we import these types from solana-genesis now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what is the best way to do that? There is no release yet that includes ValidatorAccountsFile and StakedValidatorAccountInfo? For now I could just patch it in to use solana-genesis from master if that sound good:

solana-genesis = { git = "https://github.com/anza-xyz/agave.git", package = "solana-genesis" }

^ I can then update this to the specific release when release comes out

Copy link
Collaborator Author

@gregcusack gregcusack Jan 16, 2025

Choose a reason for hiding this comment

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

actually let's just wait on this PR maybe until a v2.2.0 gets tagged and released. using the github link causes a ton of dependency issues because the master agave branch just changed to use a different Pubkey (solana_program::pubkey::Pubkey instead of solana_sdk::pubkey::Pubkey). Dependencies like spl-token-2022 will pull dependencies from crates.io which only has solana-* up to v2.1.9, so I'd have to individually patch all solana-* crates to agave github master. so probably just makes sense to wait

There also may be another way to do this but I am not sure

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh duh, sorry, I forgot we haven't released those types yet. Yeah, holding off on this until v2.2.0 is probably a-okay.

}
}

self.write_validator_genesis_accouts_to_file()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.write_validator_genesis_accouts_to_file()?;
self.write_validator_genesis_accounts_to_file()?;

Comment on lines +128 to +137
v0:
balances_lamports: <balance0>
stake_lamports: <stake0>
v1:
balances_lamports: <balance1>
stake_lamports: <stake1>
...
vN:
balances_lamports: <balanceN>
stake_lamports: <stakeN>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
v0:
balances_lamports: <balance0>
stake_lamports: <stake0>
v1:
balances_lamports: <balance1>
stake_lamports: <stake1>
...
vN:
balances_lamports: <balanceN>
stake_lamports: <stakeN>
v0:
balance_lamports: <balance0>
stake_lamports: <stake0>
v1:
balance_lamports: <balance1>
stake_lamports: <stake1>
...
vN:
balance_lamports: <balanceN>
stake_lamports: <stakeN>

# kubernetes config
--cpu-requests <cores>
--memory-requests <memory>
# deploy with clients
bench-tps
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks out of place. Is it correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bench-tps is a subcommand so should be passed in like this

// Creates yaml file solana-genesis can read in for `--validator-stakes-file <FILE>`
// Yaml file created with the following format dictated in agave/genesis/README.md
// See: https://github.com/anza-xyz/agave/blob/master/genesis/README.md#3-through-the-validator-accounts-file-flag
fn write_validator_genesis_accouts_to_file(&mut self) -> std::io::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn write_validator_genesis_accouts_to_file(&mut self) -> std::io::Result<()> {
fn write_validator_genesis_accounts_to_file(&mut self) -> std::io::Result<()> {

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.

2 participants