Skip to content

Commit

Permalink
plumb some rent (#5610)
Browse files Browse the repository at this point in the history
* plumb some rent

* nits

* fixups

* fixups

* fixups
  • Loading branch information
rob-solana authored Aug 23, 2019
1 parent 9b8d59d commit 0ffe7a9
Show file tree
Hide file tree
Showing 19 changed files with 385 additions and 143 deletions.
6 changes: 4 additions & 2 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ pub mod tests {
"owner": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"lamports": 20,
"data": [],
"executable": false
"executable": false,
"rent_epoch": 0
},
"id":1}
"#;
Expand Down Expand Up @@ -903,7 +904,8 @@ pub mod tests {
"owner": {:?},
"lamports": 20,
"data": [],
"executable": false
"executable": false,
"rent_epoch": 0
}}]],
"id":1}}
"#,
Expand Down
4 changes: 3 additions & 1 deletion core/src/rpc_pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ mod tests {
"owner": budget_program_id,
"lamports": 51,
"data": expected_data,
"executable": executable,
"executable": executable,
"rent_epoch": 0,
},
"subscription": 0,
}
Expand Down Expand Up @@ -574,6 +575,7 @@ mod tests {
"lamports": 100,
"data": [],
"executable": false,
"rent_epoch": 0,
},
"subscription": 0,
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/rpc_subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ mod tests {
subscriptions.check_account(&alice.pubkey(), 0, &bank_forks);
let string = transport_receiver.poll();
if let Async::Ready(Some(response)) = string.unwrap() {
let expected = format!(r#"{{"jsonrpc":"2.0","method":"accountNotification","params":{{"result":{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[2,203,81,223,225,24,34,35,203,214,138,130,144,208,35,77,63,16,87,51,47,198,115,123,98,188,19,160,0,0,0,0]}},"subscription":0}}}}"#);
let expected = format!(r#"{{"jsonrpc":"2.0","method":"accountNotification","params":{{"result":{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[2,203,81,223,225,24,34,35,203,214,138,130,144,208,35,77,63,16,87,51,47,198,115,123,98,188,19,160,0,0,0,0],"rent_epoch":0}},"subscription":0}}}}"#);
assert_eq!(expected, response);
}

Expand Down Expand Up @@ -403,7 +403,7 @@ mod tests {
subscriptions.check_program(&solana_budget_api::id(), 0, &bank_forks);
let string = transport_receiver.poll();
if let Async::Ready(Some(response)) = string.unwrap() {
let expected = format!(r#"{{"jsonrpc":"2.0","method":"programNotification","params":{{"result":["{:?}",{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[2,203,81,223,225,24,34,35,203,214,138,130,144,208,35,77,63,16,87,51,47,198,115,123,98,188,19,160,0,0,0,0]}}],"subscription":0}}}}"#, alice.pubkey());
let expected = format!(r#"{{"jsonrpc":"2.0","method":"programNotification","params":{{"result":["{:?}",{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":1,"owner":[2,203,81,223,225,24,34,35,203,214,138,130,144,208,35,77,63,16,87,51,47,198,115,123,98,188,19,160,0,0,0,0],"rent_epoch":0}}],"subscription":0}}}}"#, alice.pubkey());
assert_eq!(expected, response);
}

Expand Down
13 changes: 13 additions & 0 deletions genesis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use solana_sdk::genesis_block::Builder;
use solana_sdk::hash::{hash, Hash};
use solana_sdk::poh_config::PohConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::rent::Rent;
use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
use solana_sdk::system_program;
use solana_sdk::timing;
Expand Down Expand Up @@ -59,6 +60,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
let default_target_lamports_per_signature = &FeeCalculator::default()
.target_lamports_per_signature
.to_string();
let default_lamports_per_byte_year = &Rent::default().lamports_per_byte_year.to_string();
let default_target_signatures_per_slot = &FeeCalculator::default()
.target_signatures_per_slot
.to_string();
Expand Down Expand Up @@ -161,6 +163,17 @@ fn main() -> Result<(), Box<dyn error::Error>> {
verification when the cluster is operating at target-signatures-per-slot",
),
)
.arg(
Arg::with_name("lamports_per_byte_year")
.long("lamports-per-byte-year")
.value_name("LAMPORTS")
.takes_value(true)
.default_value(default_lamports_per_byte_year)
.help(
"The cost in lamports that the cluster will charge per byte per year \
for accounts with data.",
),
)
.arg(
Arg::with_name("target_signatures_per_slot")
.long("target-signatures-per-slot")
Expand Down
5 changes: 2 additions & 3 deletions programs/move_loader_api/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,17 +760,16 @@ mod tests {
lamports: 1,
data: bincode::serialize(&LibraAccountState::create_unallocated()).unwrap(),
owner: id(),
executable: false,
..Account::default()
};
Self::new(key, account)
}

pub fn create_genesis(amount: u64) -> Self {
let account = Account {
lamports: 1,
data: vec![],
owner: id(),
executable: false,
..Account::default()
};
let mut genesis = Self::new(Pubkey::default(), account);
genesis.account.data =
Expand Down
4 changes: 1 addition & 3 deletions programs/storage_api/src/storage_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,8 @@ mod tests {
let mut account = StorageAccount {
id: Pubkey::default(),
account: &mut Account {
lamports: 0,
data: vec![],
owner: id(),
executable: false,
..Account::default()
},
};
let segment_index = 0;
Expand Down
Loading

0 comments on commit 0ffe7a9

Please sign in to comment.