File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -98,18 +98,11 @@ pub struct Batcher {
9898 aggregator_fee_percentage_multiplier : u128 ,
9999 aggregator_gas_cost : u128 ,
100100
101- // Shared state access:
102- // Two kinds of threads interact with the shared state:
103- // 1. User message processing threads (run in parallel)
104- // 2. Batch creation thread (runs sequentially, includes failure recovery)
105- //
106- // Locking rules:
107- // - To avoid deadlocks, always acquire `user_states` before `batch_state`.
108- // - During failure recovery, restoring a valid state may require breaking this rule:
109- // additional user locks might be acquired *after* the batch lock.
110- // (See the `restore` algorithm in the `batch_queue` module.)
111- //
112- // Because of this exception, user message handling uses lock acquisition with timeouts.
101+ // Shared state (Mutex)
102+ /// The general business rule is:
103+ /// - User processing can be done in parallel unless a batch creation is happening
104+ /// - Batch creation needs to be able to change all the states, so all processing
105+ /// needs to be stopped, and all user_states locks need to be taken
113106 batch_state : Mutex < BatchState > ,
114107
115108 user_states : Arc < RwLock < HashMap < Address , Arc < Mutex < UserState > > > > > ,
You can’t perform that action at this time.
0 commit comments