| @@ -3,7 +3,10 @@ use crate::{ | |||||||
|     unlocks::UnlockInfo, |     unlocks::UnlockInfo, | ||||||
|     validators::{create_and_add_validator, ValidatorInfo}, |     validators::{create_and_add_validator, ValidatorInfo}, | ||||||
| }; | }; | ||||||
| use solana_sdk::{genesis_config::GenesisConfig, native_token::sol_to_lamports}; | use solana_sdk::{ | ||||||
|  |     genesis_config::GenesisConfig, | ||||||
|  |     native_token::{lamports_to_sol, sol_to_lamports}, | ||||||
|  | }; | ||||||
|  |  | ||||||
| // 30 month schedule is 1/5th every 6 months for 30 months | // 30 month schedule is 1/5th every 6 months for 30 months | ||||||
| const UNLOCKS_BY_FIFTHS_FOR_30_MONTHS: UnlockInfo = UnlockInfo { | const UNLOCKS_BY_FIFTHS_FOR_30_MONTHS: UnlockInfo = UnlockInfo { | ||||||
| @@ -11,7 +14,7 @@ const UNLOCKS_BY_FIFTHS_FOR_30_MONTHS: UnlockInfo = UnlockInfo { | |||||||
|     cliff_years: 0.5, |     cliff_years: 0.5, | ||||||
|     unlocks: 4, |     unlocks: 4, | ||||||
|     unlock_years: 0.5, |     unlock_years: 0.5, | ||||||
|     custodian: "11111111111111111111111111111111", |     custodian: "6LnFgiECFQKUcxNYDvUBMxgjeGQzzy4kgxGhantoxfUe", | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // 60 month schedule is 1/10th every 6 months for 60 months | // 60 month schedule is 1/10th every 6 months for 60 months | ||||||
| @@ -148,11 +151,6 @@ pub const POOL_STAKER_INFOS: &[StakerInfo] = &[ | |||||||
|         staker: "4h1rt2ic4AXwG7p3Qqhw57EMDD4c3tLYb5J3QstGA2p5", |         staker: "4h1rt2ic4AXwG7p3Qqhw57EMDD4c3tLYb5J3QstGA2p5", | ||||||
|         sol: 153_333_633.41, |         sol: 153_333_633.41, | ||||||
|     }, |     }, | ||||||
|     StakerInfo { |  | ||||||
|         name: "one thanks", |  | ||||||
|         staker: "3b7akieYUyCgz3Cwt5sTSErMWjg8NEygD6mbGjhGkduB", |  | ||||||
|         sol: 178_699_925.59, |  | ||||||
|     }, |  | ||||||
|     StakerInfo { |     StakerInfo { | ||||||
|         name: "lyrical supermarket", |         name: "lyrical supermarket", | ||||||
|         staker: "GRZwoJGisLTszcxtWpeREJ98EGg8pZewhbtcrikoU7b3", |         staker: "GRZwoJGisLTszcxtWpeREJ98EGg8pZewhbtcrikoU7b3", | ||||||
| @@ -269,8 +267,11 @@ fn add_validators(genesis_config: &mut GenesisConfig, validator_infos: &[Validat | |||||||
|         .sum::<u64>() |         .sum::<u64>() | ||||||
| } | } | ||||||
|  |  | ||||||
| pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig) -> u64 { | pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig, mut issued_lamports: u64) { | ||||||
|     add_stakes( |     // add_stakes() and add_validators() award tokens for rent exemption and | ||||||
|  |     //  to cover an initial transfer-free period of the network | ||||||
|  |  | ||||||
|  |     issued_lamports += add_stakes( | ||||||
|         genesis_config, |         genesis_config, | ||||||
|         &BATCH_FOUR_STAKER_INFOS, |         &BATCH_FOUR_STAKER_INFOS, | ||||||
|         &UNLOCKS_BY_FIFTHS_FOR_30_MONTHS, |         &UNLOCKS_BY_FIFTHS_FOR_30_MONTHS, | ||||||
| @@ -280,7 +281,19 @@ pub fn add_genesis_accounts(genesis_config: &mut GenesisConfig) -> u64 { | |||||||
|         &POOL_STAKER_INFOS, |         &POOL_STAKER_INFOS, | ||||||
|         &UNLOCKS_BY_TENTHS_FOR_60_MONTHS, |         &UNLOCKS_BY_TENTHS_FOR_60_MONTHS, | ||||||
|         sol_to_lamports(1_000_000.0), |         sol_to_lamports(1_000_000.0), | ||||||
|     ) + add_validators(genesis_config, &VALIDATOR_INFOS) |     ) + add_validators(genesis_config, &VALIDATOR_INFOS); | ||||||
|  |  | ||||||
|  |     // "one thanks" gets 500_000_000SOL (total) - above distributions | ||||||
|  |     create_and_add_stakes( | ||||||
|  |         genesis_config, | ||||||
|  |         &StakerInfo { | ||||||
|  |             name: "one thanks", | ||||||
|  |             staker: "3b7akieYUyCgz3Cwt5sTSErMWjg8NEygD6mbGjhGkduB", | ||||||
|  |             sol: 500_000_000.0 - lamports_to_sol(issued_lamports), | ||||||
|  |         }, | ||||||
|  |         &UNLOCKS_BY_TENTHS_FOR_60_MONTHS, | ||||||
|  |         sol_to_lamports(1_000_000.0), | ||||||
|  |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
| #[cfg(test)] | #[cfg(test)] | ||||||
| @@ -291,13 +304,7 @@ mod tests { | |||||||
|     fn test_add_genesis_accounts() { |     fn test_add_genesis_accounts() { | ||||||
|         let mut genesis_config = GenesisConfig::default(); |         let mut genesis_config = GenesisConfig::default(); | ||||||
|  |  | ||||||
|         let bootstrap_lamports = genesis_config |         add_genesis_accounts(&mut genesis_config, 0); | ||||||
|             .accounts |  | ||||||
|             .iter() |  | ||||||
|             .map(|(_, account)| account.lamports) |  | ||||||
|             .sum::<u64>(); |  | ||||||
|  |  | ||||||
|         let issued_lamports = add_genesis_accounts(&mut genesis_config); |  | ||||||
|  |  | ||||||
|         let lamports = genesis_config |         let lamports = genesis_config | ||||||
|             .accounts |             .accounts | ||||||
| @@ -305,11 +312,6 @@ mod tests { | |||||||
|             .map(|(_, account)| account.lamports) |             .map(|(_, account)| account.lamports) | ||||||
|             .sum::<u64>(); |             .sum::<u64>(); | ||||||
|  |  | ||||||
|         assert_eq!(issued_lamports, lamports); |         assert_eq!(500_000_000.0, lamports_to_sol(lamports)); | ||||||
|         let validator_reserves = 42 * 500 * 1_000_000_000; |  | ||||||
|         let rent_fees = 20; // TODO: Need a place to pay rent from. |  | ||||||
|         let expected_lamports = |  | ||||||
|             500_000_000_000_000_000 - bootstrap_lamports - validator_reserves + rent_fees; |  | ||||||
|         assert_eq!(lamports, expected_lamports); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -322,7 +322,7 @@ fn main() -> Result<(), Box<dyn error::Error>> { | |||||||
|         ) |         ) | ||||||
|         .get_matches(); |         .get_matches(); | ||||||
|  |  | ||||||
|     let faucet_lamports = value_t!(matches, "faucet_lamports", u64); |     let faucet_lamports = value_t!(matches, "faucet_lamports", u64).unwrap_or(0); | ||||||
|     let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap()); |     let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap()); | ||||||
|     let bootstrap_leader_lamports = value_t_or_exit!(matches, "bootstrap_leader_lamports", u64); |     let bootstrap_leader_lamports = value_t_or_exit!(matches, "bootstrap_leader_lamports", u64); | ||||||
|     let bootstrap_leader_stake_lamports = |     let bootstrap_leader_stake_lamports = | ||||||
| @@ -447,7 +447,7 @@ fn main() -> Result<(), Box<dyn error::Error>> { | |||||||
|     if let Some(faucet_pubkey) = faucet_pubkey { |     if let Some(faucet_pubkey) = faucet_pubkey { | ||||||
|         genesis_config.add_account( |         genesis_config.add_account( | ||||||
|             faucet_pubkey, |             faucet_pubkey, | ||||||
|             Account::new(faucet_lamports.unwrap(), 0, &system_program::id()), |             Account::new(faucet_lamports, 0, &system_program::id()), | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -461,7 +461,13 @@ fn main() -> Result<(), Box<dyn error::Error>> { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     add_genesis_accounts(&mut genesis_config); |     let issued_lamports = genesis_config | ||||||
|  |         .accounts | ||||||
|  |         .iter() | ||||||
|  |         .map(|(_key, account)| account.lamports) | ||||||
|  |         .sum::<u64>(); | ||||||
|  |  | ||||||
|  |     add_genesis_accounts(&mut genesis_config, issued_lamports - faucet_lamports); | ||||||
|  |  | ||||||
|     create_new_ledger(&ledger_path, &genesis_config)?; |     create_new_ledger(&ledger_path, &genesis_config)?; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								programs/bpf/Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										13
									
								
								programs/bpf/Cargo.lock
									
									
									
										generated
									
									
									
								
							| @@ -322,7 +322,7 @@ dependencies = [ | |||||||
|  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", |  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "publicsuffix 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", |  "publicsuffix 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", |  "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "try_from 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", |  "try_from 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", |  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
| @@ -1400,7 +1400,7 @@ dependencies = [ | |||||||
|  "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", |  "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", |  "rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", |  "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", |  "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
| @@ -1532,7 +1532,7 @@ dependencies = [ | |||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "serde_json" | name = "serde_json" | ||||||
| version = "1.0.42" | version = "1.0.44" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", |  "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
| @@ -1811,7 +1811,7 @@ dependencies = [ | |||||||
|  "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", |  "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "solana-bpf-loader-program 0.22.0", |  "solana-bpf-loader-program 0.22.0", | ||||||
|  "solana-logger 0.22.0", |  "solana-logger 0.22.0", | ||||||
|  "solana-measure 0.22.0", |  "solana-measure 0.22.0", | ||||||
| @@ -1848,11 +1848,12 @@ dependencies = [ | |||||||
|  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", |  "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", |  "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
|  "solana-crate-features 0.22.0", |  "solana-crate-features 0.22.0", | ||||||
|  "solana-logger 0.22.0", |  "solana-logger 0.22.0", | ||||||
|  "solana-sdk-macro 0.22.0", |  "solana-sdk-macro 0.22.0", | ||||||
|  |  "thiserror 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| @@ -2775,7 +2776,7 @@ dependencies = [ | |||||||
| "checksum serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702" | "checksum serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702" | ||||||
| "checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc" | "checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc" | ||||||
| "checksum serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "a8c6faef9a2e64b0064f48570289b4bf8823b7581f1d6157c1b52152306651d0" | "checksum serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "a8c6faef9a2e64b0064f48570289b4bf8823b7581f1d6157c1b52152306651d0" | ||||||
| "checksum serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)" = "1a3351dcbc1f067e2c92ab7c3c1f288ad1a4cffc470b5aaddb4c2e0a3ae80043" | "checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7" | ||||||
| "checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" | "checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" | ||||||
| "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" | "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" | ||||||
| "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" | "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user