@@ -568,19 +568,6 @@ impl<Cost: CostType, const CANCUN: bool> Interpreter<Cost, CANCUN> {
568568 Instruction :: from_u8_versioned ( opcode, context. spec ( ) ) ;
569569 self . reader . position += 1 ;
570570
571- // TODO: make compile-time removable if too much of a
572- // performance hit.
573- // self.do_trace = self.do_trace
574- // && context.trace_next_instruction(
575- // self.reader.position - 1,
576- // opcode,
577- // self.gasometer
578- // .as_mut()
579- // .expect(GASOMETER_PROOF)
580- // .current_gas
581- // .as_u256(),
582- // );
583-
584571 let instruction = match instruction {
585572 Some ( i) => i,
586573 None => {
@@ -592,8 +579,10 @@ impl<Cost: CostType, const CANCUN: bool> Interpreter<Cost, CANCUN> {
592579 }
593580 } ;
594581
595- let info =
596- instruction. info :: < CANCUN > ( context. spec ( ) . cip645 . opcode_update ) ;
582+ let info = instruction. info :: < CANCUN > (
583+ context. spec ( ) . cip645 . opcode_update ,
584+ context. spec ( ) . eip7939 ,
585+ ) ;
597586 self . last_stack_ret_len = info. ret ;
598587 if let Err ( e) = self . verify_instruction ( context, instruction, info) {
599588 return Err ( InterpreterResult :: Done ( Err ( e) ) ) ;
@@ -612,15 +601,6 @@ impl<Cost: CostType, const CANCUN: bool> Interpreter<Cost, CANCUN> {
612601 Ok ( t) => t,
613602 Err ( e) => return Err ( InterpreterResult :: Done ( Err ( e) ) ) ,
614603 } ;
615- // if self.do_trace {
616- // context.trace_prepare_execute(
617- // self.reader.position - 1,
618- // opcode,
619- // requirements.gas_cost.as_u256(),
620- // Self::mem_written(instruction, &self.stack),
621- // Self::store_written(instruction, &self.stack),
622- // );
623- // }
624604
625605 if let Err ( e) = gasometer. verify_gas ( & requirements. gas_cost ) {
626606 return Err ( InterpreterResult :: Done ( Err ( e) ) ) ;
@@ -1324,19 +1304,6 @@ impl<Cost: CostType, const CANCUN: bool> Interpreter<Cost, CANCUN> {
13241304 let b = self . stack . pop_back ( ) ;
13251305 self . stack . push (
13261306 if !b. is_zero ( ) {
1327- // match b {
1328- // ONE => a,
1329- // TWO => a >> 1,
1330- // TWO_POW_5 => a >> 5,
1331- // TWO_POW_8 => a >> 8,
1332- // TWO_POW_16 => a >> 16,
1333- // TWO_POW_24 => a >> 24,
1334- // TWO_POW_64 => a >> 64,
1335- // TWO_POW_96 => a >> 96,
1336- // TWO_POW_224 => a >> 224,
1337- // TWO_POW_248 => a >> 248,
1338- // _ => a / b,
1339- // }
13401307 if b == ONE {
13411308 a
13421309 } else if b == TWO {
@@ -1582,6 +1549,10 @@ impl<Cost: CostType, const CANCUN: bool> Interpreter<Cost, CANCUN> {
15821549 } ;
15831550 self . stack . push ( result) ;
15841551 }
1552+ instructions:: CLZ => {
1553+ let value = self . stack . pop_back ( ) ;
1554+ self . stack . push ( U256 :: from ( value. leading_zeros ( ) ) )
1555+ }
15851556 } ;
15861557 Ok ( InstructionResult :: Ok )
15871558 }
0 commit comments