Switch programs activation to whole-set based gating (#11750)
* Implement Debug for MessageProcessor * Switch from delta-based gating to whole-set gating * Remove dbg! * Fix clippy * Clippy * Add test * add loader to stable operating mode at proper epoch * refresh_programs_and_inflation after ancestor setup * Callback via snapshot; avoid account re-add; Debug * Fix test * Fix test and fix the past history * Make callback management stricter and cleaner * Fix test * Test overwrite and frozen for native programs * Test epoch callback with genesis-programs * Add assertions for parent bank * Add tests and some minor cleaning * Remove unsteady assertion... * Fix test... * Fix DOS * Skip ensuring account by dual (whole/delta) gating * Fix frozen abi implementation... * Move compute budget constatnt init back into bank Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
@ -305,6 +305,13 @@ impl<T> AbiExample for Box<dyn Fn(&mut T) + Sync + Send> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, U> AbiExample for Box<dyn Fn(&mut T, U) + Sync + Send> {
|
||||
fn example() -> Self {
|
||||
info!("AbiExample for (Box<T, U>): {}", type_name::<Self>());
|
||||
Box::new(move |_t: &mut T, _u: U| {})
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AbiExample> AbiExample for Box<[T]> {
|
||||
fn example() -> Self {
|
||||
info!("AbiExample for (Box<[T]>): {}", type_name::<Self>());
|
||||
|
@ -57,6 +57,8 @@ pub type Slot = u64;
|
||||
/// some number of Slots.
|
||||
pub type Epoch = u64;
|
||||
|
||||
pub const GENESIS_EPOCH: Epoch = 0;
|
||||
|
||||
/// SlotIndex is an index to the slots of a epoch
|
||||
pub type SlotIndex = u64;
|
||||
|
||||
|
@ -175,6 +175,20 @@ pub type ProcessInstruction = fn(&Pubkey, &[KeyedAccount], &[u8]) -> Result<(),
|
||||
pub type ProcessInstructionWithContext =
|
||||
fn(&Pubkey, &[KeyedAccount], &[u8], &mut dyn InvokeContext) -> Result<(), InstructionError>;
|
||||
|
||||
// These are just type aliases for work around of Debug-ing above function pointers
|
||||
pub type ErasedProcessInstructionWithContext = fn(
|
||||
&'static Pubkey,
|
||||
&'static [KeyedAccount<'static>],
|
||||
&'static [u8],
|
||||
&'static mut dyn InvokeContext,
|
||||
) -> Result<(), InstructionError>;
|
||||
|
||||
pub type ErasedProcessInstruction = fn(
|
||||
&'static Pubkey,
|
||||
&'static [KeyedAccount<'static>],
|
||||
&'static [u8],
|
||||
) -> Result<(), InstructionError>;
|
||||
|
||||
/// Invocation context passed to loaders
|
||||
pub trait InvokeContext {
|
||||
/// Push a program ID on to the invocation stack
|
||||
|
Reference in New Issue
Block a user