add epoch_schedule sysvar (#6256)

* add epoch_schedule sysvar

* book sheesh!
This commit is contained in:
Rob Walker
2019-10-08 22:34:26 -07:00
committed by GitHub
parent f2ee01ace3
commit 7cf90766a3
46 changed files with 572 additions and 427 deletions

View File

@ -28,7 +28,7 @@ perform_action() {
set -e
case "$1" in
build)
"$sdkDir"/bpf/rust/build.sh "$2"
bash -x "$sdkDir"/bpf/rust/build.sh "$2"
so_path="$targetDir/$profile/"
so_name="solana_bpf_rust_${3%/}"

View File

@ -17,7 +17,7 @@ use solana_sdk::{
entrypoint!(process_instruction);
fn process_instruction(_program_id: &Pubkey, accounts: &mut [AccountInfo], _data: &[u8]) -> u32 {
// Clock
let clock = Clock::from_account_info(&accounts[2]).unwrap();
let clock = Clock::from_account_info(&accounts[2]).expect("clock");
assert_eq!(clock.slot, DEFAULT_SLOTS_PER_EPOCH + 1);
assert_eq!(
clock.segment,
@ -25,20 +25,20 @@ fn process_instruction(_program_id: &Pubkey, accounts: &mut [AccountInfo], _data
);
// Fees
let fees = Fees::from_account_info(&accounts[3]).unwrap();
let fees = Fees::from_account_info(&accounts[3]).expect("fees");
let burn = fees.fee_calculator.burn(42);
assert_eq!(burn, (21, 21));
// Rewards
let _ = Rewards::from_account_info(&accounts[4]).unwrap();
let _rewards = Rewards::from_account_info(&accounts[4]).expect("rewards");
// Slot Hashes
let slot_hashes = SlotHashes::from_account_info(&accounts[5]).unwrap();
assert_eq!(slot_hashes.len(), 1);
let slot_hashes = SlotHashes::from_account_info(&accounts[5]).expect("slot_hashes");
assert!(slot_hashes.len() >= 1);
// Stake History
let stake_history = StakeHistory::from_account_info(&accounts[6]).unwrap();
assert_eq!(stake_history.len(), 1);
let stake_history = StakeHistory::from_account_info(&accounts[6]).expect("stake_history");
assert!(stake_history.len() >= 1);
let rent = Rent::from_account_info(&accounts[7]).unwrap();
assert_eq!(