File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -786,8 +786,6 @@ pub fn get_tx_weights<S: StateReader>(
786786 add_maps ( & mut builtin_counters_without_casm_hash_computation, tx_builtin_counters) ;
787787 // The transaction builtin counters does not include the transaction overhead ('additional')
788788 // resources.
789- // TODO(AvivG): Builtins from `fee_transfer_call_info` are counted twice - in `os_vm_resources`
790- // and again in `tx_builtin_counters`. Remove the duplication.
791789 add_maps (
792790 & mut builtin_counters_without_casm_hash_computation,
793791 & tx_resources. computation . os_vm_resources . prover_builtins ( ) ,
Original file line number Diff line number Diff line change @@ -209,6 +209,12 @@ impl TransactionExecutionInfo {
209209 . chain ( self . fee_transfer_call_info . iter ( ) )
210210 }
211211
212+ /// Returns call infos excluding fee transfer (to avoid double-counting in bouncer
213+ /// calculations).
214+ pub fn non_optional_call_infos_without_fee_transfer ( & self ) -> impl Iterator < Item = & CallInfo > {
215+ self . validate_call_info . iter ( ) . chain ( self . execute_call_info . iter ( ) )
216+ }
217+
212218 pub fn is_reverted ( & self ) -> bool {
213219 self . revert_error . is_some ( )
214220 }
@@ -220,10 +226,15 @@ impl TransactionExecutionInfo {
220226 }
221227
222228 pub fn summarize_builtins ( & self ) -> BuiltinCounterMap {
223- self . non_optional_call_infos ( ) . fold ( BuiltinCounterMap :: new ( ) , |mut acc, call_info| {
224- add_maps ( & mut acc, & call_info. builtin_counters ) ;
225- acc
226- } )
229+ // Remove fee transfer builtins to avoid double-counting in `get_tx_weights`
230+ // in bouncer.rs (already included in os_vm_resources).
231+ self . non_optional_call_infos_without_fee_transfer ( ) . fold (
232+ BuiltinCounterMap :: new ( ) ,
233+ |mut acc, call_info| {
234+ add_maps ( & mut acc, & call_info. builtin_counters ) ;
235+ acc
236+ } ,
237+ )
227238 }
228239}
229240pub trait ExecutionResourcesTraits {
You can’t perform that action at this time.
0 commit comments