diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a4283fb8a55..924f46bc6a6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,9 +155,10 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-go-for-project - shell: bash - run: scripts/mock.gen.sh - - shell: bash - run: .github/workflows/check-clean-branch.sh + run: | + grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm + go generate -run "go.uber.org/mock/mockgen" ./... + .github/workflows/check-clean-branch.sh go_mod_tidy: name: Up-to-date go.mod and go.sum runs-on: ubuntu-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d4312e5e8ac5..f25c0bddcf1b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,11 +45,41 @@ To start developing on AvalancheGo, you'll need a few things installed. ./scripts/protobuf_codegen.sh ``` -- To add or remove an interface that needs a corresponding mock generated, add it to the mock file [here](./scripts/mocks.mockgen.txt). You can regenerate the mocks by running the following script. +#### Autogenerated mocks -```sh -./scripts/mock.gen.sh -``` +💁 The general direction is to **reduce** usage of mocks, so use the following with moderation. + +Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/mockgen) and `//go:generate` commands in the code. + +- To **re-generate all mocks**, use the command below from the root of the project: + + ```sh + go generate -run "go.uber.org/mock/mockgen" ./... + ``` + +- To **add** an interface that needs a corresponding mock generated: + - if the file `mocks_generate_test.go` exists in the package where the interface is located, either: + - modify its `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface (preferred); or + - add another `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface according to specific mock generation settings + - if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed): + + ```go + // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. + // See the file LICENSE for licensing terms. + + package mypackage + + //go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface + ``` + + Notes: + 1. Ideally generate all mocks to `mocks_test.go` for the package you need to use the mocks for and do not export mocks to other packages. This reduces package dependencies, reduces production code pollution and forces to have locally defined narrow interfaces. + 1. Prefer using reflect mode to generate mocks than source mode, unless you need a mock for an unexported interface, which should be rare. +- To **remove** an interface from having a corresponding mock generated: + 1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined + 1. If the `//go:generate` mockgen command line: + - generates a mock file for multiple interfaces, remove your interface from the line + - generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well. ### Testing diff --git a/README.md b/README.md index f949af3307ff..bf5eaea41070 100644 --- a/README.md +++ b/README.md @@ -187,9 +187,7 @@ For more information, refer to the [GRPC Golang Quick Start Guide](https://grpc. ### Running mock codegen -To regenerate the [gomock](https://github.com/uber-go/mock) code, run `scripts/mock.gen.sh` from the root of the repo. - -This should only be necessary when modifying exported interfaces or after modifying `scripts/mock.mockgen.txt`. +See [the Contributing document autogenerated mocks section](CONTRIBUTING.md#Autogenerated-mocks). ## Versioning diff --git a/api/server/servermock/server.go b/api/server/servermock/server.go deleted file mode 100644 index f17939f2fb4f..000000000000 --- a/api/server/servermock/server.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ava-labs/avalanchego/api/server (interfaces: Server) -// -// Generated by this command: -// -// mockgen -package=servermock -destination=api/server/servermock/server.go -mock_names=Server=Server github.com/ava-labs/avalanchego/api/server Server -// - -// Package servermock is a generated GoMock package. -package servermock - -import ( - http "net/http" - reflect "reflect" - - snow "github.com/ava-labs/avalanchego/snow" - common "github.com/ava-labs/avalanchego/snow/engine/common" - gomock "go.uber.org/mock/gomock" -) - -// Server is a mock of Server interface. -type Server struct { - ctrl *gomock.Controller - recorder *ServerMockRecorder -} - -// ServerMockRecorder is the mock recorder for Server. -type ServerMockRecorder struct { - mock *Server -} - -// NewServer creates a new mock instance. -func NewServer(ctrl *gomock.Controller) *Server { - mock := &Server{ctrl: ctrl} - mock.recorder = &ServerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *Server) EXPECT() *ServerMockRecorder { - return m.recorder -} - -// AddAliases mocks base method. -func (m *Server) AddAliases(arg0 string, arg1 ...string) error { - m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "AddAliases", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddAliases indicates an expected call of AddAliases. -func (mr *ServerMockRecorder) AddAliases(arg0 any, arg1 ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAliases", reflect.TypeOf((*Server)(nil).AddAliases), varargs...) -} - -// AddAliasesWithReadLock mocks base method. -func (m *Server) AddAliasesWithReadLock(arg0 string, arg1 ...string) error { - m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "AddAliasesWithReadLock", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddAliasesWithReadLock indicates an expected call of AddAliasesWithReadLock. -func (mr *ServerMockRecorder) AddAliasesWithReadLock(arg0 any, arg1 ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAliasesWithReadLock", reflect.TypeOf((*Server)(nil).AddAliasesWithReadLock), varargs...) -} - -// AddRoute mocks base method. -func (m *Server) AddRoute(arg0 http.Handler, arg1, arg2 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddRoute", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddRoute indicates an expected call of AddRoute. -func (mr *ServerMockRecorder) AddRoute(arg0, arg1, arg2 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoute", reflect.TypeOf((*Server)(nil).AddRoute), arg0, arg1, arg2) -} - -// AddRouteWithReadLock mocks base method. -func (m *Server) AddRouteWithReadLock(arg0 http.Handler, arg1, arg2 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddRouteWithReadLock", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddRouteWithReadLock indicates an expected call of AddRouteWithReadLock. -func (mr *ServerMockRecorder) AddRouteWithReadLock(arg0, arg1, arg2 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRouteWithReadLock", reflect.TypeOf((*Server)(nil).AddRouteWithReadLock), arg0, arg1, arg2) -} - -// Dispatch mocks base method. -func (m *Server) Dispatch() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Dispatch") - ret0, _ := ret[0].(error) - return ret0 -} - -// Dispatch indicates an expected call of Dispatch. -func (mr *ServerMockRecorder) Dispatch() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dispatch", reflect.TypeOf((*Server)(nil).Dispatch)) -} - -// RegisterChain mocks base method. -func (m *Server) RegisterChain(arg0 string, arg1 *snow.ConsensusContext, arg2 common.VM) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterChain", arg0, arg1, arg2) -} - -// RegisterChain indicates an expected call of RegisterChain. -func (mr *ServerMockRecorder) RegisterChain(arg0, arg1, arg2 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterChain", reflect.TypeOf((*Server)(nil).RegisterChain), arg0, arg1, arg2) -} - -// Shutdown mocks base method. -func (m *Server) Shutdown() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Shutdown") - ret0, _ := ret[0].(error) - return ret0 -} - -// Shutdown indicates an expected call of Shutdown. -func (mr *ServerMockRecorder) Shutdown() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*Server)(nil).Shutdown)) -} diff --git a/chains/atomic/atomicmock/shared_memory.go b/chains/atomic/atomicmock/shared_memory.go index fb93096f22b6..335d94bc1ffa 100644 --- a/chains/atomic/atomicmock/shared_memory.go +++ b/chains/atomic/atomicmock/shared_memory.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=atomicmock -destination=chains/atomic/atomicmock/shared_memory.go -mock_names=SharedMemory=SharedMemory github.com/ava-labs/avalanchego/chains/atomic SharedMemory +// mockgen -package=atomicmock -destination=atomicmock/shared_memory.go -mock_names=SharedMemory=SharedMemory . SharedMemory // // Package atomicmock is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type SharedMemory struct { ctrl *gomock.Controller recorder *SharedMemoryMockRecorder + isgomock struct{} } // SharedMemoryMockRecorder is the mock recorder for SharedMemory. @@ -42,10 +43,10 @@ func (m *SharedMemory) EXPECT() *SharedMemoryMockRecorder { } // Apply mocks base method. -func (m *SharedMemory) Apply(arg0 map[ids.ID]*atomic.Requests, arg1 ...database.Batch) error { +func (m *SharedMemory) Apply(requests map[ids.ID]*atomic.Requests, batches ...database.Batch) error { m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { + varargs := []any{requests} + for _, a := range batches { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Apply", varargs...) @@ -54,31 +55,31 @@ func (m *SharedMemory) Apply(arg0 map[ids.ID]*atomic.Requests, arg1 ...database. } // Apply indicates an expected call of Apply. -func (mr *SharedMemoryMockRecorder) Apply(arg0 any, arg1 ...any) *gomock.Call { +func (mr *SharedMemoryMockRecorder) Apply(requests any, batches ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) + varargs := append([]any{requests}, batches...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*SharedMemory)(nil).Apply), varargs...) } // Get mocks base method. -func (m *SharedMemory) Get(arg0 ids.ID, arg1 [][]byte) ([][]byte, error) { +func (m *SharedMemory) Get(peerChainID ids.ID, keys [][]byte) ([][]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0, arg1) + ret := m.ctrl.Call(m, "Get", peerChainID, keys) ret0, _ := ret[0].([][]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *SharedMemoryMockRecorder) Get(arg0, arg1 any) *gomock.Call { +func (mr *SharedMemoryMockRecorder) Get(peerChainID, keys any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*SharedMemory)(nil).Get), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*SharedMemory)(nil).Get), peerChainID, keys) } // Indexed mocks base method. -func (m *SharedMemory) Indexed(arg0 ids.ID, arg1 [][]byte, arg2, arg3 []byte, arg4 int) ([][]byte, []byte, []byte, error) { +func (m *SharedMemory) Indexed(peerChainID ids.ID, traits [][]byte, startTrait, startKey []byte, limit int) ([][]byte, []byte, []byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Indexed", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "Indexed", peerChainID, traits, startTrait, startKey, limit) ret0, _ := ret[0].([][]byte) ret1, _ := ret[1].([]byte) ret2, _ := ret[2].([]byte) @@ -87,7 +88,7 @@ func (m *SharedMemory) Indexed(arg0 ids.ID, arg1 [][]byte, arg2, arg3 []byte, ar } // Indexed indicates an expected call of Indexed. -func (mr *SharedMemoryMockRecorder) Indexed(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *SharedMemoryMockRecorder) Indexed(peerChainID, traits, startTrait, startKey, limit any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Indexed", reflect.TypeOf((*SharedMemory)(nil).Indexed), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Indexed", reflect.TypeOf((*SharedMemory)(nil).Indexed), peerChainID, traits, startTrait, startKey, limit) } diff --git a/chains/atomic/mocks_generate_test.go b/chains/atomic/mocks_generate_test.go new file mode 100644 index 000000000000..6a2dde149771 --- /dev/null +++ b/chains/atomic/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package atomic + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/shared_memory.go -mock_names=SharedMemory=SharedMemory . SharedMemory diff --git a/codec/codecmock/manager.go b/codec/codecmock/manager.go index ec7c7c6ed229..85aa9f6a14e4 100644 --- a/codec/codecmock/manager.go +++ b/codec/codecmock/manager.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=codecmock -destination=codec/codecmock/manager.go -mock_names=Manager=Manager github.com/ava-labs/avalanchego/codec Manager +// mockgen -package=codecmock -destination=codecmock/manager.go -mock_names=Manager=Manager . Manager // // Package codecmock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Manager struct { ctrl *gomock.Controller recorder *ManagerMockRecorder + isgomock struct{} } // ManagerMockRecorder is the mock recorder for Manager. @@ -40,60 +41,60 @@ func (m *Manager) EXPECT() *ManagerMockRecorder { } // Marshal mocks base method. -func (m *Manager) Marshal(arg0 uint16, arg1 any) ([]byte, error) { +func (m *Manager) Marshal(version uint16, source any) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Marshal", arg0, arg1) + ret := m.ctrl.Call(m, "Marshal", version, source) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // Marshal indicates an expected call of Marshal. -func (mr *ManagerMockRecorder) Marshal(arg0, arg1 any) *gomock.Call { +func (mr *ManagerMockRecorder) Marshal(version, source any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Marshal", reflect.TypeOf((*Manager)(nil).Marshal), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Marshal", reflect.TypeOf((*Manager)(nil).Marshal), version, source) } // RegisterCodec mocks base method. -func (m *Manager) RegisterCodec(arg0 uint16, arg1 codec.Codec) error { +func (m *Manager) RegisterCodec(version uint16, codec codec.Codec) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegisterCodec", arg0, arg1) + ret := m.ctrl.Call(m, "RegisterCodec", version, codec) ret0, _ := ret[0].(error) return ret0 } // RegisterCodec indicates an expected call of RegisterCodec. -func (mr *ManagerMockRecorder) RegisterCodec(arg0, arg1 any) *gomock.Call { +func (mr *ManagerMockRecorder) RegisterCodec(version, codec any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*Manager)(nil).RegisterCodec), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*Manager)(nil).RegisterCodec), version, codec) } // Size mocks base method. -func (m *Manager) Size(arg0 uint16, arg1 any) (int, error) { +func (m *Manager) Size(version uint16, value any) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Size", arg0, arg1) + ret := m.ctrl.Call(m, "Size", version, value) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // Size indicates an expected call of Size. -func (mr *ManagerMockRecorder) Size(arg0, arg1 any) *gomock.Call { +func (mr *ManagerMockRecorder) Size(version, value any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*Manager)(nil).Size), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*Manager)(nil).Size), version, value) } // Unmarshal mocks base method. -func (m *Manager) Unmarshal(arg0 []byte, arg1 any) (uint16, error) { +func (m *Manager) Unmarshal(source []byte, destination any) (uint16, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Unmarshal", arg0, arg1) + ret := m.ctrl.Call(m, "Unmarshal", source, destination) ret0, _ := ret[0].(uint16) ret1, _ := ret[1].(error) return ret0, ret1 } // Unmarshal indicates an expected call of Unmarshal. -func (mr *ManagerMockRecorder) Unmarshal(arg0, arg1 any) *gomock.Call { +func (mr *ManagerMockRecorder) Unmarshal(source, destination any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unmarshal", reflect.TypeOf((*Manager)(nil).Unmarshal), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unmarshal", reflect.TypeOf((*Manager)(nil).Unmarshal), source, destination) } diff --git a/codec/mocks_generate_test.go b/codec/mocks_generate_test.go new file mode 100644 index 000000000000..30f2c308e758 --- /dev/null +++ b/codec/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package codec + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager diff --git a/database/databasemock/batch.go b/database/databasemock/batch.go index 515a0c0c659c..c8d85261d233 100644 --- a/database/databasemock/batch.go +++ b/database/databasemock/batch.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=databasemock -destination=database/databasemock/batch.go -mock_names=Batch=Batch github.com/ava-labs/avalanchego/database Batch +// mockgen -package=databasemock -destination=databasemock/batch.go -mock_names=Batch=Batch . Batch // // Package databasemock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Batch struct { ctrl *gomock.Controller recorder *BatchMockRecorder + isgomock struct{} } // BatchMockRecorder is the mock recorder for Batch. @@ -40,17 +41,17 @@ func (m *Batch) EXPECT() *BatchMockRecorder { } // Delete mocks base method. -func (m *Batch) Delete(arg0 []byte) error { +func (m *Batch) Delete(key []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delete", arg0) + ret := m.ctrl.Call(m, "Delete", key) ret0, _ := ret[0].(error) return ret0 } // Delete indicates an expected call of Delete. -func (mr *BatchMockRecorder) Delete(arg0 any) *gomock.Call { +func (mr *BatchMockRecorder) Delete(key any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*Batch)(nil).Delete), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*Batch)(nil).Delete), key) } // Inner mocks base method. @@ -68,31 +69,31 @@ func (mr *BatchMockRecorder) Inner() *gomock.Call { } // Put mocks base method. -func (m *Batch) Put(arg0, arg1 []byte) error { +func (m *Batch) Put(key, value []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Put", arg0, arg1) + ret := m.ctrl.Call(m, "Put", key, value) ret0, _ := ret[0].(error) return ret0 } // Put indicates an expected call of Put. -func (mr *BatchMockRecorder) Put(arg0, arg1 any) *gomock.Call { +func (mr *BatchMockRecorder) Put(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*Batch)(nil).Put), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*Batch)(nil).Put), key, value) } // Replay mocks base method. -func (m *Batch) Replay(arg0 database.KeyValueWriterDeleter) error { +func (m *Batch) Replay(w database.KeyValueWriterDeleter) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Replay", arg0) + ret := m.ctrl.Call(m, "Replay", w) ret0, _ := ret[0].(error) return ret0 } // Replay indicates an expected call of Replay. -func (mr *BatchMockRecorder) Replay(arg0 any) *gomock.Call { +func (mr *BatchMockRecorder) Replay(w any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Replay", reflect.TypeOf((*Batch)(nil).Replay), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Replay", reflect.TypeOf((*Batch)(nil).Replay), w) } // Reset mocks base method. diff --git a/database/databasemock/iterator.go b/database/databasemock/iterator.go index 2308ab65864b..77af33e5a174 100644 --- a/database/databasemock/iterator.go +++ b/database/databasemock/iterator.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=databasemock -destination=database/databasemock/iterator.go -mock_names=Iterator=Iterator github.com/ava-labs/avalanchego/database Iterator +// mockgen -package=databasemock -destination=databasemock/iterator.go -mock_names=Iterator=Iterator . Iterator // // Package databasemock is a generated GoMock package. @@ -19,6 +19,7 @@ import ( type Iterator struct { ctrl *gomock.Controller recorder *IteratorMockRecorder + isgomock struct{} } // IteratorMockRecorder is the mock recorder for Iterator. diff --git a/database/mocks_generate_test.go b/database/mocks_generate_test.go new file mode 100644 index 000000000000..32e0579b262c --- /dev/null +++ b/database/mocks_generate_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package database + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/batch.go -mock_names=Batch=Batch . Batch +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/iterator.go -mock_names=Iterator=Iterator . Iterator diff --git a/go.mod b/go.mod index f92a1ae72ed9..d03653f13775 100644 --- a/go.mod +++ b/go.mod @@ -57,10 +57,11 @@ require ( go.opentelemetry.io/otel/sdk v1.22.0 go.opentelemetry.io/otel/trace v1.22.0 go.uber.org/goleak v1.3.0 - go.uber.org/mock v0.4.0 + go.uber.org/mock v0.5.0 go.uber.org/zap v1.26.0 golang.org/x/crypto v0.31.0 golang.org/x/exp v0.0.0-20231127185646-65229373498e + golang.org/x/mod v0.18.0 golang.org/x/net v0.33.0 golang.org/x/sync v0.10.0 golang.org/x/term v0.27.0 @@ -181,7 +182,7 @@ require ( golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index d7f26b5a1e29..c7216e28f9f7 100644 --- a/go.sum +++ b/go.sum @@ -675,8 +675,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= @@ -735,6 +735,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -952,8 +954,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/message/messagemock/outbound_message.go b/message/messagemock/outbound_message.go index f7aadd4a21e2..67b5bdb8fc0f 100644 --- a/message/messagemock/outbound_message.go +++ b/message/messagemock/outbound_message.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=messagemock -destination=message/messagemock/outbound_message.go -mock_names=OutboundMessage=OutboundMessage github.com/ava-labs/avalanchego/message OutboundMessage +// mockgen -package=messagemock -destination=messagemock/outbound_message.go -mock_names=OutboundMessage=OutboundMessage . OutboundMessage // // Package messagemock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type OutboundMessage struct { ctrl *gomock.Controller recorder *OutboundMessageMockRecorder + isgomock struct{} } // OutboundMessageMockRecorder is the mock recorder for OutboundMessage. diff --git a/message/messagemock/outbound_message_builder.go b/message/messagemock/outbound_message_builder.go index 3f2c4f27dd21..89794619de73 100644 --- a/message/messagemock/outbound_message_builder.go +++ b/message/messagemock/outbound_message_builder.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=messagemock -destination=message/messagemock/outbound_message_builder.go -mock_names=OutboundMsgBuilder=OutboundMsgBuilder github.com/ava-labs/avalanchego/message OutboundMsgBuilder +// mockgen -package=messagemock -destination=messagemock/outbound_message_builder.go -mock_names=OutboundMsgBuilder=OutboundMsgBuilder . OutboundMsgBuilder // // Package messagemock is a generated GoMock package. @@ -25,6 +25,7 @@ import ( type OutboundMsgBuilder struct { ctrl *gomock.Controller recorder *OutboundMsgBuilderMockRecorder + isgomock struct{} } // OutboundMsgBuilderMockRecorder is the mock recorder for OutboundMsgBuilder. @@ -45,288 +46,288 @@ func (m *OutboundMsgBuilder) EXPECT() *OutboundMsgBuilderMockRecorder { } // Accepted mocks base method. -func (m *OutboundMsgBuilder) Accepted(arg0 ids.ID, arg1 uint32, arg2 []ids.ID) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Accepted(chainID ids.ID, requestID uint32, containerIDs []ids.ID) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Accepted", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Accepted", chainID, requestID, containerIDs) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Accepted indicates an expected call of Accepted. -func (mr *OutboundMsgBuilderMockRecorder) Accepted(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Accepted(chainID, requestID, containerIDs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accepted", reflect.TypeOf((*OutboundMsgBuilder)(nil).Accepted), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accepted", reflect.TypeOf((*OutboundMsgBuilder)(nil).Accepted), chainID, requestID, containerIDs) } // AcceptedFrontier mocks base method. -func (m *OutboundMsgBuilder) AcceptedFrontier(arg0 ids.ID, arg1 uint32, arg2 ids.ID) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) AcceptedFrontier(chainID ids.ID, requestID uint32, containerID ids.ID) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AcceptedFrontier", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AcceptedFrontier", chainID, requestID, containerID) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // AcceptedFrontier indicates an expected call of AcceptedFrontier. -func (mr *OutboundMsgBuilderMockRecorder) AcceptedFrontier(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) AcceptedFrontier(chainID, requestID, containerID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptedFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).AcceptedFrontier), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptedFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).AcceptedFrontier), chainID, requestID, containerID) } // AcceptedStateSummary mocks base method. -func (m *OutboundMsgBuilder) AcceptedStateSummary(arg0 ids.ID, arg1 uint32, arg2 []ids.ID) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) AcceptedStateSummary(chainID ids.ID, requestID uint32, summaryIDs []ids.ID) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AcceptedStateSummary", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AcceptedStateSummary", chainID, requestID, summaryIDs) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // AcceptedStateSummary indicates an expected call of AcceptedStateSummary. -func (mr *OutboundMsgBuilderMockRecorder) AcceptedStateSummary(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) AcceptedStateSummary(chainID, requestID, summaryIDs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptedStateSummary", reflect.TypeOf((*OutboundMsgBuilder)(nil).AcceptedStateSummary), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptedStateSummary", reflect.TypeOf((*OutboundMsgBuilder)(nil).AcceptedStateSummary), chainID, requestID, summaryIDs) } // Ancestors mocks base method. -func (m *OutboundMsgBuilder) Ancestors(arg0 ids.ID, arg1 uint32, arg2 [][]byte) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Ancestors(chainID ids.ID, requestID uint32, containers [][]byte) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Ancestors", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Ancestors", chainID, requestID, containers) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Ancestors indicates an expected call of Ancestors. -func (mr *OutboundMsgBuilderMockRecorder) Ancestors(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Ancestors(chainID, requestID, containers any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ancestors", reflect.TypeOf((*OutboundMsgBuilder)(nil).Ancestors), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ancestors", reflect.TypeOf((*OutboundMsgBuilder)(nil).Ancestors), chainID, requestID, containers) } // AppError mocks base method. -func (m *OutboundMsgBuilder) AppError(arg0 ids.ID, arg1 uint32, arg2 int32, arg3 string) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) AppError(chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppError", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AppError", chainID, requestID, errorCode, errorMessage) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // AppError indicates an expected call of AppError. -func (mr *OutboundMsgBuilderMockRecorder) AppError(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) AppError(chainID, requestID, errorCode, errorMessage any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppError", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppError), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppError", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppError), chainID, requestID, errorCode, errorMessage) } // AppGossip mocks base method. -func (m *OutboundMsgBuilder) AppGossip(arg0 ids.ID, arg1 []byte) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) AppGossip(chainID ids.ID, msg []byte) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppGossip", arg0, arg1) + ret := m.ctrl.Call(m, "AppGossip", chainID, msg) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // AppGossip indicates an expected call of AppGossip. -func (mr *OutboundMsgBuilderMockRecorder) AppGossip(arg0, arg1 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) AppGossip(chainID, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppGossip), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppGossip), chainID, msg) } // AppRequest mocks base method. -func (m *OutboundMsgBuilder) AppRequest(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []byte) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) AppRequest(chainID ids.ID, requestID uint32, deadline time.Duration, msg []byte) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppRequest", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AppRequest", chainID, requestID, deadline, msg) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // AppRequest indicates an expected call of AppRequest. -func (mr *OutboundMsgBuilderMockRecorder) AppRequest(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) AppRequest(chainID, requestID, deadline, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppRequest), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppRequest), chainID, requestID, deadline, msg) } // AppResponse mocks base method. -func (m *OutboundMsgBuilder) AppResponse(arg0 ids.ID, arg1 uint32, arg2 []byte) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) AppResponse(chainID ids.ID, requestID uint32, msg []byte) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppResponse", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AppResponse", chainID, requestID, msg) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // AppResponse indicates an expected call of AppResponse. -func (mr *OutboundMsgBuilderMockRecorder) AppResponse(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) AppResponse(chainID, requestID, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppResponse), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*OutboundMsgBuilder)(nil).AppResponse), chainID, requestID, msg) } // Chits mocks base method. -func (m *OutboundMsgBuilder) Chits(arg0 ids.ID, arg1 uint32, arg2, arg3, arg4 ids.ID, arg5 uint64) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Chits(chainID ids.ID, requestID uint32, preferredID, preferredIDAtHeight, acceptedID ids.ID, acceptedHeight uint64) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Chits", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "Chits", chainID, requestID, preferredID, preferredIDAtHeight, acceptedID, acceptedHeight) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Chits indicates an expected call of Chits. -func (mr *OutboundMsgBuilderMockRecorder) Chits(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Chits(chainID, requestID, preferredID, preferredIDAtHeight, acceptedID, acceptedHeight any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Chits", reflect.TypeOf((*OutboundMsgBuilder)(nil).Chits), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Chits", reflect.TypeOf((*OutboundMsgBuilder)(nil).Chits), chainID, requestID, preferredID, preferredIDAtHeight, acceptedID, acceptedHeight) } // Get mocks base method. -func (m *OutboundMsgBuilder) Get(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 ids.ID) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Get(chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "Get", chainID, requestID, deadline, containerID) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *OutboundMsgBuilderMockRecorder) Get(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Get(chainID, requestID, deadline, containerID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*OutboundMsgBuilder)(nil).Get), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*OutboundMsgBuilder)(nil).Get), chainID, requestID, deadline, containerID) } // GetAccepted mocks base method. -func (m *OutboundMsgBuilder) GetAccepted(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []ids.ID) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) GetAccepted(chainID ids.ID, requestID uint32, deadline time.Duration, containerIDs []ids.ID) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAccepted", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "GetAccepted", chainID, requestID, deadline, containerIDs) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAccepted indicates an expected call of GetAccepted. -func (mr *OutboundMsgBuilderMockRecorder) GetAccepted(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) GetAccepted(chainID, requestID, deadline, containerIDs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccepted", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAccepted), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccepted", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAccepted), chainID, requestID, deadline, containerIDs) } // GetAcceptedFrontier mocks base method. -func (m *OutboundMsgBuilder) GetAcceptedFrontier(arg0 ids.ID, arg1 uint32, arg2 time.Duration) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) GetAcceptedFrontier(chainID ids.ID, requestID uint32, deadline time.Duration) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAcceptedFrontier", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetAcceptedFrontier", chainID, requestID, deadline) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAcceptedFrontier indicates an expected call of GetAcceptedFrontier. -func (mr *OutboundMsgBuilderMockRecorder) GetAcceptedFrontier(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) GetAcceptedFrontier(chainID, requestID, deadline any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAcceptedFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAcceptedFrontier), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAcceptedFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAcceptedFrontier), chainID, requestID, deadline) } // GetAcceptedStateSummary mocks base method. -func (m *OutboundMsgBuilder) GetAcceptedStateSummary(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []uint64) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) GetAcceptedStateSummary(chainID ids.ID, requestID uint32, deadline time.Duration, heights []uint64) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAcceptedStateSummary", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "GetAcceptedStateSummary", chainID, requestID, deadline, heights) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAcceptedStateSummary indicates an expected call of GetAcceptedStateSummary. -func (mr *OutboundMsgBuilderMockRecorder) GetAcceptedStateSummary(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) GetAcceptedStateSummary(chainID, requestID, deadline, heights any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAcceptedStateSummary", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAcceptedStateSummary), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAcceptedStateSummary", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAcceptedStateSummary), chainID, requestID, deadline, heights) } // GetAncestors mocks base method. -func (m *OutboundMsgBuilder) GetAncestors(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 ids.ID, arg4 p2p.EngineType) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) GetAncestors(chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, engineType p2p.EngineType) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAncestors", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "GetAncestors", chainID, requestID, deadline, containerID, engineType) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAncestors indicates an expected call of GetAncestors. -func (mr *OutboundMsgBuilderMockRecorder) GetAncestors(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) GetAncestors(chainID, requestID, deadline, containerID, engineType any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAncestors", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAncestors), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAncestors", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetAncestors), chainID, requestID, deadline, containerID, engineType) } // GetPeerList mocks base method. -func (m *OutboundMsgBuilder) GetPeerList(arg0, arg1 []byte, arg2 bool) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) GetPeerList(knownPeersFilter, knownPeersSalt []byte, requestAllSubnetIPs bool) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetPeerList", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetPeerList", knownPeersFilter, knownPeersSalt, requestAllSubnetIPs) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // GetPeerList indicates an expected call of GetPeerList. -func (mr *OutboundMsgBuilderMockRecorder) GetPeerList(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) GetPeerList(knownPeersFilter, knownPeersSalt, requestAllSubnetIPs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPeerList", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetPeerList), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPeerList", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetPeerList), knownPeersFilter, knownPeersSalt, requestAllSubnetIPs) } // GetStateSummaryFrontier mocks base method. -func (m *OutboundMsgBuilder) GetStateSummaryFrontier(arg0 ids.ID, arg1 uint32, arg2 time.Duration) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) GetStateSummaryFrontier(chainID ids.ID, requestID uint32, deadline time.Duration) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStateSummaryFrontier", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetStateSummaryFrontier", chainID, requestID, deadline) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // GetStateSummaryFrontier indicates an expected call of GetStateSummaryFrontier. -func (mr *OutboundMsgBuilderMockRecorder) GetStateSummaryFrontier(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) GetStateSummaryFrontier(chainID, requestID, deadline any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStateSummaryFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetStateSummaryFrontier), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStateSummaryFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).GetStateSummaryFrontier), chainID, requestID, deadline) } // Handshake mocks base method. -func (m *OutboundMsgBuilder) Handshake(arg0 uint32, arg1 uint64, arg2 netip.AddrPort, arg3 string, arg4, arg5, arg6 uint32, arg7 uint64, arg8, arg9 []byte, arg10 []ids.ID, arg11, arg12 []uint32, arg13, arg14 []byte, arg15 bool) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Handshake(networkID uint32, myTime uint64, ip netip.AddrPort, client string, major, minor, patch uint32, ipSigningTime uint64, ipNodeIDSig, ipBLSSig []byte, trackedSubnets []ids.ID, supportedACPs, objectedACPs []uint32, knownPeersFilter, knownPeersSalt []byte, requestAllSubnetIPs bool) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Handshake", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) + ret := m.ctrl.Call(m, "Handshake", networkID, myTime, ip, client, major, minor, patch, ipSigningTime, ipNodeIDSig, ipBLSSig, trackedSubnets, supportedACPs, objectedACPs, knownPeersFilter, knownPeersSalt, requestAllSubnetIPs) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Handshake indicates an expected call of Handshake. -func (mr *OutboundMsgBuilderMockRecorder) Handshake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Handshake(networkID, myTime, ip, client, major, minor, patch, ipSigningTime, ipNodeIDSig, ipBLSSig, trackedSubnets, supportedACPs, objectedACPs, knownPeersFilter, knownPeersSalt, requestAllSubnetIPs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handshake", reflect.TypeOf((*OutboundMsgBuilder)(nil).Handshake), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handshake", reflect.TypeOf((*OutboundMsgBuilder)(nil).Handshake), networkID, myTime, ip, client, major, minor, patch, ipSigningTime, ipNodeIDSig, ipBLSSig, trackedSubnets, supportedACPs, objectedACPs, knownPeersFilter, knownPeersSalt, requestAllSubnetIPs) } // PeerList mocks base method. -func (m *OutboundMsgBuilder) PeerList(arg0 []*ips.ClaimedIPPort, arg1 bool) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) PeerList(peers []*ips.ClaimedIPPort, bypassThrottling bool) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PeerList", arg0, arg1) + ret := m.ctrl.Call(m, "PeerList", peers, bypassThrottling) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // PeerList indicates an expected call of PeerList. -func (mr *OutboundMsgBuilderMockRecorder) PeerList(arg0, arg1 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) PeerList(peers, bypassThrottling any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeerList", reflect.TypeOf((*OutboundMsgBuilder)(nil).PeerList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PeerList", reflect.TypeOf((*OutboundMsgBuilder)(nil).PeerList), peers, bypassThrottling) } // Ping mocks base method. -func (m *OutboundMsgBuilder) Ping(arg0 uint32) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Ping(primaryUptime uint32) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Ping", arg0) + ret := m.ctrl.Call(m, "Ping", primaryUptime) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Ping indicates an expected call of Ping. -func (mr *OutboundMsgBuilderMockRecorder) Ping(arg0 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Ping(primaryUptime any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*OutboundMsgBuilder)(nil).Ping), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*OutboundMsgBuilder)(nil).Ping), primaryUptime) } // Pong mocks base method. @@ -345,61 +346,61 @@ func (mr *OutboundMsgBuilderMockRecorder) Pong() *gomock.Call { } // PullQuery mocks base method. -func (m *OutboundMsgBuilder) PullQuery(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 ids.ID, arg4 uint64) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) PullQuery(chainID ids.ID, requestID uint32, deadline time.Duration, containerID ids.ID, requestedHeight uint64) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PullQuery", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "PullQuery", chainID, requestID, deadline, containerID, requestedHeight) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // PullQuery indicates an expected call of PullQuery. -func (mr *OutboundMsgBuilderMockRecorder) PullQuery(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) PullQuery(chainID, requestID, deadline, containerID, requestedHeight any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PullQuery", reflect.TypeOf((*OutboundMsgBuilder)(nil).PullQuery), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PullQuery", reflect.TypeOf((*OutboundMsgBuilder)(nil).PullQuery), chainID, requestID, deadline, containerID, requestedHeight) } // PushQuery mocks base method. -func (m *OutboundMsgBuilder) PushQuery(arg0 ids.ID, arg1 uint32, arg2 time.Duration, arg3 []byte, arg4 uint64) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) PushQuery(chainID ids.ID, requestID uint32, deadline time.Duration, container []byte, requestedHeight uint64) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PushQuery", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "PushQuery", chainID, requestID, deadline, container, requestedHeight) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // PushQuery indicates an expected call of PushQuery. -func (mr *OutboundMsgBuilderMockRecorder) PushQuery(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) PushQuery(chainID, requestID, deadline, container, requestedHeight any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PushQuery", reflect.TypeOf((*OutboundMsgBuilder)(nil).PushQuery), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PushQuery", reflect.TypeOf((*OutboundMsgBuilder)(nil).PushQuery), chainID, requestID, deadline, container, requestedHeight) } // Put mocks base method. -func (m *OutboundMsgBuilder) Put(arg0 ids.ID, arg1 uint32, arg2 []byte) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Put(chainID ids.ID, requestID uint32, container []byte) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Put", chainID, requestID, container) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Put indicates an expected call of Put. -func (mr *OutboundMsgBuilderMockRecorder) Put(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Put(chainID, requestID, container any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*OutboundMsgBuilder)(nil).Put), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*OutboundMsgBuilder)(nil).Put), chainID, requestID, container) } // StateSummaryFrontier mocks base method. -func (m *OutboundMsgBuilder) StateSummaryFrontier(arg0 ids.ID, arg1 uint32, arg2 []byte) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) StateSummaryFrontier(chainID ids.ID, requestID uint32, summary []byte) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StateSummaryFrontier", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "StateSummaryFrontier", chainID, requestID, summary) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // StateSummaryFrontier indicates an expected call of StateSummaryFrontier. -func (mr *OutboundMsgBuilderMockRecorder) StateSummaryFrontier(arg0, arg1, arg2 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) StateSummaryFrontier(chainID, requestID, summary any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSummaryFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).StateSummaryFrontier), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSummaryFrontier", reflect.TypeOf((*OutboundMsgBuilder)(nil).StateSummaryFrontier), chainID, requestID, summary) } diff --git a/message/mocks_generate_test.go b/message/mocks_generate_test.go new file mode 100644 index 000000000000..87baa584349c --- /dev/null +++ b/message/mocks_generate_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package message + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/outbound_message.go -mock_names=OutboundMessage=OutboundMessage . OutboundMessage +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/outbound_message_builder.go -mock_names=OutboundMsgBuilder=OutboundMsgBuilder . OutboundMsgBuilder diff --git a/scripts/lint.sh b/scripts/lint.sh index 89dd610859c7..58545af454ab 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -43,7 +43,7 @@ _addlicense_flags=${ADDLICENSE_FLAGS:-"--verify --debug"} function test_license_header { go install -v github.com/palantir/go-license@v1.25.0 local files=() - while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -path './**/*mock/*.go') + while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -name 'mocks_*.go' ! -path './**/*mock/*.go') # shellcheck disable=SC2086 go-license \ diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh deleted file mode 100755 index 3a25f8ee4f6c..000000000000 --- a/scripts/mock.gen.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -if ! [[ "$0" =~ scripts/mock.gen.sh ]]; then - echo "must be run from repository root" - exit 255 -fi - -# https://github.com/uber-go/mock -go install -v go.uber.org/mock/mockgen@v0.4.0 - -source ./scripts/constants.sh - -outputted_files=() - -# tuples of (source import path, comma-separated interface names, output file path) -input="scripts/mocks.mockgen.txt" -while IFS= read -r line -do - IFS='=' read -r src_import_path interface_name output_path <<< "${line}" - package_name="$(basename "$(dirname "$output_path")")" - echo "Generating ${output_path}..." - outputted_files+=("${output_path}") - mockgen -package="${package_name}" -destination="${output_path}" -mock_names="${interface_name}=${interface_name}" "${src_import_path}" "${interface_name}" - -done < "$input" - -# tuples of (source import path, comma-separated interface names to exclude, interface name, output file path) -input="scripts/mocks.mockgen.source.txt" -while IFS= read -r line -do - IFS='=' read -r source_path exclude_interfaces interface_name output_path <<< "${line}" - package_name=$(basename "$(dirname "$output_path")") - outputted_files+=("${output_path}") - echo "Generating ${output_path}..." - - mockgen \ - -source="${source_path}" \ - -destination="${output_path}" \ - -package="${package_name}" \ - -exclude_interfaces="${exclude_interfaces}" \ - -mock_names="${interface_name}=${interface_name}" - -done < "$input" - -mapfile -t all_generated_files < <(grep -Rl 'Code generated by MockGen. DO NOT EDIT.') - -# Exclude certain files -outputted_files+=('scripts/mock.gen.sh') # This file -outputted_files+=('vms/components/avax/avaxmock/transferable_out.go') # Embedded verify.IsState -outputted_files+=('vms/platformvm/fx/fxmock/owner.go') # Embedded verify.IsNotState - -mapfile -t diff_files < <(echo "${all_generated_files[@]}" "${outputted_files[@]}" | tr ' ' '\n' | sort | uniq -u) - -if (( ${#diff_files[@]} )); then - printf "\nFAILURE\n" - echo "Detected MockGen generated files that are not in scripts/mocks.mockgen.source.txt or scripts/mocks.mockgen.txt:" - printf "%s\n" "${diff_files[@]}" - exit 255 -fi - -echo "SUCCESS" diff --git a/scripts/mocks.mockgen.source.txt b/scripts/mocks.mockgen.source.txt deleted file mode 100644 index 10cc5a678ebf..000000000000 --- a/scripts/mocks.mockgen.source.txt +++ /dev/null @@ -1,13 +0,0 @@ -snow/engine/common/sender.go=StateSummarySender,AcceptedStateSummarySender,FrontierSender,AcceptedSender,FetchSender,AppSender,QuerySender,Gossiper=Sender=snow/engine/common/commonmock/sender.go -snow/networking/router/router.go=InternalHandler=Router=snow/networking/router/routermock/router.go -snow/networking/sender/external_sender.go==ExternalSender=snow/networking/sender/sendermock/external_sender.go -vms/avm/block/block.go==MockBlock=vms/avm/block/mock_block.go -vms/avm/block/executor/manager.go==Manager=vms/avm/block/executor/executormock/manager.go -vms/avm/txs/tx.go==UnsignedTx=vms/avm/txs/txsmock/tx.go -vms/platformvm/block/block.go=BanffBlock=MockBlock=vms/platformvm/block/mock_block.go -vms/platformvm/block/executor/manager.go==Manager=vms/platformvm/block/executor/executormock/manager.go -vms/platformvm/signer/signer.go==Signer=vms/platformvm/signer/signermock/signer.go -vms/platformvm/state/diff.go==MockDiff=vms/platformvm/state/mock_diff.go -vms/platformvm/state/state.go=Chain=MockState=vms/platformvm/state/mock_state.go -vms/platformvm/state/state.go=State=MockChain=vms/platformvm/state/mock_chain.go -vms/proposervm/block.go=Block=MockPostForkBlock=vms/proposervm/mock_post_fork_block.go diff --git a/scripts/mocks.mockgen.txt b/scripts/mocks.mockgen.txt deleted file mode 100644 index 97efc98b846e..000000000000 --- a/scripts/mocks.mockgen.txt +++ /dev/null @@ -1,40 +0,0 @@ -github.com/ava-labs/avalanchego/api/server=Server=api/server/servermock/server.go -github.com/ava-labs/avalanchego/chains/atomic=SharedMemory=chains/atomic/atomicmock/shared_memory.go -github.com/ava-labs/avalanchego/codec=Manager=codec/codecmock/manager.go -github.com/ava-labs/avalanchego/database=Batch=database/databasemock/batch.go -github.com/ava-labs/avalanchego/database=Iterator=database/databasemock/iterator.go -github.com/ava-labs/avalanchego/message=OutboundMessage=message/messagemock/outbound_message.go -github.com/ava-labs/avalanchego/message=OutboundMsgBuilder=message/messagemock/outbound_message_builder.go -github.com/ava-labs/avalanchego/snow/consensus/snowman=Block=snow/consensus/snowman/snowmanmock/block.go -github.com/ava-labs/avalanchego/snow/engine/avalanche/vertex=LinearizableVM=snow/engine/avalanche/vertex/vertexmock/linearizable_vm.go -github.com/ava-labs/avalanchego/snow/engine/snowman/block=BuildBlockWithContextChainVM=snow/engine/snowman/block/blockmock/build_block_with_context_chain_vm.go -github.com/ava-labs/avalanchego/snow/engine/snowman/block=ChainVM=snow/engine/snowman/block/blockmock/chain_vm.go -github.com/ava-labs/avalanchego/snow/engine/snowman/block=StateSyncableVM=snow/engine/snowman/block/blockmock/state_syncable_vm.go -github.com/ava-labs/avalanchego/snow/engine/snowman/block=WithVerifyContext=snow/engine/snowman/block/blockmock/with_verify_context.go -github.com/ava-labs/avalanchego/snow/networking/handler=Handler=snow/networking/handler/handlermock/handler.go -github.com/ava-labs/avalanchego/snow/networking/timeout=Manager=snow/networking/timeout/timeoutmock/manager.go -github.com/ava-labs/avalanchego/snow/networking/tracker=Targeter=snow/networking/tracker/trackermock/targeter.go -github.com/ava-labs/avalanchego/snow/networking/tracker=Tracker=snow/networking/tracker/trackermock/tracker.go -github.com/ava-labs/avalanchego/snow/uptime=Calculator=snow/uptime/uptimemock/calculator.go -github.com/ava-labs/avalanchego/snow/validators=State=snow/validators/validatorsmock/state.go -github.com/ava-labs/avalanchego/utils/crypto/keychain=Ledger=utils/crypto/keychain/keychainmock/ledger.go -github.com/ava-labs/avalanchego/utils/filesystem=Reader=utils/filesystem/filesystemmock/reader.go -github.com/ava-labs/avalanchego/utils/hashing=Hasher=utils/hashing/hashingmock/hasher.go -github.com/ava-labs/avalanchego/utils/resource=User=utils/resource/resourcemock/user.go -github.com/ava-labs/avalanchego/vms/avm/metrics=Metrics=vms/avm/metrics/metricsmock/metrics.go -github.com/ava-labs/avalanchego/vms/avm/state=Chain=vms/avm/state/statemock/chain.go -github.com/ava-labs/avalanchego/vms/avm/state=Diff=vms/avm/state/statemock/diff.go -github.com/ava-labs/avalanchego/vms/avm/state=State=vms/avm/state/statemock/state.go -github.com/ava-labs/avalanchego/vms/avm/txs/mempool=Mempool=vms/avm/txs/mempool/mempoolmock/mempool.go -github.com/ava-labs/avalanchego/vms/components/avax=TransferableIn=vms/components/avax/avaxmock/transferable_in.go -github.com/ava-labs/avalanchego/vms/components/verify=Verifiable=vms/components/verify/verifymock/verifiable.go -github.com/ava-labs/avalanchego/vms/platformvm/fx=Fx=vms/platformvm/fx/fxmock/fx.go -github.com/ava-labs/avalanchego/vms/platformvm/txs/mempool=Mempool=vms/platformvm/txs/mempool/mempoolmock/mempool.go -github.com/ava-labs/avalanchego/vms/platformvm/utxo=Verifier=vms/platformvm/utxo/utxomock/verifier.go -github.com/ava-labs/avalanchego/vms/proposervm/proposer=Windower=vms/proposervm/proposer/proposermock/windower.go -github.com/ava-labs/avalanchego/vms/proposervm/scheduler=Scheduler=vms/proposervm/scheduler/schedulermock/scheduler.go -github.com/ava-labs/avalanchego/vms/proposervm/state=State=vms/proposervm/state/statemock/state.go -github.com/ava-labs/avalanchego/vms/registry=VMGetter=vms/registry/registrymock/vm_getter.go -github.com/ava-labs/avalanchego/vms/registry=VMRegistry=vms/registry/registrymock/vm_registry.go -github.com/ava-labs/avalanchego/vms=Factory=vms/vmsmock/factory.go -github.com/ava-labs/avalanchego/vms=Manager=vms/vmsmock/manager.go diff --git a/snow/consensus/snowman/mocks_generate_test.go b/snow/consensus/snowman/mocks_generate_test.go new file mode 100644 index 000000000000..e9cc606bc6e3 --- /dev/null +++ b/snow/consensus/snowman/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package snowman + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/block.go -mock_names=Block=Block . Block diff --git a/snow/consensus/snowman/snowmanmock/block.go b/snow/consensus/snowman/snowmanmock/block.go index e3f179229c77..8ea8341d19d8 100644 --- a/snow/consensus/snowman/snowmanmock/block.go +++ b/snow/consensus/snowman/snowmanmock/block.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=snowmanmock -destination=snow/consensus/snowman/snowmanmock/block.go -mock_names=Block=Block github.com/ava-labs/avalanchego/snow/consensus/snowman Block +// mockgen -package=snowmanmock -destination=snowmanmock/block.go -mock_names=Block=Block . Block // // Package snowmanmock is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type Block struct { ctrl *gomock.Controller recorder *BlockMockRecorder + isgomock struct{} } // BlockMockRecorder is the mock recorder for Block. diff --git a/snow/engine/avalanche/vertex/mocks_generate_test.go b/snow/engine/avalanche/vertex/mocks_generate_test.go new file mode 100644 index 000000000000..dea7ebc1ad0f --- /dev/null +++ b/snow/engine/avalanche/vertex/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package vertex + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/linearizable_vm.go -mock_names=LinearizableVM=LinearizableVM . LinearizableVM diff --git a/snow/engine/avalanche/vertex/vertexmock/linearizable_vm.go b/snow/engine/avalanche/vertex/vertexmock/linearizable_vm.go index 491d25617944..19c2c4290475 100644 --- a/snow/engine/avalanche/vertex/vertexmock/linearizable_vm.go +++ b/snow/engine/avalanche/vertex/vertexmock/linearizable_vm.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=vertexmock -destination=snow/engine/avalanche/vertex/vertexmock/linearizable_vm.go -mock_names=LinearizableVM=LinearizableVM github.com/ava-labs/avalanchego/snow/engine/avalanche/vertex LinearizableVM +// mockgen -package=vertexmock -destination=vertexmock/linearizable_vm.go -mock_names=LinearizableVM=LinearizableVM . LinearizableVM // // Package vertexmock is a generated GoMock package. @@ -29,6 +29,7 @@ import ( type LinearizableVM struct { ctrl *gomock.Controller recorder *LinearizableVMMockRecorder + isgomock struct{} } // LinearizableVMMockRecorder is the mock recorder for LinearizableVM. @@ -49,59 +50,59 @@ func (m *LinearizableVM) EXPECT() *LinearizableVMMockRecorder { } // AppGossip mocks base method. -func (m *LinearizableVM) AppGossip(arg0 context.Context, arg1 ids.NodeID, arg2 []byte) error { +func (m *LinearizableVM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppGossip", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AppGossip", ctx, nodeID, msg) ret0, _ := ret[0].(error) return ret0 } // AppGossip indicates an expected call of AppGossip. -func (mr *LinearizableVMMockRecorder) AppGossip(arg0, arg1, arg2 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) AppGossip(ctx, nodeID, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*LinearizableVM)(nil).AppGossip), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*LinearizableVM)(nil).AppGossip), ctx, nodeID, msg) } // AppRequest mocks base method. -func (m *LinearizableVM) AppRequest(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 time.Time, arg4 []byte) error { +func (m *LinearizableVM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppRequest", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "AppRequest", ctx, nodeID, requestID, deadline, request) ret0, _ := ret[0].(error) return ret0 } // AppRequest indicates an expected call of AppRequest. -func (mr *LinearizableVMMockRecorder) AppRequest(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) AppRequest(ctx, nodeID, requestID, deadline, request any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*LinearizableVM)(nil).AppRequest), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*LinearizableVM)(nil).AppRequest), ctx, nodeID, requestID, deadline, request) } // AppRequestFailed mocks base method. -func (m *LinearizableVM) AppRequestFailed(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 *common.AppError) error { +func (m *LinearizableVM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *common.AppError) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppRequestFailed", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AppRequestFailed", ctx, nodeID, requestID, appErr) ret0, _ := ret[0].(error) return ret0 } // AppRequestFailed indicates an expected call of AppRequestFailed. -func (mr *LinearizableVMMockRecorder) AppRequestFailed(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) AppRequestFailed(ctx, nodeID, requestID, appErr any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequestFailed", reflect.TypeOf((*LinearizableVM)(nil).AppRequestFailed), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequestFailed", reflect.TypeOf((*LinearizableVM)(nil).AppRequestFailed), ctx, nodeID, requestID, appErr) } // AppResponse mocks base method. -func (m *LinearizableVM) AppResponse(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte) error { +func (m *LinearizableVM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppResponse", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AppResponse", ctx, nodeID, requestID, response) ret0, _ := ret[0].(error) return ret0 } // AppResponse indicates an expected call of AppResponse. -func (mr *LinearizableVMMockRecorder) AppResponse(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) AppResponse(ctx, nodeID, requestID, response any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*LinearizableVM)(nil).AppResponse), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*LinearizableVM)(nil).AppResponse), ctx, nodeID, requestID, response) } // BuildBlock mocks base method. @@ -120,17 +121,17 @@ func (mr *LinearizableVMMockRecorder) BuildBlock(arg0 any) *gomock.Call { } // Connected mocks base method. -func (m *LinearizableVM) Connected(arg0 context.Context, arg1 ids.NodeID, arg2 *version.Application) error { +func (m *LinearizableVM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Connected", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Connected", ctx, nodeID, nodeVersion) ret0, _ := ret[0].(error) return ret0 } // Connected indicates an expected call of Connected. -func (mr *LinearizableVMMockRecorder) Connected(arg0, arg1, arg2 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) Connected(ctx, nodeID, nodeVersion any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connected", reflect.TypeOf((*LinearizableVM)(nil).Connected), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connected", reflect.TypeOf((*LinearizableVM)(nil).Connected), ctx, nodeID, nodeVersion) } // CreateHandlers mocks base method. @@ -149,47 +150,47 @@ func (mr *LinearizableVMMockRecorder) CreateHandlers(arg0 any) *gomock.Call { } // Disconnected mocks base method. -func (m *LinearizableVM) Disconnected(arg0 context.Context, arg1 ids.NodeID) error { +func (m *LinearizableVM) Disconnected(ctx context.Context, nodeID ids.NodeID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Disconnected", arg0, arg1) + ret := m.ctrl.Call(m, "Disconnected", ctx, nodeID) ret0, _ := ret[0].(error) return ret0 } // Disconnected indicates an expected call of Disconnected. -func (mr *LinearizableVMMockRecorder) Disconnected(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) Disconnected(ctx, nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnected", reflect.TypeOf((*LinearizableVM)(nil).Disconnected), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnected", reflect.TypeOf((*LinearizableVM)(nil).Disconnected), ctx, nodeID) } // GetBlock mocks base method. -func (m *LinearizableVM) GetBlock(arg0 context.Context, arg1 ids.ID) (snowman.Block, error) { +func (m *LinearizableVM) GetBlock(ctx context.Context, blkID ids.ID) (snowman.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0, arg1) + ret := m.ctrl.Call(m, "GetBlock", ctx, blkID) ret0, _ := ret[0].(snowman.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlock indicates an expected call of GetBlock. -func (mr *LinearizableVMMockRecorder) GetBlock(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) GetBlock(ctx, blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*LinearizableVM)(nil).GetBlock), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*LinearizableVM)(nil).GetBlock), ctx, blkID) } // GetBlockIDAtHeight mocks base method. -func (m *LinearizableVM) GetBlockIDAtHeight(arg0 context.Context, arg1 uint64) (ids.ID, error) { +func (m *LinearizableVM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockIDAtHeight", arg0, arg1) + ret := m.ctrl.Call(m, "GetBlockIDAtHeight", ctx, height) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight. -func (mr *LinearizableVMMockRecorder) GetBlockIDAtHeight(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) GetBlockIDAtHeight(ctx, height any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*LinearizableVM)(nil).GetBlockIDAtHeight), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*LinearizableVM)(nil).GetBlockIDAtHeight), ctx, height) } // HealthCheck mocks base method. @@ -208,17 +209,17 @@ func (mr *LinearizableVMMockRecorder) HealthCheck(arg0 any) *gomock.Call { } // Initialize mocks base method. -func (m *LinearizableVM) Initialize(arg0 context.Context, arg1 *snow.Context, arg2 database.Database, arg3, arg4, arg5 []byte, arg6 chan<- common.Message, arg7 []*common.Fx, arg8 common.AppSender) error { +func (m *LinearizableVM) Initialize(ctx context.Context, chainCtx *snow.Context, db database.Database, genesisBytes, upgradeBytes, configBytes []byte, toEngine chan<- common.Message, fxs []*common.Fx, appSender common.AppSender) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Initialize", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + ret := m.ctrl.Call(m, "Initialize", ctx, chainCtx, db, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender) ret0, _ := ret[0].(error) return ret0 } // Initialize indicates an expected call of Initialize. -func (mr *LinearizableVMMockRecorder) Initialize(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) Initialize(ctx, chainCtx, db, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*LinearizableVM)(nil).Initialize), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*LinearizableVM)(nil).Initialize), ctx, chainCtx, db, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender) } // LastAccepted mocks base method. @@ -237,75 +238,75 @@ func (mr *LinearizableVMMockRecorder) LastAccepted(arg0 any) *gomock.Call { } // Linearize mocks base method. -func (m *LinearizableVM) Linearize(arg0 context.Context, arg1 ids.ID) error { +func (m *LinearizableVM) Linearize(ctx context.Context, stopVertexID ids.ID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Linearize", arg0, arg1) + ret := m.ctrl.Call(m, "Linearize", ctx, stopVertexID) ret0, _ := ret[0].(error) return ret0 } // Linearize indicates an expected call of Linearize. -func (mr *LinearizableVMMockRecorder) Linearize(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) Linearize(ctx, stopVertexID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Linearize", reflect.TypeOf((*LinearizableVM)(nil).Linearize), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Linearize", reflect.TypeOf((*LinearizableVM)(nil).Linearize), ctx, stopVertexID) } // ParseBlock mocks base method. -func (m *LinearizableVM) ParseBlock(arg0 context.Context, arg1 []byte) (snowman.Block, error) { +func (m *LinearizableVM) ParseBlock(ctx context.Context, blockBytes []byte) (snowman.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ParseBlock", arg0, arg1) + ret := m.ctrl.Call(m, "ParseBlock", ctx, blockBytes) ret0, _ := ret[0].(snowman.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // ParseBlock indicates an expected call of ParseBlock. -func (mr *LinearizableVMMockRecorder) ParseBlock(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) ParseBlock(ctx, blockBytes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseBlock", reflect.TypeOf((*LinearizableVM)(nil).ParseBlock), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseBlock", reflect.TypeOf((*LinearizableVM)(nil).ParseBlock), ctx, blockBytes) } // ParseTx mocks base method. -func (m *LinearizableVM) ParseTx(arg0 context.Context, arg1 []byte) (snowstorm.Tx, error) { +func (m *LinearizableVM) ParseTx(ctx context.Context, txBytes []byte) (snowstorm.Tx, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ParseTx", arg0, arg1) + ret := m.ctrl.Call(m, "ParseTx", ctx, txBytes) ret0, _ := ret[0].(snowstorm.Tx) ret1, _ := ret[1].(error) return ret0, ret1 } // ParseTx indicates an expected call of ParseTx. -func (mr *LinearizableVMMockRecorder) ParseTx(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) ParseTx(ctx, txBytes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseTx", reflect.TypeOf((*LinearizableVM)(nil).ParseTx), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseTx", reflect.TypeOf((*LinearizableVM)(nil).ParseTx), ctx, txBytes) } // SetPreference mocks base method. -func (m *LinearizableVM) SetPreference(arg0 context.Context, arg1 ids.ID) error { +func (m *LinearizableVM) SetPreference(ctx context.Context, blkID ids.ID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetPreference", arg0, arg1) + ret := m.ctrl.Call(m, "SetPreference", ctx, blkID) ret0, _ := ret[0].(error) return ret0 } // SetPreference indicates an expected call of SetPreference. -func (mr *LinearizableVMMockRecorder) SetPreference(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) SetPreference(ctx, blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreference", reflect.TypeOf((*LinearizableVM)(nil).SetPreference), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreference", reflect.TypeOf((*LinearizableVM)(nil).SetPreference), ctx, blkID) } // SetState mocks base method. -func (m *LinearizableVM) SetState(arg0 context.Context, arg1 snow.State) error { +func (m *LinearizableVM) SetState(ctx context.Context, state snow.State) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetState", arg0, arg1) + ret := m.ctrl.Call(m, "SetState", ctx, state) ret0, _ := ret[0].(error) return ret0 } // SetState indicates an expected call of SetState. -func (mr *LinearizableVMMockRecorder) SetState(arg0, arg1 any) *gomock.Call { +func (mr *LinearizableVMMockRecorder) SetState(ctx, state any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*LinearizableVM)(nil).SetState), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*LinearizableVM)(nil).SetState), ctx, state) } // Shutdown mocks base method. diff --git a/snow/engine/common/commonmock/sender.go b/snow/engine/common/commonmock/sender.go index 80aad6a2f6ce..e4eefe806d9b 100644 --- a/snow/engine/common/commonmock/sender.go +++ b/snow/engine/common/commonmock/sender.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: snow/engine/common/sender.go +// Source: github.com/ava-labs/avalanchego/snow/engine/common (interfaces: Sender) // // Generated by this command: // -// mockgen -source=snow/engine/common/sender.go -destination=snow/engine/common/commonmock/sender.go -package=commonmock -exclude_interfaces=StateSummarySender,AcceptedStateSummarySender,FrontierSender,AcceptedSender,FetchSender,AppSender,QuerySender,Gossiper -mock_names=Sender=Sender +// mockgen -package=commonmock -destination=commonmock/sender.go -mock_names=Sender=Sender . Sender // // Package commonmock is a generated GoMock package. @@ -23,6 +23,7 @@ import ( type Sender struct { ctrl *gomock.Controller recorder *SenderMockRecorder + isgomock struct{} } // SenderMockRecorder is the mock recorder for Sender. diff --git a/snow/engine/common/mocks_generate_test.go b/snow/engine/common/mocks_generate_test.go new file mode 100644 index 000000000000..1c925d3da539 --- /dev/null +++ b/snow/engine/common/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package common + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/sender.go -mock_names=Sender=Sender . Sender diff --git a/snow/engine/snowman/block/blockmock/build_block_with_context_chain_vm.go b/snow/engine/snowman/block/blockmock/build_block_with_context_chain_vm.go index 5106fef25848..b610d2d346d2 100644 --- a/snow/engine/snowman/block/blockmock/build_block_with_context_chain_vm.go +++ b/snow/engine/snowman/block/blockmock/build_block_with_context_chain_vm.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=blockmock -destination=snow/engine/snowman/block/blockmock/build_block_with_context_chain_vm.go -mock_names=BuildBlockWithContextChainVM=BuildBlockWithContextChainVM github.com/ava-labs/avalanchego/snow/engine/snowman/block BuildBlockWithContextChainVM +// mockgen -package=blockmock -destination=blockmock/build_block_with_context_chain_vm.go -mock_names=BuildBlockWithContextChainVM=BuildBlockWithContextChainVM . BuildBlockWithContextChainVM // // Package blockmock is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type BuildBlockWithContextChainVM struct { ctrl *gomock.Controller recorder *BuildBlockWithContextChainVMMockRecorder + isgomock struct{} } // BuildBlockWithContextChainVMMockRecorder is the mock recorder for BuildBlockWithContextChainVM. @@ -42,16 +43,16 @@ func (m *BuildBlockWithContextChainVM) EXPECT() *BuildBlockWithContextChainVMMoc } // BuildBlockWithContext mocks base method. -func (m *BuildBlockWithContextChainVM) BuildBlockWithContext(arg0 context.Context, arg1 *block.Context) (snowman.Block, error) { +func (m *BuildBlockWithContextChainVM) BuildBlockWithContext(ctx context.Context, blockCtx *block.Context) (snowman.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BuildBlockWithContext", arg0, arg1) + ret := m.ctrl.Call(m, "BuildBlockWithContext", ctx, blockCtx) ret0, _ := ret[0].(snowman.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // BuildBlockWithContext indicates an expected call of BuildBlockWithContext. -func (mr *BuildBlockWithContextChainVMMockRecorder) BuildBlockWithContext(arg0, arg1 any) *gomock.Call { +func (mr *BuildBlockWithContextChainVMMockRecorder) BuildBlockWithContext(ctx, blockCtx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildBlockWithContext", reflect.TypeOf((*BuildBlockWithContextChainVM)(nil).BuildBlockWithContext), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildBlockWithContext", reflect.TypeOf((*BuildBlockWithContextChainVM)(nil).BuildBlockWithContext), ctx, blockCtx) } diff --git a/snow/engine/snowman/block/blockmock/chain_vm.go b/snow/engine/snowman/block/blockmock/chain_vm.go index 5dc21630bb11..051287561454 100644 --- a/snow/engine/snowman/block/blockmock/chain_vm.go +++ b/snow/engine/snowman/block/blockmock/chain_vm.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=blockmock -destination=snow/engine/snowman/block/blockmock/chain_vm.go -mock_names=ChainVM=ChainVM github.com/ava-labs/avalanchego/snow/engine/snowman/block ChainVM +// mockgen -package=blockmock -destination=blockmock/chain_vm.go -mock_names=ChainVM=ChainVM . ChainVM // // Package blockmock is a generated GoMock package. @@ -28,6 +28,7 @@ import ( type ChainVM struct { ctrl *gomock.Controller recorder *ChainVMMockRecorder + isgomock struct{} } // ChainVMMockRecorder is the mock recorder for ChainVM. @@ -48,59 +49,59 @@ func (m *ChainVM) EXPECT() *ChainVMMockRecorder { } // AppGossip mocks base method. -func (m *ChainVM) AppGossip(arg0 context.Context, arg1 ids.NodeID, arg2 []byte) error { +func (m *ChainVM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppGossip", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AppGossip", ctx, nodeID, msg) ret0, _ := ret[0].(error) return ret0 } // AppGossip indicates an expected call of AppGossip. -func (mr *ChainVMMockRecorder) AppGossip(arg0, arg1, arg2 any) *gomock.Call { +func (mr *ChainVMMockRecorder) AppGossip(ctx, nodeID, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*ChainVM)(nil).AppGossip), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*ChainVM)(nil).AppGossip), ctx, nodeID, msg) } // AppRequest mocks base method. -func (m *ChainVM) AppRequest(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 time.Time, arg4 []byte) error { +func (m *ChainVM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppRequest", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "AppRequest", ctx, nodeID, requestID, deadline, request) ret0, _ := ret[0].(error) return ret0 } // AppRequest indicates an expected call of AppRequest. -func (mr *ChainVMMockRecorder) AppRequest(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *ChainVMMockRecorder) AppRequest(ctx, nodeID, requestID, deadline, request any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*ChainVM)(nil).AppRequest), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*ChainVM)(nil).AppRequest), ctx, nodeID, requestID, deadline, request) } // AppRequestFailed mocks base method. -func (m *ChainVM) AppRequestFailed(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 *common.AppError) error { +func (m *ChainVM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *common.AppError) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppRequestFailed", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AppRequestFailed", ctx, nodeID, requestID, appErr) ret0, _ := ret[0].(error) return ret0 } // AppRequestFailed indicates an expected call of AppRequestFailed. -func (mr *ChainVMMockRecorder) AppRequestFailed(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *ChainVMMockRecorder) AppRequestFailed(ctx, nodeID, requestID, appErr any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequestFailed", reflect.TypeOf((*ChainVM)(nil).AppRequestFailed), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequestFailed", reflect.TypeOf((*ChainVM)(nil).AppRequestFailed), ctx, nodeID, requestID, appErr) } // AppResponse mocks base method. -func (m *ChainVM) AppResponse(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte) error { +func (m *ChainVM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppResponse", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "AppResponse", ctx, nodeID, requestID, response) ret0, _ := ret[0].(error) return ret0 } // AppResponse indicates an expected call of AppResponse. -func (mr *ChainVMMockRecorder) AppResponse(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *ChainVMMockRecorder) AppResponse(ctx, nodeID, requestID, response any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*ChainVM)(nil).AppResponse), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*ChainVM)(nil).AppResponse), ctx, nodeID, requestID, response) } // BuildBlock mocks base method. @@ -119,17 +120,17 @@ func (mr *ChainVMMockRecorder) BuildBlock(arg0 any) *gomock.Call { } // Connected mocks base method. -func (m *ChainVM) Connected(arg0 context.Context, arg1 ids.NodeID, arg2 *version.Application) error { +func (m *ChainVM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Connected", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Connected", ctx, nodeID, nodeVersion) ret0, _ := ret[0].(error) return ret0 } // Connected indicates an expected call of Connected. -func (mr *ChainVMMockRecorder) Connected(arg0, arg1, arg2 any) *gomock.Call { +func (mr *ChainVMMockRecorder) Connected(ctx, nodeID, nodeVersion any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connected", reflect.TypeOf((*ChainVM)(nil).Connected), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connected", reflect.TypeOf((*ChainVM)(nil).Connected), ctx, nodeID, nodeVersion) } // CreateHandlers mocks base method. @@ -148,47 +149,47 @@ func (mr *ChainVMMockRecorder) CreateHandlers(arg0 any) *gomock.Call { } // Disconnected mocks base method. -func (m *ChainVM) Disconnected(arg0 context.Context, arg1 ids.NodeID) error { +func (m *ChainVM) Disconnected(ctx context.Context, nodeID ids.NodeID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Disconnected", arg0, arg1) + ret := m.ctrl.Call(m, "Disconnected", ctx, nodeID) ret0, _ := ret[0].(error) return ret0 } // Disconnected indicates an expected call of Disconnected. -func (mr *ChainVMMockRecorder) Disconnected(arg0, arg1 any) *gomock.Call { +func (mr *ChainVMMockRecorder) Disconnected(ctx, nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnected", reflect.TypeOf((*ChainVM)(nil).Disconnected), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnected", reflect.TypeOf((*ChainVM)(nil).Disconnected), ctx, nodeID) } // GetBlock mocks base method. -func (m *ChainVM) GetBlock(arg0 context.Context, arg1 ids.ID) (snowman.Block, error) { +func (m *ChainVM) GetBlock(ctx context.Context, blkID ids.ID) (snowman.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0, arg1) + ret := m.ctrl.Call(m, "GetBlock", ctx, blkID) ret0, _ := ret[0].(snowman.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlock indicates an expected call of GetBlock. -func (mr *ChainVMMockRecorder) GetBlock(arg0, arg1 any) *gomock.Call { +func (mr *ChainVMMockRecorder) GetBlock(ctx, blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*ChainVM)(nil).GetBlock), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*ChainVM)(nil).GetBlock), ctx, blkID) } // GetBlockIDAtHeight mocks base method. -func (m *ChainVM) GetBlockIDAtHeight(arg0 context.Context, arg1 uint64) (ids.ID, error) { +func (m *ChainVM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockIDAtHeight", arg0, arg1) + ret := m.ctrl.Call(m, "GetBlockIDAtHeight", ctx, height) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight. -func (mr *ChainVMMockRecorder) GetBlockIDAtHeight(arg0, arg1 any) *gomock.Call { +func (mr *ChainVMMockRecorder) GetBlockIDAtHeight(ctx, height any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*ChainVM)(nil).GetBlockIDAtHeight), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*ChainVM)(nil).GetBlockIDAtHeight), ctx, height) } // HealthCheck mocks base method. @@ -207,17 +208,17 @@ func (mr *ChainVMMockRecorder) HealthCheck(arg0 any) *gomock.Call { } // Initialize mocks base method. -func (m *ChainVM) Initialize(arg0 context.Context, arg1 *snow.Context, arg2 database.Database, arg3, arg4, arg5 []byte, arg6 chan<- common.Message, arg7 []*common.Fx, arg8 common.AppSender) error { +func (m *ChainVM) Initialize(ctx context.Context, chainCtx *snow.Context, db database.Database, genesisBytes, upgradeBytes, configBytes []byte, toEngine chan<- common.Message, fxs []*common.Fx, appSender common.AppSender) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Initialize", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + ret := m.ctrl.Call(m, "Initialize", ctx, chainCtx, db, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender) ret0, _ := ret[0].(error) return ret0 } // Initialize indicates an expected call of Initialize. -func (mr *ChainVMMockRecorder) Initialize(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 any) *gomock.Call { +func (mr *ChainVMMockRecorder) Initialize(ctx, chainCtx, db, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*ChainVM)(nil).Initialize), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*ChainVM)(nil).Initialize), ctx, chainCtx, db, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender) } // LastAccepted mocks base method. @@ -236,46 +237,46 @@ func (mr *ChainVMMockRecorder) LastAccepted(arg0 any) *gomock.Call { } // ParseBlock mocks base method. -func (m *ChainVM) ParseBlock(arg0 context.Context, arg1 []byte) (snowman.Block, error) { +func (m *ChainVM) ParseBlock(ctx context.Context, blockBytes []byte) (snowman.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ParseBlock", arg0, arg1) + ret := m.ctrl.Call(m, "ParseBlock", ctx, blockBytes) ret0, _ := ret[0].(snowman.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // ParseBlock indicates an expected call of ParseBlock. -func (mr *ChainVMMockRecorder) ParseBlock(arg0, arg1 any) *gomock.Call { +func (mr *ChainVMMockRecorder) ParseBlock(ctx, blockBytes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseBlock", reflect.TypeOf((*ChainVM)(nil).ParseBlock), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseBlock", reflect.TypeOf((*ChainVM)(nil).ParseBlock), ctx, blockBytes) } // SetPreference mocks base method. -func (m *ChainVM) SetPreference(arg0 context.Context, arg1 ids.ID) error { +func (m *ChainVM) SetPreference(ctx context.Context, blkID ids.ID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetPreference", arg0, arg1) + ret := m.ctrl.Call(m, "SetPreference", ctx, blkID) ret0, _ := ret[0].(error) return ret0 } // SetPreference indicates an expected call of SetPreference. -func (mr *ChainVMMockRecorder) SetPreference(arg0, arg1 any) *gomock.Call { +func (mr *ChainVMMockRecorder) SetPreference(ctx, blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreference", reflect.TypeOf((*ChainVM)(nil).SetPreference), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreference", reflect.TypeOf((*ChainVM)(nil).SetPreference), ctx, blkID) } // SetState mocks base method. -func (m *ChainVM) SetState(arg0 context.Context, arg1 snow.State) error { +func (m *ChainVM) SetState(ctx context.Context, state snow.State) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetState", arg0, arg1) + ret := m.ctrl.Call(m, "SetState", ctx, state) ret0, _ := ret[0].(error) return ret0 } // SetState indicates an expected call of SetState. -func (mr *ChainVMMockRecorder) SetState(arg0, arg1 any) *gomock.Call { +func (mr *ChainVMMockRecorder) SetState(ctx, state any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*ChainVM)(nil).SetState), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*ChainVM)(nil).SetState), ctx, state) } // Shutdown mocks base method. diff --git a/snow/engine/snowman/block/blockmock/state_syncable_vm.go b/snow/engine/snowman/block/blockmock/state_syncable_vm.go index cd44c7c8c7fa..62bf9042523f 100644 --- a/snow/engine/snowman/block/blockmock/state_syncable_vm.go +++ b/snow/engine/snowman/block/blockmock/state_syncable_vm.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=blockmock -destination=snow/engine/snowman/block/blockmock/state_syncable_vm.go -mock_names=StateSyncableVM=StateSyncableVM github.com/ava-labs/avalanchego/snow/engine/snowman/block StateSyncableVM +// mockgen -package=blockmock -destination=blockmock/state_syncable_vm.go -mock_names=StateSyncableVM=StateSyncableVM . StateSyncableVM // // Package blockmock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type StateSyncableVM struct { ctrl *gomock.Controller recorder *StateSyncableVMMockRecorder + isgomock struct{} } // StateSyncableVMMockRecorder is the mock recorder for StateSyncableVM. @@ -71,33 +72,33 @@ func (mr *StateSyncableVMMockRecorder) GetOngoingSyncStateSummary(arg0 any) *gom } // GetStateSummary mocks base method. -func (m *StateSyncableVM) GetStateSummary(arg0 context.Context, arg1 uint64) (block.StateSummary, error) { +func (m *StateSyncableVM) GetStateSummary(ctx context.Context, summaryHeight uint64) (block.StateSummary, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStateSummary", arg0, arg1) + ret := m.ctrl.Call(m, "GetStateSummary", ctx, summaryHeight) ret0, _ := ret[0].(block.StateSummary) ret1, _ := ret[1].(error) return ret0, ret1 } // GetStateSummary indicates an expected call of GetStateSummary. -func (mr *StateSyncableVMMockRecorder) GetStateSummary(arg0, arg1 any) *gomock.Call { +func (mr *StateSyncableVMMockRecorder) GetStateSummary(ctx, summaryHeight any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStateSummary", reflect.TypeOf((*StateSyncableVM)(nil).GetStateSummary), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStateSummary", reflect.TypeOf((*StateSyncableVM)(nil).GetStateSummary), ctx, summaryHeight) } // ParseStateSummary mocks base method. -func (m *StateSyncableVM) ParseStateSummary(arg0 context.Context, arg1 []byte) (block.StateSummary, error) { +func (m *StateSyncableVM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ParseStateSummary", arg0, arg1) + ret := m.ctrl.Call(m, "ParseStateSummary", ctx, summaryBytes) ret0, _ := ret[0].(block.StateSummary) ret1, _ := ret[1].(error) return ret0, ret1 } // ParseStateSummary indicates an expected call of ParseStateSummary. -func (mr *StateSyncableVMMockRecorder) ParseStateSummary(arg0, arg1 any) *gomock.Call { +func (mr *StateSyncableVMMockRecorder) ParseStateSummary(ctx, summaryBytes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseStateSummary", reflect.TypeOf((*StateSyncableVM)(nil).ParseStateSummary), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseStateSummary", reflect.TypeOf((*StateSyncableVM)(nil).ParseStateSummary), ctx, summaryBytes) } // StateSyncEnabled mocks base method. diff --git a/snow/engine/snowman/block/blockmock/with_verify_context.go b/snow/engine/snowman/block/blockmock/with_verify_context.go index 03b52475e13b..bded762c2aa5 100644 --- a/snow/engine/snowman/block/blockmock/with_verify_context.go +++ b/snow/engine/snowman/block/blockmock/with_verify_context.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=blockmock -destination=snow/engine/snowman/block/blockmock/with_verify_context.go -mock_names=WithVerifyContext=WithVerifyContext github.com/ava-labs/avalanchego/snow/engine/snowman/block WithVerifyContext +// mockgen -package=blockmock -destination=blockmock/with_verify_context.go -mock_names=WithVerifyContext=WithVerifyContext . WithVerifyContext // // Package blockmock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type WithVerifyContext struct { ctrl *gomock.Controller recorder *WithVerifyContextMockRecorder + isgomock struct{} } // WithVerifyContextMockRecorder is the mock recorder for WithVerifyContext. diff --git a/snow/engine/snowman/block/mocks_generate_test.go b/snow/engine/snowman/block/mocks_generate_test.go new file mode 100644 index 000000000000..3abb5303146a --- /dev/null +++ b/snow/engine/snowman/block/mocks_generate_test.go @@ -0,0 +1,9 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package block + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/build_block_with_context_chain_vm.go -mock_names=BuildBlockWithContextChainVM=BuildBlockWithContextChainVM . BuildBlockWithContextChainVM +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/chain_vm.go -mock_names=ChainVM=ChainVM . ChainVM +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/state_syncable_vm.go -mock_names=StateSyncableVM=StateSyncableVM . StateSyncableVM +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/with_verify_context.go -mock_names=WithVerifyContext=WithVerifyContext . WithVerifyContext diff --git a/snow/networking/handler/handlermock/handler.go b/snow/networking/handler/handlermock/handler.go index 71d58ce7d090..ba444f2015c6 100644 --- a/snow/networking/handler/handlermock/handler.go +++ b/snow/networking/handler/handlermock/handler.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=handlermock -destination=snow/networking/handler/handlermock/handler.go -mock_names=Handler=Handler github.com/ava-labs/avalanchego/snow/networking/handler Handler +// mockgen -package=handlermock -destination=handlermock/handler.go -mock_names=Handler=Handler . Handler // // Package handlermock is a generated GoMock package. @@ -24,6 +24,7 @@ import ( type Handler struct { ctrl *gomock.Controller recorder *HandlerMockRecorder + isgomock struct{} } // HandlerMockRecorder is the mock recorder for Handler. @@ -44,18 +45,18 @@ func (m *Handler) EXPECT() *HandlerMockRecorder { } // AwaitStopped mocks base method. -func (m *Handler) AwaitStopped(arg0 context.Context) (time.Duration, error) { +func (m *Handler) AwaitStopped(ctx context.Context) (time.Duration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AwaitStopped", arg0) + ret := m.ctrl.Call(m, "AwaitStopped", ctx) ret0, _ := ret[0].(time.Duration) ret1, _ := ret[1].(error) return ret0, ret1 } // AwaitStopped indicates an expected call of AwaitStopped. -func (mr *HandlerMockRecorder) AwaitStopped(arg0 any) *gomock.Call { +func (mr *HandlerMockRecorder) AwaitStopped(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AwaitStopped", reflect.TypeOf((*Handler)(nil).AwaitStopped), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AwaitStopped", reflect.TypeOf((*Handler)(nil).AwaitStopped), ctx) } // Context mocks base method. @@ -116,87 +117,87 @@ func (mr *HandlerMockRecorder) Len() *gomock.Call { } // Push mocks base method. -func (m *Handler) Push(arg0 context.Context, arg1 handler.Message) { +func (m *Handler) Push(ctx context.Context, msg handler.Message) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Push", arg0, arg1) + m.ctrl.Call(m, "Push", ctx, msg) } // Push indicates an expected call of Push. -func (mr *HandlerMockRecorder) Push(arg0, arg1 any) *gomock.Call { +func (mr *HandlerMockRecorder) Push(ctx, msg any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Push", reflect.TypeOf((*Handler)(nil).Push), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Push", reflect.TypeOf((*Handler)(nil).Push), ctx, msg) } // SetEngineManager mocks base method. -func (m *Handler) SetEngineManager(arg0 *handler.EngineManager) { +func (m *Handler) SetEngineManager(engineManager *handler.EngineManager) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetEngineManager", arg0) + m.ctrl.Call(m, "SetEngineManager", engineManager) } // SetEngineManager indicates an expected call of SetEngineManager. -func (mr *HandlerMockRecorder) SetEngineManager(arg0 any) *gomock.Call { +func (mr *HandlerMockRecorder) SetEngineManager(engineManager any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEngineManager", reflect.TypeOf((*Handler)(nil).SetEngineManager), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEngineManager", reflect.TypeOf((*Handler)(nil).SetEngineManager), engineManager) } // SetOnStopped mocks base method. -func (m *Handler) SetOnStopped(arg0 func()) { +func (m *Handler) SetOnStopped(onStopped func()) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetOnStopped", arg0) + m.ctrl.Call(m, "SetOnStopped", onStopped) } // SetOnStopped indicates an expected call of SetOnStopped. -func (mr *HandlerMockRecorder) SetOnStopped(arg0 any) *gomock.Call { +func (mr *HandlerMockRecorder) SetOnStopped(onStopped any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetOnStopped", reflect.TypeOf((*Handler)(nil).SetOnStopped), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetOnStopped", reflect.TypeOf((*Handler)(nil).SetOnStopped), onStopped) } // ShouldHandle mocks base method. -func (m *Handler) ShouldHandle(arg0 ids.NodeID) bool { +func (m *Handler) ShouldHandle(nodeID ids.NodeID) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShouldHandle", arg0) + ret := m.ctrl.Call(m, "ShouldHandle", nodeID) ret0, _ := ret[0].(bool) return ret0 } // ShouldHandle indicates an expected call of ShouldHandle. -func (mr *HandlerMockRecorder) ShouldHandle(arg0 any) *gomock.Call { +func (mr *HandlerMockRecorder) ShouldHandle(nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldHandle", reflect.TypeOf((*Handler)(nil).ShouldHandle), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldHandle", reflect.TypeOf((*Handler)(nil).ShouldHandle), nodeID) } // Start mocks base method. -func (m *Handler) Start(arg0 context.Context, arg1 bool) { +func (m *Handler) Start(ctx context.Context, recoverPanic bool) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Start", arg0, arg1) + m.ctrl.Call(m, "Start", ctx, recoverPanic) } // Start indicates an expected call of Start. -func (mr *HandlerMockRecorder) Start(arg0, arg1 any) *gomock.Call { +func (mr *HandlerMockRecorder) Start(ctx, recoverPanic any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*Handler)(nil).Start), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*Handler)(nil).Start), ctx, recoverPanic) } // Stop mocks base method. -func (m *Handler) Stop(arg0 context.Context) { +func (m *Handler) Stop(ctx context.Context) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Stop", arg0) + m.ctrl.Call(m, "Stop", ctx) } // Stop indicates an expected call of Stop. -func (mr *HandlerMockRecorder) Stop(arg0 any) *gomock.Call { +func (mr *HandlerMockRecorder) Stop(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*Handler)(nil).Stop), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*Handler)(nil).Stop), ctx) } // StopWithError mocks base method. -func (m *Handler) StopWithError(arg0 context.Context, arg1 error) { +func (m *Handler) StopWithError(ctx context.Context, err error) { m.ctrl.T.Helper() - m.ctrl.Call(m, "StopWithError", arg0, arg1) + m.ctrl.Call(m, "StopWithError", ctx, err) } // StopWithError indicates an expected call of StopWithError. -func (mr *HandlerMockRecorder) StopWithError(arg0, arg1 any) *gomock.Call { +func (mr *HandlerMockRecorder) StopWithError(ctx, err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopWithError", reflect.TypeOf((*Handler)(nil).StopWithError), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopWithError", reflect.TypeOf((*Handler)(nil).StopWithError), ctx, err) } diff --git a/snow/networking/handler/mocks_generate_test.go b/snow/networking/handler/mocks_generate_test.go new file mode 100644 index 000000000000..e7898ea19fdc --- /dev/null +++ b/snow/networking/handler/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package handler + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/handler.go -mock_names=Handler=Handler . Handler diff --git a/snow/networking/router/mocks_generate_test.go b/snow/networking/router/mocks_generate_test.go new file mode 100644 index 000000000000..0d6814973d90 --- /dev/null +++ b/snow/networking/router/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package router + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/router.go -mock_names=Router=Router . Router diff --git a/snow/networking/router/routermock/router.go b/snow/networking/router/routermock/router.go index 8d0610ac5f88..9f6975becf71 100644 --- a/snow/networking/router/routermock/router.go +++ b/snow/networking/router/routermock/router.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: snow/networking/router/router.go +// Source: github.com/ava-labs/avalanchego/snow/networking/router (interfaces: Router) // // Generated by this command: // -// mockgen -source=snow/networking/router/router.go -destination=snow/networking/router/routermock/router.go -package=routermock -exclude_interfaces=InternalHandler -mock_names=Router=Router +// mockgen -package=routermock -destination=routermock/router.go -mock_names=Router=Router . Router // // Package routermock is a generated GoMock package. @@ -31,6 +31,7 @@ import ( type Router struct { ctrl *gomock.Controller recorder *RouterMockRecorder + isgomock struct{} } // RouterMockRecorder is the mock recorder for Router. diff --git a/snow/networking/sender/mocks_generate_test.go b/snow/networking/sender/mocks_generate_test.go new file mode 100644 index 000000000000..9f2ea6cf995e --- /dev/null +++ b/snow/networking/sender/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package sender + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/external_sender.go -mock_names=ExternalSender=ExternalSender . ExternalSender diff --git a/snow/networking/sender/sendermock/external_sender.go b/snow/networking/sender/sendermock/external_sender.go index bdef54250909..042e6d664afe 100644 --- a/snow/networking/sender/sendermock/external_sender.go +++ b/snow/networking/sender/sendermock/external_sender.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: snow/networking/sender/external_sender.go +// Source: github.com/ava-labs/avalanchego/snow/networking/sender (interfaces: ExternalSender) // // Generated by this command: // -// mockgen -source=snow/networking/sender/external_sender.go -destination=snow/networking/sender/sendermock/external_sender.go -package=sendermock -exclude_interfaces= -mock_names=ExternalSender=ExternalSender +// mockgen -package=sendermock -destination=sendermock/external_sender.go -mock_names=ExternalSender=ExternalSender . ExternalSender // // Package sendermock is a generated GoMock package. @@ -24,6 +24,7 @@ import ( type ExternalSender struct { ctrl *gomock.Controller recorder *ExternalSenderMockRecorder + isgomock struct{} } // ExternalSenderMockRecorder is the mock recorder for ExternalSender. diff --git a/snow/networking/timeout/mocks_generate_test.go b/snow/networking/timeout/mocks_generate_test.go new file mode 100644 index 000000000000..f1f3460a0052 --- /dev/null +++ b/snow/networking/timeout/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package timeout + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager diff --git a/snow/networking/timeout/timeoutmock/manager.go b/snow/networking/timeout/timeoutmock/manager.go index 317336cc7a64..7f7ce2aee3a9 100644 --- a/snow/networking/timeout/timeoutmock/manager.go +++ b/snow/networking/timeout/timeoutmock/manager.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=timeoutmock -destination=snow/networking/timeout/timeoutmock/manager.go -mock_names=Manager=Manager github.com/ava-labs/avalanchego/snow/networking/timeout Manager +// mockgen -package=timeoutmock -destination=timeoutmock/manager.go -mock_names=Manager=Manager . Manager // // Package timeoutmock is a generated GoMock package. @@ -23,6 +23,7 @@ import ( type Manager struct { ctrl *gomock.Controller recorder *ManagerMockRecorder + isgomock struct{} } // ManagerMockRecorder is the mock recorder for Manager. @@ -55,43 +56,43 @@ func (mr *ManagerMockRecorder) Dispatch() *gomock.Call { } // IsBenched mocks base method. -func (m *Manager) IsBenched(arg0 ids.NodeID, arg1 ids.ID) bool { +func (m *Manager) IsBenched(nodeID ids.NodeID, chainID ids.ID) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsBenched", arg0, arg1) + ret := m.ctrl.Call(m, "IsBenched", nodeID, chainID) ret0, _ := ret[0].(bool) return ret0 } // IsBenched indicates an expected call of IsBenched. -func (mr *ManagerMockRecorder) IsBenched(arg0, arg1 any) *gomock.Call { +func (mr *ManagerMockRecorder) IsBenched(nodeID, chainID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBenched", reflect.TypeOf((*Manager)(nil).IsBenched), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBenched", reflect.TypeOf((*Manager)(nil).IsBenched), nodeID, chainID) } // RegisterChain mocks base method. -func (m *Manager) RegisterChain(arg0 *snow.ConsensusContext) error { +func (m *Manager) RegisterChain(ctx *snow.ConsensusContext) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegisterChain", arg0) + ret := m.ctrl.Call(m, "RegisterChain", ctx) ret0, _ := ret[0].(error) return ret0 } // RegisterChain indicates an expected call of RegisterChain. -func (mr *ManagerMockRecorder) RegisterChain(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) RegisterChain(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterChain", reflect.TypeOf((*Manager)(nil).RegisterChain), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterChain", reflect.TypeOf((*Manager)(nil).RegisterChain), ctx) } // RegisterRequest mocks base method. -func (m *Manager) RegisterRequest(arg0 ids.NodeID, arg1 ids.ID, arg2 bool, arg3 ids.RequestID, arg4 func()) { +func (m *Manager) RegisterRequest(nodeID ids.NodeID, chainID ids.ID, measureLatency bool, requestID ids.RequestID, timeoutHandler func()) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterRequest", arg0, arg1, arg2, arg3, arg4) + m.ctrl.Call(m, "RegisterRequest", nodeID, chainID, measureLatency, requestID, timeoutHandler) } // RegisterRequest indicates an expected call of RegisterRequest. -func (mr *ManagerMockRecorder) RegisterRequest(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *ManagerMockRecorder) RegisterRequest(nodeID, chainID, measureLatency, requestID, timeoutHandler any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRequest", reflect.TypeOf((*Manager)(nil).RegisterRequest), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRequest", reflect.TypeOf((*Manager)(nil).RegisterRequest), nodeID, chainID, measureLatency, requestID, timeoutHandler) } // RegisterRequestToUnreachableValidator mocks base method. @@ -107,27 +108,27 @@ func (mr *ManagerMockRecorder) RegisterRequestToUnreachableValidator() *gomock.C } // RegisterResponse mocks base method. -func (m *Manager) RegisterResponse(arg0 ids.NodeID, arg1 ids.ID, arg2 ids.RequestID, arg3 message.Op, arg4 time.Duration) { +func (m *Manager) RegisterResponse(nodeID ids.NodeID, chainID ids.ID, requestID ids.RequestID, op message.Op, latency time.Duration) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RegisterResponse", arg0, arg1, arg2, arg3, arg4) + m.ctrl.Call(m, "RegisterResponse", nodeID, chainID, requestID, op, latency) } // RegisterResponse indicates an expected call of RegisterResponse. -func (mr *ManagerMockRecorder) RegisterResponse(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *ManagerMockRecorder) RegisterResponse(nodeID, chainID, requestID, op, latency any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterResponse", reflect.TypeOf((*Manager)(nil).RegisterResponse), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterResponse", reflect.TypeOf((*Manager)(nil).RegisterResponse), nodeID, chainID, requestID, op, latency) } // RemoveRequest mocks base method. -func (m *Manager) RemoveRequest(arg0 ids.RequestID) { +func (m *Manager) RemoveRequest(requestID ids.RequestID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RemoveRequest", arg0) + m.ctrl.Call(m, "RemoveRequest", requestID) } // RemoveRequest indicates an expected call of RemoveRequest. -func (mr *ManagerMockRecorder) RemoveRequest(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) RemoveRequest(requestID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRequest", reflect.TypeOf((*Manager)(nil).RemoveRequest), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRequest", reflect.TypeOf((*Manager)(nil).RemoveRequest), requestID) } // Stop mocks base method. diff --git a/snow/networking/tracker/mocks_generate_test.go b/snow/networking/tracker/mocks_generate_test.go new file mode 100644 index 000000000000..8594217563e6 --- /dev/null +++ b/snow/networking/tracker/mocks_generate_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package tracker + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/targeter.go -mock_names=Targeter=Targeter . Targeter +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/tracker.go -mock_names=Tracker=Tracker . Tracker diff --git a/snow/networking/tracker/trackermock/targeter.go b/snow/networking/tracker/trackermock/targeter.go index 81bf539b3c96..b8d7e4551703 100644 --- a/snow/networking/tracker/trackermock/targeter.go +++ b/snow/networking/tracker/trackermock/targeter.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=trackermock -destination=snow/networking/tracker/trackermock/targeter.go -mock_names=Targeter=Targeter github.com/ava-labs/avalanchego/snow/networking/tracker Targeter +// mockgen -package=trackermock -destination=trackermock/targeter.go -mock_names=Targeter=Targeter . Targeter // // Package trackermock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Targeter struct { ctrl *gomock.Controller recorder *TargeterMockRecorder + isgomock struct{} } // TargeterMockRecorder is the mock recorder for Targeter. @@ -40,15 +41,15 @@ func (m *Targeter) EXPECT() *TargeterMockRecorder { } // TargetUsage mocks base method. -func (m *Targeter) TargetUsage(arg0 ids.NodeID) float64 { +func (m *Targeter) TargetUsage(nodeID ids.NodeID) float64 { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TargetUsage", arg0) + ret := m.ctrl.Call(m, "TargetUsage", nodeID) ret0, _ := ret[0].(float64) return ret0 } // TargetUsage indicates an expected call of TargetUsage. -func (mr *TargeterMockRecorder) TargetUsage(arg0 any) *gomock.Call { +func (mr *TargeterMockRecorder) TargetUsage(nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TargetUsage", reflect.TypeOf((*Targeter)(nil).TargetUsage), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TargetUsage", reflect.TypeOf((*Targeter)(nil).TargetUsage), nodeID) } diff --git a/snow/networking/tracker/trackermock/tracker.go b/snow/networking/tracker/trackermock/tracker.go index 9c8aaa178d64..e76959541e86 100644 --- a/snow/networking/tracker/trackermock/tracker.go +++ b/snow/networking/tracker/trackermock/tracker.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=trackermock -destination=snow/networking/tracker/trackermock/tracker.go -mock_names=Tracker=Tracker github.com/ava-labs/avalanchego/snow/networking/tracker Tracker +// mockgen -package=trackermock -destination=trackermock/tracker.go -mock_names=Tracker=Tracker . Tracker // // Package trackermock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type Tracker struct { ctrl *gomock.Controller recorder *TrackerMockRecorder + isgomock struct{} } // TrackerMockRecorder is the mock recorder for Tracker. @@ -41,17 +42,17 @@ func (m *Tracker) EXPECT() *TrackerMockRecorder { } // TimeUntilUsage mocks base method. -func (m *Tracker) TimeUntilUsage(arg0 ids.NodeID, arg1 time.Time, arg2 float64) time.Duration { +func (m *Tracker) TimeUntilUsage(nodeID ids.NodeID, now time.Time, value float64) time.Duration { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TimeUntilUsage", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "TimeUntilUsage", nodeID, now, value) ret0, _ := ret[0].(time.Duration) return ret0 } // TimeUntilUsage indicates an expected call of TimeUntilUsage. -func (mr *TrackerMockRecorder) TimeUntilUsage(arg0, arg1, arg2 any) *gomock.Call { +func (mr *TrackerMockRecorder) TimeUntilUsage(nodeID, now, value any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TimeUntilUsage", reflect.TypeOf((*Tracker)(nil).TimeUntilUsage), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TimeUntilUsage", reflect.TypeOf((*Tracker)(nil).TimeUntilUsage), nodeID, now, value) } // TotalUsage mocks base method. @@ -69,15 +70,15 @@ func (mr *TrackerMockRecorder) TotalUsage() *gomock.Call { } // Usage mocks base method. -func (m *Tracker) Usage(arg0 ids.NodeID, arg1 time.Time) float64 { +func (m *Tracker) Usage(nodeID ids.NodeID, now time.Time) float64 { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Usage", arg0, arg1) + ret := m.ctrl.Call(m, "Usage", nodeID, now) ret0, _ := ret[0].(float64) return ret0 } // Usage indicates an expected call of Usage. -func (mr *TrackerMockRecorder) Usage(arg0, arg1 any) *gomock.Call { +func (mr *TrackerMockRecorder) Usage(nodeID, now any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Usage", reflect.TypeOf((*Tracker)(nil).Usage), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Usage", reflect.TypeOf((*Tracker)(nil).Usage), nodeID, now) } diff --git a/snow/uptime/mocks_generate_test.go b/snow/uptime/mocks_generate_test.go new file mode 100644 index 000000000000..1e6195b72f4b --- /dev/null +++ b/snow/uptime/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package uptime + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/calculator.go -mock_names=Calculator=Calculator . Calculator diff --git a/snow/uptime/uptimemock/calculator.go b/snow/uptime/uptimemock/calculator.go index c587637cc36b..c4170b59bcfb 100644 --- a/snow/uptime/uptimemock/calculator.go +++ b/snow/uptime/uptimemock/calculator.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=uptimemock -destination=snow/uptime/uptimemock/calculator.go -mock_names=Calculator=Calculator github.com/ava-labs/avalanchego/snow/uptime Calculator +// mockgen -package=uptimemock -destination=uptimemock/calculator.go -mock_names=Calculator=Calculator . Calculator // // Package uptimemock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type Calculator struct { ctrl *gomock.Controller recorder *CalculatorMockRecorder + isgomock struct{} } // CalculatorMockRecorder is the mock recorder for Calculator. @@ -41,9 +42,9 @@ func (m *Calculator) EXPECT() *CalculatorMockRecorder { } // CalculateUptime mocks base method. -func (m *Calculator) CalculateUptime(arg0 ids.NodeID) (time.Duration, time.Time, error) { +func (m *Calculator) CalculateUptime(nodeID ids.NodeID) (time.Duration, time.Time, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CalculateUptime", arg0) + ret := m.ctrl.Call(m, "CalculateUptime", nodeID) ret0, _ := ret[0].(time.Duration) ret1, _ := ret[1].(time.Time) ret2, _ := ret[2].(error) @@ -51,37 +52,37 @@ func (m *Calculator) CalculateUptime(arg0 ids.NodeID) (time.Duration, time.Time, } // CalculateUptime indicates an expected call of CalculateUptime. -func (mr *CalculatorMockRecorder) CalculateUptime(arg0 any) *gomock.Call { +func (mr *CalculatorMockRecorder) CalculateUptime(nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptime", reflect.TypeOf((*Calculator)(nil).CalculateUptime), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptime", reflect.TypeOf((*Calculator)(nil).CalculateUptime), nodeID) } // CalculateUptimePercent mocks base method. -func (m *Calculator) CalculateUptimePercent(arg0 ids.NodeID) (float64, error) { +func (m *Calculator) CalculateUptimePercent(nodeID ids.NodeID) (float64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CalculateUptimePercent", arg0) + ret := m.ctrl.Call(m, "CalculateUptimePercent", nodeID) ret0, _ := ret[0].(float64) ret1, _ := ret[1].(error) return ret0, ret1 } // CalculateUptimePercent indicates an expected call of CalculateUptimePercent. -func (mr *CalculatorMockRecorder) CalculateUptimePercent(arg0 any) *gomock.Call { +func (mr *CalculatorMockRecorder) CalculateUptimePercent(nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercent", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercent), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercent", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercent), nodeID) } // CalculateUptimePercentFrom mocks base method. -func (m *Calculator) CalculateUptimePercentFrom(arg0 ids.NodeID, arg1 time.Time) (float64, error) { +func (m *Calculator) CalculateUptimePercentFrom(nodeID ids.NodeID, startTime time.Time) (float64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CalculateUptimePercentFrom", arg0, arg1) + ret := m.ctrl.Call(m, "CalculateUptimePercentFrom", nodeID, startTime) ret0, _ := ret[0].(float64) ret1, _ := ret[1].(error) return ret0, ret1 } // CalculateUptimePercentFrom indicates an expected call of CalculateUptimePercentFrom. -func (mr *CalculatorMockRecorder) CalculateUptimePercentFrom(arg0, arg1 any) *gomock.Call { +func (mr *CalculatorMockRecorder) CalculateUptimePercentFrom(nodeID, startTime any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercentFrom", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercentFrom), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercentFrom", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercentFrom), nodeID, startTime) } diff --git a/snow/validators/mocks_generate_test.go b/snow/validators/mocks_generate_test.go new file mode 100644 index 000000000000..df342dd385fd --- /dev/null +++ b/snow/validators/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package validators + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/state.go -mock_names=State=State . State diff --git a/snow/validators/validatorsmock/state.go b/snow/validators/validatorsmock/state.go index feb6cdbb57ae..1928373b877e 100644 --- a/snow/validators/validatorsmock/state.go +++ b/snow/validators/validatorsmock/state.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=validatorsmock -destination=snow/validators/validatorsmock/state.go -mock_names=State=State github.com/ava-labs/avalanchego/snow/validators State +// mockgen -package=validatorsmock -destination=validatorsmock/state.go -mock_names=State=State . State // // Package validatorsmock is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type State struct { ctrl *gomock.Controller recorder *StateMockRecorder + isgomock struct{} } // StateMockRecorder is the mock recorder for State. @@ -57,9 +58,9 @@ func (mr *StateMockRecorder) GetCurrentHeight(arg0 any) *gomock.Call { } // GetCurrentValidatorSet mocks base method. -func (m *State) GetCurrentValidatorSet(arg0 context.Context, arg1 ids.ID) (map[ids.ID]*validators.GetCurrentValidatorOutput, uint64, error) { +func (m *State) GetCurrentValidatorSet(ctx context.Context, subnetID ids.ID) (map[ids.ID]*validators.GetCurrentValidatorOutput, uint64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCurrentValidatorSet", arg0, arg1) + ret := m.ctrl.Call(m, "GetCurrentValidatorSet", ctx, subnetID) ret0, _ := ret[0].(map[ids.ID]*validators.GetCurrentValidatorOutput) ret1, _ := ret[1].(uint64) ret2, _ := ret[2].(error) @@ -67,9 +68,9 @@ func (m *State) GetCurrentValidatorSet(arg0 context.Context, arg1 ids.ID) (map[i } // GetCurrentValidatorSet indicates an expected call of GetCurrentValidatorSet. -func (mr *StateMockRecorder) GetCurrentValidatorSet(arg0, arg1 any) *gomock.Call { +func (mr *StateMockRecorder) GetCurrentValidatorSet(ctx, subnetID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentValidatorSet", reflect.TypeOf((*State)(nil).GetCurrentValidatorSet), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentValidatorSet", reflect.TypeOf((*State)(nil).GetCurrentValidatorSet), ctx, subnetID) } // GetMinimumHeight mocks base method. @@ -88,31 +89,31 @@ func (mr *StateMockRecorder) GetMinimumHeight(arg0 any) *gomock.Call { } // GetSubnetID mocks base method. -func (m *State) GetSubnetID(arg0 context.Context, arg1 ids.ID) (ids.ID, error) { +func (m *State) GetSubnetID(ctx context.Context, chainID ids.ID) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSubnetID", arg0, arg1) + ret := m.ctrl.Call(m, "GetSubnetID", ctx, chainID) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // GetSubnetID indicates an expected call of GetSubnetID. -func (mr *StateMockRecorder) GetSubnetID(arg0, arg1 any) *gomock.Call { +func (mr *StateMockRecorder) GetSubnetID(ctx, chainID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubnetID", reflect.TypeOf((*State)(nil).GetSubnetID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubnetID", reflect.TypeOf((*State)(nil).GetSubnetID), ctx, chainID) } // GetValidatorSet mocks base method. -func (m *State) GetValidatorSet(arg0 context.Context, arg1 uint64, arg2 ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) { +func (m *State) GetValidatorSet(ctx context.Context, height uint64, subnetID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetValidatorSet", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetValidatorSet", ctx, height, subnetID) ret0, _ := ret[0].(map[ids.NodeID]*validators.GetValidatorOutput) ret1, _ := ret[1].(error) return ret0, ret1 } // GetValidatorSet indicates an expected call of GetValidatorSet. -func (mr *StateMockRecorder) GetValidatorSet(arg0, arg1, arg2 any) *gomock.Call { +func (mr *StateMockRecorder) GetValidatorSet(ctx, height, subnetID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorSet", reflect.TypeOf((*State)(nil).GetValidatorSet), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorSet", reflect.TypeOf((*State)(nil).GetValidatorSet), ctx, height, subnetID) } diff --git a/tools.go b/tools.go new file mode 100644 index 000000000000..ebe4ab619fec --- /dev/null +++ b/tools.go @@ -0,0 +1,8 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package avalanchego + +import ( + _ "golang.org/x/mod/semver" // golang.org/x/mod to satisfy requirement for go.uber.org/mock/mockgen@v0.5 +) diff --git a/utils/crypto/keychain/keychainmock/ledger.go b/utils/crypto/keychain/keychainmock/ledger.go index 378001e1d3ba..d7a22a93bc77 100644 --- a/utils/crypto/keychain/keychainmock/ledger.go +++ b/utils/crypto/keychain/keychainmock/ledger.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=keychainmock -destination=utils/crypto/keychain/keychainmock/ledger.go -mock_names=Ledger=Ledger github.com/ava-labs/avalanchego/utils/crypto/keychain Ledger +// mockgen -package=keychainmock -destination=keychainmock/ledger.go -mock_names=Ledger=Ledger . Ledger // // Package keychainmock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type Ledger struct { ctrl *gomock.Controller recorder *LedgerMockRecorder + isgomock struct{} } // LedgerMockRecorder is the mock recorder for Ledger. @@ -41,33 +42,33 @@ func (m *Ledger) EXPECT() *LedgerMockRecorder { } // Address mocks base method. -func (m *Ledger) Address(arg0 string, arg1 uint32) (ids.ShortID, error) { +func (m *Ledger) Address(displayHRP string, addressIndex uint32) (ids.ShortID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Address", arg0, arg1) + ret := m.ctrl.Call(m, "Address", displayHRP, addressIndex) ret0, _ := ret[0].(ids.ShortID) ret1, _ := ret[1].(error) return ret0, ret1 } // Address indicates an expected call of Address. -func (mr *LedgerMockRecorder) Address(arg0, arg1 any) *gomock.Call { +func (mr *LedgerMockRecorder) Address(displayHRP, addressIndex any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Address", reflect.TypeOf((*Ledger)(nil).Address), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Address", reflect.TypeOf((*Ledger)(nil).Address), displayHRP, addressIndex) } // Addresses mocks base method. -func (m *Ledger) Addresses(arg0 []uint32) ([]ids.ShortID, error) { +func (m *Ledger) Addresses(addressIndices []uint32) ([]ids.ShortID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Addresses", arg0) + ret := m.ctrl.Call(m, "Addresses", addressIndices) ret0, _ := ret[0].([]ids.ShortID) ret1, _ := ret[1].(error) return ret0, ret1 } // Addresses indicates an expected call of Addresses. -func (mr *LedgerMockRecorder) Addresses(arg0 any) *gomock.Call { +func (mr *LedgerMockRecorder) Addresses(addressIndices any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Addresses", reflect.TypeOf((*Ledger)(nil).Addresses), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Addresses", reflect.TypeOf((*Ledger)(nil).Addresses), addressIndices) } // Disconnect mocks base method. @@ -85,33 +86,33 @@ func (mr *LedgerMockRecorder) Disconnect() *gomock.Call { } // Sign mocks base method. -func (m *Ledger) Sign(arg0 []byte, arg1 []uint32) ([][]byte, error) { +func (m *Ledger) Sign(unsignedTxBytes []byte, addressIndices []uint32) ([][]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Sign", arg0, arg1) + ret := m.ctrl.Call(m, "Sign", unsignedTxBytes, addressIndices) ret0, _ := ret[0].([][]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // Sign indicates an expected call of Sign. -func (mr *LedgerMockRecorder) Sign(arg0, arg1 any) *gomock.Call { +func (mr *LedgerMockRecorder) Sign(unsignedTxBytes, addressIndices any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sign", reflect.TypeOf((*Ledger)(nil).Sign), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sign", reflect.TypeOf((*Ledger)(nil).Sign), unsignedTxBytes, addressIndices) } // SignHash mocks base method. -func (m *Ledger) SignHash(arg0 []byte, arg1 []uint32) ([][]byte, error) { +func (m *Ledger) SignHash(hash []byte, addressIndices []uint32) ([][]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignHash", arg0, arg1) + ret := m.ctrl.Call(m, "SignHash", hash, addressIndices) ret0, _ := ret[0].([][]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // SignHash indicates an expected call of SignHash. -func (mr *LedgerMockRecorder) SignHash(arg0, arg1 any) *gomock.Call { +func (mr *LedgerMockRecorder) SignHash(hash, addressIndices any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignHash", reflect.TypeOf((*Ledger)(nil).SignHash), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignHash", reflect.TypeOf((*Ledger)(nil).SignHash), hash, addressIndices) } // Version mocks base method. diff --git a/utils/crypto/keychain/mocks_generate_test.go b/utils/crypto/keychain/mocks_generate_test.go new file mode 100644 index 000000000000..c1ac84b74cad --- /dev/null +++ b/utils/crypto/keychain/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package keychain + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/ledger.go -mock_names=Ledger=Ledger . Ledger diff --git a/utils/filesystem/filesystemmock/reader.go b/utils/filesystem/filesystemmock/reader.go index 3875190621ce..e2a039ec32bd 100644 --- a/utils/filesystem/filesystemmock/reader.go +++ b/utils/filesystem/filesystemmock/reader.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=filesystemmock -destination=utils/filesystem/filesystemmock/reader.go -mock_names=Reader=Reader github.com/ava-labs/avalanchego/utils/filesystem Reader +// mockgen -package=filesystemmock -destination=filesystemmock/reader.go -mock_names=Reader=Reader . Reader // // Package filesystemmock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Reader struct { ctrl *gomock.Controller recorder *ReaderMockRecorder + isgomock struct{} } // ReaderMockRecorder is the mock recorder for Reader. diff --git a/utils/filesystem/mocks_generate_test.go b/utils/filesystem/mocks_generate_test.go new file mode 100644 index 000000000000..521ef05f64c0 --- /dev/null +++ b/utils/filesystem/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package filesystem + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/reader.go -mock_names=Reader=Reader . Reader diff --git a/utils/hashing/hashingmock/hasher.go b/utils/hashing/hashingmock/hasher.go index dc0642b45800..be3dbeee0ead 100644 --- a/utils/hashing/hashingmock/hasher.go +++ b/utils/hashing/hashingmock/hasher.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=hashingmock -destination=utils/hashing/hashingmock/hasher.go -mock_names=Hasher=Hasher github.com/ava-labs/avalanchego/utils/hashing Hasher +// mockgen -package=hashingmock -destination=hashingmock/hasher.go -mock_names=Hasher=Hasher . Hasher // // Package hashingmock is a generated GoMock package. @@ -19,6 +19,7 @@ import ( type Hasher struct { ctrl *gomock.Controller recorder *HasherMockRecorder + isgomock struct{} } // HasherMockRecorder is the mock recorder for Hasher. diff --git a/utils/hashing/mocks_generate_test.go b/utils/hashing/mocks_generate_test.go new file mode 100644 index 000000000000..0e378fe0e45a --- /dev/null +++ b/utils/hashing/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package hashing + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/hasher.go -mock_names=Hasher=Hasher . Hasher diff --git a/utils/resource/mocks_generate_test.go b/utils/resource/mocks_generate_test.go new file mode 100644 index 000000000000..d995c052054d --- /dev/null +++ b/utils/resource/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package resource + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/user.go -mock_names=User=User . User diff --git a/utils/resource/resourcemock/user.go b/utils/resource/resourcemock/user.go index 01e634ae2ee0..d18ae4dbcf0b 100644 --- a/utils/resource/resourcemock/user.go +++ b/utils/resource/resourcemock/user.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=resourcemock -destination=utils/resource/resourcemock/user.go -mock_names=User=User github.com/ava-labs/avalanchego/utils/resource User +// mockgen -package=resourcemock -destination=resourcemock/user.go -mock_names=User=User . User // // Package resourcemock is a generated GoMock package. @@ -19,6 +19,7 @@ import ( type User struct { ctrl *gomock.Controller recorder *UserMockRecorder + isgomock struct{} } // UserMockRecorder is the mock recorder for User. diff --git a/vms/avm/block/executor/executormock/manager.go b/vms/avm/block/executor/executormock/manager.go index 73633b34e2bf..0579a81f9320 100644 --- a/vms/avm/block/executor/executormock/manager.go +++ b/vms/avm/block/executor/executormock/manager.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/avm/block/executor/manager.go +// Source: github.com/ava-labs/avalanchego/vms/avm/block/executor (interfaces: Manager) // // Generated by this command: // -// mockgen -source=vms/avm/block/executor/manager.go -destination=vms/avm/block/executor/executormock/manager.go -package=executormock -exclude_interfaces= -mock_names=Manager=Manager +// mockgen -package=executormock -destination=executormock/manager.go -mock_names=Manager=Manager . Manager // // Package executormock is a generated GoMock package. @@ -25,6 +25,7 @@ import ( type Manager struct { ctrl *gomock.Controller recorder *ManagerMockRecorder + isgomock struct{} } // ManagerMockRecorder is the mock recorder for Manager. diff --git a/vms/avm/block/executor/mocks_generate_test.go b/vms/avm/block/executor/mocks_generate_test.go new file mode 100644 index 000000000000..7f80b29b03f0 --- /dev/null +++ b/vms/avm/block/executor/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package executor + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager diff --git a/vms/avm/block/mock_block.go b/vms/avm/block/mock_block.go index d62403641a2f..8f06c4d9fd91 100644 --- a/vms/avm/block/mock_block.go +++ b/vms/avm/block/mock_block.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/avm/block/block.go +// Source: github.com/ava-labs/avalanchego/vms/avm/block (interfaces: Block) // // Generated by this command: // -// mockgen -source=vms/avm/block/block.go -destination=vms/avm/block/mock_block.go -package=block -exclude_interfaces= -mock_names=MockBlock=MockBlock +// mockgen -package=block -destination=mock_block.go . Block // // Package block is a generated GoMock package. @@ -24,6 +24,7 @@ import ( type MockBlock struct { ctrl *gomock.Controller recorder *MockBlockMockRecorder + isgomock struct{} } // MockBlockMockRecorder is the mock recorder for MockBlock. diff --git a/vms/avm/block/mocks_generate_test.go b/vms/avm/block/mocks_generate_test.go new file mode 100644 index 000000000000..0de0cea64dca --- /dev/null +++ b/vms/avm/block/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package block + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mock_block.go . Block diff --git a/vms/avm/metrics/metricsmock/metrics.go b/vms/avm/metrics/metricsmock/metrics.go index ceaea8c73056..ba36614447ef 100644 --- a/vms/avm/metrics/metricsmock/metrics.go +++ b/vms/avm/metrics/metricsmock/metrics.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=metricsmock -destination=vms/avm/metrics/metricsmock/metrics.go -mock_names=Metrics=Metrics github.com/ava-labs/avalanchego/vms/avm/metrics Metrics +// mockgen -package=metricsmock -destination=metricsmock/metrics.go -mock_names=Metrics=Metrics . Metrics // // Package metricsmock is a generated GoMock package. @@ -23,6 +23,7 @@ import ( type Metrics struct { ctrl *gomock.Controller recorder *MetricsMockRecorder + isgomock struct{} } // MetricsMockRecorder is the mock recorder for Metrics. @@ -43,15 +44,15 @@ func (m *Metrics) EXPECT() *MetricsMockRecorder { } // AfterRequest mocks base method. -func (m *Metrics) AfterRequest(arg0 *rpc.RequestInfo) { +func (m *Metrics) AfterRequest(i *rpc.RequestInfo) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AfterRequest", arg0) + m.ctrl.Call(m, "AfterRequest", i) } // AfterRequest indicates an expected call of AfterRequest. -func (mr *MetricsMockRecorder) AfterRequest(arg0 any) *gomock.Call { +func (mr *MetricsMockRecorder) AfterRequest(i any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterRequest", reflect.TypeOf((*Metrics)(nil).AfterRequest), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterRequest", reflect.TypeOf((*Metrics)(nil).AfterRequest), i) } // IncTxRefreshHits mocks base method. @@ -91,43 +92,43 @@ func (mr *MetricsMockRecorder) IncTxRefreshes() *gomock.Call { } // InterceptRequest mocks base method. -func (m *Metrics) InterceptRequest(arg0 *rpc.RequestInfo) *http.Request { +func (m *Metrics) InterceptRequest(i *rpc.RequestInfo) *http.Request { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InterceptRequest", arg0) + ret := m.ctrl.Call(m, "InterceptRequest", i) ret0, _ := ret[0].(*http.Request) return ret0 } // InterceptRequest indicates an expected call of InterceptRequest. -func (mr *MetricsMockRecorder) InterceptRequest(arg0 any) *gomock.Call { +func (mr *MetricsMockRecorder) InterceptRequest(i any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptRequest", reflect.TypeOf((*Metrics)(nil).InterceptRequest), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptRequest", reflect.TypeOf((*Metrics)(nil).InterceptRequest), i) } // MarkBlockAccepted mocks base method. -func (m *Metrics) MarkBlockAccepted(arg0 block.Block) error { +func (m *Metrics) MarkBlockAccepted(b block.Block) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MarkBlockAccepted", arg0) + ret := m.ctrl.Call(m, "MarkBlockAccepted", b) ret0, _ := ret[0].(error) return ret0 } // MarkBlockAccepted indicates an expected call of MarkBlockAccepted. -func (mr *MetricsMockRecorder) MarkBlockAccepted(arg0 any) *gomock.Call { +func (mr *MetricsMockRecorder) MarkBlockAccepted(b any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkBlockAccepted", reflect.TypeOf((*Metrics)(nil).MarkBlockAccepted), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkBlockAccepted", reflect.TypeOf((*Metrics)(nil).MarkBlockAccepted), b) } // MarkTxAccepted mocks base method. -func (m *Metrics) MarkTxAccepted(arg0 *txs.Tx) error { +func (m *Metrics) MarkTxAccepted(tx *txs.Tx) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MarkTxAccepted", arg0) + ret := m.ctrl.Call(m, "MarkTxAccepted", tx) ret0, _ := ret[0].(error) return ret0 } // MarkTxAccepted indicates an expected call of MarkTxAccepted. -func (mr *MetricsMockRecorder) MarkTxAccepted(arg0 any) *gomock.Call { +func (mr *MetricsMockRecorder) MarkTxAccepted(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkTxAccepted", reflect.TypeOf((*Metrics)(nil).MarkTxAccepted), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkTxAccepted", reflect.TypeOf((*Metrics)(nil).MarkTxAccepted), tx) } diff --git a/vms/avm/metrics/mocks_generate_test.go b/vms/avm/metrics/mocks_generate_test.go new file mode 100644 index 000000000000..8046bd58449a --- /dev/null +++ b/vms/avm/metrics/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package metrics + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/metrics.go -mock_names=Metrics=Metrics . Metrics diff --git a/vms/avm/state/mocks_generate_test.go b/vms/avm/state/mocks_generate_test.go new file mode 100644 index 000000000000..cb78277b68ab --- /dev/null +++ b/vms/avm/state/mocks_generate_test.go @@ -0,0 +1,8 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package state + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/chain.go -mock_names=Chain=Chain . Chain +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/diff.go -mock_names=Diff=Diff . Diff +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/state.go -mock_names=State=State . State diff --git a/vms/avm/state/statemock/chain.go b/vms/avm/state/statemock/chain.go index 3a802954d765..58f4452fd122 100644 --- a/vms/avm/state/statemock/chain.go +++ b/vms/avm/state/statemock/chain.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=statemock -destination=vms/avm/state/statemock/chain.go -mock_names=Chain=Chain github.com/ava-labs/avalanchego/vms/avm/state Chain +// mockgen -package=statemock -destination=statemock/chain.go -mock_names=Chain=Chain . Chain // // Package statemock is a generated GoMock package. @@ -24,6 +24,7 @@ import ( type Chain struct { ctrl *gomock.Controller recorder *ChainMockRecorder + isgomock struct{} } // ChainMockRecorder is the mock recorder for Chain. @@ -44,81 +45,81 @@ func (m *Chain) EXPECT() *ChainMockRecorder { } // AddBlock mocks base method. -func (m *Chain) AddBlock(arg0 block.Block) { +func (m *Chain) AddBlock(block block.Block) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddBlock", arg0) + m.ctrl.Call(m, "AddBlock", block) } // AddBlock indicates an expected call of AddBlock. -func (mr *ChainMockRecorder) AddBlock(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) AddBlock(block any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*Chain)(nil).AddBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*Chain)(nil).AddBlock), block) } // AddTx mocks base method. -func (m *Chain) AddTx(arg0 *txs.Tx) { +func (m *Chain) AddTx(tx *txs.Tx) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddTx", arg0) + m.ctrl.Call(m, "AddTx", tx) } // AddTx indicates an expected call of AddTx. -func (mr *ChainMockRecorder) AddTx(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) AddTx(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTx", reflect.TypeOf((*Chain)(nil).AddTx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTx", reflect.TypeOf((*Chain)(nil).AddTx), tx) } // AddUTXO mocks base method. -func (m *Chain) AddUTXO(arg0 *avax.UTXO) { +func (m *Chain) AddUTXO(utxo *avax.UTXO) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddUTXO", arg0) + m.ctrl.Call(m, "AddUTXO", utxo) } // AddUTXO indicates an expected call of AddUTXO. -func (mr *ChainMockRecorder) AddUTXO(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) AddUTXO(utxo any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUTXO", reflect.TypeOf((*Chain)(nil).AddUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUTXO", reflect.TypeOf((*Chain)(nil).AddUTXO), utxo) } // DeleteUTXO mocks base method. -func (m *Chain) DeleteUTXO(arg0 ids.ID) { +func (m *Chain) DeleteUTXO(utxoID ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "DeleteUTXO", arg0) + m.ctrl.Call(m, "DeleteUTXO", utxoID) } // DeleteUTXO indicates an expected call of DeleteUTXO. -func (mr *ChainMockRecorder) DeleteUTXO(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) DeleteUTXO(utxoID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUTXO", reflect.TypeOf((*Chain)(nil).DeleteUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUTXO", reflect.TypeOf((*Chain)(nil).DeleteUTXO), utxoID) } // GetBlock mocks base method. -func (m *Chain) GetBlock(arg0 ids.ID) (block.Block, error) { +func (m *Chain) GetBlock(blkID ids.ID) (block.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0) + ret := m.ctrl.Call(m, "GetBlock", blkID) ret0, _ := ret[0].(block.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlock indicates an expected call of GetBlock. -func (mr *ChainMockRecorder) GetBlock(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) GetBlock(blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*Chain)(nil).GetBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*Chain)(nil).GetBlock), blkID) } // GetBlockIDAtHeight mocks base method. -func (m *Chain) GetBlockIDAtHeight(arg0 uint64) (ids.ID, error) { +func (m *Chain) GetBlockIDAtHeight(height uint64) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockIDAtHeight", arg0) + ret := m.ctrl.Call(m, "GetBlockIDAtHeight", height) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight. -func (mr *ChainMockRecorder) GetBlockIDAtHeight(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) GetBlockIDAtHeight(height any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*Chain)(nil).GetBlockIDAtHeight), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*Chain)(nil).GetBlockIDAtHeight), height) } // GetLastAccepted mocks base method. @@ -150,55 +151,55 @@ func (mr *ChainMockRecorder) GetTimestamp() *gomock.Call { } // GetTx mocks base method. -func (m *Chain) GetTx(arg0 ids.ID) (*txs.Tx, error) { +func (m *Chain) GetTx(txID ids.ID) (*txs.Tx, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTx", arg0) + ret := m.ctrl.Call(m, "GetTx", txID) ret0, _ := ret[0].(*txs.Tx) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTx indicates an expected call of GetTx. -func (mr *ChainMockRecorder) GetTx(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) GetTx(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTx", reflect.TypeOf((*Chain)(nil).GetTx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTx", reflect.TypeOf((*Chain)(nil).GetTx), txID) } // GetUTXO mocks base method. -func (m *Chain) GetUTXO(arg0 ids.ID) (*avax.UTXO, error) { +func (m *Chain) GetUTXO(utxoID ids.ID) (*avax.UTXO, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUTXO", arg0) + ret := m.ctrl.Call(m, "GetUTXO", utxoID) ret0, _ := ret[0].(*avax.UTXO) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUTXO indicates an expected call of GetUTXO. -func (mr *ChainMockRecorder) GetUTXO(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) GetUTXO(utxoID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUTXO", reflect.TypeOf((*Chain)(nil).GetUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUTXO", reflect.TypeOf((*Chain)(nil).GetUTXO), utxoID) } // SetLastAccepted mocks base method. -func (m *Chain) SetLastAccepted(arg0 ids.ID) { +func (m *Chain) SetLastAccepted(blkID ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetLastAccepted", arg0) + m.ctrl.Call(m, "SetLastAccepted", blkID) } // SetLastAccepted indicates an expected call of SetLastAccepted. -func (mr *ChainMockRecorder) SetLastAccepted(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) SetLastAccepted(blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*Chain)(nil).SetLastAccepted), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*Chain)(nil).SetLastAccepted), blkID) } // SetTimestamp mocks base method. -func (m *Chain) SetTimestamp(arg0 time.Time) { +func (m *Chain) SetTimestamp(t time.Time) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetTimestamp", arg0) + m.ctrl.Call(m, "SetTimestamp", t) } // SetTimestamp indicates an expected call of SetTimestamp. -func (mr *ChainMockRecorder) SetTimestamp(arg0 any) *gomock.Call { +func (mr *ChainMockRecorder) SetTimestamp(t any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTimestamp", reflect.TypeOf((*Chain)(nil).SetTimestamp), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTimestamp", reflect.TypeOf((*Chain)(nil).SetTimestamp), t) } diff --git a/vms/avm/state/statemock/diff.go b/vms/avm/state/statemock/diff.go index e41fc90825bb..35724dfdb457 100644 --- a/vms/avm/state/statemock/diff.go +++ b/vms/avm/state/statemock/diff.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=statemock -destination=vms/avm/state/statemock/diff.go -mock_names=Diff=Diff github.com/ava-labs/avalanchego/vms/avm/state Diff +// mockgen -package=statemock -destination=statemock/diff.go -mock_names=Diff=Diff . Diff // // Package statemock is a generated GoMock package. @@ -25,6 +25,7 @@ import ( type Diff struct { ctrl *gomock.Controller recorder *DiffMockRecorder + isgomock struct{} } // DiffMockRecorder is the mock recorder for Diff. @@ -45,39 +46,39 @@ func (m *Diff) EXPECT() *DiffMockRecorder { } // AddBlock mocks base method. -func (m *Diff) AddBlock(arg0 block.Block) { +func (m *Diff) AddBlock(block block.Block) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddBlock", arg0) + m.ctrl.Call(m, "AddBlock", block) } // AddBlock indicates an expected call of AddBlock. -func (mr *DiffMockRecorder) AddBlock(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) AddBlock(block any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*Diff)(nil).AddBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*Diff)(nil).AddBlock), block) } // AddTx mocks base method. -func (m *Diff) AddTx(arg0 *txs.Tx) { +func (m *Diff) AddTx(tx *txs.Tx) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddTx", arg0) + m.ctrl.Call(m, "AddTx", tx) } // AddTx indicates an expected call of AddTx. -func (mr *DiffMockRecorder) AddTx(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) AddTx(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTx", reflect.TypeOf((*Diff)(nil).AddTx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTx", reflect.TypeOf((*Diff)(nil).AddTx), tx) } // AddUTXO mocks base method. -func (m *Diff) AddUTXO(arg0 *avax.UTXO) { +func (m *Diff) AddUTXO(utxo *avax.UTXO) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddUTXO", arg0) + m.ctrl.Call(m, "AddUTXO", utxo) } // AddUTXO indicates an expected call of AddUTXO. -func (mr *DiffMockRecorder) AddUTXO(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) AddUTXO(utxo any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUTXO", reflect.TypeOf((*Diff)(nil).AddUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUTXO", reflect.TypeOf((*Diff)(nil).AddUTXO), utxo) } // Apply mocks base method. @@ -93,45 +94,45 @@ func (mr *DiffMockRecorder) Apply(arg0 any) *gomock.Call { } // DeleteUTXO mocks base method. -func (m *Diff) DeleteUTXO(arg0 ids.ID) { +func (m *Diff) DeleteUTXO(utxoID ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "DeleteUTXO", arg0) + m.ctrl.Call(m, "DeleteUTXO", utxoID) } // DeleteUTXO indicates an expected call of DeleteUTXO. -func (mr *DiffMockRecorder) DeleteUTXO(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) DeleteUTXO(utxoID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUTXO", reflect.TypeOf((*Diff)(nil).DeleteUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUTXO", reflect.TypeOf((*Diff)(nil).DeleteUTXO), utxoID) } // GetBlock mocks base method. -func (m *Diff) GetBlock(arg0 ids.ID) (block.Block, error) { +func (m *Diff) GetBlock(blkID ids.ID) (block.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0) + ret := m.ctrl.Call(m, "GetBlock", blkID) ret0, _ := ret[0].(block.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlock indicates an expected call of GetBlock. -func (mr *DiffMockRecorder) GetBlock(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) GetBlock(blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*Diff)(nil).GetBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*Diff)(nil).GetBlock), blkID) } // GetBlockIDAtHeight mocks base method. -func (m *Diff) GetBlockIDAtHeight(arg0 uint64) (ids.ID, error) { +func (m *Diff) GetBlockIDAtHeight(height uint64) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockIDAtHeight", arg0) + ret := m.ctrl.Call(m, "GetBlockIDAtHeight", height) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight. -func (mr *DiffMockRecorder) GetBlockIDAtHeight(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) GetBlockIDAtHeight(height any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*Diff)(nil).GetBlockIDAtHeight), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*Diff)(nil).GetBlockIDAtHeight), height) } // GetLastAccepted mocks base method. @@ -163,55 +164,55 @@ func (mr *DiffMockRecorder) GetTimestamp() *gomock.Call { } // GetTx mocks base method. -func (m *Diff) GetTx(arg0 ids.ID) (*txs.Tx, error) { +func (m *Diff) GetTx(txID ids.ID) (*txs.Tx, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTx", arg0) + ret := m.ctrl.Call(m, "GetTx", txID) ret0, _ := ret[0].(*txs.Tx) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTx indicates an expected call of GetTx. -func (mr *DiffMockRecorder) GetTx(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) GetTx(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTx", reflect.TypeOf((*Diff)(nil).GetTx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTx", reflect.TypeOf((*Diff)(nil).GetTx), txID) } // GetUTXO mocks base method. -func (m *Diff) GetUTXO(arg0 ids.ID) (*avax.UTXO, error) { +func (m *Diff) GetUTXO(utxoID ids.ID) (*avax.UTXO, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUTXO", arg0) + ret := m.ctrl.Call(m, "GetUTXO", utxoID) ret0, _ := ret[0].(*avax.UTXO) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUTXO indicates an expected call of GetUTXO. -func (mr *DiffMockRecorder) GetUTXO(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) GetUTXO(utxoID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUTXO", reflect.TypeOf((*Diff)(nil).GetUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUTXO", reflect.TypeOf((*Diff)(nil).GetUTXO), utxoID) } // SetLastAccepted mocks base method. -func (m *Diff) SetLastAccepted(arg0 ids.ID) { +func (m *Diff) SetLastAccepted(blkID ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetLastAccepted", arg0) + m.ctrl.Call(m, "SetLastAccepted", blkID) } // SetLastAccepted indicates an expected call of SetLastAccepted. -func (mr *DiffMockRecorder) SetLastAccepted(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) SetLastAccepted(blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*Diff)(nil).SetLastAccepted), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*Diff)(nil).SetLastAccepted), blkID) } // SetTimestamp mocks base method. -func (m *Diff) SetTimestamp(arg0 time.Time) { +func (m *Diff) SetTimestamp(t time.Time) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetTimestamp", arg0) + m.ctrl.Call(m, "SetTimestamp", t) } // SetTimestamp indicates an expected call of SetTimestamp. -func (mr *DiffMockRecorder) SetTimestamp(arg0 any) *gomock.Call { +func (mr *DiffMockRecorder) SetTimestamp(t any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTimestamp", reflect.TypeOf((*Diff)(nil).SetTimestamp), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTimestamp", reflect.TypeOf((*Diff)(nil).SetTimestamp), t) } diff --git a/vms/avm/state/statemock/state.go b/vms/avm/state/statemock/state.go index 1c78f8bda1ba..f7dfce3c6614 100644 --- a/vms/avm/state/statemock/state.go +++ b/vms/avm/state/statemock/state.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=statemock -destination=vms/avm/state/statemock/state.go -mock_names=State=State github.com/ava-labs/avalanchego/vms/avm/state State +// mockgen -package=statemock -destination=statemock/state.go -mock_names=State=State . State // // Package statemock is a generated GoMock package. @@ -25,6 +25,7 @@ import ( type State struct { ctrl *gomock.Controller recorder *StateMockRecorder + isgomock struct{} } // StateMockRecorder is the mock recorder for State. @@ -57,39 +58,39 @@ func (mr *StateMockRecorder) Abort() *gomock.Call { } // AddBlock mocks base method. -func (m *State) AddBlock(arg0 block.Block) { +func (m *State) AddBlock(block block.Block) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddBlock", arg0) + m.ctrl.Call(m, "AddBlock", block) } // AddBlock indicates an expected call of AddBlock. -func (mr *StateMockRecorder) AddBlock(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) AddBlock(block any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*State)(nil).AddBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*State)(nil).AddBlock), block) } // AddTx mocks base method. -func (m *State) AddTx(arg0 *txs.Tx) { +func (m *State) AddTx(tx *txs.Tx) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddTx", arg0) + m.ctrl.Call(m, "AddTx", tx) } // AddTx indicates an expected call of AddTx. -func (mr *StateMockRecorder) AddTx(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) AddTx(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTx", reflect.TypeOf((*State)(nil).AddTx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTx", reflect.TypeOf((*State)(nil).AddTx), tx) } // AddUTXO mocks base method. -func (m *State) AddUTXO(arg0 *avax.UTXO) { +func (m *State) AddUTXO(utxo *avax.UTXO) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddUTXO", arg0) + m.ctrl.Call(m, "AddUTXO", utxo) } // AddUTXO indicates an expected call of AddUTXO. -func (mr *StateMockRecorder) AddUTXO(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) AddUTXO(utxo any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUTXO", reflect.TypeOf((*State)(nil).AddUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUTXO", reflect.TypeOf((*State)(nil).AddUTXO), utxo) } // Checksums mocks base method. @@ -151,45 +152,45 @@ func (mr *StateMockRecorder) CommitBatch() *gomock.Call { } // DeleteUTXO mocks base method. -func (m *State) DeleteUTXO(arg0 ids.ID) { +func (m *State) DeleteUTXO(utxoID ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "DeleteUTXO", arg0) + m.ctrl.Call(m, "DeleteUTXO", utxoID) } // DeleteUTXO indicates an expected call of DeleteUTXO. -func (mr *StateMockRecorder) DeleteUTXO(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) DeleteUTXO(utxoID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUTXO", reflect.TypeOf((*State)(nil).DeleteUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUTXO", reflect.TypeOf((*State)(nil).DeleteUTXO), utxoID) } // GetBlock mocks base method. -func (m *State) GetBlock(arg0 ids.ID) (block.Block, error) { +func (m *State) GetBlock(blkID ids.ID) (block.Block, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0) + ret := m.ctrl.Call(m, "GetBlock", blkID) ret0, _ := ret[0].(block.Block) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlock indicates an expected call of GetBlock. -func (mr *StateMockRecorder) GetBlock(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) GetBlock(blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*State)(nil).GetBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*State)(nil).GetBlock), blkID) } // GetBlockIDAtHeight mocks base method. -func (m *State) GetBlockIDAtHeight(arg0 uint64) (ids.ID, error) { +func (m *State) GetBlockIDAtHeight(height uint64) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockIDAtHeight", arg0) + ret := m.ctrl.Call(m, "GetBlockIDAtHeight", height) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight. -func (mr *StateMockRecorder) GetBlockIDAtHeight(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) GetBlockIDAtHeight(height any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*State)(nil).GetBlockIDAtHeight), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*State)(nil).GetBlockIDAtHeight), height) } // GetLastAccepted mocks base method. @@ -221,47 +222,47 @@ func (mr *StateMockRecorder) GetTimestamp() *gomock.Call { } // GetTx mocks base method. -func (m *State) GetTx(arg0 ids.ID) (*txs.Tx, error) { +func (m *State) GetTx(txID ids.ID) (*txs.Tx, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTx", arg0) + ret := m.ctrl.Call(m, "GetTx", txID) ret0, _ := ret[0].(*txs.Tx) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTx indicates an expected call of GetTx. -func (mr *StateMockRecorder) GetTx(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) GetTx(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTx", reflect.TypeOf((*State)(nil).GetTx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTx", reflect.TypeOf((*State)(nil).GetTx), txID) } // GetUTXO mocks base method. -func (m *State) GetUTXO(arg0 ids.ID) (*avax.UTXO, error) { +func (m *State) GetUTXO(utxoID ids.ID) (*avax.UTXO, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUTXO", arg0) + ret := m.ctrl.Call(m, "GetUTXO", utxoID) ret0, _ := ret[0].(*avax.UTXO) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUTXO indicates an expected call of GetUTXO. -func (mr *StateMockRecorder) GetUTXO(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) GetUTXO(utxoID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUTXO", reflect.TypeOf((*State)(nil).GetUTXO), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUTXO", reflect.TypeOf((*State)(nil).GetUTXO), utxoID) } // InitializeChainState mocks base method. -func (m *State) InitializeChainState(arg0 ids.ID, arg1 time.Time) error { +func (m *State) InitializeChainState(stopVertexID ids.ID, genesisTimestamp time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InitializeChainState", arg0, arg1) + ret := m.ctrl.Call(m, "InitializeChainState", stopVertexID, genesisTimestamp) ret0, _ := ret[0].(error) return ret0 } // InitializeChainState indicates an expected call of InitializeChainState. -func (mr *StateMockRecorder) InitializeChainState(arg0, arg1 any) *gomock.Call { +func (mr *StateMockRecorder) InitializeChainState(stopVertexID, genesisTimestamp any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeChainState", reflect.TypeOf((*State)(nil).InitializeChainState), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeChainState", reflect.TypeOf((*State)(nil).InitializeChainState), stopVertexID, genesisTimestamp) } // IsInitialized mocks base method. @@ -294,40 +295,40 @@ func (mr *StateMockRecorder) SetInitialized() *gomock.Call { } // SetLastAccepted mocks base method. -func (m *State) SetLastAccepted(arg0 ids.ID) { +func (m *State) SetLastAccepted(blkID ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetLastAccepted", arg0) + m.ctrl.Call(m, "SetLastAccepted", blkID) } // SetLastAccepted indicates an expected call of SetLastAccepted. -func (mr *StateMockRecorder) SetLastAccepted(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) SetLastAccepted(blkID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*State)(nil).SetLastAccepted), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*State)(nil).SetLastAccepted), blkID) } // SetTimestamp mocks base method. -func (m *State) SetTimestamp(arg0 time.Time) { +func (m *State) SetTimestamp(t time.Time) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetTimestamp", arg0) + m.ctrl.Call(m, "SetTimestamp", t) } // SetTimestamp indicates an expected call of SetTimestamp. -func (mr *StateMockRecorder) SetTimestamp(arg0 any) *gomock.Call { +func (mr *StateMockRecorder) SetTimestamp(t any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTimestamp", reflect.TypeOf((*State)(nil).SetTimestamp), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTimestamp", reflect.TypeOf((*State)(nil).SetTimestamp), t) } // UTXOIDs mocks base method. -func (m *State) UTXOIDs(arg0 []byte, arg1 ids.ID, arg2 int) ([]ids.ID, error) { +func (m *State) UTXOIDs(addr []byte, previous ids.ID, limit int) ([]ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UTXOIDs", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UTXOIDs", addr, previous, limit) ret0, _ := ret[0].([]ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // UTXOIDs indicates an expected call of UTXOIDs. -func (mr *StateMockRecorder) UTXOIDs(arg0, arg1, arg2 any) *gomock.Call { +func (mr *StateMockRecorder) UTXOIDs(addr, previous, limit any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UTXOIDs", reflect.TypeOf((*State)(nil).UTXOIDs), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UTXOIDs", reflect.TypeOf((*State)(nil).UTXOIDs), addr, previous, limit) } diff --git a/vms/avm/txs/mempool/mempoolmock/mempool.go b/vms/avm/txs/mempool/mempoolmock/mempool.go index 13bdf672db46..8e061855dfb8 100644 --- a/vms/avm/txs/mempool/mempoolmock/mempool.go +++ b/vms/avm/txs/mempool/mempoolmock/mempool.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=mempoolmock -destination=vms/avm/txs/mempool/mempoolmock/mempool.go -mock_names=Mempool=Mempool github.com/ava-labs/avalanchego/vms/avm/txs/mempool Mempool +// mockgen -package=mempoolmock -destination=mempoolmock/mempool.go -mock_names=Mempool=Mempool . Mempool // // Package mempoolmock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type Mempool struct { ctrl *gomock.Controller recorder *MempoolMockRecorder + isgomock struct{} } // MempoolMockRecorder is the mock recorder for Mempool. @@ -41,58 +42,58 @@ func (m *Mempool) EXPECT() *MempoolMockRecorder { } // Add mocks base method. -func (m *Mempool) Add(arg0 *txs.Tx) error { +func (m *Mempool) Add(tx *txs.Tx) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Add", arg0) + ret := m.ctrl.Call(m, "Add", tx) ret0, _ := ret[0].(error) return ret0 } // Add indicates an expected call of Add. -func (mr *MempoolMockRecorder) Add(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) Add(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*Mempool)(nil).Add), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*Mempool)(nil).Add), tx) } // Get mocks base method. -func (m *Mempool) Get(arg0 ids.ID) (*txs.Tx, bool) { +func (m *Mempool) Get(txID ids.ID) (*txs.Tx, bool) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0) + ret := m.ctrl.Call(m, "Get", txID) ret0, _ := ret[0].(*txs.Tx) ret1, _ := ret[1].(bool) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MempoolMockRecorder) Get(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) Get(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*Mempool)(nil).Get), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*Mempool)(nil).Get), txID) } // GetDropReason mocks base method. -func (m *Mempool) GetDropReason(arg0 ids.ID) error { +func (m *Mempool) GetDropReason(txID ids.ID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDropReason", arg0) + ret := m.ctrl.Call(m, "GetDropReason", txID) ret0, _ := ret[0].(error) return ret0 } // GetDropReason indicates an expected call of GetDropReason. -func (mr *MempoolMockRecorder) GetDropReason(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) GetDropReason(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDropReason", reflect.TypeOf((*Mempool)(nil).GetDropReason), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDropReason", reflect.TypeOf((*Mempool)(nil).GetDropReason), txID) } // Iterate mocks base method. -func (m *Mempool) Iterate(arg0 func(*txs.Tx) bool) { +func (m *Mempool) Iterate(f func(*txs.Tx) bool) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Iterate", arg0) + m.ctrl.Call(m, "Iterate", f) } // Iterate indicates an expected call of Iterate. -func (mr *MempoolMockRecorder) Iterate(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) Iterate(f any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*Mempool)(nil).Iterate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*Mempool)(nil).Iterate), f) } // Len mocks base method. @@ -110,15 +111,15 @@ func (mr *MempoolMockRecorder) Len() *gomock.Call { } // MarkDropped mocks base method. -func (m *Mempool) MarkDropped(arg0 ids.ID, arg1 error) { +func (m *Mempool) MarkDropped(txID ids.ID, reason error) { m.ctrl.T.Helper() - m.ctrl.Call(m, "MarkDropped", arg0, arg1) + m.ctrl.Call(m, "MarkDropped", txID, reason) } // MarkDropped indicates an expected call of MarkDropped. -func (mr *MempoolMockRecorder) MarkDropped(arg0, arg1 any) *gomock.Call { +func (mr *MempoolMockRecorder) MarkDropped(txID, reason any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkDropped", reflect.TypeOf((*Mempool)(nil).MarkDropped), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkDropped", reflect.TypeOf((*Mempool)(nil).MarkDropped), txID, reason) } // Peek mocks base method. @@ -137,19 +138,19 @@ func (mr *MempoolMockRecorder) Peek() *gomock.Call { } // Remove mocks base method. -func (m *Mempool) Remove(arg0 ...*txs.Tx) { +func (m *Mempool) Remove(txs ...*txs.Tx) { m.ctrl.T.Helper() varargs := []any{} - for _, a := range arg0 { + for _, a := range txs { varargs = append(varargs, a) } m.ctrl.Call(m, "Remove", varargs...) } // Remove indicates an expected call of Remove. -func (mr *MempoolMockRecorder) Remove(arg0 ...any) *gomock.Call { +func (mr *MempoolMockRecorder) Remove(txs ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*Mempool)(nil).Remove), arg0...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*Mempool)(nil).Remove), txs...) } // RequestBuildBlock mocks base method. diff --git a/vms/avm/txs/mempool/mocks_generate_test.go b/vms/avm/txs/mempool/mocks_generate_test.go new file mode 100644 index 000000000000..7390f30c4b5c --- /dev/null +++ b/vms/avm/txs/mempool/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package mempool + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/mempool.go -mock_names=Mempool=Mempool . Mempool diff --git a/vms/avm/txs/mocks_generate_test.go b/vms/avm/txs/mocks_generate_test.go new file mode 100644 index 000000000000..e96c67df8092 --- /dev/null +++ b/vms/avm/txs/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package txs + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/tx.go -mock_names=UnsignedTx=UnsignedTx . UnsignedTx diff --git a/vms/avm/txs/txsmock/tx.go b/vms/avm/txs/txsmock/tx.go index 73ec73472921..19e9f5a2a2fd 100644 --- a/vms/avm/txs/txsmock/tx.go +++ b/vms/avm/txs/txsmock/tx.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/avm/txs/tx.go +// Source: github.com/ava-labs/avalanchego/vms/avm/txs (interfaces: UnsignedTx) // // Generated by this command: // -// mockgen -source=vms/avm/txs/tx.go -destination=vms/avm/txs/txsmock/tx.go -package=txsmock -exclude_interfaces= -mock_names=UnsignedTx=UnsignedTx +// mockgen -package=txsmock -destination=txsmock/tx.go -mock_names=UnsignedTx=UnsignedTx . UnsignedTx // // Package txsmock is a generated GoMock package. @@ -24,6 +24,7 @@ import ( type UnsignedTx struct { ctrl *gomock.Controller recorder *UnsignedTxMockRecorder + isgomock struct{} } // UnsignedTxMockRecorder is the mock recorder for UnsignedTx. diff --git a/vms/components/avax/avaxmock/transferable_in.go b/vms/components/avax/avaxmock/transferable_in.go index 4221e1830648..a866f7380655 100644 --- a/vms/components/avax/avaxmock/transferable_in.go +++ b/vms/components/avax/avaxmock/transferable_in.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=avaxmock -destination=vms/components/avax/avaxmock/transferable_in.go -mock_names=TransferableIn=TransferableIn github.com/ava-labs/avalanchego/vms/components/avax TransferableIn +// mockgen -package=avaxmock -destination=avaxmock/transferable_in.go -mock_names=TransferableIn=TransferableIn . TransferableIn // // Package avaxmock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type TransferableIn struct { ctrl *gomock.Controller recorder *TransferableInMockRecorder + isgomock struct{} } // TransferableInMockRecorder is the mock recorder for TransferableIn. @@ -69,15 +70,15 @@ func (mr *TransferableInMockRecorder) Cost() *gomock.Call { } // InitCtx mocks base method. -func (m *TransferableIn) InitCtx(arg0 *snow.Context) { +func (m *TransferableIn) InitCtx(ctx *snow.Context) { m.ctrl.T.Helper() - m.ctrl.Call(m, "InitCtx", arg0) + m.ctrl.Call(m, "InitCtx", ctx) } // InitCtx indicates an expected call of InitCtx. -func (mr *TransferableInMockRecorder) InitCtx(arg0 any) *gomock.Call { +func (mr *TransferableInMockRecorder) InitCtx(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitCtx", reflect.TypeOf((*TransferableIn)(nil).InitCtx), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitCtx", reflect.TypeOf((*TransferableIn)(nil).InitCtx), ctx) } // Verify mocks base method. diff --git a/vms/components/avax/avaxmock/transferable_out.go b/vms/components/avax/avaxmock/transferable_out.go index ce30c4d0ddc7..7deda34475e6 100644 --- a/vms/components/avax/avaxmock/transferable_out.go +++ b/vms/components/avax/avaxmock/transferable_out.go @@ -1,4 +1,4 @@ -// Code generated by MockGen. DO NOT EDIT. +// Code generated by MockGen and manually edited. // Source: github.com/ava-labs/avalanchego/vms/components/avax (interfaces: TransferableOut) // // Generated by this command: diff --git a/vms/components/avax/mocks_generate_test.go b/vms/components/avax/mocks_generate_test.go new file mode 100644 index 000000000000..f20efeda4d3d --- /dev/null +++ b/vms/components/avax/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package avax + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/transferable_in.go -mock_names=TransferableIn=TransferableIn . TransferableIn diff --git a/vms/components/verify/mocks_generate_test.go b/vms/components/verify/mocks_generate_test.go new file mode 100644 index 000000000000..5fe3cfca64e0 --- /dev/null +++ b/vms/components/verify/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package verify + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/verifiable.go -mock_names=Verifiable=Verifiable . Verifiable diff --git a/vms/components/verify/verifymock/verifiable.go b/vms/components/verify/verifymock/verifiable.go index 53663316573c..88f9b54394da 100644 --- a/vms/components/verify/verifymock/verifiable.go +++ b/vms/components/verify/verifymock/verifiable.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=verifymock -destination=vms/components/verify/verifymock/verifiable.go -mock_names=Verifiable=Verifiable github.com/ava-labs/avalanchego/vms/components/verify Verifiable +// mockgen -package=verifymock -destination=verifymock/verifiable.go -mock_names=Verifiable=Verifiable . Verifiable // // Package verifymock is a generated GoMock package. @@ -19,6 +19,7 @@ import ( type Verifiable struct { ctrl *gomock.Controller recorder *VerifiableMockRecorder + isgomock struct{} } // VerifiableMockRecorder is the mock recorder for Verifiable. diff --git a/vms/mocks_generate_test.go b/vms/mocks_generate_test.go new file mode 100644 index 000000000000..19866bbd8b63 --- /dev/null +++ b/vms/mocks_generate_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package vms + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/factory.go -mock_names=Factory=Factory . Factory +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager diff --git a/vms/platformvm/block/executor/executormock/manager.go b/vms/platformvm/block/executor/executormock/manager.go index 1b6c1a5094c1..c4bd2dbacbb8 100644 --- a/vms/platformvm/block/executor/executormock/manager.go +++ b/vms/platformvm/block/executor/executormock/manager.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/platformvm/block/executor/manager.go +// Source: github.com/ava-labs/avalanchego/vms/platformvm/block/executor (interfaces: Manager) // // Generated by this command: // -// mockgen -source=vms/platformvm/block/executor/manager.go -destination=vms/platformvm/block/executor/executormock/manager.go -package=executormock -exclude_interfaces= -mock_names=Manager=Manager +// mockgen -package=executormock -destination=executormock/manager.go -mock_names=Manager=Manager . Manager // // Package executormock is a generated GoMock package. @@ -25,6 +25,7 @@ import ( type Manager struct { ctrl *gomock.Controller recorder *ManagerMockRecorder + isgomock struct{} } // ManagerMockRecorder is the mock recorder for Manager. diff --git a/vms/platformvm/block/executor/mocks_generate_test.go b/vms/platformvm/block/executor/mocks_generate_test.go new file mode 100644 index 000000000000..7f80b29b03f0 --- /dev/null +++ b/vms/platformvm/block/executor/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package executor + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/manager.go -mock_names=Manager=Manager . Manager diff --git a/vms/platformvm/block/mock_block.go b/vms/platformvm/block/mock_block.go index 34e00be948a2..48698e787da5 100644 --- a/vms/platformvm/block/mock_block.go +++ b/vms/platformvm/block/mock_block.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/platformvm/block/block.go +// Source: github.com/ava-labs/avalanchego/vms/platformvm/block (interfaces: Block) // // Generated by this command: // -// mockgen -source=vms/platformvm/block/block.go -destination=vms/platformvm/block/mock_block.go -package=block -exclude_interfaces=BanffBlock -mock_names=MockBlock=MockBlock +// mockgen -package=block -destination=mock_block.go . Block // // Package block is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type MockBlock struct { ctrl *gomock.Controller recorder *MockBlockMockRecorder + isgomock struct{} } // MockBlockMockRecorder is the mock recorder for MockBlock. diff --git a/vms/platformvm/block/mocks_generate_test.go b/vms/platformvm/block/mocks_generate_test.go new file mode 100644 index 000000000000..0de0cea64dca --- /dev/null +++ b/vms/platformvm/block/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package block + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mock_block.go . Block diff --git a/vms/platformvm/fx/fxmock/fx.go b/vms/platformvm/fx/fxmock/fx.go index 39e6d550ad81..2376623fec3f 100644 --- a/vms/platformvm/fx/fxmock/fx.go +++ b/vms/platformvm/fx/fxmock/fx.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=fxmock -destination=vms/platformvm/fx/fxmock/fx.go -mock_names=Fx=Fx github.com/ava-labs/avalanchego/vms/platformvm/fx Fx +// mockgen -package=fxmock -destination=fxmock/fx.go -mock_names=Fx=Fx . Fx // // Package fxmock is a generated GoMock package. @@ -19,6 +19,7 @@ import ( type Fx struct { ctrl *gomock.Controller recorder *FxMockRecorder + isgomock struct{} } // FxMockRecorder is the mock recorder for Fx. @@ -67,58 +68,58 @@ func (mr *FxMockRecorder) Bootstrapping() *gomock.Call { } // CreateOutput mocks base method. -func (m *Fx) CreateOutput(arg0 uint64, arg1 any) (any, error) { +func (m *Fx) CreateOutput(amount uint64, controlGroup any) (any, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateOutput", arg0, arg1) + ret := m.ctrl.Call(m, "CreateOutput", amount, controlGroup) ret0, _ := ret[0].(any) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateOutput indicates an expected call of CreateOutput. -func (mr *FxMockRecorder) CreateOutput(arg0, arg1 any) *gomock.Call { +func (mr *FxMockRecorder) CreateOutput(amount, controlGroup any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOutput", reflect.TypeOf((*Fx)(nil).CreateOutput), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOutput", reflect.TypeOf((*Fx)(nil).CreateOutput), amount, controlGroup) } // Initialize mocks base method. -func (m *Fx) Initialize(arg0 any) error { +func (m *Fx) Initialize(vm any) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Initialize", arg0) + ret := m.ctrl.Call(m, "Initialize", vm) ret0, _ := ret[0].(error) return ret0 } // Initialize indicates an expected call of Initialize. -func (mr *FxMockRecorder) Initialize(arg0 any) *gomock.Call { +func (mr *FxMockRecorder) Initialize(vm any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*Fx)(nil).Initialize), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*Fx)(nil).Initialize), vm) } // VerifyPermission mocks base method. -func (m *Fx) VerifyPermission(arg0, arg1, arg2, arg3 any) error { +func (m *Fx) VerifyPermission(tx, in, cred, controlGroup any) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VerifyPermission", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "VerifyPermission", tx, in, cred, controlGroup) ret0, _ := ret[0].(error) return ret0 } // VerifyPermission indicates an expected call of VerifyPermission. -func (mr *FxMockRecorder) VerifyPermission(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *FxMockRecorder) VerifyPermission(tx, in, cred, controlGroup any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyPermission", reflect.TypeOf((*Fx)(nil).VerifyPermission), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyPermission", reflect.TypeOf((*Fx)(nil).VerifyPermission), tx, in, cred, controlGroup) } // VerifyTransfer mocks base method. -func (m *Fx) VerifyTransfer(arg0, arg1, arg2, arg3 any) error { +func (m *Fx) VerifyTransfer(tx, in, cred, utxo any) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VerifyTransfer", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "VerifyTransfer", tx, in, cred, utxo) ret0, _ := ret[0].(error) return ret0 } // VerifyTransfer indicates an expected call of VerifyTransfer. -func (mr *FxMockRecorder) VerifyTransfer(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *FxMockRecorder) VerifyTransfer(tx, in, cred, utxo any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyTransfer", reflect.TypeOf((*Fx)(nil).VerifyTransfer), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyTransfer", reflect.TypeOf((*Fx)(nil).VerifyTransfer), tx, in, cred, utxo) } diff --git a/vms/platformvm/fx/fxmock/owner.go b/vms/platformvm/fx/fxmock/owner.go index 9f1f9b0e6932..5f24f244a9b7 100644 --- a/vms/platformvm/fx/fxmock/owner.go +++ b/vms/platformvm/fx/fxmock/owner.go @@ -1,4 +1,4 @@ -// Code generated by MockGen. DO NOT EDIT. +// Code generated by MockGen and manually edited. // Source: github.com/ava-labs/avalanchego/vms/platformvm/fx (interfaces: Owner) // // Generated by this command: diff --git a/vms/platformvm/fx/mocks_generate_test.go b/vms/platformvm/fx/mocks_generate_test.go new file mode 100644 index 000000000000..e86ad230550a --- /dev/null +++ b/vms/platformvm/fx/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package fx + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/fx.go -mock_names=Fx=Fx . Fx diff --git a/vms/platformvm/signer/mocks_generate_test.go b/vms/platformvm/signer/mocks_generate_test.go new file mode 100644 index 000000000000..a94abc4eef84 --- /dev/null +++ b/vms/platformvm/signer/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package signer + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -source=signer.go -destination=${GOPACKAGE}mock/signer.go -mock_names=Signer=Signer diff --git a/vms/platformvm/signer/signermock/signer.go b/vms/platformvm/signer/signermock/signer.go index a6d6f3c24011..2e90d3a61679 100644 --- a/vms/platformvm/signer/signermock/signer.go +++ b/vms/platformvm/signer/signermock/signer.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/platformvm/signer/signer.go +// Source: signer.go // // Generated by this command: // -// mockgen -source=vms/platformvm/signer/signer.go -destination=vms/platformvm/signer/signermock/signer.go -package=signermock -exclude_interfaces= -mock_names=Signer=Signer +// mockgen -package=signermock -source=signer.go -destination=signermock/signer.go -mock_names=Signer=Signer // // Package signermock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Signer struct { ctrl *gomock.Controller recorder *SignerMockRecorder + isgomock struct{} } // SignerMockRecorder is the mock recorder for Signer. diff --git a/vms/platformvm/state/mock_chain.go b/vms/platformvm/state/mock_chain.go index 0c629e524cf3..98877bd403e8 100644 --- a/vms/platformvm/state/mock_chain.go +++ b/vms/platformvm/state/mock_chain.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/platformvm/state/state.go +// Source: github.com/ava-labs/avalanchego/vms/platformvm/state (interfaces: Chain) // // Generated by this command: // -// mockgen -source=vms/platformvm/state/state.go -destination=vms/platformvm/state/mock_chain.go -package=state -exclude_interfaces=State -mock_names=MockChain=MockChain +// mockgen -package=state -destination=mock_chain.go . Chain // // Package state is a generated GoMock package. @@ -27,6 +27,7 @@ import ( type MockChain struct { ctrl *gomock.Controller recorder *MockChainMockRecorder + isgomock struct{} } // MockChainMockRecorder is the mock recorder for MockChain. diff --git a/vms/platformvm/state/mock_diff.go b/vms/platformvm/state/mock_diff.go index 94481109ac59..9c2c5d8db8a5 100644 --- a/vms/platformvm/state/mock_diff.go +++ b/vms/platformvm/state/mock_diff.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/platformvm/state/diff.go +// Source: github.com/ava-labs/avalanchego/vms/platformvm/state (interfaces: Diff) // // Generated by this command: // -// mockgen -source=vms/platformvm/state/diff.go -destination=vms/platformvm/state/mock_diff.go -package=state -exclude_interfaces= -mock_names=MockDiff=MockDiff +// mockgen -package=state -destination=mock_diff.go . Diff // // Package state is a generated GoMock package. @@ -27,6 +27,7 @@ import ( type MockDiff struct { ctrl *gomock.Controller recorder *MockDiffMockRecorder + isgomock struct{} } // MockDiffMockRecorder is the mock recorder for MockDiff. diff --git a/vms/platformvm/state/mock_state.go b/vms/platformvm/state/mock_state.go index 184b2c9563f3..cdaccf060b60 100644 --- a/vms/platformvm/state/mock_state.go +++ b/vms/platformvm/state/mock_state.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/platformvm/state/state.go +// Source: github.com/ava-labs/avalanchego/vms/platformvm/state (interfaces: State) // // Generated by this command: // -// mockgen -source=vms/platformvm/state/state.go -destination=vms/platformvm/state/mock_state.go -package=state -exclude_interfaces=Chain -mock_names=MockState=MockState +// mockgen -package=state -destination=mock_state.go . State // // Package state is a generated GoMock package. @@ -33,6 +33,7 @@ import ( type MockState struct { ctrl *gomock.Controller recorder *MockStateMockRecorder + isgomock struct{} } // MockStateMockRecorder is the mock recorder for MockState. diff --git a/vms/platformvm/state/mocks_generate_test.go b/vms/platformvm/state/mocks_generate_test.go new file mode 100644 index 000000000000..6f325306b9d2 --- /dev/null +++ b/vms/platformvm/state/mocks_generate_test.go @@ -0,0 +1,8 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package state + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mock_diff.go . Diff +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mock_state.go . State +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mock_chain.go . Chain diff --git a/vms/platformvm/txs/mempool/mempoolmock/mempool.go b/vms/platformvm/txs/mempool/mempoolmock/mempool.go index 7d81182575c5..f88c81824b15 100644 --- a/vms/platformvm/txs/mempool/mempoolmock/mempool.go +++ b/vms/platformvm/txs/mempool/mempoolmock/mempool.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=mempoolmock -destination=vms/platformvm/txs/mempool/mempoolmock/mempool.go -mock_names=Mempool=Mempool github.com/ava-labs/avalanchego/vms/platformvm/txs/mempool Mempool +// mockgen -package=mempoolmock -destination=mempoolmock/mempool.go -mock_names=Mempool=Mempool . Mempool // // Package mempoolmock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type Mempool struct { ctrl *gomock.Controller recorder *MempoolMockRecorder + isgomock struct{} } // MempoolMockRecorder is the mock recorder for Mempool. @@ -41,58 +42,58 @@ func (m *Mempool) EXPECT() *MempoolMockRecorder { } // Add mocks base method. -func (m *Mempool) Add(arg0 *txs.Tx) error { +func (m *Mempool) Add(tx *txs.Tx) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Add", arg0) + ret := m.ctrl.Call(m, "Add", tx) ret0, _ := ret[0].(error) return ret0 } // Add indicates an expected call of Add. -func (mr *MempoolMockRecorder) Add(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) Add(tx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*Mempool)(nil).Add), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*Mempool)(nil).Add), tx) } // Get mocks base method. -func (m *Mempool) Get(arg0 ids.ID) (*txs.Tx, bool) { +func (m *Mempool) Get(txID ids.ID) (*txs.Tx, bool) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0) + ret := m.ctrl.Call(m, "Get", txID) ret0, _ := ret[0].(*txs.Tx) ret1, _ := ret[1].(bool) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MempoolMockRecorder) Get(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) Get(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*Mempool)(nil).Get), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*Mempool)(nil).Get), txID) } // GetDropReason mocks base method. -func (m *Mempool) GetDropReason(arg0 ids.ID) error { +func (m *Mempool) GetDropReason(txID ids.ID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDropReason", arg0) + ret := m.ctrl.Call(m, "GetDropReason", txID) ret0, _ := ret[0].(error) return ret0 } // GetDropReason indicates an expected call of GetDropReason. -func (mr *MempoolMockRecorder) GetDropReason(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) GetDropReason(txID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDropReason", reflect.TypeOf((*Mempool)(nil).GetDropReason), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDropReason", reflect.TypeOf((*Mempool)(nil).GetDropReason), txID) } // Iterate mocks base method. -func (m *Mempool) Iterate(arg0 func(*txs.Tx) bool) { +func (m *Mempool) Iterate(f func(*txs.Tx) bool) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Iterate", arg0) + m.ctrl.Call(m, "Iterate", f) } // Iterate indicates an expected call of Iterate. -func (mr *MempoolMockRecorder) Iterate(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) Iterate(f any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*Mempool)(nil).Iterate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*Mempool)(nil).Iterate), f) } // Len mocks base method. @@ -110,15 +111,15 @@ func (mr *MempoolMockRecorder) Len() *gomock.Call { } // MarkDropped mocks base method. -func (m *Mempool) MarkDropped(arg0 ids.ID, arg1 error) { +func (m *Mempool) MarkDropped(txID ids.ID, reason error) { m.ctrl.T.Helper() - m.ctrl.Call(m, "MarkDropped", arg0, arg1) + m.ctrl.Call(m, "MarkDropped", txID, reason) } // MarkDropped indicates an expected call of MarkDropped. -func (mr *MempoolMockRecorder) MarkDropped(arg0, arg1 any) *gomock.Call { +func (mr *MempoolMockRecorder) MarkDropped(txID, reason any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkDropped", reflect.TypeOf((*Mempool)(nil).MarkDropped), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarkDropped", reflect.TypeOf((*Mempool)(nil).MarkDropped), txID, reason) } // Peek mocks base method. @@ -137,29 +138,29 @@ func (mr *MempoolMockRecorder) Peek() *gomock.Call { } // Remove mocks base method. -func (m *Mempool) Remove(arg0 ...*txs.Tx) { +func (m *Mempool) Remove(txs ...*txs.Tx) { m.ctrl.T.Helper() varargs := []any{} - for _, a := range arg0 { + for _, a := range txs { varargs = append(varargs, a) } m.ctrl.Call(m, "Remove", varargs...) } // Remove indicates an expected call of Remove. -func (mr *MempoolMockRecorder) Remove(arg0 ...any) *gomock.Call { +func (mr *MempoolMockRecorder) Remove(txs ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*Mempool)(nil).Remove), arg0...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*Mempool)(nil).Remove), txs...) } // RequestBuildBlock mocks base method. -func (m *Mempool) RequestBuildBlock(arg0 bool) { +func (m *Mempool) RequestBuildBlock(emptyBlockPermitted bool) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RequestBuildBlock", arg0) + m.ctrl.Call(m, "RequestBuildBlock", emptyBlockPermitted) } // RequestBuildBlock indicates an expected call of RequestBuildBlock. -func (mr *MempoolMockRecorder) RequestBuildBlock(arg0 any) *gomock.Call { +func (mr *MempoolMockRecorder) RequestBuildBlock(emptyBlockPermitted any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequestBuildBlock", reflect.TypeOf((*Mempool)(nil).RequestBuildBlock), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequestBuildBlock", reflect.TypeOf((*Mempool)(nil).RequestBuildBlock), emptyBlockPermitted) } diff --git a/vms/platformvm/txs/mempool/mocks_generate_test.go b/vms/platformvm/txs/mempool/mocks_generate_test.go new file mode 100644 index 000000000000..7390f30c4b5c --- /dev/null +++ b/vms/platformvm/txs/mempool/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package mempool + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/mempool.go -mock_names=Mempool=Mempool . Mempool diff --git a/vms/platformvm/utxo/mocks_generate_test.go b/vms/platformvm/utxo/mocks_generate_test.go new file mode 100644 index 000000000000..8f61b373151f --- /dev/null +++ b/vms/platformvm/utxo/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package utxo + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/verifier.go -mock_names=Verifier=Verifier . Verifier diff --git a/vms/platformvm/utxo/utxomock/verifier.go b/vms/platformvm/utxo/utxomock/verifier.go index 9da143719b87..8d31867dd729 100644 --- a/vms/platformvm/utxo/utxomock/verifier.go +++ b/vms/platformvm/utxo/utxomock/verifier.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=utxomock -destination=vms/platformvm/utxo/utxomock/verifier.go -mock_names=Verifier=Verifier github.com/ava-labs/avalanchego/vms/platformvm/utxo Verifier +// mockgen -package=utxomock -destination=utxomock/verifier.go -mock_names=Verifier=Verifier . Verifier // // Package utxomock is a generated GoMock package. @@ -23,6 +23,7 @@ import ( type Verifier struct { ctrl *gomock.Controller recorder *VerifierMockRecorder + isgomock struct{} } // VerifierMockRecorder is the mock recorder for Verifier. @@ -43,29 +44,29 @@ func (m *Verifier) EXPECT() *VerifierMockRecorder { } // VerifySpend mocks base method. -func (m *Verifier) VerifySpend(arg0 txs.UnsignedTx, arg1 avax.UTXOGetter, arg2 []*avax.TransferableInput, arg3 []*avax.TransferableOutput, arg4 []verify.Verifiable, arg5 map[ids.ID]uint64) error { +func (m *Verifier) VerifySpend(tx txs.UnsignedTx, utxoDB avax.UTXOGetter, ins []*avax.TransferableInput, outs []*avax.TransferableOutput, creds []verify.Verifiable, unlockedProduced map[ids.ID]uint64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VerifySpend", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "VerifySpend", tx, utxoDB, ins, outs, creds, unlockedProduced) ret0, _ := ret[0].(error) return ret0 } // VerifySpend indicates an expected call of VerifySpend. -func (mr *VerifierMockRecorder) VerifySpend(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *VerifierMockRecorder) VerifySpend(tx, utxoDB, ins, outs, creds, unlockedProduced any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifySpend", reflect.TypeOf((*Verifier)(nil).VerifySpend), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifySpend", reflect.TypeOf((*Verifier)(nil).VerifySpend), tx, utxoDB, ins, outs, creds, unlockedProduced) } // VerifySpendUTXOs mocks base method. -func (m *Verifier) VerifySpendUTXOs(arg0 txs.UnsignedTx, arg1 []*avax.UTXO, arg2 []*avax.TransferableInput, arg3 []*avax.TransferableOutput, arg4 []verify.Verifiable, arg5 map[ids.ID]uint64) error { +func (m *Verifier) VerifySpendUTXOs(tx txs.UnsignedTx, utxos []*avax.UTXO, ins []*avax.TransferableInput, outs []*avax.TransferableOutput, creds []verify.Verifiable, unlockedProduced map[ids.ID]uint64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VerifySpendUTXOs", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "VerifySpendUTXOs", tx, utxos, ins, outs, creds, unlockedProduced) ret0, _ := ret[0].(error) return ret0 } // VerifySpendUTXOs indicates an expected call of VerifySpendUTXOs. -func (mr *VerifierMockRecorder) VerifySpendUTXOs(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *VerifierMockRecorder) VerifySpendUTXOs(tx, utxos, ins, outs, creds, unlockedProduced any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifySpendUTXOs", reflect.TypeOf((*Verifier)(nil).VerifySpendUTXOs), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifySpendUTXOs", reflect.TypeOf((*Verifier)(nil).VerifySpendUTXOs), tx, utxos, ins, outs, creds, unlockedProduced) } diff --git a/vms/proposervm/mocks_generate_test.go b/vms/proposervm/mocks_generate_test.go new file mode 100644 index 000000000000..c403ad84d159 --- /dev/null +++ b/vms/proposervm/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package proposervm + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . PostForkBlock diff --git a/vms/proposervm/mock_post_fork_block.go b/vms/proposervm/mocks_test.go similarity index 97% rename from vms/proposervm/mock_post_fork_block.go rename to vms/proposervm/mocks_test.go index a57042007bcb..52633dfbda40 100644 --- a/vms/proposervm/mock_post_fork_block.go +++ b/vms/proposervm/mocks_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: vms/proposervm/block.go +// Source: github.com/ava-labs/avalanchego/vms/proposervm (interfaces: PostForkBlock) // // Generated by this command: // -// mockgen -source=vms/proposervm/block.go -destination=vms/proposervm/mock_post_fork_block.go -package=proposervm -exclude_interfaces=Block -mock_names=MockPostForkBlock=MockPostForkBlock +// mockgen -package=proposervm -destination=mocks_test.go . PostForkBlock // // Package proposervm is a generated GoMock package. @@ -24,6 +24,7 @@ import ( type MockPostForkBlock struct { ctrl *gomock.Controller recorder *MockPostForkBlockMockRecorder + isgomock struct{} } // MockPostForkBlockMockRecorder is the mock recorder for MockPostForkBlock. diff --git a/vms/proposervm/proposer/mocks_generate_test.go b/vms/proposervm/proposer/mocks_generate_test.go new file mode 100644 index 000000000000..b98088ce12dd --- /dev/null +++ b/vms/proposervm/proposer/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package proposer + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/windower.go -mock_names=Windower=Windower . Windower diff --git a/vms/proposervm/proposer/proposermock/windower.go b/vms/proposervm/proposer/proposermock/windower.go index 66d83cb41692..946dbd58a076 100644 --- a/vms/proposervm/proposer/proposermock/windower.go +++ b/vms/proposervm/proposer/proposermock/windower.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=proposermock -destination=vms/proposervm/proposer/proposermock/windower.go -mock_names=Windower=Windower github.com/ava-labs/avalanchego/vms/proposervm/proposer Windower +// mockgen -package=proposermock -destination=proposermock/windower.go -mock_names=Windower=Windower . Windower // // Package proposermock is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type Windower struct { ctrl *gomock.Controller recorder *WindowerMockRecorder + isgomock struct{} } // WindowerMockRecorder is the mock recorder for Windower. @@ -42,61 +43,61 @@ func (m *Windower) EXPECT() *WindowerMockRecorder { } // Delay mocks base method. -func (m *Windower) Delay(arg0 context.Context, arg1, arg2 uint64, arg3 ids.NodeID, arg4 int) (time.Duration, error) { +func (m *Windower) Delay(ctx context.Context, blockHeight, pChainHeight uint64, validatorID ids.NodeID, maxWindows int) (time.Duration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delay", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "Delay", ctx, blockHeight, pChainHeight, validatorID, maxWindows) ret0, _ := ret[0].(time.Duration) ret1, _ := ret[1].(error) return ret0, ret1 } // Delay indicates an expected call of Delay. -func (mr *WindowerMockRecorder) Delay(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *WindowerMockRecorder) Delay(ctx, blockHeight, pChainHeight, validatorID, maxWindows any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delay", reflect.TypeOf((*Windower)(nil).Delay), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delay", reflect.TypeOf((*Windower)(nil).Delay), ctx, blockHeight, pChainHeight, validatorID, maxWindows) } // ExpectedProposer mocks base method. -func (m *Windower) ExpectedProposer(arg0 context.Context, arg1, arg2, arg3 uint64) (ids.NodeID, error) { +func (m *Windower) ExpectedProposer(ctx context.Context, blockHeight, pChainHeight, slot uint64) (ids.NodeID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExpectedProposer", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "ExpectedProposer", ctx, blockHeight, pChainHeight, slot) ret0, _ := ret[0].(ids.NodeID) ret1, _ := ret[1].(error) return ret0, ret1 } // ExpectedProposer indicates an expected call of ExpectedProposer. -func (mr *WindowerMockRecorder) ExpectedProposer(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *WindowerMockRecorder) ExpectedProposer(ctx, blockHeight, pChainHeight, slot any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExpectedProposer", reflect.TypeOf((*Windower)(nil).ExpectedProposer), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExpectedProposer", reflect.TypeOf((*Windower)(nil).ExpectedProposer), ctx, blockHeight, pChainHeight, slot) } // MinDelayForProposer mocks base method. -func (m *Windower) MinDelayForProposer(arg0 context.Context, arg1, arg2 uint64, arg3 ids.NodeID, arg4 uint64) (time.Duration, error) { +func (m *Windower) MinDelayForProposer(ctx context.Context, blockHeight, pChainHeight uint64, nodeID ids.NodeID, startSlot uint64) (time.Duration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MinDelayForProposer", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "MinDelayForProposer", ctx, blockHeight, pChainHeight, nodeID, startSlot) ret0, _ := ret[0].(time.Duration) ret1, _ := ret[1].(error) return ret0, ret1 } // MinDelayForProposer indicates an expected call of MinDelayForProposer. -func (mr *WindowerMockRecorder) MinDelayForProposer(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *WindowerMockRecorder) MinDelayForProposer(ctx, blockHeight, pChainHeight, nodeID, startSlot any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MinDelayForProposer", reflect.TypeOf((*Windower)(nil).MinDelayForProposer), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MinDelayForProposer", reflect.TypeOf((*Windower)(nil).MinDelayForProposer), ctx, blockHeight, pChainHeight, nodeID, startSlot) } // Proposers mocks base method. -func (m *Windower) Proposers(arg0 context.Context, arg1, arg2 uint64, arg3 int) ([]ids.NodeID, error) { +func (m *Windower) Proposers(ctx context.Context, blockHeight, pChainHeight uint64, maxWindows int) ([]ids.NodeID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Proposers", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "Proposers", ctx, blockHeight, pChainHeight, maxWindows) ret0, _ := ret[0].([]ids.NodeID) ret1, _ := ret[1].(error) return ret0, ret1 } // Proposers indicates an expected call of Proposers. -func (mr *WindowerMockRecorder) Proposers(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *WindowerMockRecorder) Proposers(ctx, blockHeight, pChainHeight, maxWindows any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Proposers", reflect.TypeOf((*Windower)(nil).Proposers), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Proposers", reflect.TypeOf((*Windower)(nil).Proposers), ctx, blockHeight, pChainHeight, maxWindows) } diff --git a/vms/proposervm/scheduler/mocks_generate_test.go b/vms/proposervm/scheduler/mocks_generate_test.go new file mode 100644 index 000000000000..90570afb311b --- /dev/null +++ b/vms/proposervm/scheduler/mocks_generate_test.go @@ -0,0 +1,6 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package scheduler + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/scheduler.go -mock_names=Scheduler=Scheduler . Scheduler diff --git a/vms/proposervm/scheduler/schedulermock/scheduler.go b/vms/proposervm/scheduler/schedulermock/scheduler.go index 72a9fbbd7a9d..b004fa607dd6 100644 --- a/vms/proposervm/scheduler/schedulermock/scheduler.go +++ b/vms/proposervm/scheduler/schedulermock/scheduler.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=schedulermock -destination=vms/proposervm/scheduler/schedulermock/scheduler.go -mock_names=Scheduler=Scheduler github.com/ava-labs/avalanchego/vms/proposervm/scheduler Scheduler +// mockgen -package=schedulermock -destination=schedulermock/scheduler.go -mock_names=Scheduler=Scheduler . Scheduler // // Package schedulermock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Scheduler struct { ctrl *gomock.Controller recorder *SchedulerMockRecorder + isgomock struct{} } // SchedulerMockRecorder is the mock recorder for Scheduler. @@ -52,25 +53,25 @@ func (mr *SchedulerMockRecorder) Close() *gomock.Call { } // Dispatch mocks base method. -func (m *Scheduler) Dispatch(arg0 time.Time) { +func (m *Scheduler) Dispatch(startTime time.Time) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Dispatch", arg0) + m.ctrl.Call(m, "Dispatch", startTime) } // Dispatch indicates an expected call of Dispatch. -func (mr *SchedulerMockRecorder) Dispatch(arg0 any) *gomock.Call { +func (mr *SchedulerMockRecorder) Dispatch(startTime any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dispatch", reflect.TypeOf((*Scheduler)(nil).Dispatch), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dispatch", reflect.TypeOf((*Scheduler)(nil).Dispatch), startTime) } // SetBuildBlockTime mocks base method. -func (m *Scheduler) SetBuildBlockTime(arg0 time.Time) { +func (m *Scheduler) SetBuildBlockTime(t time.Time) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetBuildBlockTime", arg0) + m.ctrl.Call(m, "SetBuildBlockTime", t) } // SetBuildBlockTime indicates an expected call of SetBuildBlockTime. -func (mr *SchedulerMockRecorder) SetBuildBlockTime(arg0 any) *gomock.Call { +func (mr *SchedulerMockRecorder) SetBuildBlockTime(t any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBuildBlockTime", reflect.TypeOf((*Scheduler)(nil).SetBuildBlockTime), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBuildBlockTime", reflect.TypeOf((*Scheduler)(nil).SetBuildBlockTime), t) } diff --git a/vms/proposervm/state/statemock/state.go b/vms/proposervm/state/statemock/state.go deleted file mode 100644 index 49ac45e9ecd3..000000000000 --- a/vms/proposervm/state/statemock/state.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ava-labs/avalanchego/vms/proposervm/state (interfaces: State) -// -// Generated by this command: -// -// mockgen -package=statemock -destination=vms/proposervm/state/statemock/state.go -mock_names=State=State github.com/ava-labs/avalanchego/vms/proposervm/state State -// - -// Package statemock is a generated GoMock package. -package statemock - -import ( - reflect "reflect" - - ids "github.com/ava-labs/avalanchego/ids" - block "github.com/ava-labs/avalanchego/vms/proposervm/block" - gomock "go.uber.org/mock/gomock" -) - -// State is a mock of State interface. -type State struct { - ctrl *gomock.Controller - recorder *StateMockRecorder -} - -// StateMockRecorder is the mock recorder for State. -type StateMockRecorder struct { - mock *State -} - -// NewState creates a new mock instance. -func NewState(ctrl *gomock.Controller) *State { - mock := &State{ctrl: ctrl} - mock.recorder = &StateMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *State) EXPECT() *StateMockRecorder { - return m.recorder -} - -// DeleteBlock mocks base method. -func (m *State) DeleteBlock(arg0 ids.ID) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteBlock", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteBlock indicates an expected call of DeleteBlock. -func (mr *StateMockRecorder) DeleteBlock(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBlock", reflect.TypeOf((*State)(nil).DeleteBlock), arg0) -} - -// DeleteBlockIDAtHeight mocks base method. -func (m *State) DeleteBlockIDAtHeight(arg0 uint64) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteBlockIDAtHeight", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteBlockIDAtHeight indicates an expected call of DeleteBlockIDAtHeight. -func (mr *StateMockRecorder) DeleteBlockIDAtHeight(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBlockIDAtHeight", reflect.TypeOf((*State)(nil).DeleteBlockIDAtHeight), arg0) -} - -// DeleteLastAccepted mocks base method. -func (m *State) DeleteLastAccepted() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteLastAccepted") - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteLastAccepted indicates an expected call of DeleteLastAccepted. -func (mr *StateMockRecorder) DeleteLastAccepted() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLastAccepted", reflect.TypeOf((*State)(nil).DeleteLastAccepted)) -} - -// GetBlock mocks base method. -func (m *State) GetBlock(arg0 ids.ID) (block.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlock", arg0) - ret0, _ := ret[0].(block.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlock indicates an expected call of GetBlock. -func (mr *StateMockRecorder) GetBlock(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*State)(nil).GetBlock), arg0) -} - -// GetBlockIDAtHeight mocks base method. -func (m *State) GetBlockIDAtHeight(arg0 uint64) (ids.ID, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockIDAtHeight", arg0) - ret0, _ := ret[0].(ids.ID) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight. -func (mr *StateMockRecorder) GetBlockIDAtHeight(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockIDAtHeight", reflect.TypeOf((*State)(nil).GetBlockIDAtHeight), arg0) -} - -// GetForkHeight mocks base method. -func (m *State) GetForkHeight() (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetForkHeight") - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetForkHeight indicates an expected call of GetForkHeight. -func (mr *StateMockRecorder) GetForkHeight() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetForkHeight", reflect.TypeOf((*State)(nil).GetForkHeight)) -} - -// GetLastAccepted mocks base method. -func (m *State) GetLastAccepted() (ids.ID, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetLastAccepted") - ret0, _ := ret[0].(ids.ID) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetLastAccepted indicates an expected call of GetLastAccepted. -func (mr *StateMockRecorder) GetLastAccepted() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastAccepted", reflect.TypeOf((*State)(nil).GetLastAccepted)) -} - -// GetMinimumHeight mocks base method. -func (m *State) GetMinimumHeight() (uint64, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMinimumHeight") - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetMinimumHeight indicates an expected call of GetMinimumHeight. -func (mr *StateMockRecorder) GetMinimumHeight() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMinimumHeight", reflect.TypeOf((*State)(nil).GetMinimumHeight)) -} - -// PutBlock mocks base method. -func (m *State) PutBlock(arg0 block.Block) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PutBlock", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// PutBlock indicates an expected call of PutBlock. -func (mr *StateMockRecorder) PutBlock(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutBlock", reflect.TypeOf((*State)(nil).PutBlock), arg0) -} - -// SetBlockIDAtHeight mocks base method. -func (m *State) SetBlockIDAtHeight(arg0 uint64, arg1 ids.ID) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetBlockIDAtHeight", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetBlockIDAtHeight indicates an expected call of SetBlockIDAtHeight. -func (mr *StateMockRecorder) SetBlockIDAtHeight(arg0, arg1 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBlockIDAtHeight", reflect.TypeOf((*State)(nil).SetBlockIDAtHeight), arg0, arg1) -} - -// SetForkHeight mocks base method. -func (m *State) SetForkHeight(arg0 uint64) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetForkHeight", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetForkHeight indicates an expected call of SetForkHeight. -func (mr *StateMockRecorder) SetForkHeight(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetForkHeight", reflect.TypeOf((*State)(nil).SetForkHeight), arg0) -} - -// SetLastAccepted mocks base method. -func (m *State) SetLastAccepted(arg0 ids.ID) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetLastAccepted", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetLastAccepted indicates an expected call of SetLastAccepted. -func (mr *StateMockRecorder) SetLastAccepted(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLastAccepted", reflect.TypeOf((*State)(nil).SetLastAccepted), arg0) -} diff --git a/vms/registry/mocks_generate_test.go b/vms/registry/mocks_generate_test.go new file mode 100644 index 000000000000..3d640f77bda8 --- /dev/null +++ b/vms/registry/mocks_generate_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package registry + +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/vm_getter.go -mock_names=VMGetter=VMGetter . VMGetter +//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE}mock -destination=${GOPACKAGE}mock/vm_registry.go -mock_names=VMRegistry=VMRegistry . VMRegistry diff --git a/vms/registry/registrymock/vm_getter.go b/vms/registry/registrymock/vm_getter.go index 655db298542e..644ba3ff3fdd 100644 --- a/vms/registry/registrymock/vm_getter.go +++ b/vms/registry/registrymock/vm_getter.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=registrymock -destination=vms/registry/registrymock/vm_getter.go -mock_names=VMGetter=VMGetter github.com/ava-labs/avalanchego/vms/registry VMGetter +// mockgen -package=registrymock -destination=registrymock/vm_getter.go -mock_names=VMGetter=VMGetter . VMGetter // // Package registrymock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type VMGetter struct { ctrl *gomock.Controller recorder *VMGetterMockRecorder + isgomock struct{} } // VMGetterMockRecorder is the mock recorder for VMGetter. diff --git a/vms/registry/registrymock/vm_registry.go b/vms/registry/registrymock/vm_registry.go index 3176b71de8fb..c969493bcd28 100644 --- a/vms/registry/registrymock/vm_registry.go +++ b/vms/registry/registrymock/vm_registry.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=registrymock -destination=vms/registry/registrymock/vm_registry.go -mock_names=VMRegistry=VMRegistry github.com/ava-labs/avalanchego/vms/registry VMRegistry +// mockgen -package=registrymock -destination=registrymock/vm_registry.go -mock_names=VMRegistry=VMRegistry . VMRegistry // // Package registrymock is a generated GoMock package. @@ -21,6 +21,7 @@ import ( type VMRegistry struct { ctrl *gomock.Controller recorder *VMRegistryMockRecorder + isgomock struct{} } // VMRegistryMockRecorder is the mock recorder for VMRegistry. @@ -41,9 +42,9 @@ func (m *VMRegistry) EXPECT() *VMRegistryMockRecorder { } // Reload mocks base method. -func (m *VMRegistry) Reload(arg0 context.Context) ([]ids.ID, map[ids.ID]error, error) { +func (m *VMRegistry) Reload(ctx context.Context) ([]ids.ID, map[ids.ID]error, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Reload", arg0) + ret := m.ctrl.Call(m, "Reload", ctx) ret0, _ := ret[0].([]ids.ID) ret1, _ := ret[1].(map[ids.ID]error) ret2, _ := ret[2].(error) @@ -51,7 +52,7 @@ func (m *VMRegistry) Reload(arg0 context.Context) ([]ids.ID, map[ids.ID]error, e } // Reload indicates an expected call of Reload. -func (mr *VMRegistryMockRecorder) Reload(arg0 any) *gomock.Call { +func (mr *VMRegistryMockRecorder) Reload(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reload", reflect.TypeOf((*VMRegistry)(nil).Reload), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reload", reflect.TypeOf((*VMRegistry)(nil).Reload), ctx) } diff --git a/vms/vmsmock/factory.go b/vms/vmsmock/factory.go index 2b256c365900..633b94b2fe90 100644 --- a/vms/vmsmock/factory.go +++ b/vms/vmsmock/factory.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=vmsmock -destination=vms/vmsmock/factory.go -mock_names=Factory=Factory github.com/ava-labs/avalanchego/vms Factory +// mockgen -package=vmsmock -destination=vmsmock/factory.go -mock_names=Factory=Factory . Factory // // Package vmsmock is a generated GoMock package. @@ -20,6 +20,7 @@ import ( type Factory struct { ctrl *gomock.Controller recorder *FactoryMockRecorder + isgomock struct{} } // FactoryMockRecorder is the mock recorder for Factory. diff --git a/vms/vmsmock/manager.go b/vms/vmsmock/manager.go index b6bc2ac0565b..86365170cdca 100644 --- a/vms/vmsmock/manager.go +++ b/vms/vmsmock/manager.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=vmsmock -destination=vms/vmsmock/manager.go -mock_names=Manager=Manager github.com/ava-labs/avalanchego/vms Manager +// mockgen -package=vmsmock -destination=vmsmock/manager.go -mock_names=Manager=Manager . Manager // // Package vmsmock is a generated GoMock package. @@ -22,6 +22,7 @@ import ( type Manager struct { ctrl *gomock.Controller recorder *ManagerMockRecorder + isgomock struct{} } // ManagerMockRecorder is the mock recorder for Manager. @@ -42,47 +43,47 @@ func (m *Manager) EXPECT() *ManagerMockRecorder { } // Alias mocks base method. -func (m *Manager) Alias(arg0 ids.ID, arg1 string) error { +func (m *Manager) Alias(id ids.ID, alias string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Alias", arg0, arg1) + ret := m.ctrl.Call(m, "Alias", id, alias) ret0, _ := ret[0].(error) return ret0 } // Alias indicates an expected call of Alias. -func (mr *ManagerMockRecorder) Alias(arg0, arg1 any) *gomock.Call { +func (mr *ManagerMockRecorder) Alias(id, alias any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Alias", reflect.TypeOf((*Manager)(nil).Alias), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Alias", reflect.TypeOf((*Manager)(nil).Alias), id, alias) } // Aliases mocks base method. -func (m *Manager) Aliases(arg0 ids.ID) ([]string, error) { +func (m *Manager) Aliases(id ids.ID) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Aliases", arg0) + ret := m.ctrl.Call(m, "Aliases", id) ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } // Aliases indicates an expected call of Aliases. -func (mr *ManagerMockRecorder) Aliases(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) Aliases(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Aliases", reflect.TypeOf((*Manager)(nil).Aliases), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Aliases", reflect.TypeOf((*Manager)(nil).Aliases), id) } // GetFactory mocks base method. -func (m *Manager) GetFactory(arg0 ids.ID) (vms.Factory, error) { +func (m *Manager) GetFactory(vmID ids.ID) (vms.Factory, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetFactory", arg0) + ret := m.ctrl.Call(m, "GetFactory", vmID) ret0, _ := ret[0].(vms.Factory) ret1, _ := ret[1].(error) return ret0, ret1 } // GetFactory indicates an expected call of GetFactory. -func (mr *ManagerMockRecorder) GetFactory(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) GetFactory(vmID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFactory", reflect.TypeOf((*Manager)(nil).GetFactory), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFactory", reflect.TypeOf((*Manager)(nil).GetFactory), vmID) } // ListFactories mocks base method. @@ -101,73 +102,73 @@ func (mr *ManagerMockRecorder) ListFactories() *gomock.Call { } // Lookup mocks base method. -func (m *Manager) Lookup(arg0 string) (ids.ID, error) { +func (m *Manager) Lookup(alias string) (ids.ID, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Lookup", arg0) + ret := m.ctrl.Call(m, "Lookup", alias) ret0, _ := ret[0].(ids.ID) ret1, _ := ret[1].(error) return ret0, ret1 } // Lookup indicates an expected call of Lookup. -func (mr *ManagerMockRecorder) Lookup(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) Lookup(alias any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lookup", reflect.TypeOf((*Manager)(nil).Lookup), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lookup", reflect.TypeOf((*Manager)(nil).Lookup), alias) } // PrimaryAlias mocks base method. -func (m *Manager) PrimaryAlias(arg0 ids.ID) (string, error) { +func (m *Manager) PrimaryAlias(id ids.ID) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PrimaryAlias", arg0) + ret := m.ctrl.Call(m, "PrimaryAlias", id) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // PrimaryAlias indicates an expected call of PrimaryAlias. -func (mr *ManagerMockRecorder) PrimaryAlias(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) PrimaryAlias(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrimaryAlias", reflect.TypeOf((*Manager)(nil).PrimaryAlias), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrimaryAlias", reflect.TypeOf((*Manager)(nil).PrimaryAlias), id) } // PrimaryAliasOrDefault mocks base method. -func (m *Manager) PrimaryAliasOrDefault(arg0 ids.ID) string { +func (m *Manager) PrimaryAliasOrDefault(id ids.ID) string { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PrimaryAliasOrDefault", arg0) + ret := m.ctrl.Call(m, "PrimaryAliasOrDefault", id) ret0, _ := ret[0].(string) return ret0 } // PrimaryAliasOrDefault indicates an expected call of PrimaryAliasOrDefault. -func (mr *ManagerMockRecorder) PrimaryAliasOrDefault(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) PrimaryAliasOrDefault(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrimaryAliasOrDefault", reflect.TypeOf((*Manager)(nil).PrimaryAliasOrDefault), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrimaryAliasOrDefault", reflect.TypeOf((*Manager)(nil).PrimaryAliasOrDefault), id) } // RegisterFactory mocks base method. -func (m *Manager) RegisterFactory(arg0 context.Context, arg1 ids.ID, arg2 vms.Factory) error { +func (m *Manager) RegisterFactory(ctx context.Context, vmID ids.ID, factory vms.Factory) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegisterFactory", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "RegisterFactory", ctx, vmID, factory) ret0, _ := ret[0].(error) return ret0 } // RegisterFactory indicates an expected call of RegisterFactory. -func (mr *ManagerMockRecorder) RegisterFactory(arg0, arg1, arg2 any) *gomock.Call { +func (mr *ManagerMockRecorder) RegisterFactory(ctx, vmID, factory any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterFactory", reflect.TypeOf((*Manager)(nil).RegisterFactory), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterFactory", reflect.TypeOf((*Manager)(nil).RegisterFactory), ctx, vmID, factory) } // RemoveAliases mocks base method. -func (m *Manager) RemoveAliases(arg0 ids.ID) { +func (m *Manager) RemoveAliases(id ids.ID) { m.ctrl.T.Helper() - m.ctrl.Call(m, "RemoveAliases", arg0) + m.ctrl.Call(m, "RemoveAliases", id) } // RemoveAliases indicates an expected call of RemoveAliases. -func (mr *ManagerMockRecorder) RemoveAliases(arg0 any) *gomock.Call { +func (mr *ManagerMockRecorder) RemoveAliases(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAliases", reflect.TypeOf((*Manager)(nil).RemoveAliases), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAliases", reflect.TypeOf((*Manager)(nil).RemoveAliases), id) } // Versions mocks base method.