Skip to content

Commit

Permalink
Adjust default cluster signature fees (#6436)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Oct 19, 2019
1 parent f2fd53e commit 621c67a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
10 changes: 6 additions & 4 deletions genesis/src/main.rs
Expand Up @@ -10,6 +10,7 @@ use solana_sdk::{
epoch_schedule::EpochSchedule,
fee_calculator::FeeCalculator,
genesis_block::GenesisBlock,
native_token::sol_to_lamports,
poh_config::PohConfig,
pubkey::Pubkey,
rent_calculator::RentCalculator,
Expand All @@ -21,8 +22,6 @@ use solana_storage_api::storage_contract;
use solana_vote_api::vote_state;
use std::{collections::HashMap, error, fs::File, io, path::PathBuf, str::FromStr, time::Duration};

pub const BOOTSTRAP_LEADER_LAMPORTS: u64 = 42;

pub enum AccountFileFormat {
Pubkey,
Keypair,
Expand Down Expand Up @@ -78,7 +77,9 @@ pub fn add_genesis_accounts(
}

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()
.target_lamports_per_signature
.to_string();
Expand Down Expand Up @@ -122,6 +123,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.long("lamports")
.value_name("LAMPORTS")
.takes_value(true)
.default_value(default_lamports)
.required(true)
.help("Number of lamports to create in the mint"),
)
Expand Down Expand Up @@ -174,7 +176,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.long("bootstrap-leader-stake-lamports")
.value_name("LAMPORTS")
.takes_value(true)
.default_value(default_bootstrap_leader_lamports)
.default_value(default_bootstrap_leader_stake_lamports)
.required(true)
.help("Number of lamports to assign to the bootstrap leader's stake account"),
)
Expand Down
2 changes: 1 addition & 1 deletion multinode-demo/delegate-stake.sh
Expand Up @@ -8,7 +8,7 @@ here=$(dirname "$0")
# shellcheck source=multinode-demo/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

usage() {
Expand Down
4 changes: 0 additions & 4 deletions multinode-demo/setup.sh
Expand Up @@ -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 --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader
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
$solana_genesis "${args[@]}"

Expand Down
2 changes: 1 addition & 1 deletion multinode-demo/validator.sh
Expand Up @@ -35,7 +35,7 @@ EOF

args=()
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
label=
identity_keypair_path=
Expand Down
4 changes: 0 additions & 4 deletions run.sh
Expand Up @@ -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-genesis \
--lamports 1000000000 \
--bootstrap-leader-lamports 10000000 \
--target-lamports-per-signature 42 \
--target-signatures-per-slot 42 \
--hashes-per-tick sleep \
--mint "$dataDir"/drone-keypair.json \
--bootstrap-leader-keypair "$dataDir"/leader-keypair.json \
Expand Down
2 changes: 1 addition & 1 deletion scripts/wallet-sanity.sh
Expand Up @@ -36,7 +36,7 @@ fi
(
set -x
$solana_cli "${args[@]}" address
$solana_cli "${args[@]}" airdrop 1000 lamports
$solana_cli "${args[@]}" airdrop 0.0001
$solana_cli "${args[@]}" balance --lamports
$solana_cli "${args[@]}" ping --count 5 --interval 0
$solana_cli "${args[@]}" balance --lamports
Expand Down
15 changes: 10 additions & 5 deletions sdk/src/fee_calculator.rs
Expand Up @@ -25,10 +25,9 @@ pub struct FeeCalculator {
pub burn_percent: u8,
}

/// TODO: determine good values for these
pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 42;
pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 171_717;
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;

impl Default for FeeCalculator {
Expand Down Expand Up @@ -196,8 +195,14 @@ mod tests {
f1.target_signatures_per_slot,
DEFAULT_TARGET_SIGNATURES_PER_SLOT
);
assert_eq!(f1.target_lamports_per_signature, 42);
assert_eq!(f1.lamports_per_signature, 21); // min
assert_eq!(
f1.target_lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE
);
assert_eq!(
f1.lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE / 2
); // min
}

#[test]
Expand Down

0 comments on commit 621c67a

Please sign in to comment.