The constraints on compute power a program can consume is limited only to its instruction count (#11717)
This commit is contained in:
@ -196,6 +196,16 @@ pub trait InvokeContext {
|
||||
fn get_logger(&self) -> Rc<RefCell<dyn Logger>>;
|
||||
/// Are cross program invocations supported
|
||||
fn is_cross_program_supported(&self) -> bool;
|
||||
/// Get this invocation's compute meter
|
||||
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>>;
|
||||
}
|
||||
|
||||
/// Compute meter
|
||||
pub trait ComputeMeter {
|
||||
/// Consume compute units
|
||||
fn consume(&mut self, amount: u64) -> Result<(), InstructionError>;
|
||||
/// Get the number of remaining compute units
|
||||
fn get_remaining(&self) -> u64;
|
||||
}
|
||||
|
||||
/// Log messages
|
||||
|
@ -160,9 +160,13 @@ pub enum InstructionError {
|
||||
#[error("Provided seeds do not result in a valid address")]
|
||||
InvalidSeeds,
|
||||
|
||||
// Failed to reallocate account data of this length
|
||||
/// Failed to reallocate account data of this length
|
||||
#[error("Failed to reallocate account data")]
|
||||
InvalidRealloc,
|
||||
|
||||
/// Computational budget exceeded
|
||||
#[error("Computational budget exceeded")]
|
||||
ComputationalBudgetExceeded,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
|
Reference in New Issue
Block a user