@@ -95,7 +95,7 @@ func (s *AccountStorageMap) DomainExists(domain common.StorageDomain) bool {
95
95
// is created and inserted into account storage map with given domain as key.
96
96
func (s * AccountStorageMap ) GetDomain (
97
97
gauge common.MemoryGauge ,
98
- interpreter * Interpreter ,
98
+ storageMutationTracker StorageMutationTracker ,
99
99
domain common.StorageDomain ,
100
100
createIfNotExists bool ,
101
101
) * DomainStorageMap {
@@ -112,7 +112,7 @@ func (s *AccountStorageMap) GetDomain(
112
112
// Create domain storage map if needed.
113
113
114
114
if createIfNotExists {
115
- return s .NewDomain (gauge , interpreter , domain )
115
+ return s .NewDomain (gauge , storageMutationTracker , domain )
116
116
}
117
117
118
118
return nil
@@ -128,10 +128,10 @@ func (s *AccountStorageMap) GetDomain(
128
128
// NewDomain creates new domain storage map and inserts it to AccountStorageMap with given domain as key.
129
129
func (s * AccountStorageMap ) NewDomain (
130
130
gauge common.MemoryGauge ,
131
- interpreter * Interpreter ,
131
+ storageMutationTracker StorageMutationTracker ,
132
132
domain common.StorageDomain ,
133
133
) * DomainStorageMap {
134
- interpreter . recordStorageMutation ()
134
+ storageMutationTracker . RecordStorageMutation ()
135
135
136
136
domainStorageMap := NewDomainStorageMap (gauge , s .orderedMap .Storage , s .orderedMap .Address ())
137
137
@@ -162,24 +162,24 @@ func (s *AccountStorageMap) NewDomain(
162
162
// If the given storage map is non-nil, domain is added/updated.
163
163
// Returns true if domain storage map previously existed at the given domain.
164
164
func (s * AccountStorageMap ) WriteDomain (
165
- interpreter * Interpreter ,
165
+ context ValueTransferContext ,
166
166
domain common.StorageDomain ,
167
167
domainStorageMap * DomainStorageMap ,
168
168
) (existed bool ) {
169
169
if domainStorageMap == nil {
170
- return s .removeDomain (interpreter , domain )
170
+ return s .removeDomain (context , domain )
171
171
}
172
- return s .setDomain (interpreter , domain , domainStorageMap )
172
+ return s .setDomain (context , domain , domainStorageMap )
173
173
}
174
174
175
175
// setDomain sets domain storage map in the account storage map and returns true if domain previously existed.
176
176
// If the given domain already stores a domain storage map, it is overwritten.
177
177
func (s * AccountStorageMap ) setDomain (
178
- interpreter * Interpreter ,
178
+ context ValueTransferContext ,
179
179
domain common.StorageDomain ,
180
180
newDomainStorageMap * DomainStorageMap ,
181
181
) (existed bool ) {
182
- interpreter . recordStorageMutation ()
182
+ context . RecordStorageMutation ()
183
183
184
184
key := Uint64StorageMapKey (domain )
185
185
@@ -199,13 +199,13 @@ func (s *AccountStorageMap) setDomain(
199
199
existingDomainStorageMap := newDomainStorageMapWithAtreeStorable (s .orderedMap .Storage , existingValueStorable )
200
200
201
201
// Deep remove elements in domain storage map
202
- existingDomainStorageMap .DeepRemove (interpreter , true )
202
+ existingDomainStorageMap .DeepRemove (context , true )
203
203
204
204
// Remove domain storage map slab
205
- interpreter . RemoveReferencedSlab (existingValueStorable )
205
+ RemoveReferencedSlab (context , existingValueStorable )
206
206
}
207
207
208
- interpreter .MaybeValidateAtreeValue (s .orderedMap )
208
+ context .MaybeValidateAtreeValue (s .orderedMap )
209
209
210
210
// NOTE: Don't call maybeValidateAtreeStorage() here because it is possible
211
211
// that domain storage map is in the process of being migrated to account
@@ -215,8 +215,8 @@ func (s *AccountStorageMap) setDomain(
215
215
}
216
216
217
217
// removeDomain removes domain storage map with given domain in account storage map, if it exists.
218
- func (s * AccountStorageMap ) removeDomain (interpreter * Interpreter , domain common.StorageDomain ) (existed bool ) {
219
- interpreter . recordStorageMutation ()
218
+ func (s * AccountStorageMap ) removeDomain (context ValueTransferContext , domain common.StorageDomain ) (existed bool ) {
219
+ context . RecordStorageMutation ()
220
220
221
221
key := Uint64StorageMapKey (domain )
222
222
@@ -238,7 +238,7 @@ func (s *AccountStorageMap) removeDomain(interpreter *Interpreter, domain common
238
238
239
239
// NOTE: Key is just an atree.Value (Uint64AtreeValue), not an interpreter.Value,
240
240
// so do not need (can) convert and not need to deep remove
241
- interpreter . RemoveReferencedSlab (existingKeyStorable )
241
+ RemoveReferencedSlab (context , existingKeyStorable )
242
242
243
243
// Value
244
244
@@ -248,14 +248,14 @@ func (s *AccountStorageMap) removeDomain(interpreter *Interpreter, domain common
248
248
domainStorageMap := newDomainStorageMapWithAtreeStorable (s .orderedMap .Storage , existingValueStorable )
249
249
250
250
// Deep remove elements in domain storage map
251
- domainStorageMap .DeepRemove (interpreter , true )
251
+ domainStorageMap .DeepRemove (context , true )
252
252
253
253
// Remove domain storage map slab
254
- interpreter . RemoveReferencedSlab (existingValueStorable )
254
+ RemoveReferencedSlab (context , existingValueStorable )
255
255
}
256
256
257
- interpreter .MaybeValidateAtreeValue (s .orderedMap )
258
- interpreter .MaybeValidateAtreeStorage ()
257
+ context .MaybeValidateAtreeValue (s .orderedMap )
258
+ context .MaybeValidateAtreeStorage ()
259
259
260
260
return
261
261
}
0 commit comments