From 6e790102068e7be93742ecfa95d56235ac0aeea9 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Fri, 27 Dec 2024 11:21:26 +0100 Subject: [PATCH 01/15] header.yml is missing so removing ineffective go-license --- scripts/mock.gen.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh index 87465d43a9..677e3fa501 100755 --- a/scripts/mock.gen.sh +++ b/scripts/mock.gen.sh @@ -16,12 +16,6 @@ fi # https://github.com/uber-go/mock go install -v go.uber.org/mock/mockgen@v0.4.0 -if ! command -v go-license &>/dev/null; then - echo "go-license not found, installing..." - # https://github.com/palantir/go-license - go install -v github.com/palantir/go-license@v1.25.0 -fi - # Load the versions source "$CORETH_PATH"/scripts/versions.sh @@ -35,10 +29,6 @@ while IFS= read -r line; do package_name=$(basename "$(dirname "$output_path")") echo "Generating ${output_path}..." mockgen -package="${package_name}" -destination="${output_path}" "${src_import_path}" "${interface_name}" - - go-license \ - --config=./header.yml \ - "${output_path}" done <"$input" echo "SUCCESS" From 915477ca0ce7b45b24b5b9768edc69a87015b14e Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Fri, 27 Dec 2024 11:27:07 +0100 Subject: [PATCH 02/15] Remove unneeded source constants --- scripts/mock.gen.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh index 677e3fa501..356294a64f 100755 --- a/scripts/mock.gen.sh +++ b/scripts/mock.gen.sh @@ -19,9 +19,6 @@ go install -v go.uber.org/mock/mockgen@v0.4.0 # Load the versions source "$CORETH_PATH"/scripts/versions.sh -# Load the constants -source "$CORETH_PATH"/scripts/constants.sh - # tuples of (source interface import path, comma-separated interface names, output file path) input="scripts/mocks.mockgen.txt" while IFS= read -r line; do From b0a07958801a45bec15efbada5cd8b4c2c29f48c Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Fri, 27 Dec 2024 11:27:25 +0100 Subject: [PATCH 03/15] Remove unneeded source versions --- scripts/mock.gen.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh index 356294a64f..8b22da831c 100755 --- a/scripts/mock.gen.sh +++ b/scripts/mock.gen.sh @@ -16,9 +16,6 @@ fi # https://github.com/uber-go/mock go install -v go.uber.org/mock/mockgen@v0.4.0 -# Load the versions -source "$CORETH_PATH"/scripts/versions.sh - # tuples of (source interface import path, comma-separated interface names, output file path) input="scripts/mocks.mockgen.txt" while IFS= read -r line; do From 709dd4f473d13de31604b3820abec62010ea3692 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Fri, 27 Dec 2024 11:50:11 +0100 Subject: [PATCH 04/15] Use go generate commands to generate mocks --- precompile/contract/mocks.go | 2 +- precompile/contract/mocks_generate_test.go | 3 +++ precompile/precompileconfig/mocks.go | 2 +- .../precompileconfig/mocks_generate_test.go | 3 +++ scripts/mock.gen.sh | 17 +---------------- scripts/mocks.mockgen.txt | 2 -- 6 files changed, 9 insertions(+), 20 deletions(-) create mode 100644 precompile/contract/mocks_generate_test.go create mode 100644 precompile/precompileconfig/mocks_generate_test.go delete mode 100644 scripts/mocks.mockgen.txt diff --git a/precompile/contract/mocks.go b/precompile/contract/mocks.go index 94bf9c5ba0..2b3ea9e96d 100644 --- a/precompile/contract/mocks.go +++ b/precompile/contract/mocks.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=contract -destination=precompile/contract/mocks.go github.com/ava-labs/coreth/precompile/contract BlockContext,AccessibleState,StateDB +// mockgen -package=contract -destination=mocks.go . BlockContext,AccessibleState,StateDB // // Package contract is a generated GoMock package. diff --git a/precompile/contract/mocks_generate_test.go b/precompile/contract/mocks_generate_test.go new file mode 100644 index 0000000000..ef40b0c378 --- /dev/null +++ b/precompile/contract/mocks_generate_test.go @@ -0,0 +1,3 @@ +package contract + +//go:generate mockgen -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . BlockContext,AccessibleState,StateDB diff --git a/precompile/precompileconfig/mocks.go b/precompile/precompileconfig/mocks.go index 4be7f046ec..4690c046ec 100644 --- a/precompile/precompileconfig/mocks.go +++ b/precompile/precompileconfig/mocks.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package=precompileconfig -destination=precompile/precompileconfig/mocks.go github.com/ava-labs/coreth/precompile/precompileconfig Predicater,Config,ChainConfig,Accepter +// mockgen -package=precompileconfig -destination=mocks.go . Predicater,Config,ChainConfig,Accepter // // Package precompileconfig is a generated GoMock package. diff --git a/precompile/precompileconfig/mocks_generate_test.go b/precompile/precompileconfig/mocks_generate_test.go new file mode 100644 index 0000000000..696153d890 --- /dev/null +++ b/precompile/precompileconfig/mocks_generate_test.go @@ -0,0 +1,3 @@ +package precompileconfig + +//go:generate mockgen -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . Predicater,Config,ChainConfig,Accepter diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh index 8b22da831c..d06c0bd124 100755 --- a/scripts/mock.gen.sh +++ b/scripts/mock.gen.sh @@ -2,12 +2,6 @@ set -euo pipefail -# Root directory -CORETH_PATH=$( - cd "$(dirname "${BASH_SOURCE[0]}")" - cd .. && pwd -) - if ! [[ "$0" =~ scripts/mock.gen.sh ]]; then echo "must be run from repository root" exit 255 @@ -16,13 +10,4 @@ fi # https://github.com/uber-go/mock go install -v go.uber.org/mock/mockgen@v0.4.0 -# tuples of (source interface 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}..." - mockgen -package="${package_name}" -destination="${output_path}" "${src_import_path}" "${interface_name}" -done <"$input" - -echo "SUCCESS" +go generate -run mockgen ./... diff --git a/scripts/mocks.mockgen.txt b/scripts/mocks.mockgen.txt deleted file mode 100644 index 694343e40e..0000000000 --- a/scripts/mocks.mockgen.txt +++ /dev/null @@ -1,2 +0,0 @@ -github.com/ava-labs/coreth/precompile/precompileconfig=Predicater,Config,ChainConfig,Accepter=precompile/precompileconfig/mocks.go -github.com/ava-labs/coreth/precompile/contract=BlockContext,AccessibleState,StateDB=precompile/contract/mocks.go From 7da260e4689e19ea14430225469957b0c9246695 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Fri, 27 Dec 2024 12:27:38 +0100 Subject: [PATCH 05/15] Remove the need to install mockgen in the script --- precompile/contract/mocks_generate_test.go | 2 +- precompile/precompileconfig/mocks_generate_test.go | 2 +- scripts/mock.gen.sh | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/precompile/contract/mocks_generate_test.go b/precompile/contract/mocks_generate_test.go index ef40b0c378..8c50872884 100644 --- a/precompile/contract/mocks_generate_test.go +++ b/precompile/contract/mocks_generate_test.go @@ -1,3 +1,3 @@ package contract -//go:generate mockgen -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . BlockContext,AccessibleState,StateDB +//go:generate go run go.uber.org/mock/mockgen@v0.4.0 -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . BlockContext,AccessibleState,StateDB diff --git a/precompile/precompileconfig/mocks_generate_test.go b/precompile/precompileconfig/mocks_generate_test.go index 696153d890..c0cf6d2e8b 100644 --- a/precompile/precompileconfig/mocks_generate_test.go +++ b/precompile/precompileconfig/mocks_generate_test.go @@ -1,3 +1,3 @@ package precompileconfig -//go:generate mockgen -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . Predicater,Config,ChainConfig,Accepter +//go:generate go run go.uber.org/mock/mockgen@v0.4.0 -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . Predicater,Config,ChainConfig,Accepter diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh index d06c0bd124..1b5fe4a929 100755 --- a/scripts/mock.gen.sh +++ b/scripts/mock.gen.sh @@ -7,7 +7,4 @@ if ! [[ "$0" =~ scripts/mock.gen.sh ]]; then exit 255 fi -# https://github.com/uber-go/mock -go install -v go.uber.org/mock/mockgen@v0.4.0 - go generate -run mockgen ./... From 2f8fcc2b370686d74bcde7b7890a4bd1d0a3626c Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 30 Dec 2024 17:09:25 +0100 Subject: [PATCH 06/15] Add mock-up-to-date step to test CI workflow --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 553c2761d7..c5817c3dc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,10 @@ jobs: run: echo "TIMEOUT=1200s" >> "$GITHUB_ENV" - run: go mod download shell: bash + - name: Mocks are up to date + run: | + ./scripts/mock.gen.sh + git diff --exit-code - run: ./scripts/build.sh evm shell: bash - run: ./scripts/build_test.sh From c0de1ee066f05651e5cb064e100981c1e707127a Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 30 Dec 2024 18:02:41 +0100 Subject: [PATCH 07/15] Remove all mocks before generating them in CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5817c3dc3..1c38bfe072 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,7 @@ jobs: shell: bash - name: Mocks are up to date run: | + grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm ./scripts/mock.gen.sh git diff --exit-code - run: ./scripts/build.sh evm From edf1df3bffcbc3095dd04239c8d89bd4a70db33d Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 30 Dec 2024 18:20:54 +0100 Subject: [PATCH 08/15] Add generate command for non-tracked mock (Note using source mode was compulsory due to CGO) --- warp/aggregator/mock_signature_getter.go | 53 +++++++++++++++++++++--- warp/aggregator/mocks_generate_test.go | 3 ++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 warp/aggregator/mocks_generate_test.go diff --git a/warp/aggregator/mock_signature_getter.go b/warp/aggregator/mock_signature_getter.go index 144d8a2f98..737588928f 100644 --- a/warp/aggregator/mock_signature_getter.go +++ b/warp/aggregator/mock_signature_getter.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ava-labs/coreth/warp/aggregator (interfaces: SignatureGetter) +// Source: signature_getter.go +// +// Generated by this command: +// +// mockgen -package=aggregator -source=signature_getter.go -destination=mock_signature_getter.go +// // Package aggregator is a generated GoMock package. package aggregator @@ -38,16 +43,54 @@ func (m *MockSignatureGetter) EXPECT() *MockSignatureGetterMockRecorder { } // GetSignature mocks base method. -func (m *MockSignatureGetter) GetSignature(arg0 context.Context, arg1 ids.NodeID, arg2 *warp.UnsignedMessage) (*bls.Signature, error) { +func (m *MockSignatureGetter) GetSignature(ctx context.Context, nodeID ids.NodeID, unsignedWarpMessage *warp.UnsignedMessage) (*bls.Signature, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSignature", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetSignature", ctx, nodeID, unsignedWarpMessage) ret0, _ := ret[0].(*bls.Signature) ret1, _ := ret[1].(error) return ret0, ret1 } // GetSignature indicates an expected call of GetSignature. -func (mr *MockSignatureGetterMockRecorder) GetSignature(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockSignatureGetterMockRecorder) GetSignature(ctx, nodeID, unsignedWarpMessage any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSignature", reflect.TypeOf((*MockSignatureGetter)(nil).GetSignature), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSignature", reflect.TypeOf((*MockSignatureGetter)(nil).GetSignature), ctx, nodeID, unsignedWarpMessage) +} + +// MockNetworkClient is a mock of NetworkClient interface. +type MockNetworkClient struct { + ctrl *gomock.Controller + recorder *MockNetworkClientMockRecorder +} + +// MockNetworkClientMockRecorder is the mock recorder for MockNetworkClient. +type MockNetworkClientMockRecorder struct { + mock *MockNetworkClient +} + +// NewMockNetworkClient creates a new mock instance. +func NewMockNetworkClient(ctrl *gomock.Controller) *MockNetworkClient { + mock := &MockNetworkClient{ctrl: ctrl} + mock.recorder = &MockNetworkClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockNetworkClient) EXPECT() *MockNetworkClientMockRecorder { + return m.recorder +} + +// SendAppRequest mocks base method. +func (m *MockNetworkClient) SendAppRequest(ctx context.Context, nodeID ids.NodeID, message []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendAppRequest", ctx, nodeID, message) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SendAppRequest indicates an expected call of SendAppRequest. +func (mr *MockNetworkClientMockRecorder) SendAppRequest(ctx, nodeID, message any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendAppRequest", reflect.TypeOf((*MockNetworkClient)(nil).SendAppRequest), ctx, nodeID, message) } diff --git a/warp/aggregator/mocks_generate_test.go b/warp/aggregator/mocks_generate_test.go new file mode 100644 index 0000000000..8b59d3e4c0 --- /dev/null +++ b/warp/aggregator/mocks_generate_test.go @@ -0,0 +1,3 @@ +package aggregator + +//go:generate go run go.uber.org/mock/mockgen@v0.4 -package=$GOPACKAGE -source=signature_getter.go -destination=mock_signature_getter.go From 2145c284629fcd91947cf4e33ff9d28e888277a5 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 30 Dec 2024 18:51:40 +0100 Subject: [PATCH 09/15] Use bash shell for mock check step --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c38bfe072..6d73e0a06d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,6 +85,7 @@ jobs: - run: go mod download shell: bash - name: Mocks are up to date + shell: bash run: | grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm ./scripts/mock.gen.sh From 057ab7323f788acdc803061b3de5c8734b649bb2 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Tue, 31 Dec 2024 13:44:24 +0100 Subject: [PATCH 10/15] Remove script mock.gen.sh --- .github/workflows/ci.yml | 2 +- scripts/mock.gen.sh | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100755 scripts/mock.gen.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d73e0a06d..ba7fe7f00a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: shell: bash run: | grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm - ./scripts/mock.gen.sh + go generate -run "mockgen" ./... git diff --exit-code - run: ./scripts/build.sh evm shell: bash diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh deleted file mode 100755 index 1b5fe4a929..0000000000 --- a/scripts/mock.gen.sh +++ /dev/null @@ -1,10 +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 - -go generate -run mockgen ./... From f94bd288daa62ac7f8b074653f140f43ecc87930 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Tue, 31 Dec 2024 13:47:20 +0100 Subject: [PATCH 11/15] docs(contributing): add mocks section --- .github/CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 87c79fcfe2..da6529dcdd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -33,3 +33,36 @@ Please make sure your contributions adhere to our coding guidelines: Before you submit a feature request, please check and make sure that it isn't possible through some other means. +## Mocks + +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@v0.4` to generate a mock for your interface (preferred); or + * add another `//go:generate go run go.uber.org/mock/mockgen@v0.4` 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-2025, Ava Labs, Inc. All rights reserved. + // See the file LICENSE for licensing terms. + + package mypackage + + //go:generate go run go.uber.org/mock/mockgen@v0.4 -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. From 5c4171c1f154a9a94ebf8bd5fc1b4b2cbdeaabb5 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 6 Jan 2025 12:03:53 +0100 Subject: [PATCH 12/15] mockgen version used is the one defined in go.mod - requires a `tools.go` blank importing golang.org/x/tools/imports in order to have the `golang.org/x/tools` dependency satisfied for mockgen v0.4 - less future deltas when upgrading mockgen --- .github/CONTRIBUTING.md | 6 +-- go.mod | 3 +- go.sum | 14 ++---- precompile/contract/mocks.go | 43 ++++++++++--------- precompile/contract/mocks_generate_test.go | 2 +- precompile/precompileconfig/mocks.go | 36 +++++++++------- .../precompileconfig/mocks_generate_test.go | 2 +- tools.go | 8 ++++ warp/aggregator/mock_signature_getter.go | 2 + warp/aggregator/mocks_generate_test.go | 2 +- 10 files changed, 65 insertions(+), 53 deletions(-) create mode 100644 tools.go diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index da6529dcdd..86e02648c8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -45,8 +45,8 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc * 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@v0.4` to generate a mock for your interface (preferred); or - * add another `//go:generate go run go.uber.org/mock/mockgen@v0.4` to generate a mock for your interface according to specific mock generation settings + * 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 @@ -55,7 +55,7 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc package mypackage - //go:generate go run go.uber.org/mock/mockgen@v0.4 -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface + //go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface ``` Notes: diff --git a/go.mod b/go.mod index a4acd1705f..63146cd8d2 100644 --- a/go.mod +++ b/go.mod @@ -44,6 +44,7 @@ require ( golang.org/x/sys v0.28.0 golang.org/x/text v0.21.0 golang.org/x/time v0.3.0 + golang.org/x/tools v0.22.0 google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) @@ -120,7 +121,7 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/mod v0.18.0 // indirect + golang.org/x/mod v0.22.0 // indirect golang.org/x/net v0.33.0 // indirect golang.org/x/term v0.27.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect diff --git a/go.sum b/go.sum index 4bf0d64d42..9391e7bb79 100644 --- a/go.sum +++ b/go.sum @@ -54,10 +54,6 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/ava-labs/avalanchego v1.12.2-0.20241224161435-3998475d671d h1:QCtjS4ANcNfCdL6Z2sKpanDVJNt1MU0bUyVdW0g5zuU= -github.com/ava-labs/avalanchego v1.12.2-0.20241224161435-3998475d671d/go.mod h1:cDoT0Hq3P+/XfCyVvzrBj66yoid2I5LnMuj7LIkap+o= -github.com/ava-labs/avalanchego v1.12.2-0.20241224181600-fade5be3051d h1:iPlsqC9pIy4emCo8wyI/VmVmfljpzmw58ZqahVdcehI= -github.com/ava-labs/avalanchego v1.12.2-0.20241224181600-fade5be3051d/go.mod h1:dKawab3nXqwI7ZcOFatTOv//l1V0t8MRBnhXoOqbN4E= github.com/ava-labs/avalanchego v1.12.2-0.20250106102004-902377d447ba h1:7t2ORGM53sqdsczNZGFQIK99of9yeetCld90keJ47Os= github.com/ava-labs/avalanchego v1.12.2-0.20250106102004-902377d447ba/go.mod h1:oK/C7ZGo5cAEayBKBoawh2EpOo3E9gD1rpd9NAM0RkQ= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= @@ -586,8 +582,6 @@ 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= @@ -647,8 +641,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/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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= @@ -693,8 +687,6 @@ golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -865,6 +857,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.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/precompile/contract/mocks.go b/precompile/contract/mocks.go index 2b3ea9e96d..546090339f 100644 --- a/precompile/contract/mocks.go +++ b/precompile/contract/mocks.go @@ -24,6 +24,7 @@ import ( type MockBlockContext struct { ctrl *gomock.Controller recorder *MockBlockContextMockRecorder + isgomock struct{} } // MockBlockContextMockRecorder is the mock recorder for MockBlockContext. @@ -44,17 +45,17 @@ func (m *MockBlockContext) EXPECT() *MockBlockContextMockRecorder { } // GetPredicateResults mocks base method. -func (m *MockBlockContext) GetPredicateResults(arg0 common.Hash, arg1 common.Address) []byte { +func (m *MockBlockContext) GetPredicateResults(txHash common.Hash, precompileAddress common.Address) []byte { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetPredicateResults", arg0, arg1) + ret := m.ctrl.Call(m, "GetPredicateResults", txHash, precompileAddress) ret0, _ := ret[0].([]byte) return ret0 } // GetPredicateResults indicates an expected call of GetPredicateResults. -func (mr *MockBlockContextMockRecorder) GetPredicateResults(arg0, arg1 any) *gomock.Call { +func (mr *MockBlockContextMockRecorder) GetPredicateResults(txHash, precompileAddress any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPredicateResults", reflect.TypeOf((*MockBlockContext)(nil).GetPredicateResults), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPredicateResults", reflect.TypeOf((*MockBlockContext)(nil).GetPredicateResults), txHash, precompileAddress) } // Number mocks base method. @@ -89,6 +90,7 @@ func (mr *MockBlockContextMockRecorder) Timestamp() *gomock.Call { type MockAccessibleState struct { ctrl *gomock.Controller recorder *MockAccessibleStateMockRecorder + isgomock struct{} } // MockAccessibleStateMockRecorder is the mock recorder for MockAccessibleState. @@ -165,9 +167,9 @@ func (mr *MockAccessibleStateMockRecorder) GetStateDB() *gomock.Call { } // NativeAssetCall mocks base method. -func (m *MockAccessibleState) NativeAssetCall(arg0 common.Address, arg1 []byte, arg2, arg3 uint64, arg4 bool) ([]byte, uint64, error) { +func (m *MockAccessibleState) NativeAssetCall(caller common.Address, input []byte, suppliedGas, gasCost uint64, readOnly bool) ([]byte, uint64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NativeAssetCall", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "NativeAssetCall", caller, input, suppliedGas, gasCost, readOnly) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(uint64) ret2, _ := ret[2].(error) @@ -175,15 +177,16 @@ func (m *MockAccessibleState) NativeAssetCall(arg0 common.Address, arg1 []byte, } // NativeAssetCall indicates an expected call of NativeAssetCall. -func (mr *MockAccessibleStateMockRecorder) NativeAssetCall(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockAccessibleStateMockRecorder) NativeAssetCall(caller, input, suppliedGas, gasCost, readOnly any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NativeAssetCall", reflect.TypeOf((*MockAccessibleState)(nil).NativeAssetCall), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NativeAssetCall", reflect.TypeOf((*MockAccessibleState)(nil).NativeAssetCall), caller, input, suppliedGas, gasCost, readOnly) } // MockStateDB is a mock of StateDB interface. type MockStateDB struct { ctrl *gomock.Controller recorder *MockStateDBMockRecorder + isgomock struct{} } // MockStateDBMockRecorder is the mock recorder for MockStateDB. @@ -216,15 +219,15 @@ func (mr *MockStateDBMockRecorder) AddBalance(arg0, arg1 any) *gomock.Call { } // AddLog mocks base method. -func (m *MockStateDB) AddLog(arg0 common.Address, arg1 []common.Hash, arg2 []byte, arg3 uint64) { +func (m *MockStateDB) AddLog(addr common.Address, topics []common.Hash, data []byte, blockNumber uint64) { m.ctrl.T.Helper() - m.ctrl.Call(m, "AddLog", arg0, arg1, arg2, arg3) + m.ctrl.Call(m, "AddLog", addr, topics, data, blockNumber) } // AddLog indicates an expected call of AddLog. -func (mr *MockStateDBMockRecorder) AddLog(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockStateDBMockRecorder) AddLog(addr, topics, data, blockNumber any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddLog", reflect.TypeOf((*MockStateDB)(nil).AddLog), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddLog", reflect.TypeOf((*MockStateDB)(nil).AddLog), addr, topics, data, blockNumber) } // CreateAccount mocks base method. @@ -311,18 +314,18 @@ func (mr *MockStateDBMockRecorder) GetNonce(arg0 any) *gomock.Call { } // GetPredicateStorageSlots mocks base method. -func (m *MockStateDB) GetPredicateStorageSlots(arg0 common.Address, arg1 int) ([]byte, bool) { +func (m *MockStateDB) GetPredicateStorageSlots(address common.Address, index int) ([]byte, bool) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetPredicateStorageSlots", arg0, arg1) + ret := m.ctrl.Call(m, "GetPredicateStorageSlots", address, index) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(bool) return ret0, ret1 } // GetPredicateStorageSlots indicates an expected call of GetPredicateStorageSlots. -func (mr *MockStateDBMockRecorder) GetPredicateStorageSlots(arg0, arg1 any) *gomock.Call { +func (mr *MockStateDBMockRecorder) GetPredicateStorageSlots(address, index any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPredicateStorageSlots", reflect.TypeOf((*MockStateDB)(nil).GetPredicateStorageSlots), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPredicateStorageSlots", reflect.TypeOf((*MockStateDB)(nil).GetPredicateStorageSlots), address, index) } // GetState mocks base method. @@ -378,15 +381,15 @@ func (mr *MockStateDBMockRecorder) SetNonce(arg0, arg1 any) *gomock.Call { } // SetPredicateStorageSlots mocks base method. -func (m *MockStateDB) SetPredicateStorageSlots(arg0 common.Address, arg1 [][]byte) { +func (m *MockStateDB) SetPredicateStorageSlots(address common.Address, predicates [][]byte) { m.ctrl.T.Helper() - m.ctrl.Call(m, "SetPredicateStorageSlots", arg0, arg1) + m.ctrl.Call(m, "SetPredicateStorageSlots", address, predicates) } // SetPredicateStorageSlots indicates an expected call of SetPredicateStorageSlots. -func (mr *MockStateDBMockRecorder) SetPredicateStorageSlots(arg0, arg1 any) *gomock.Call { +func (mr *MockStateDBMockRecorder) SetPredicateStorageSlots(address, predicates any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPredicateStorageSlots", reflect.TypeOf((*MockStateDB)(nil).SetPredicateStorageSlots), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPredicateStorageSlots", reflect.TypeOf((*MockStateDB)(nil).SetPredicateStorageSlots), address, predicates) } // SetState mocks base method. diff --git a/precompile/contract/mocks_generate_test.go b/precompile/contract/mocks_generate_test.go index 8c50872884..4903b47c7c 100644 --- a/precompile/contract/mocks_generate_test.go +++ b/precompile/contract/mocks_generate_test.go @@ -1,3 +1,3 @@ package contract -//go:generate go run go.uber.org/mock/mockgen@v0.4.0 -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . BlockContext,AccessibleState,StateDB +//go:generate go run go.uber.org/mock/mockgen -package=$GOPACKAGE -destination=mocks.go . BlockContext,AccessibleState,StateDB diff --git a/precompile/precompileconfig/mocks.go b/precompile/precompileconfig/mocks.go index 4690c046ec..cba1ca13a3 100644 --- a/precompile/precompileconfig/mocks.go +++ b/precompile/precompileconfig/mocks.go @@ -20,6 +20,7 @@ import ( type MockPredicater struct { ctrl *gomock.Controller recorder *MockPredicaterMockRecorder + isgomock struct{} } // MockPredicaterMockRecorder is the mock recorder for MockPredicater. @@ -40,38 +41,39 @@ func (m *MockPredicater) EXPECT() *MockPredicaterMockRecorder { } // PredicateGas mocks base method. -func (m *MockPredicater) PredicateGas(arg0 []byte) (uint64, error) { +func (m *MockPredicater) PredicateGas(predicateBytes []byte) (uint64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PredicateGas", arg0) + ret := m.ctrl.Call(m, "PredicateGas", predicateBytes) ret0, _ := ret[0].(uint64) ret1, _ := ret[1].(error) return ret0, ret1 } // PredicateGas indicates an expected call of PredicateGas. -func (mr *MockPredicaterMockRecorder) PredicateGas(arg0 any) *gomock.Call { +func (mr *MockPredicaterMockRecorder) PredicateGas(predicateBytes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PredicateGas", reflect.TypeOf((*MockPredicater)(nil).PredicateGas), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PredicateGas", reflect.TypeOf((*MockPredicater)(nil).PredicateGas), predicateBytes) } // VerifyPredicate mocks base method. -func (m *MockPredicater) VerifyPredicate(arg0 *PredicateContext, arg1 []byte) error { +func (m *MockPredicater) VerifyPredicate(predicateContext *PredicateContext, predicateBytes []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VerifyPredicate", arg0, arg1) + ret := m.ctrl.Call(m, "VerifyPredicate", predicateContext, predicateBytes) ret0, _ := ret[0].(error) return ret0 } // VerifyPredicate indicates an expected call of VerifyPredicate. -func (mr *MockPredicaterMockRecorder) VerifyPredicate(arg0, arg1 any) *gomock.Call { +func (mr *MockPredicaterMockRecorder) VerifyPredicate(predicateContext, predicateBytes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyPredicate", reflect.TypeOf((*MockPredicater)(nil).VerifyPredicate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyPredicate", reflect.TypeOf((*MockPredicater)(nil).VerifyPredicate), predicateContext, predicateBytes) } // MockConfig is a mock of Config interface. type MockConfig struct { ctrl *gomock.Controller recorder *MockConfigMockRecorder + isgomock struct{} } // MockConfigMockRecorder is the mock recorder for MockConfig. @@ -165,6 +167,7 @@ func (mr *MockConfigMockRecorder) Verify(arg0 any) *gomock.Call { type MockChainConfig struct { ctrl *gomock.Controller recorder *MockChainConfigMockRecorder + isgomock struct{} } // MockChainConfigMockRecorder is the mock recorder for MockChainConfig. @@ -185,23 +188,24 @@ func (m *MockChainConfig) EXPECT() *MockChainConfigMockRecorder { } // IsDurango mocks base method. -func (m *MockChainConfig) IsDurango(arg0 uint64) bool { +func (m *MockChainConfig) IsDurango(time uint64) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsDurango", arg0) + ret := m.ctrl.Call(m, "IsDurango", time) ret0, _ := ret[0].(bool) return ret0 } // IsDurango indicates an expected call of IsDurango. -func (mr *MockChainConfigMockRecorder) IsDurango(arg0 any) *gomock.Call { +func (mr *MockChainConfigMockRecorder) IsDurango(time any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDurango", reflect.TypeOf((*MockChainConfig)(nil).IsDurango), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDurango", reflect.TypeOf((*MockChainConfig)(nil).IsDurango), time) } // MockAccepter is a mock of Accepter interface. type MockAccepter struct { ctrl *gomock.Controller recorder *MockAccepterMockRecorder + isgomock struct{} } // MockAccepterMockRecorder is the mock recorder for MockAccepter. @@ -222,15 +226,15 @@ func (m *MockAccepter) EXPECT() *MockAccepterMockRecorder { } // Accept mocks base method. -func (m *MockAccepter) Accept(arg0 *AcceptContext, arg1 common.Hash, arg2 uint64, arg3 common.Hash, arg4 int, arg5 []common.Hash, arg6 []byte) error { +func (m *MockAccepter) Accept(acceptCtx *AcceptContext, blockHash common.Hash, blockNumber uint64, txHash common.Hash, logIndex int, topics []common.Hash, logData []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Accept", arg0, arg1, arg2, arg3, arg4, arg5, arg6) + ret := m.ctrl.Call(m, "Accept", acceptCtx, blockHash, blockNumber, txHash, logIndex, topics, logData) ret0, _ := ret[0].(error) return ret0 } // Accept indicates an expected call of Accept. -func (mr *MockAccepterMockRecorder) Accept(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { +func (mr *MockAccepterMockRecorder) Accept(acceptCtx, blockHash, blockNumber, txHash, logIndex, topics, logData any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accept", reflect.TypeOf((*MockAccepter)(nil).Accept), arg0, arg1, arg2, arg3, arg4, arg5, arg6) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accept", reflect.TypeOf((*MockAccepter)(nil).Accept), acceptCtx, blockHash, blockNumber, txHash, logIndex, topics, logData) } diff --git a/precompile/precompileconfig/mocks_generate_test.go b/precompile/precompileconfig/mocks_generate_test.go index c0cf6d2e8b..7dcdbbdde0 100644 --- a/precompile/precompileconfig/mocks_generate_test.go +++ b/precompile/precompileconfig/mocks_generate_test.go @@ -1,3 +1,3 @@ package precompileconfig -//go:generate go run go.uber.org/mock/mockgen@v0.4.0 -package=$GOPACKAGE -copyright_file=../../license_header -destination=mocks.go . Predicater,Config,ChainConfig,Accepter +//go:generate go run go.uber.org/mock/mockgen -package=$GOPACKAGE -destination=mocks.go . Predicater,Config,ChainConfig,Accepter diff --git a/tools.go b/tools.go new file mode 100644 index 0000000000..d7c65266dd --- /dev/null +++ b/tools.go @@ -0,0 +1,8 @@ +// (c) 2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package coreth + +import ( + _ "golang.org/x/tools/imports" // golang.org/x/tools to satisfy requirement for go.uber.org/mock/mockgen@v0.5 +) diff --git a/warp/aggregator/mock_signature_getter.go b/warp/aggregator/mock_signature_getter.go index 737588928f..70365da0ce 100644 --- a/warp/aggregator/mock_signature_getter.go +++ b/warp/aggregator/mock_signature_getter.go @@ -23,6 +23,7 @@ import ( type MockSignatureGetter struct { ctrl *gomock.Controller recorder *MockSignatureGetterMockRecorder + isgomock struct{} } // MockSignatureGetterMockRecorder is the mock recorder for MockSignatureGetter. @@ -61,6 +62,7 @@ func (mr *MockSignatureGetterMockRecorder) GetSignature(ctx, nodeID, unsignedWar type MockNetworkClient struct { ctrl *gomock.Controller recorder *MockNetworkClientMockRecorder + isgomock struct{} } // MockNetworkClientMockRecorder is the mock recorder for MockNetworkClient. diff --git a/warp/aggregator/mocks_generate_test.go b/warp/aggregator/mocks_generate_test.go index 8b59d3e4c0..c32cd1d998 100644 --- a/warp/aggregator/mocks_generate_test.go +++ b/warp/aggregator/mocks_generate_test.go @@ -1,3 +1,3 @@ package aggregator -//go:generate go run go.uber.org/mock/mockgen@v0.4 -package=$GOPACKAGE -source=signature_getter.go -destination=mock_signature_getter.go +//go:generate go run go.uber.org/mock/mockgen -package=$GOPACKAGE -source=signature_getter.go -destination=mock_signature_getter.go From d92f9ae4facf342bb058b815564cf48a0d29f9c5 Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 6 Jan 2025 10:48:28 +0100 Subject: [PATCH 13/15] ci: use more precise go generate regex --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba7fe7f00a..728d0381c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: shell: bash run: | grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm - go generate -run "mockgen" ./... + go generate -run "go.uber.org/mock/mockgen" ./... git diff --exit-code - run: ./scripts/build.sh evm shell: bash From dace4c18e37af2779399456e2bd01b3c3066992a Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 6 Jan 2025 10:50:01 +0100 Subject: [PATCH 14/15] Add `git add --intent-to-add --all` to detect untracked files --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 728d0381c1..48056c04f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,7 @@ jobs: run: | grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm go generate -run "go.uber.org/mock/mockgen" ./... + git add --intent-to-add --all git diff --exit-code - run: ./scripts/build.sh evm shell: bash From 8fce33b02573d17507ded7bf322f0bcedc5124be Mon Sep 17 00:00:00 2001 From: Quentin Mc Gaw Date: Mon, 6 Jan 2025 12:07:10 +0100 Subject: [PATCH 15/15] Add copyright notices --- .github/CONTRIBUTING.md | 2 +- precompile/contract/mocks_generate_test.go | 3 +++ precompile/precompileconfig/mocks_generate_test.go | 3 +++ warp/aggregator/mocks_generate_test.go | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 86e02648c8..9e89d2d0da 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -50,7 +50,7 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc * 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-2025, Ava Labs, Inc. All rights reserved. + // Copyright (C) 2025-2025, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package mypackage diff --git a/precompile/contract/mocks_generate_test.go b/precompile/contract/mocks_generate_test.go index 4903b47c7c..ab422832da 100644 --- a/precompile/contract/mocks_generate_test.go +++ b/precompile/contract/mocks_generate_test.go @@ -1,3 +1,6 @@ +// Copyright (C) 2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + package contract //go:generate go run go.uber.org/mock/mockgen -package=$GOPACKAGE -destination=mocks.go . BlockContext,AccessibleState,StateDB diff --git a/precompile/precompileconfig/mocks_generate_test.go b/precompile/precompileconfig/mocks_generate_test.go index 7dcdbbdde0..9ca4ea38df 100644 --- a/precompile/precompileconfig/mocks_generate_test.go +++ b/precompile/precompileconfig/mocks_generate_test.go @@ -1,3 +1,6 @@ +// Copyright (C) 2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + package precompileconfig //go:generate go run go.uber.org/mock/mockgen -package=$GOPACKAGE -destination=mocks.go . Predicater,Config,ChainConfig,Accepter diff --git a/warp/aggregator/mocks_generate_test.go b/warp/aggregator/mocks_generate_test.go index c32cd1d998..46388a6c7c 100644 --- a/warp/aggregator/mocks_generate_test.go +++ b/warp/aggregator/mocks_generate_test.go @@ -1,3 +1,6 @@ +// Copyright (C) 2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + package aggregator //go:generate go run go.uber.org/mock/mockgen -package=$GOPACKAGE -source=signature_getter.go -destination=mock_signature_getter.go