Align host addresses (#11384)

* Align host addresses

* support new program abi

* update epoch rollout

* Enforce aligned pointers in cross-program invocations
This commit is contained in:
Jack May
2020-08-11 16:11:52 -07:00
committed by GitHub
parent 697a0e2947
commit 9290e561e1
16 changed files with 655 additions and 163 deletions

View File

@@ -36,9 +36,8 @@ pub fn get_inflation(operating_mode: OperatingMode, epoch: Epoch) -> Option<Infl
OperatingMode::Stable => match epoch {
// No inflation at epoch 0
0 => Some(Inflation::new_disabled()),
// Inflation starts
// The epoch of Epoch::MAX is a placeholder and is expected to be reduced in
// a future hard fork.
// Inflation starts The epoch of Epoch::MAX is a placeholder and is
// expected to be reduced in a future hard fork.
Epoch::MAX => Some(Inflation::default()),
_ => None,
},
@@ -49,38 +48,36 @@ pub fn get_programs(operating_mode: OperatingMode, epoch: Epoch) -> Option<Vec<(
match operating_mode {
OperatingMode::Development => {
if epoch == 0 {
// Programs used for testing
Some(vec![
// Enable all Stable programs
solana_bpf_loader_program!(),
solana_bpf_loader_deprecated_program!(),
solana_vest_program!(),
// Programs that are only available in Development mode
solana_budget_program!(),
solana_exchange_program!(),
])
} else if epoch == std::u64::MAX {
// The epoch of std::u64::MAX is a placeholder and is expected
// to be reduced in a future network update.
Some(vec![solana_bpf_loader_program!()])
} else {
None
}
}
OperatingMode::Stable => {
if epoch == std::u64::MAX - 1 {
// The epoch of std::u64::MAX - 1 is a placeholder and is expected to be reduced in
// a future hard fork.
Some(vec![solana_bpf_loader_program!()])
} else if epoch == std::u64::MAX {
// The epoch of std::u64::MAX is a placeholder and is expected to be reduced in a
// future hard fork.
Some(vec![solana_vest_program!()])
if epoch == std::u64::MAX {
// The epoch of std::u64::MAX is a placeholder and is expected
// to be reduced in a future network update.
Some(vec![solana_bpf_loader_program!(), solana_vest_program!()])
} else {
None
}
}
OperatingMode::Preview => {
if epoch == 0 {
Some(vec![solana_bpf_loader_program!()])
} else if epoch == std::u64::MAX {
// The epoch of std::u64::MAX is a placeholder and is expected to be reduced in a
// future hard fork.
Some(vec![solana_vest_program!()])
if epoch == std::u64::MAX {
// The epoch of std::u64::MAX is a placeholder and is expected
// to be reduced in a future network update.
Some(vec![solana_bpf_loader_program!(), solana_vest_program!()])
} else {
None
}
@@ -138,7 +135,7 @@ mod tests {
fn test_development_programs() {
assert_eq!(
get_programs(OperatingMode::Development, 0).unwrap().len(),
4
5
);
assert_eq!(get_programs(OperatingMode::Development, 1), None);
}
@@ -159,7 +156,6 @@ mod tests {
#[test]
fn test_softlaunch_programs() {
assert_eq!(get_programs(OperatingMode::Stable, 1), None);
assert!(get_programs(OperatingMode::Stable, std::u64::MAX - 1).is_some());
assert!(get_programs(OperatingMode::Stable, std::u64::MAX).is_some());
}
}