Add tests for metering, add option to compiler config

This commit is contained in:
Brandon Fish
2019-06-02 11:37:02 -05:00
parent 995ecefa92
commit e533a8a7b5
5 changed files with 179 additions and 0 deletions

View File

@@ -59,6 +59,8 @@ pub struct CompilerConfig {
pub symbol_map: Option<HashMap<u32, String>>,
pub memory_bound_check_mode: MemoryBoundCheckMode,
pub enforce_stack_check: bool,
/// Enables metering functionality if set and used as default points limit during compilation
pub points_limit: Option<u64>,
}
pub trait Compiler {

View File

@@ -350,6 +350,16 @@ impl Ctx {
pub fn dynamic_sigindice_count(&self) -> usize {
unsafe { (*self.local_backing).dynamic_sigindices.len() }
}
/// Returns the number of points used by a function call for metering
pub fn get_points_used(&self) -> u64 {
unimplemented!()
}
/// Sets the value of points used
pub fn set_points_used(&mut self, _value: u64) {
unimplemented!()
}
}
#[doc(hidden)]