@@ -113,20 +113,6 @@ impl InMemoryTemporaryAccount {
113
113
}
114
114
115
115
impl TemporaryStorage for InMemoryTemporaryStorage {
116
- // -------------------------------------------------------------------------
117
- // Accounts and Slots
118
- // -------------------------------------------------------------------------
119
-
120
- fn read_account ( & self , address : & Address ) -> anyhow:: Result < Option < Account > > {
121
- let states = self . lock_read ( ) ;
122
- Ok ( read_account ( & states, address) )
123
- }
124
-
125
- fn read_slot ( & self , address : & Address , index : & SlotIndex ) -> anyhow:: Result < Option < Slot > > {
126
- let states = self . lock_read ( ) ;
127
- Ok ( read_slot ( & states, address, index) )
128
- }
129
-
130
116
// -------------------------------------------------------------------------
131
117
// Block number
132
118
// -------------------------------------------------------------------------
@@ -151,7 +137,7 @@ impl TemporaryStorage for InMemoryTemporaryStorage {
151
137
}
152
138
153
139
// -------------------------------------------------------------------------
154
- // External block
140
+ // Block and executions
155
141
// -------------------------------------------------------------------------
156
142
157
143
fn set_active_external_block ( & self , block : ExternalBlock ) -> anyhow:: Result < ( ) > {
@@ -160,10 +146,6 @@ impl TemporaryStorage for InMemoryTemporaryStorage {
160
146
Ok ( ( ) )
161
147
}
162
148
163
- // -------------------------------------------------------------------------
164
- // Executions
165
- // -------------------------------------------------------------------------
166
-
167
149
fn save_execution ( & self , tx : TransactionExecution ) -> anyhow:: Result < ( ) > {
168
150
// check conflicts
169
151
let mut states = self . lock_write ( ) ;
@@ -207,15 +189,6 @@ impl TemporaryStorage for InMemoryTemporaryStorage {
207
189
Ok ( ( ) )
208
190
}
209
191
210
- // -------------------------------------------------------------------------
211
- // General state
212
- // -------------------------------------------------------------------------
213
-
214
- fn check_conflicts ( & self , execution : & EvmExecution ) -> anyhow:: Result < Option < ExecutionConflicts > > {
215
- let states = self . lock_read ( ) ;
216
- Ok ( check_conflicts ( & states, execution) )
217
- }
218
-
219
192
/// TODO: we cannot allow more than one pending block. Where to put this check?
220
193
fn finish_block ( & self ) -> anyhow:: Result < PendingBlock > {
221
194
let mut states = self . lock_write ( ) ;
@@ -233,6 +206,28 @@ impl TemporaryStorage for InMemoryTemporaryStorage {
233
206
Ok ( finished_block)
234
207
}
235
208
209
+ // -------------------------------------------------------------------------
210
+ // Accounts and Slots
211
+ // -------------------------------------------------------------------------
212
+
213
+ fn check_conflicts ( & self , execution : & EvmExecution ) -> anyhow:: Result < Option < ExecutionConflicts > > {
214
+ let states = self . lock_read ( ) ;
215
+ Ok ( check_conflicts ( & states, execution) )
216
+ }
217
+
218
+ fn read_account ( & self , address : & Address ) -> anyhow:: Result < Option < Account > > {
219
+ let states = self . lock_read ( ) ;
220
+ Ok ( read_account ( & states, address) )
221
+ }
222
+
223
+ fn read_slot ( & self , address : & Address , index : & SlotIndex ) -> anyhow:: Result < Option < Slot > > {
224
+ let states = self . lock_read ( ) ;
225
+ Ok ( read_slot ( & states, address, index) )
226
+ }
227
+
228
+ // -------------------------------------------------------------------------
229
+ // Global state
230
+ // -------------------------------------------------------------------------
236
231
fn reset ( & self ) -> anyhow:: Result < ( ) > {
237
232
let mut state = self . lock_write ( ) ;
238
233
state. tail . clear ( ) ;
0 commit comments