diff --git a/linera-execution/src/runtime.rs b/linera-execution/src/runtime.rs index 94133dd6810..12ad01d0e2e 100644 --- a/linera-execution/src/runtime.rs +++ b/linera-execution/src/runtime.rs @@ -38,28 +38,28 @@ pub(crate) struct ExecutionRuntime<'a, C, const WRITABLE: bool> { /// The current chain ID. chain_id: ChainId, /// The current stack of application descriptions. - applications: Arc>>, + applications: Mutex<&'a mut Vec>, /// The storage view on the execution state. - execution_state: Arc>>, + execution_state: Mutex<&'a mut ExecutionStateView>, /// All the sessions and their IDs. - session_manager: Arc>, + session_manager: Mutex<&'a mut SessionManager>, /// Track active (i.e. locked) applications for which re-entrancy is disallowed. - active_simple_user_states: Arc>>, + active_simple_user_states: Mutex>, /// Track active (i.e. locked) applications for which re-entrancy is disallowed. - active_view_user_states: Arc>>, + active_view_user_states: Mutex>, /// Track active (i.e. locked) sessions for which re-entrancy is disallowed. - active_sessions: Arc>, + active_sessions: Mutex, /// Accumulate the externally visible results (e.g. cross-chain messages) of applications. - execution_results: Arc>>, + execution_results: Mutex<&'a mut Vec>, /// The amount of fuel available for executing the application. - remaining_fuel: Arc, + remaining_fuel: AtomicU64, /// The number of reads - num_reads: Arc, + num_reads: AtomicU64, /// the total size being read - bytes_read: Arc, + bytes_read: AtomicU64, /// The total size being written - bytes_written: Arc, + bytes_written: AtomicU64, /// The runtime limits runtime_limits: RuntimeLimits, } @@ -115,17 +115,17 @@ where ) -> Self { assert_eq!(chain_id, execution_state.context().extra().chain_id()); Self { - applications: Arc::new(Mutex::new(applications)), - execution_state: Arc::new(Mutex::new(execution_state)), - session_manager: Arc::new(Mutex::new(session_manager)), - active_simple_user_states: Arc::default(), - active_view_user_states: Arc::default(), - active_sessions: Arc::default(), - execution_results: Arc::new(Mutex::new(execution_results)), - remaining_fuel: Arc::new(AtomicU64::new(fuel)), - num_reads: Arc::new(AtomicU64::new(0)), - bytes_read: Arc::new(AtomicU64::new(0)), - bytes_written: Arc::new(AtomicU64::new(0)), + applications: Mutex::new(applications), + execution_state: Mutex::new(execution_state), + session_manager: Mutex::new(session_manager), + active_simple_user_states: Mutex::default(), + active_view_user_states: Mutex::default(), + active_sessions: Mutex::default(), + execution_results: Mutex::new(execution_results), + remaining_fuel: AtomicU64::new(fuel), + num_reads: AtomicU64::new(0), + bytes_read: AtomicU64::new(0), + bytes_written: AtomicU64::new(0), runtime_limits, chain_id, }