@@ -89,14 +89,13 @@ var (
8989)
9090
9191func setupProgramsTest (t * testing.T ) storage.SnapshotTree {
92- view := delta .NewDeltaView (nil )
92+ txnState := storage.SerialTransaction {
93+ NestedTransaction : state .NewTransactionState (
94+ delta .NewDeltaView (nil ),
95+ state .DefaultParameters ()),
96+ }
9397
94- accounts := environment .NewAccounts (
95- storage.SerialTransaction {
96- NestedTransaction : state .NewTransactionState (
97- view ,
98- state .DefaultParameters ()),
99- })
98+ accounts := environment .NewAccounts (txnState )
10099
101100 err := accounts .Create (nil , addressA )
102101 require .NoError (t , err )
@@ -107,7 +106,10 @@ func setupProgramsTest(t *testing.T) storage.SnapshotTree {
107106 err = accounts .Create (nil , addressC )
108107 require .NoError (t , err )
109108
110- return storage .NewSnapshotTree (nil ).Append (view .Finalize ())
109+ executionSnapshot , err := txnState .FinalizeMainTransaction ()
110+ require .NoError (t , err )
111+
112+ return storage .NewSnapshotTree (nil ).Append (executionSnapshot )
111113}
112114
113115func getTestContract (
@@ -261,7 +263,7 @@ func Test_Programs(t *testing.T) {
261263
262264 require .Contains (t , output .Logs , "\" hello from A\" " )
263265
264- // same transaction should produce the exact same views
266+ // same transaction should produce the exact same execution snapshots
265267 // but only because we don't do any conditional update in a tx
266268 compareExecutionSnapshots (t , executionSnapshotA , executionSnapshotA2 )
267269 })
@@ -338,7 +340,7 @@ func Test_Programs(t *testing.T) {
338340 // rerun transaction
339341
340342 // execute transaction again, this time make sure it doesn't load code
341- execB2Snapshot := delta . NewDeltaView ( state .NewReadFuncStorageSnapshot (
343+ execB2Snapshot := state .NewReadFuncStorageSnapshot (
342344 func (id flow.RegisterID ) (flow.RegisterValue , error ) {
343345 idA := flow .ContractRegisterID (
344346 flow .BytesToAddress ([]byte (id .Owner )),
@@ -351,7 +353,7 @@ func Test_Programs(t *testing.T) {
351353 require .NotEqual (t , id .Key , idB .Key )
352354
353355 return mainSnapshot .Get (id )
354- }))
356+ })
355357
356358 executionSnapshotB2 , output , err := vm .RunV2 (
357359 context ,
@@ -779,14 +781,6 @@ func updateContractTx(name, code string, address flow.Address) *flow.Transaction
779781 ).AddAuthorizer (address )
780782}
781783
782- // compareViews compares views using only data that matters (ie. two different hasher instances
783- // trips the library comparison, even if actual SPoCKs are the same)
784- func compareViews (t * testing.T , a , b * delta.View ) {
785- require .Equal (t , a .Delta (), b .Delta ())
786- require .Equal (t , a .Interactions (), b .Interactions ())
787- require .Equal (t , a .SpockSecret (), b .SpockSecret ())
788- }
789-
790784func compareExecutionSnapshots (t * testing.T , a , b * state.ExecutionSnapshot ) {
791785 require .Equal (t , a .WriteSet , b .WriteSet )
792786 require .Equal (t , a .ReadSet , b .ReadSet )
0 commit comments