@@ -58,8 +58,11 @@ func TestComputeBlockWithStorage(t *testing.T) {
5858 privateKeys , err := testutil .GenerateAccountPrivateKeys (2 )
5959 require .NoError (t , err )
6060
61- ledger := testutil .RootBootstrappedLedger (vm , execCtx )
62- accounts , err := testutil .CreateAccounts (vm , ledger , privateKeys , chain )
61+ snapshotTree , accounts , err := testutil .CreateAccounts (
62+ vm ,
63+ testutil .RootBootstrappedLedger (vm , execCtx ),
64+ privateKeys ,
65+ chain )
6366 require .NoError (t , err )
6467
6568 tx1 := testutil .DeployCounterContractTransaction (accounts [0 ], chain )
@@ -150,17 +153,21 @@ func TestComputeBlockWithStorage(t *testing.T) {
150153 derivedChainData : derivedChainData ,
151154 }
152155
153- view := delta .NewDeltaView (ledger )
154- blockView := view .NewChild ()
155-
156156 returnedComputationResult , err := engine .ComputeBlock (
157157 context .Background (),
158158 unittest .IdentifierFixture (),
159159 executableBlock ,
160- blockView )
160+ snapshotTree )
161161 require .NoError (t , err )
162162
163- require .NotEmpty (t , blockView .(* delta.View ).Delta ())
163+ hasUpdates := false
164+ for _ , snapshot := range returnedComputationResult .StateSnapshots {
165+ if len (snapshot .WriteSet ) > 0 {
166+ hasUpdates = true
167+ break
168+ }
169+ }
170+ require .True (t , hasUpdates )
164171 require .Len (t , returnedComputationResult .StateSnapshots , 1 + 1 ) // 1 coll + 1 system chunk
165172 assert .NotEmpty (t , returnedComputationResult .StateSnapshots [0 ].UpdatedRegisters ())
166173}
@@ -703,8 +710,11 @@ func Test_EventEncodingFailsOnlyTxAndCarriesOn(t *testing.T) {
703710
704711 privateKeys , err := testutil .GenerateAccountPrivateKeys (1 )
705712 require .NoError (t , err )
706- ledger := testutil .RootBootstrappedLedger (vm , execCtx )
707- accounts , err := testutil .CreateAccounts (vm , ledger , privateKeys , chain )
713+ snapshotTree , accounts , err := testutil .CreateAccounts (
714+ vm ,
715+ testutil .RootBootstrappedLedger (vm , execCtx ),
716+ privateKeys ,
717+ chain )
708718 require .NoError (t , err )
709719
710720 // setup transactions
@@ -789,16 +799,13 @@ func Test_EventEncodingFailsOnlyTxAndCarriesOn(t *testing.T) {
789799 derivedChainData : derivedChainData ,
790800 }
791801
792- view := delta .NewDeltaView (ledger )
793- blockView := view .NewChild ()
794-
795802 eventEncoder .enabled = true
796803
797804 returnedComputationResult , err := engine .ComputeBlock (
798805 context .Background (),
799806 unittest .IdentifierFixture (),
800807 executableBlock ,
801- blockView )
808+ snapshotTree )
802809 require .NoError (t , err )
803810
804811 require .Len (t , returnedComputationResult .Events , 2 ) // 1 collection + 1 system chunk
@@ -858,14 +865,18 @@ func TestScriptStorageMutationsDiscarded(t *testing.T) {
858865 },
859866 )
860867 vm := manager .vm
861- view := testutil .RootBootstrappedLedger (vm , ctx )
862868
863869 // Create an account private key.
864870 privateKeys , err := testutil .GenerateAccountPrivateKeys (1 )
865871 require .NoError (t , err )
866872
867- // Bootstrap a ledger, creating accounts with the provided private keys and the root account.
868- accounts , err := testutil .CreateAccounts (vm , view , privateKeys , chain )
873+ // Bootstrap a ledger, creating accounts with the provided private keys
874+ // and the root account.
875+ snapshotTree , accounts , err := testutil .CreateAccounts (
876+ vm ,
877+ testutil .RootBootstrappedLedger (vm , ctx ),
878+ privateKeys ,
879+ chain )
869880 require .NoError (t , err )
870881 account := accounts [0 ]
871882 address := cadence .NewAddress (account )
@@ -884,13 +895,13 @@ func TestScriptStorageMutationsDiscarded(t *testing.T) {
884895 script ,
885896 [][]byte {jsoncdc .MustEncode (address )},
886897 header ,
887- view )
898+ snapshotTree )
888899
889900 require .NoError (t , err )
890901
891902 env := environment .NewScriptEnvironmentFromStorageSnapshot (
892903 ctx .EnvironmentParams ,
893- view )
904+ snapshotTree )
894905
895906 rt := env .BorrowCadenceRuntime ()
896907 defer env .ReturnCadenceRuntime (rt )
0 commit comments