@@ -35,6 +35,7 @@ import (
3535 fvmmock "github.com/onflow/flow-go/fvm/mock"
3636 reusableRuntime "github.com/onflow/flow-go/fvm/runtime"
3737 "github.com/onflow/flow-go/fvm/state"
38+ "github.com/onflow/flow-go/fvm/storage"
3839 "github.com/onflow/flow-go/fvm/storage/testutils"
3940 "github.com/onflow/flow-go/fvm/systemcontracts"
4041 "github.com/onflow/flow-go/ledger"
@@ -362,15 +363,20 @@ func TestBlockExecutor_ExecuteBlock(t *testing.T) {
362363
363364 opts := append (baseOpts , contextOptions ... )
364365 ctx := fvm .NewContext (opts ... )
365- view := delta . NewDeltaView (nil )
366+ snapshotTree := storage . NewSnapshotTree (nil )
366367
367368 baseBootstrapOpts := []fvm.BootstrapProcedureOption {
368369 fvm .WithInitialTokenSupply (unittest .GenesisTokenSupply ),
369370 }
370371 bootstrapOpts := append (baseBootstrapOpts , bootstrapOptions ... )
371- err := vm .Run (ctx , fvm .Bootstrap (unittest .ServiceAccountPublicKey , bootstrapOpts ... ), view )
372+ executionSnapshot , _ , err := vm .RunV2 (
373+ ctx ,
374+ fvm .Bootstrap (unittest .ServiceAccountPublicKey , bootstrapOpts ... ),
375+ snapshotTree )
372376 require .NoError (t , err )
373377
378+ snapshotTree = snapshotTree .Append (executionSnapshot )
379+
374380 comm := new (computermock.ViewCommitter )
375381
376382 bservice := requesterunit .MockBlobService (blockstore .NewBlockstore (dssync .MutexWrap (datastore .NewMapDatastore ())))
@@ -407,7 +413,7 @@ func TestBlockExecutor_ExecuteBlock(t *testing.T) {
407413 context .Background (),
408414 unittest .IdentifierFixture (),
409415 block ,
410- view ,
416+ snapshotTree ,
411417 derivedBlockData )
412418 assert .NoError (t , err )
413419 assert .Len (t , result .StateSnapshots , 1 )
@@ -718,18 +724,15 @@ func TestBlockExecutor_ExecuteBlock(t *testing.T) {
718724 const transactionCount = 2
719725 block := generateBlock (collectionCount , transactionCount , rag )
720726
721- view := delta .NewDeltaView (nil )
722-
723- err = view .Set (
724- flow .AccountStatusRegisterID (flow .BytesToAddress (address .Bytes ())),
725- environment .NewAccountStatus ().ToBytes ())
726- require .NoError (t , err )
727+ key := flow .AccountStatusRegisterID (
728+ flow .BytesToAddress (address .Bytes ()))
729+ value := environment .NewAccountStatus ().ToBytes ()
727730
728731 result , err := exe .ExecuteBlock (
729732 context .Background (),
730733 unittest .IdentifierFixture (),
731734 block ,
732- view ,
735+ state. MapStorageSnapshot { key : value } ,
733736 derived .NewEmptyDerivedBlockData ())
734737 assert .NoError (t , err )
735738 assert .Len (t , result .StateSnapshots , collectionCount + 1 ) // +1 system chunk
@@ -818,18 +821,15 @@ func TestBlockExecutor_ExecuteBlock(t *testing.T) {
818821
819822 block := generateBlock (collectionCount , transactionCount , rag )
820823
821- view := delta .NewDeltaView (nil )
822-
823- err = view .Set (
824- flow .AccountStatusRegisterID (flow .BytesToAddress (address .Bytes ())),
825- environment .NewAccountStatus ().ToBytes ())
826- require .NoError (t , err )
824+ key := flow .AccountStatusRegisterID (
825+ flow .BytesToAddress (address .Bytes ()))
826+ value := environment .NewAccountStatus ().ToBytes ()
827827
828828 result , err := exe .ExecuteBlock (
829829 context .Background (),
830830 unittest .IdentifierFixture (),
831831 block ,
832- view ,
832+ state. MapStorageSnapshot { key : value } ,
833833 derived .NewEmptyDerivedBlockData ())
834834 require .NoError (t , err )
835835 assert .Len (t , result .StateSnapshots , collectionCount + 1 ) // +1 system chunk
@@ -1154,13 +1154,11 @@ func Test_ExecutingSystemCollection(t *testing.T) {
11541154 // create empty block, it will have system collection attached while executing
11551155 block := generateBlock (0 , 0 , rag )
11561156
1157- view := delta .NewDeltaView (ledger )
1158-
11591157 result , err := exe .ExecuteBlock (
11601158 context .Background (),
11611159 unittest .IdentifierFixture (),
11621160 block ,
1163- view ,
1161+ ledger ,
11641162 derived .NewEmptyDerivedBlockData ())
11651163 assert .NoError (t , err )
11661164 assert .Len (t , result .StateSnapshots , 1 ) // +1 system chunk
0 commit comments