Account for all tokens at genesis (#7350)

* Towards accounting for all tokens

* Move 5m tokens back into the big pool

* Flesh out batch 4

* Add a script to generate ValidatorInfo structs from a CSV file

* Remove commented out code and improve test
This commit is contained in:
Greg Fitzgerald
2019-12-08 09:17:42 -07:00
committed by GitHub
parent 5253c27ca8
commit 62810d769a
5 changed files with 185 additions and 398 deletions

View File

@@ -0,0 +1,42 @@
// Utility to print ValidatorInfo structs for `genesis_accounts.rs`
//
// Usage:
// cargo run --bin solana-csv-to-validator-infos < validators.csv
use serde::Deserialize;
use std::error::Error;
use std::io;
use std::process;
#[derive(Debug, Deserialize)]
struct ValidatorRecord {
id: u64,
tokens: f64,
adjective: String,
noun: String,
identity_pubkey: String,
vote_pubkey: String,
}
fn parse_csv() -> Result<(), Box<dyn Error>> {
let mut rdr = csv::Reader::from_reader(io::stdin());
for result in rdr.deserialize() {
let record: ValidatorRecord = result?;
println!(
r#"ValidatorInfo {{name: "{adjective} {noun}", node: "{identity_pubkey}", node_sol: {tokens:.1}, vote: "{vote_pubkey}", commission: 0}},"#,
tokens = &record.tokens,
adjective = &record.adjective,
noun = &record.noun,
identity_pubkey = &record.identity_pubkey,
vote_pubkey = &record.vote_pubkey,
);
}
Ok(())
}
fn main() {
if let Err(err) = parse_csv() {
println!("error: {}", err);
process::exit(1);
}
}