@@ -256,7 +256,7 @@ func (s *StateDB) Error() error {
256
256
}
257
257
258
258
func (s * StateDB ) AddLog (log * types.Log ) {
259
- s .journal .append ( addLogChange { txhash : s .thash } )
259
+ s .journal .JournalLog ( s .thash )
260
260
261
261
log .TxHash = s .thash
262
262
log .TxIndex = uint (s .txIndex )
@@ -290,7 +290,7 @@ func (s *StateDB) Logs() []*types.Log {
290
290
// AddPreimage records a SHA3 preimage seen by the VM.
291
291
func (s * StateDB ) AddPreimage (hash common.Hash , preimage []byte ) {
292
292
if _ , ok := s .preimages [hash ]; ! ok {
293
- s .journal .append ( addPreimageChange { hash : hash } )
293
+ s .journal .JournalAddPreimage ( hash )
294
294
s .preimages [hash ] = slices .Clone (preimage )
295
295
}
296
296
}
@@ -302,14 +302,14 @@ func (s *StateDB) Preimages() map[common.Hash][]byte {
302
302
303
303
// AddRefund adds gas to the refund counter
304
304
func (s * StateDB ) AddRefund (gas uint64 ) {
305
- s .journal .append ( refundChange { prev : s .refund } )
305
+ s .journal .JournalRefundChange ( s .refund )
306
306
s .refund += gas
307
307
}
308
308
309
309
// SubRefund removes gas from the refund counter.
310
310
// This method will panic if the refund counter goes below zero
311
311
func (s * StateDB ) SubRefund (gas uint64 ) {
312
- s .journal .append ( refundChange { prev : s .refund } )
312
+ s .journal .JournalRefundChange ( s .refund )
313
313
if gas > s .refund {
314
314
panic (fmt .Sprintf ("Refund counter below zero (gas: %d > refund: %d)" , gas , s .refund ))
315
315
}
@@ -510,14 +510,12 @@ func (s *StateDB) SelfDestruct(addr common.Address) {
510
510
prev = new (uint256.Int ).Set (stateObject .Balance ())
511
511
n = new (uint256.Int )
512
512
)
513
- s .journal .append (selfDestructChange {
514
- account : & addr ,
515
- prev : stateObject .selfDestructed ,
516
- prevbalance : prev ,
517
- })
513
+ s .journal .JournalDestruct (addr , stateObject .selfDestructed , prev )
514
+
518
515
if s .logger != nil && s .logger .OnBalanceChange != nil && prev .Sign () > 0 {
519
516
s .logger .OnBalanceChange (addr , prev .ToBig (), n .ToBig (), tracing .BalanceDecreaseSelfdestruct )
520
517
}
518
+
521
519
stateObject .markSelfdestructed ()
522
520
stateObject .data .Balance = n
523
521
}
@@ -540,11 +538,7 @@ func (s *StateDB) SetTransientState(addr common.Address, key, value common.Hash)
540
538
if prev == value {
541
539
return
542
540
}
543
- s .journal .append (transientStorageChange {
544
- account : & addr ,
545
- key : key ,
546
- prevalue : prev ,
547
- })
541
+ s .journal .JournalSetTransientState (addr , key , prev )
548
542
s .setTransientState (addr , key , value )
549
543
}
550
544
@@ -663,7 +657,7 @@ func (s *StateDB) getOrNewStateObject(addr common.Address) *stateObject {
663
657
// existing account with the given address, otherwise it will be silently overwritten.
664
658
func (s * StateDB ) createObject (addr common.Address ) * stateObject {
665
659
obj := newObject (s , addr , nil )
666
- s .journal .append ( createObjectChange { account : & addr } )
660
+ s .journal .JournalCreate ( addr )
667
661
s .setStateObject (obj )
668
662
return obj
669
663
}
@@ -1419,7 +1413,7 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
1419
1413
// AddAddressToAccessList adds the given address to the access list
1420
1414
func (s * StateDB ) AddAddressToAccessList (addr common.Address ) {
1421
1415
if s .accessList .AddAddress (addr ) {
1422
- s .journal .append ( accessListAddAccountChange { & addr } )
1416
+ s .journal .JournalAccessListAddAccount ( addr )
1423
1417
}
1424
1418
}
1425
1419
@@ -1431,13 +1425,10 @@ func (s *StateDB) AddSlotToAccessList(addr common.Address, slot common.Hash) {
1431
1425
// scope of 'address' without having the 'address' become already added
1432
1426
// to the access list (via call-variant, create, etc).
1433
1427
// Better safe than sorry, though
1434
- s .journal .append ( accessListAddAccountChange { & addr } )
1428
+ s .journal .JournalAccessListAddAccount ( addr )
1435
1429
}
1436
1430
if slotMod {
1437
- s .journal .append (accessListAddSlotChange {
1438
- address : & addr ,
1439
- slot : & slot ,
1440
- })
1431
+ s .journal .JournalAccessListAddSlot (addr , slot )
1441
1432
}
1442
1433
}
1443
1434
0 commit comments