@@ -14,7 +14,6 @@ use fvm_shared::event::StampedEvent;
1414use fvm_shared:: sys:: BlockId ;
1515use fvm_shared:: { ActorID , METHOD_SEND } ;
1616use num_traits:: Zero ;
17- use std:: collections:: HashMap ;
1817
1918use super :: state_access_tracker:: { ActorAccessState , StateAccessTracker } ;
2019use super :: { Backtrace , CallManager , Entrypoint , InvocationResult , NO_DATA_BLOCK_ID } ;
@@ -76,8 +75,8 @@ pub struct InnerDefaultCallManager<M: Machine> {
7675 limits : M :: Limiter ,
7776 /// Accumulator for events emitted in this call stack.
7877 events : EventsAccumulator ,
79- /// A map of ActorID and how often they appear on the call stack .
80- actor_call_stack : HashMap < ActorID , i32 > ,
78+ /// The actor call stack ( ActorID and entrypoint name tuple) .
79+ actor_call_stack : Vec < ( ActorID , & ' static str ) > ,
8180}
8281
8382#[ doc( hidden) ]
@@ -162,7 +161,7 @@ where
162161 limits,
163162 events : Default :: default ( ) ,
164163 state_access_tracker,
165- actor_call_stack : HashMap :: new ( ) ,
164+ actor_call_stack : vec ! [ ] ,
166165 } ) ) )
167166 }
168167
@@ -331,12 +330,16 @@ where
331330 self . nonce
332331 }
333332
334- fn get_actor_call_stack ( & self ) -> & HashMap < ActorID , i32 > {
333+ fn get_actor_call_stack ( & self ) -> & Vec < ( ActorID , & ' static str ) > {
335334 & self . actor_call_stack
336335 }
337336
338- fn get_actor_call_stack_mut ( & mut self ) -> & mut HashMap < ActorID , i32 > {
339- & mut self . actor_call_stack
337+ fn actor_call_stack_push ( & mut self , actor_id : ActorID , entrypoint : & Entrypoint ) -> ( ) {
338+ self . actor_call_stack
339+ . push ( ( actor_id, entrypoint. func_name ( ) ) )
340+ }
341+ fn actor_call_stack_pop ( & mut self ) -> Option < ( ActorID , & ' static str ) > {
342+ self . actor_call_stack . pop ( )
340343 }
341344
342345 fn next_actor_address ( & self ) -> Address {
@@ -639,7 +642,11 @@ where
639642 } ,
640643 } ;
641644
642- self . send_resolved :: < K > ( from, to, entrypoint, params, value, read_only)
645+ self . actor_call_stack_push ( to, & entrypoint) ;
646+ let res = self . send_resolved :: < K > ( from, to, entrypoint, params, value, read_only) ;
647+ self . actor_call_stack_pop ( ) ;
648+
649+ res
643650 }
644651
645652 /// Send with resolved addresses.
0 commit comments