*: don't use dao.Cached in tests

There is no need to use it.
This commit is contained in:
Roman Khimov 2021-08-11 21:02:50 +03:00
parent 18682f2409
commit 50ee1a1f91
3 changed files with 6 additions and 6 deletions

View file

@ -174,7 +174,7 @@ func TestCheckSig(t *testing.T) {
verifyFunc := ECDSASecp256r1CheckSig verifyFunc := ECDSASecp256r1CheckSig
d := dao.NewSimple(storage.NewMemoryStore(), false) d := dao.NewSimple(storage.NewMemoryStore(), false)
ic := &interop.Context{Network: uint32(netmode.UnitTestNet), DAO: dao.NewCached(d)} ic := &interop.Context{Network: uint32(netmode.UnitTestNet), DAO: d}
runCase := func(t *testing.T, isErr bool, result interface{}, args ...interface{}) { runCase := func(t *testing.T, isErr bool, result interface{}, args ...interface{}) {
ic.SpawnVM() ic.SpawnVM()
for i := range args { for i := range args {

View file

@ -45,7 +45,7 @@ func TestRuntimeGetRandomCompatibility(t *testing.T) {
b := getSharpTestGenesis(t) b := getSharpTestGenesis(t)
tx := getSharpTestTx(util.Uint160{}) tx := getSharpTestTx(util.Uint160{})
ic := bc.newInteropContext(trigger.Application, dao.NewCached(bc.dao), b, tx) ic := bc.newInteropContext(trigger.Application, bc.dao.GetWrapped(), b, tx)
ic.Network = 5195086 // Old mainnet magic used by C# tests. ic.Network = 5195086 // Old mainnet magic used by C# tests.
ic.VM = vm.New() ic.VM = vm.New()
@ -72,12 +72,12 @@ func TestRuntimeGetRandomDifferentTransactions(t *testing.T) {
b, _ := bc.GetBlock(bc.GetHeaderHash(0)) b, _ := bc.GetBlock(bc.GetHeaderHash(0))
tx1 := transaction.New([]byte{byte(opcode.PUSH1)}, 0) tx1 := transaction.New([]byte{byte(opcode.PUSH1)}, 0)
ic1 := bc.newInteropContext(trigger.Application, dao.NewCached(bc.dao), b, tx1) ic1 := bc.newInteropContext(trigger.Application, bc.dao.GetWrapped(), b, tx1)
ic1.VM = vm.New() ic1.VM = vm.New()
ic1.VM.LoadScript(tx1.Script) ic1.VM.LoadScript(tx1.Script)
tx2 := transaction.New([]byte{byte(opcode.PUSH2)}, 0) tx2 := transaction.New([]byte{byte(opcode.PUSH2)}, 0)
ic2 := bc.newInteropContext(trigger.Application, dao.NewCached(bc.dao), b, tx2) ic2 := bc.newInteropContext(trigger.Application, bc.dao.GetWrapped(), b, tx2)
ic2.VM = vm.New() ic2.VM = vm.New()
ic2.VM.LoadScript(tx2.Script) ic2.VM.LoadScript(tx2.Script)

View file

@ -17,7 +17,7 @@ import (
func TestDeployGetUpdateDestroyContract(t *testing.T) { func TestDeployGetUpdateDestroyContract(t *testing.T) {
mgmt := newManagement() mgmt := newManagement()
d := dao.NewCached(dao.NewSimple(storage.NewMemoryStore(), false)) d := dao.NewSimple(storage.NewMemoryStore(), false)
err := mgmt.Initialize(&interop.Context{DAO: d}) err := mgmt.Initialize(&interop.Context{DAO: d})
require.NoError(t, err) require.NoError(t, err)
script := []byte{byte(opcode.RET)} script := []byte{byte(opcode.RET)}
@ -86,7 +86,7 @@ func TestManagement_Initialize(t *testing.T) {
func TestManagement_GetNEP17Contracts(t *testing.T) { func TestManagement_GetNEP17Contracts(t *testing.T) {
mgmt := newManagement() mgmt := newManagement()
d := dao.NewCached(dao.NewSimple(storage.NewMemoryStore(), false)) d := dao.NewSimple(storage.NewMemoryStore(), false)
err := mgmt.Initialize(&interop.Context{DAO: d}) err := mgmt.Initialize(&interop.Context{DAO: d})
require.NoError(t, err) require.NoError(t, err)