@@ -37,6 +37,7 @@ pub struct GasProfiler<G> {
3737
3838 intrinsic_cost : Option < InternalGas > ,
3939 keyless_cost : Option < InternalGas > ,
40+ slh_dsa_sha2_128s_cost : Option < InternalGas > ,
4041 dependencies : Vec < Dependency > ,
4142 frames : Vec < CallFrame > ,
4243 transaction_transient : Option < InternalGas > ,
@@ -94,6 +95,7 @@ impl<G> GasProfiler<G> {
9495
9596 intrinsic_cost : None ,
9697 keyless_cost : None ,
98+ slh_dsa_sha2_128s_cost : None ,
9799 dependencies : vec ! [ ] ,
98100 frames : vec ! [ CallFrame :: new_script( ) ] ,
99101 transaction_transient : None ,
@@ -114,6 +116,7 @@ impl<G> GasProfiler<G> {
114116
115117 intrinsic_cost : None ,
116118 keyless_cost : None ,
119+ slh_dsa_sha2_128s_cost : None ,
117120 dependencies : vec ! [ ] ,
118121 frames : vec ! [ CallFrame :: new_function( module_id, func_name, ty_args) ] ,
119122 transaction_transient : None ,
@@ -702,9 +705,24 @@ where
702705 }
703706
704707 fn charge_keyless ( & mut self ) -> VMResult < ( ) > {
705- let ( _cost , res) = self . delegate_charge ( |base| base. charge_keyless ( ) ) ;
708+ let ( cost , res) = self . delegate_charge ( |base| base. charge_keyless ( ) ) ;
706709
707- // TODO: add keyless
710+ // TODO: Is this right? (Do not understand the semantics here.)
711+ if res. is_ok ( ) {
712+ self . keyless_cost = Some ( self . keyless_cost . unwrap_or_else ( || 0 . into ( ) ) + cost) ;
713+ }
714+
715+ res
716+ }
717+
718+ fn charge_slh_dsa_sha2_128s ( & mut self ) -> VMResult < ( ) > {
719+ let ( cost, res) = self . delegate_charge ( |base| base. charge_slh_dsa_sha2_128s ( ) ) ;
720+
721+ // TODO: Is this right? (Do not understand the semantics here.)
722+ if res. is_ok ( ) {
723+ self . slh_dsa_sha2_128s_cost =
724+ Some ( self . slh_dsa_sha2_128s_cost . unwrap_or_else ( || 0 . into ( ) ) + cost) ;
725+ }
708726
709727 res
710728 }
@@ -726,6 +744,7 @@ where
726744 total : self . algebra ( ) . execution_gas_used ( ) + self . algebra ( ) . io_gas_used ( ) ,
727745 intrinsic_cost : self . intrinsic_cost . unwrap_or_else ( || 0 . into ( ) ) ,
728746 keyless_cost : self . keyless_cost . unwrap_or_else ( || 0 . into ( ) ) ,
747+ slh_dsa_sha2_128s_cost : self . slh_dsa_sha2_128s_cost . unwrap_or_else ( || 0 . into ( ) ) ,
729748 dependencies : self . dependencies ,
730749 call_graph : self . frames . pop ( ) . expect ( "frame must exist" ) ,
731750 transaction_transient : self . transaction_transient ,
0 commit comments