github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/storage/testutils/utils.go (about)

     1  package testutils
     2  
     3  import (
     4  	"github.com/onflow/flow-go/fvm/storage"
     5  	"github.com/onflow/flow-go/fvm/storage/snapshot"
     6  	"github.com/onflow/flow-go/fvm/storage/state"
     7  )
     8  
     9  // NewSimpleTransaction returns a transaction which can be used to test
    10  // fvm evaluation.  The returned transaction should not be committed.
    11  func NewSimpleTransaction(
    12  	snapshot snapshot.StorageSnapshot,
    13  ) storage.Transaction {
    14  	blockDatabase := storage.NewBlockDatabase(snapshot, 0, nil)
    15  
    16  	txn, err := blockDatabase.NewTransaction(0, state.DefaultParameters())
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  
    21  	return txn
    22  }