Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions storage/memstore/memstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"github.com/onflow/flow-go/fvm/storage/snapshot"
"github.com/onflow/flow-go/model/flow"
flowgo "github.com/onflow/flow-go/model/flow"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -35,14 +34,14 @@ func TestMemstore(t *testing.T) {
t.Parallel()

const blockHeight = 0
key := flow.NewRegisterID(flowgo.EmptyAddress, "foo")
key := flow.NewRegisterID(flow.EmptyAddress, "foo")
value := []byte("bar")
store := New()

err := store.insertExecutionSnapshot(
blockHeight,
&snapshot.ExecutionSnapshot{
WriteSet: map[flowgo.RegisterID]flowgo.RegisterValue{
WriteSet: map[flow.RegisterID]flow.RegisterValue{
key: value,
},
},
Expand Down Expand Up @@ -75,7 +74,7 @@ func TestMemstoreSetValueToNil(t *testing.T) {
t.Parallel()

store := New()
key := flow.NewRegisterID(flowgo.EmptyAddress, "foo")
key := flow.NewRegisterID(flow.EmptyAddress, "foo")
value := []byte("bar")
var nilByte []byte
nilValue := nilByte
Expand All @@ -84,7 +83,7 @@ func TestMemstoreSetValueToNil(t *testing.T) {
err := store.insertExecutionSnapshot(
0,
&snapshot.ExecutionSnapshot{
WriteSet: map[flowgo.RegisterID]flowgo.RegisterValue{
WriteSet: map[flow.RegisterID]flow.RegisterValue{
key: value,
},
})
Expand All @@ -101,7 +100,7 @@ func TestMemstoreSetValueToNil(t *testing.T) {
err = store.insertExecutionSnapshot(
1,
&snapshot.ExecutionSnapshot{
WriteSet: map[flowgo.RegisterID]flowgo.RegisterValue{
WriteSet: map[flow.RegisterID]flow.RegisterValue{
key: nilValue,
},
})
Expand Down
23 changes: 11 additions & 12 deletions storage/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/onflow/flow-go-sdk/test"
"github.com/onflow/flow-go/fvm/storage/snapshot"
"github.com/onflow/flow-go/model/flow"
flowgo "github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow/protobuf/go/flow/entities"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -49,21 +48,21 @@ func TestBlocks(t *testing.T) {
require.NoError(t, os.RemoveAll(dir))
}()

block1 := &flowgo.Block{
Header: &flowgo.Header{
block1 := &flow.Block{
Header: &flow.Header{
Height: 1,
},
}
block2 := &flowgo.Block{
Header: &flowgo.Header{
block2 := &flow.Block{
Header: &flow.Header{
Height: 2,
},
}

t.Run("should return error for not found", func(t *testing.T) {
t.Run("BlockByID", func(t *testing.T) {
freshId := test.IdentifierGenerator().New()
_, err := store.BlockByID(context.Background(), flowgo.Identifier(freshId))
_, err := store.BlockByID(context.Background(), flow.Identifier(freshId))
if assert.Error(t, err) {
assert.Equal(t, storage.ErrNotFound, err)
}
Expand Down Expand Up @@ -239,7 +238,7 @@ func TestTransactionResults(t *testing.T) {
result := unittest.StorableTransactionResultFixture(eventEncodingVersion)

t.Run("should return error for not found", func(t *testing.T) {
txID := flowgo.Identifier(ids.New())
txID := flow.Identifier(ids.New())

_, err := store.TransactionResultByID(context.Background(), txID)
if assert.Error(t, err) {
Expand All @@ -248,7 +247,7 @@ func TestTransactionResults(t *testing.T) {
})

t.Run("should be able to insert result", func(t *testing.T) {
txID := flowgo.Identifier(ids.New())
txID := flow.Identifier(ids.New())

err := store.InsertTransactionResult(context.Background(), txID, result)
assert.NoError(t, err)
Expand Down Expand Up @@ -404,7 +403,7 @@ func TestInsertEvents(t *testing.T) {

t.Run("should be able to insert events", func(t *testing.T) {
event, _ := convert.SDKEventToFlow(events.New())
events := []flowgo.Event{event}
events := []flow.Event{event}

var blockHeight uint64 = 1

Expand Down Expand Up @@ -445,9 +444,9 @@ func TestEventsByHeight(t *testing.T) {
emptyBlockHeight uint64 = 2
nonExistentBlockHeight uint64 = 3

allEvents = make([]flowgo.Event, 10)
eventsA = make([]flowgo.Event, 0, 5)
eventsB = make([]flowgo.Event, 0, 5)
allEvents = make([]flow.Event, 10)
eventsA = make([]flow.Event, 0, 5)
eventsB = make([]flow.Event, 0, 5)
)

for i := range allEvents {
Expand Down