Adjust default cluster signature fees (#6436)

This commit is contained in:
Michael Vines 2019-10-18 17:00:51 -07:00 committed by GitHub
parent f2fd53e773
commit 621c67a8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 20 deletions

View File

@ -10,6 +10,7 @@ use solana_sdk::{
epoch_schedule::EpochSchedule, epoch_schedule::EpochSchedule,
fee_calculator::FeeCalculator, fee_calculator::FeeCalculator,
genesis_block::GenesisBlock, genesis_block::GenesisBlock,
native_token::sol_to_lamports,
poh_config::PohConfig, poh_config::PohConfig,
pubkey::Pubkey, pubkey::Pubkey,
rent_calculator::RentCalculator, rent_calculator::RentCalculator,
@ -21,8 +22,6 @@ use solana_storage_api::storage_contract;
use solana_vote_api::vote_state; use solana_vote_api::vote_state;
use std::{collections::HashMap, error, fs::File, io, path::PathBuf, str::FromStr, time::Duration}; use std::{collections::HashMap, error, fs::File, io, path::PathBuf, str::FromStr, time::Duration};
pub const BOOTSTRAP_LEADER_LAMPORTS: u64 = 42;
pub enum AccountFileFormat { pub enum AccountFileFormat {
Pubkey, Pubkey,
Keypair, Keypair,
@ -78,7 +77,9 @@ pub fn add_genesis_accounts(
} }
fn main() -> Result<(), Box<dyn error::Error>> { fn main() -> Result<(), Box<dyn error::Error>> {
let default_bootstrap_leader_lamports = &BOOTSTRAP_LEADER_LAMPORTS.to_string(); let default_bootstrap_leader_lamports = &sol_to_lamports(500.0).to_string();
let default_bootstrap_leader_stake_lamports = &sol_to_lamports(0.5).to_string();
let default_lamports = &sol_to_lamports(500_000_000.0).to_string();
let default_target_lamports_per_signature = &FeeCalculator::default() let default_target_lamports_per_signature = &FeeCalculator::default()
.target_lamports_per_signature .target_lamports_per_signature
.to_string(); .to_string();
@ -122,6 +123,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.long("lamports") .long("lamports")
.value_name("LAMPORTS") .value_name("LAMPORTS")
.takes_value(true) .takes_value(true)
.default_value(default_lamports)
.required(true) .required(true)
.help("Number of lamports to create in the mint"), .help("Number of lamports to create in the mint"),
) )
@ -174,7 +176,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.long("bootstrap-leader-stake-lamports") .long("bootstrap-leader-stake-lamports")
.value_name("LAMPORTS") .value_name("LAMPORTS")
.takes_value(true) .takes_value(true)
.default_value(default_bootstrap_leader_lamports) .default_value(default_bootstrap_leader_stake_lamports)
.required(true) .required(true)
.help("Number of lamports to assign to the bootstrap leader's stake account"), .help("Number of lamports to assign to the bootstrap leader's stake account"),
) )

View File

@ -8,7 +8,7 @@ here=$(dirname "$0")
# shellcheck source=multinode-demo/common.sh # shellcheck source=multinode-demo/common.sh
source "$here"/common.sh source "$here"/common.sh
stake_lamports=42 # default number of lamports to assign as stake stake_lamports=8589934592 # default number of lamports to assign as stake (0.5 SOL)
url=http://127.0.0.1:8899 # default RPC url url=http://127.0.0.1:8899 # default RPC url
usage() { usage() {

View File

@ -25,10 +25,6 @@ default_arg --bootstrap-stake-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/stak
default_arg --bootstrap-storage-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/storage-keypair.json default_arg --bootstrap-storage-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/storage-keypair.json
default_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader default_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader
default_arg --mint "$SOLANA_CONFIG_DIR"/mint-keypair.json default_arg --mint "$SOLANA_CONFIG_DIR"/mint-keypair.json
default_arg --lamports 100000000000000
default_arg --bootstrap-leader-lamports 424242424242
default_arg --target-lamports-per-signature 42
default_arg --target-signatures-per-slot 42
default_arg --hashes-per-tick auto default_arg --hashes-per-tick auto
$solana_genesis "${args[@]}" $solana_genesis "${args[@]}"

View File

@ -35,7 +35,7 @@ EOF
args=() args=()
airdrops_enabled=1 airdrops_enabled=1
node_lamports=424242424242 # number of lamports to airdrop the node for transaction fees (ignored if airdrops_enabled=0) node_lamports=8589934592000 # 500 SOL: number of lamports to airdrop the node for transaction fees (ignored if airdrops_enabled=0)
poll_for_new_genesis_block=0 poll_for_new_genesis_block=0
label= label=
identity_keypair_path= identity_keypair_path=

4
run.sh
View File

@ -63,10 +63,6 @@ solana-keygen new -f -o "$dataDir"/drone-keypair.json
solana-keygen new -f -o "$dataDir"/leader-storage-account-keypair.json solana-keygen new -f -o "$dataDir"/leader-storage-account-keypair.json
solana-genesis \ solana-genesis \
--lamports 1000000000 \
--bootstrap-leader-lamports 10000000 \
--target-lamports-per-signature 42 \
--target-signatures-per-slot 42 \
--hashes-per-tick sleep \ --hashes-per-tick sleep \
--mint "$dataDir"/drone-keypair.json \ --mint "$dataDir"/drone-keypair.json \
--bootstrap-leader-keypair "$dataDir"/leader-keypair.json \ --bootstrap-leader-keypair "$dataDir"/leader-keypair.json \

View File

@ -36,7 +36,7 @@ fi
( (
set -x set -x
$solana_cli "${args[@]}" address $solana_cli "${args[@]}" address
$solana_cli "${args[@]}" airdrop 1000 lamports $solana_cli "${args[@]}" airdrop 0.0001
$solana_cli "${args[@]}" balance --lamports $solana_cli "${args[@]}" balance --lamports
$solana_cli "${args[@]}" ping --count 5 --interval 0 $solana_cli "${args[@]}" ping --count 5 --interval 0
$solana_cli "${args[@]}" balance --lamports $solana_cli "${args[@]}" balance --lamports

View File

@ -25,10 +25,9 @@ pub struct FeeCalculator {
pub burn_percent: u8, pub burn_percent: u8,
} }
/// TODO: determine good values for these pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 171_717;
pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 42;
pub const DEFAULT_TARGET_SIGNATURES_PER_SLOT: usize = pub const DEFAULT_TARGET_SIGNATURES_PER_SLOT: usize =
710_000 * DEFAULT_TICKS_PER_SLOT as usize / DEFAULT_TICKS_PER_SECOND as usize; 50_000 * DEFAULT_TICKS_PER_SLOT as usize / DEFAULT_TICKS_PER_SECOND as usize;
pub const DEFAULT_BURN_PERCENT: u8 = ((50usize * std::u8::MAX as usize) / 100usize) as u8; pub const DEFAULT_BURN_PERCENT: u8 = ((50usize * std::u8::MAX as usize) / 100usize) as u8;
impl Default for FeeCalculator { impl Default for FeeCalculator {
@ -196,8 +195,14 @@ mod tests {
f1.target_signatures_per_slot, f1.target_signatures_per_slot,
DEFAULT_TARGET_SIGNATURES_PER_SLOT DEFAULT_TARGET_SIGNATURES_PER_SLOT
); );
assert_eq!(f1.target_lamports_per_signature, 42); assert_eq!(
assert_eq!(f1.lamports_per_signature, 21); // min f1.target_lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE
);
assert_eq!(
f1.lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE / 2
); // min
} }
#[test] #[test]