Make the rules passed to gas metering injection generic

This commit is contained in:
Alexander Theißen
2020-10-14 12:20:41 +02:00
parent 3568667ecb
commit 880d273861
4 changed files with 76 additions and 22 deletions
+2 -1
View File
@@ -10,6 +10,7 @@
use super::MeteredBlock;
use rules::Set as RuleSet;
use rules::Rules;
use parity_wasm::elements::{FuncBody, Instruction};
use std::collections::HashMap;
@@ -167,7 +168,7 @@ fn build_control_flow_graph(
graph.increment_charged_cost(active_node_id, next_metered_block.cost);
}
let instruction_cost = rules.process(instruction)?;
let instruction_cost = rules.instruction_cost(instruction).ok_or(())?;
match instruction {
Instruction::Block(_) => {
graph.increment_actual_cost(active_node_id, instruction_cost);