sui_execution/
verifier.rsuse move_binary_format::CompiledModule;
use move_bytecode_verifier_meter::Meter;
use move_vm_config::verifier::MeterConfig;
use sui_protocol_config::ProtocolConfig;
use sui_types::error::SuiResult;
use sui_types::execution_config_utils::to_binary_config;
pub trait Verifier {
fn meter(&self, config: MeterConfig) -> Box<dyn Meter>;
fn meter_compiled_modules(
&mut self,
protocol_config: &ProtocolConfig,
modules: &[CompiledModule],
meter: &mut dyn Meter,
) -> SuiResult<()>;
fn meter_module_bytes(
&mut self,
protocol_config: &ProtocolConfig,
module_bytes: &[Vec<u8>],
meter: &mut dyn Meter,
) -> SuiResult<()> {
let binary_config = to_binary_config(protocol_config);
let Ok(modules) = module_bytes
.iter()
.map(|b| CompiledModule::deserialize_with_config(b, &binary_config))
.collect::<Result<Vec<_>, _>>()
else {
return Ok(());
};
self.meter_compiled_modules(protocol_config, &modules, meter)
}
}