Skip to content

Commit

Permalink
Merge branch 'dev' into e2e-cleanup-test-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
marun authored Sep 19, 2023
2 parents b485023 + 63271f8 commit fd5806e
Show file tree
Hide file tree
Showing 29 changed files with 153 additions and 149 deletions.
2 changes: 1 addition & 1 deletion scripts/mocks.mockgen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ github.com/ava-labs/avalanchego/utils/filesystem=Reader=utils/filesystem/mock_io
github.com/ava-labs/avalanchego/utils/hashing=Hasher=utils/hashing/mock_hasher.go
github.com/ava-labs/avalanchego/utils/logging=Logger=utils/logging/mock_logger.go
github.com/ava-labs/avalanchego/utils/resource=User=utils/resource/mock_user.go
github.com/ava-labs/avalanchego/vms/avm/blocks=Block=vms/avm/blocks/mock_block.go
github.com/ava-labs/avalanchego/vms/avm/block=Block=vms/avm/block/mock_block.go
github.com/ava-labs/avalanchego/vms/avm/metrics=Metrics=vms/avm/metrics/mock_metrics.go
github.com/ava-labs/avalanchego/vms/avm/states=Chain,State,Diff=vms/avm/states/mock_states.go
github.com/ava-labs/avalanchego/vms/avm/txs/mempool=Mempool=vms/avm/txs/mempool/mock_mempool.go
Expand Down
2 changes: 1 addition & 1 deletion vms/avm/blocks/block.go → vms/avm/block/block.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package blocks
package block

import (
"time"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package blocks
package block

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/utils/timer/mockable"
"github.com/ava-labs/avalanchego/utils/units"
"github.com/ava-labs/avalanchego/vms/avm/blocks"
"github.com/ava-labs/avalanchego/vms/avm/block"
"github.com/ava-labs/avalanchego/vms/avm/states"
"github.com/ava-labs/avalanchego/vms/avm/txs"
"github.com/ava-labs/avalanchego/vms/avm/txs/mempool"

blockexecutor "github.com/ava-labs/avalanchego/vms/avm/blocks/executor"
blockexecutor "github.com/ava-labs/avalanchego/vms/avm/block/executor"
txexecutor "github.com/ava-labs/avalanchego/vms/avm/txs/executor"
)

Expand Down Expand Up @@ -153,7 +153,7 @@ func (b *builder) BuildBlock(context.Context) (snowman.Block, error) {
return nil, ErrNoTransactions
}

statelessBlk, err := blocks.NewStandardBlock(
statelessBlk, err := block.NewStandardBlock(
preferredID,
nextHeight,
nextTimestamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/timer/mockable"
"github.com/ava-labs/avalanchego/version"
"github.com/ava-labs/avalanchego/vms/avm/blocks"
"github.com/ava-labs/avalanchego/vms/avm/block"
"github.com/ava-labs/avalanchego/vms/avm/fxs"
"github.com/ava-labs/avalanchego/vms/avm/metrics"
"github.com/ava-labs/avalanchego/vms/avm/states"
Expand All @@ -36,7 +36,7 @@ import (
"github.com/ava-labs/avalanchego/vms/components/avax"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"

blkexecutor "github.com/ava-labs/avalanchego/vms/avm/blocks/executor"
blkexecutor "github.com/ava-labs/avalanchego/vms/avm/block/executor"
txexecutor "github.com/ava-labs/avalanchego/vms/avm/txs/executor"
)

Expand Down Expand Up @@ -86,7 +86,7 @@ func TestBuilderBuildBlock(t *testing.T) {
preferredID := ids.GenerateTestID()
preferredHeight := uint64(1337)
preferredTimestamp := time.Now()
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand Down Expand Up @@ -117,7 +117,7 @@ func TestBuilderBuildBlock(t *testing.T) {
preferredID := ids.GenerateTestID()
preferredHeight := uint64(1337)
preferredTimestamp := time.Now()
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand Down Expand Up @@ -161,7 +161,7 @@ func TestBuilderBuildBlock(t *testing.T) {
preferredID := ids.GenerateTestID()
preferredHeight := uint64(1337)
preferredTimestamp := time.Now()
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand Down Expand Up @@ -206,7 +206,7 @@ func TestBuilderBuildBlock(t *testing.T) {
preferredID := ids.GenerateTestID()
preferredHeight := uint64(1337)
preferredTimestamp := time.Now()
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand Down Expand Up @@ -252,7 +252,7 @@ func TestBuilderBuildBlock(t *testing.T) {
preferredID := ids.GenerateTestID()
preferredHeight := uint64(1337)
preferredTimestamp := time.Now()
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand Down Expand Up @@ -300,7 +300,7 @@ func TestBuilderBuildBlock(t *testing.T) {
// Assert created block has one tx, tx1,
// and other fields are set correctly.
manager.EXPECT().NewBlock(gomock.Any()).DoAndReturn(
func(block *blocks.StandardBlock) snowman.Block {
func(block *block.StandardBlock) snowman.Block {
require.Len(t, block.Transactions, 1)
require.Equal(t, tx1, block.Transactions[0])
require.Equal(t, preferredHeight+1, block.Height())
Expand Down Expand Up @@ -345,7 +345,7 @@ func TestBuilderBuildBlock(t *testing.T) {
preferredID := ids.GenerateTestID()
preferredHeight := uint64(1337)
preferredTimestamp := time.Now()
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand All @@ -365,7 +365,7 @@ func TestBuilderBuildBlock(t *testing.T) {
manager.EXPECT().VerifyUniqueInputs(preferredID, gomock.Any()).Return(nil)
// Assert that the created block has the right timestamp
manager.EXPECT().NewBlock(gomock.Any()).DoAndReturn(
func(block *blocks.StandardBlock) snowman.Block {
func(block *block.StandardBlock) snowman.Block {
require.Equal(t, preferredTimestamp.Unix(), block.Timestamp().Unix())
return nil
},
Expand Down Expand Up @@ -419,7 +419,7 @@ func TestBuilderBuildBlock(t *testing.T) {
// preferred block's timestamp is after the time reported by clock
now := time.Now()
preferredTimestamp := now.Add(-2 * time.Second)
preferredBlock := blocks.NewMockBlock(ctrl)
preferredBlock := block.NewMockBlock(ctrl)
preferredBlock.EXPECT().Height().Return(preferredHeight)
preferredBlock.EXPECT().Timestamp().Return(preferredTimestamp)

Expand All @@ -439,7 +439,7 @@ func TestBuilderBuildBlock(t *testing.T) {
manager.EXPECT().VerifyUniqueInputs(preferredID, gomock.Any()).Return(nil)
// Assert that the created block has the right timestamp
manager.EXPECT().NewBlock(gomock.Any()).DoAndReturn(
func(block *blocks.StandardBlock) snowman.Block {
func(block *block.StandardBlock) snowman.Block {
require.Equal(t, now.Unix(), block.Timestamp().Unix())
return nil
},
Expand Down Expand Up @@ -513,7 +513,7 @@ func TestBlockBuilderAddLocalTx(t *testing.T) {
require.NoError(mempool.Add(tx))
require.True(mempool.Has(txID))

parser, err := blocks.NewParser([]fxs.Fx{
parser, err := block.NewParser([]fxs.Fx{
&secp256k1fx.Fx{},
})
require.NoError(err)
Expand All @@ -539,7 +539,7 @@ func TestBlockBuilderAddLocalTx(t *testing.T) {
cm := parser.Codec()
txs, err := createParentTxs(cm)
require.NoError(err)
parentBlk, err := blocks.NewStandardBlock(parentID, 0, parentTimestamp, txs, cm)
parentBlk, err := block.NewStandardBlock(parentID, 0, parentTimestamp, txs, cm)
require.NoError(err)
state.AddBlock(parentBlk)
state.SetLastAccepted(parentBlk.ID())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/choices"
"github.com/ava-labs/avalanchego/snow/consensus/snowman"
"github.com/ava-labs/avalanchego/vms/avm/blocks"
"github.com/ava-labs/avalanchego/vms/avm/block"
"github.com/ava-labs/avalanchego/vms/avm/states"
"github.com/ava-labs/avalanchego/vms/avm/txs/executor"
)
Expand All @@ -37,7 +37,7 @@ var (

// Exported for testing in avm package.
type Block struct {
blocks.Block
block.Block
manager *manager
rejected bool
}
Expand Down
Loading

0 comments on commit fd5806e

Please sign in to comment.