diff --git a/.golangci.yml b/.golangci.yml index e330f88311da..ea34625f279f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -55,12 +55,15 @@ linters-settings: goimports: local-prefixes: github.com/ava-labs/avalanchego depguard: - list-type: blacklist - packages-with-error-message: - - io/ioutil: 'io/ioutil is deprecated. Use package io or os instead.' - - github.com/stretchr/testify/assert: 'github.com/stretchr/testify/require should be used instead.' - - github.com/golang/mock/gomock: 'go.uber.org/mock/gomock should be used instead.' - include-go-root: true + rules: + packages: + deny: + - pkg: "io/ioutil" + desc: io/ioutil is deprecated. Use package io or os instead. + - pkg: "github.com/stretchr/testify/assert" + desc: github.com/stretchr/testify/require should be used instead. + - pkg: "github.com/golang/mock/gomock" + desc: go.uber.org/mock/gomock should be used instead. errorlint: # Check for plain type assertions and type switches. asserts: false diff --git a/RELEASES.md b/RELEASES.md index 8443885ddf14..73e79cc8bda0 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,5 +1,42 @@ # Release Notes +## [v1.10.11](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.11) + +This version is backwards compatible to [v1.10.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.0). It is optional, but encouraged. + +The plugin version is unchanged at `28` and compatible with versions `v1.10.9 - v1.10.10`. + +### Fixes + +- Prevented overzelous benching due to dropped AppRequests +- Populated the process file atomically to avoid racy reads + +### What's Changed + +- Rename platformvm/blocks to platformvm/block by @joshua-kim in https://github.com/ava-labs/avalanchego/pull/1980 +- RewardValidatorTx cleanup by @abi87 in https://github.com/ava-labs/avalanchego/pull/1891 +- Cancel stale SH actions by @danlaine in https://github.com/ava-labs/avalanchego/pull/2003 +- e2e: Switch assertion library from gomega to testify by @marun in https://github.com/ava-labs/avalanchego/pull/1909 +- e2e: Add bootstrap checks to migrated kurtosis tests by @marun in https://github.com/ava-labs/avalanchego/pull/1935 +- Add `GetTransformSubnetTx` helper by @dhrubabasu in https://github.com/ava-labs/avalanchego/pull/2047 +- Add readme for the staking/local folder by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2046 +- use `IsCortinaActivated` helper by @dhrubabasu in https://github.com/ava-labs/avalanchego/pull/2048 +- add `D` upgrade boilerplate by @dhrubabasu in https://github.com/ava-labs/avalanchego/pull/2049 +- e2e: Ensure interchain workflow coverage for the P-Chain by @marun in https://github.com/ava-labs/avalanchego/pull/1882 +- e2e: Switch to using default timed context everywhere by @marun in https://github.com/ava-labs/avalanchego/pull/1910 +- Remove indentation + confusing comment by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2053 +- Delete ErrDelegatorSubset by @joshua-kim in https://github.com/ava-labs/avalanchego/pull/2055 +- Fix default validator start time by @marun in https://github.com/ava-labs/avalanchego/pull/2058 +- Enable workflows to be triggered by merge queue by @marun in https://github.com/ava-labs/avalanchego/pull/2057 +- e2e: Migrate staking rewards test from kurtosis by @marun in https://github.com/ava-labs/avalanchego/pull/1767 +- Fix LRU documentation comment by @anusha-ctrl in https://github.com/ava-labs/avalanchego/pull/2036 +- Ignore AppResponse timeouts for benching by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/2066 +- trace: provide appName and version from Config by @najeal in https://github.com/ava-labs/avalanchego/pull/1893 +- Update perms.WriteFile to write atomically by @marun in https://github.com/ava-labs/avalanchego/pull/2063 +- ArchiveDB by @nytzuga in https://github.com/ava-labs/avalanchego/pull/1911 + +**Full Changelog**: https://github.com/ava-labs/avalanchego/compare/v1.10.10...v1.10.11 + ## [v1.10.10](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.10) This version is backwards compatible to [v1.10.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.0). It is optional, but encouraged. diff --git a/ids/id_test.go b/ids/id_test.go index 3424b17633e6..0a85cead49c2 100644 --- a/ids/id_test.go +++ b/ids/id_test.go @@ -149,7 +149,7 @@ func TestIDUnmarshalJSON(t *testing.T) { func TestIDHex(t *testing.T) { id := ID{'a', 'v', 'a', ' ', 'l', 'a', 'b', 's'} - expected := "617661206c616273000000000000000000000000000000000000000000000000" + expected := "617661206c616273000000000000000000000000000000000000000000000000" //nolint:gosec require.Equal(t, expected, id.Hex()) } diff --git a/scripts/lint.sh b/scripts/lint.sh index 804c951eaf07..c6417b7f51f6 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -32,7 +32,7 @@ fi TESTS=${TESTS:-"golangci_lint license_header require_error_is_no_funcs_as_params single_import interface_compliance_nil require_equal_zero require_len_zero require_equal_len require_nil require_no_error_inline_func"} function test_golangci_lint { - go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 + go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 golangci-lint run --config .golangci.yml } diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go new file mode 100644 index 000000000000..f3a1daaf3d2c --- /dev/null +++ b/tests/e2e/c/dynamic_fees.go @@ -0,0 +1,169 @@ +// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package c + +import ( + "math/big" + "strings" + + ginkgo "github.com/onsi/ginkgo/v2" + + "github.com/stretchr/testify/require" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" + + "github.com/ava-labs/coreth/core/types" + "github.com/ava-labs/coreth/params" + "github.com/ava-labs/coreth/plugin/evm" + + "github.com/ava-labs/avalanchego/tests" + "github.com/ava-labs/avalanchego/tests/e2e" + "github.com/ava-labs/avalanchego/tests/fixture/testnet" + "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" +) + +// This test uses the compiled bin for `hashing.sol` as +// well as its ABI contained in `hashing_contract.go`. + +var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { + require := require.New(ginkgo.GinkgoT()) + + // Need a gas limit much larger than the standard 21_000 to enable + // the contract to induce a gas price increase + const largeGasLimit = uint64(8_000_000) + + // TODO(marun) What is the significance of this value? + gasTip := big.NewInt(1000 * params.GWei) + + ginkgo.It("should ensure that the gas price is affected by load", func() { + ginkgo.By("creating a new private network to ensure isolation from other tests") + privateNetwork := e2e.Env.NewPrivateNetwork() + + ginkgo.By("allocating a pre-funded key") + key := privateNetwork.GetConfig().FundedKeys[0] + ethAddress := evm.GetEthAddress(key) + + ginkgo.By("initializing a coreth client") + node := privateNetwork.GetNodes()[0] + nodeURI := testnet.NodeURI{ + NodeID: node.GetID(), + URI: node.GetProcessContext().URI, + } + ethClient := e2e.Env.NewEthClient(nodeURI) + + ginkgo.By("initializing a transaction signer") + cChainID, err := ethClient.ChainID(e2e.DefaultContext()) + require.NoError(err) + signer := types.NewEIP155Signer(cChainID) + ecdsaKey := key.ToECDSA() + sign := func(tx *types.Transaction) *types.Transaction { + signedTx, err := types.SignTx(tx, signer, ecdsaKey) + require.NoError(err) + return signedTx + } + + var contractAddress common.Address + ginkgo.By("deploying an expensive contract", func() { + // Create transaction + nonce, err := ethClient.AcceptedNonceAt(e2e.DefaultContext(), ethAddress) + require.NoError(err) + compiledContract := common.Hex2Bytes(hashingCompiledContract) + tx := types.NewTx(&types.LegacyTx{ + Nonce: nonce, + GasPrice: gasTip, + Gas: largeGasLimit, + Value: common.Big0, + Data: compiledContract, + }) + + // Send the transaction and wait for acceptance + signedTx := sign(tx) + receipt := e2e.SendEthTransaction(ethClient, signedTx) + + contractAddress = receipt.ContractAddress + }) + + var gasPrice *big.Int + ginkgo.By("calling the expensive contract repeatedly until a gas price increase is detected", func() { + // Evaluate the bytes representation of the contract + hashingABI, err := abi.JSON(strings.NewReader(hashingABIJson)) + require.NoError(err) + contractData, err := hashingABI.Pack("hashIt") + require.NoError(err) + + var initialGasPrice *big.Int + e2e.Eventually(func() bool { + // Check the gas price + var err error + gasPrice, err = ethClient.SuggestGasPrice(e2e.DefaultContext()) + require.NoError(err) + if initialGasPrice == nil { + initialGasPrice = gasPrice + tests.Outf("{{blue}}initial gas price is %v{{/}}\n", initialGasPrice) + } else if gasPrice.Cmp(initialGasPrice) > 0 { + // Gas price has increased + tests.Outf("{{blue}}gas price has increased to %v{{/}}\n", gasPrice) + return true + } + + // Create the transaction + nonce, err := ethClient.AcceptedNonceAt(e2e.DefaultContext(), ethAddress) + require.NoError(err) + tx := types.NewTx(&types.LegacyTx{ + Nonce: nonce, + GasPrice: gasTip, + Gas: largeGasLimit, + To: &contractAddress, + Value: common.Big0, + Data: contractData, + }) + + // Send the transaction and wait for acceptance + signedTx := sign(tx) + _ = e2e.SendEthTransaction(ethClient, signedTx) + + // The gas price will be checked at the start of the next iteration + return false + }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price increase before timeout") + }) + + ginkgo.By("waiting for the gas price to decrease...", func() { + initialGasPrice := gasPrice + e2e.Eventually(func() bool { + var err error + gasPrice, err = ethClient.SuggestGasPrice(e2e.DefaultContext()) + require.NoError(err) + tests.Outf("{{blue}}.{{/}}") + return initialGasPrice.Cmp(gasPrice) > 0 + }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price decrease before timeout") + tests.Outf("\n{{blue}}gas price has decreased to %v{{/}}\n", gasPrice) + }) + + ginkgo.By("sending funds at the current gas price", func() { + // Create a recipient address + factory := secp256k1.Factory{} + recipientKey, err := factory.NewPrivateKey() + require.NoError(err) + recipientEthAddress := evm.GetEthAddress(recipientKey) + + // Create transaction + nonce, err := ethClient.AcceptedNonceAt(e2e.DefaultContext(), ethAddress) + require.NoError(err) + tx := types.NewTx(&types.LegacyTx{ + Nonce: nonce, + GasPrice: gasPrice, + Gas: e2e.DefaultGasLimit, + To: &recipientEthAddress, + Value: common.Big0, + }) + + // Send the transaction and wait for acceptance + signedTx := sign(tx) + _ = e2e.SendEthTransaction(ethClient, signedTx) + }) + + e2e.CheckBootstrapIsPossible(privateNetwork) + }) +}) diff --git a/tests/e2e/c/hashing.sol b/tests/e2e/c/hashing.sol new file mode 100644 index 000000000000..0457ac428e01 --- /dev/null +++ b/tests/e2e/c/hashing.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + +pragma solidity = 0.8.6; + +contract ConsumeGas { + + bytes hashVar = bytes("This is the hashing text for the test"); + + function hashIt() public { + for (uint i=0; i<3700; i++) { + ripemd160(hashVar); + } + } + +} diff --git a/tests/e2e/c/hashing_contract.go b/tests/e2e/c/hashing_contract.go new file mode 100644 index 000000000000..af5e81eb9057 --- /dev/null +++ b/tests/e2e/c/hashing_contract.go @@ -0,0 +1,11 @@ +// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// AUTOMATICALLY GENERATED. DO NOT EDIT! +// Generated from hashing.sol by compile-contract.sh +package c + +const ( + hashingCompiledContract = "60806040526040518060600160405280602581526020016103ba6025913960009080519060200190610032929190610045565b5034801561003f57600080fd5b50610149565b828054610051906100e8565b90600052602060002090601f01602090048101928261007357600085556100ba565b82601f1061008c57805160ff19168380011785556100ba565b828001600101855582156100ba579182015b828111156100b957825182559160200191906001019061009e565b5b5090506100c791906100cb565b5090565b5b808211156100e45760008160009055506001016100cc565b5090565b6000600282049050600182168061010057607f821691505b602082108114156101145761011361011a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b610262806101586000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80636f37ecea14610030575b600080fd5b61003861003a565b005b60005b610e7481101561009057600360006040516100589190610112565b602060405180830381855afa158015610075573d6000803e3d6000fd5b5050506040515150808061008890610185565b91505061003d565b50565b600081546100a081610153565b6100aa818661013e565b945060018216600081146100c557600181146100d657610109565b60ff19831686528186019350610109565b6100df85610129565b60005b83811015610101578154818901526001820191506020810190506100e2565b838801955050505b50505092915050565b600061011e8284610093565b915081905092915050565b60008190508160005260206000209050919050565b600081905092915050565b6000819050919050565b6000600282049050600182168061016b57607f821691505b6020821081141561017f5761017e6101fd565b5b50919050565b600061019082610149565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156101c3576101c26101ce565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fdfea2646970667358221220cc5de5cd3c7aa5bda60e63e0f3156691253f7a78191eb336ec6699b38a8a777c64736f6c6343000806003354686973206973207468652068617368696e67207465787420666f72207468652074657374" + hashingABIJson = `[{"inputs":[],"name":"hashIt","outputs":[],"stateMutability":"nonpayable","type":"function"}]` +) diff --git a/tests/e2e/c/interchain_workflow.go b/tests/e2e/c/interchain_workflow.go index 4d24f38f9652..47c430d4c12a 100644 --- a/tests/e2e/c/interchain_workflow.go +++ b/tests/e2e/c/interchain_workflow.go @@ -26,10 +26,7 @@ import ( var _ = e2e.DescribeCChain("[Interchain Workflow]", func() { require := require.New(ginkgo.GinkgoT()) - const ( - txAmount = 10 * units.Avax // Arbitrary amount to send and transfer - gasLimit = uint64(21000) // Standard gas limit - ) + const txAmount = 10 * units.Avax // Arbitrary amount to send and transfer ginkgo.It("should ensure that funds can be transferred from the C-Chain to the X-Chain and the P-Chain", func() { ginkgo.By("initializing a new eth client") @@ -56,7 +53,7 @@ var _ = e2e.DescribeCChain("[Interchain Workflow]", func() { acceptedNonce, recipientEthAddress, big.NewInt(int64(txAmount)), - gasLimit, + e2e.DefaultGasLimit, gasPrice, nil, ) diff --git a/tests/e2e/e2e.go b/tests/e2e/e2e.go index ce5e99096595..2cbea2d6290c 100644 --- a/tests/e2e/e2e.go +++ b/tests/e2e/e2e.go @@ -12,6 +12,7 @@ import ( "math/big" "math/rand" "os" + "path/filepath" "strings" "time" @@ -29,6 +30,7 @@ import ( "github.com/ava-labs/avalanchego/tests/fixture/testnet" "github.com/ava-labs/avalanchego/tests/fixture/testnet/local" "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" + "github.com/ava-labs/avalanchego/utils/perms" "github.com/ava-labs/avalanchego/vms/platformvm/txs/executor" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary" @@ -54,6 +56,16 @@ const ( // current time for validator addition to succeed, and adding 20 // seconds provides a buffer in case of any delay in processing. DefaultValidatorStartTimeDiff = executor.SyncBound + 20*time.Second + + DefaultGasLimit = uint64(21000) // Standard gas limit + + // An empty string prompts the use of the default path which ensures a + // predictable target for github's upload-artifact action. + DefaultNetworkDir = "" + + // Directory used to store private networks (specific to a single test) + // under the shared network dir. + PrivateNetworksDirName = "private_networks" ) // Env is used to access shared test fixture. Intended to be @@ -116,6 +128,7 @@ func (te *TestEnvironment) NewKeychain(count int) *secp256k1fx.Keychain { } // Create a new wallet for the provided keychain against the specified node URI. +// TODO(marun) Make this a regular function. func (te *TestEnvironment) NewWallet(keychain *secp256k1fx.Keychain, nodeURI testnet.NodeURI) primary.Wallet { tests.Outf("{{blue}} initializing a new wallet for node %s with URI: %s {{/}}\n", nodeURI.NodeID, nodeURI.URI) baseWallet, err := primary.MakeWallet(DefaultContext(), &primary.WalletConfig{ @@ -135,6 +148,7 @@ func (te *TestEnvironment) NewWallet(keychain *secp256k1fx.Keychain, nodeURI tes } // Create a new eth client targeting the specified node URI. +// TODO(marun) Make this a regular function. func (te *TestEnvironment) NewEthClient(nodeURI testnet.NodeURI) ethclient.Client { tests.Outf("{{blue}} initializing a new eth client for node %s with URI: %s {{/}}\n", nodeURI.NodeID, nodeURI.URI) nodeAddress := strings.Split(nodeURI.URI, "//")[1] @@ -144,6 +158,20 @@ func (te *TestEnvironment) NewEthClient(nodeURI testnet.NodeURI) ethclient.Clien return client } +// Create a new private network that is not shared with other tests. +func (te *TestEnvironment) NewPrivateNetwork() testnet.Network { + // Load the shared network to retrieve its path and exec path + sharedNetwork, err := local.ReadNetwork(te.NetworkDir) + te.require.NoError(err) + + // The private networks dir is under the shared network dir to ensure it + // will be included in the artifact uploaded in CI. + privateNetworksDir := filepath.Join(sharedNetwork.Dir, PrivateNetworksDirName) + te.require.NoError(os.MkdirAll(privateNetworksDir, perms.ReadWriteExecute)) + + return StartLocalNetwork(sharedNetwork.ExecPath, privateNetworksDir) +} + // Helper simplifying use of a timed context by canceling the context on ginkgo teardown. func ContextWithTimeout(duration time.Duration) context.Context { ctx, cancel := context.WithTimeout(context.Background(), duration) @@ -259,3 +287,30 @@ func CheckBootstrapIsPossible(network testnet.Network) { node := AddEphemeralNode(network, testnet.FlagsMap{}) WaitForHealthy(node) } + +// Start a local test-managed network with the provided avalanchego binary. +func StartLocalNetwork(avalancheGoExecPath string, networkDir string) *local.LocalNetwork { + require := require.New(ginkgo.GinkgoT()) + + network, err := local.StartNetwork( + DefaultContext(), + ginkgo.GinkgoWriter, + networkDir, + &local.LocalNetwork{ + LocalConfig: local.LocalConfig{ + ExecPath: avalancheGoExecPath, + }, + }, + testnet.DefaultNodeCount, + testnet.DefaultFundedKeyCount, + ) + require.NoError(err) + ginkgo.DeferCleanup(func() { + tests.Outf("Shutting down network\n") + require.NoError(network.Stop()) + }) + + tests.Outf("{{green}}Successfully started network{{/}}\n") + + return network +} diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 5373082f94a0..2e9a86684df0 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -4,7 +4,6 @@ package e2e_test import ( - "context" "encoding/json" "flag" "fmt" @@ -20,7 +19,6 @@ import ( "github.com/ava-labs/avalanchego/tests" "github.com/ava-labs/avalanchego/tests/e2e" "github.com/ava-labs/avalanchego/tests/fixture" - "github.com/ava-labs/avalanchego/tests/fixture/testnet" "github.com/ava-labs/avalanchego/tests/fixture/testnet/local" // ensure test packages are scanned by ginkgo @@ -83,28 +81,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { network, err = local.ReadNetwork(persistentNetworkDir) require.NoError(err) } else { - ctx, cancel := context.WithTimeout(context.Background(), local.DefaultNetworkStartTimeout) - defer cancel() - var err error - network, err = local.StartNetwork( - ctx, - ginkgo.GinkgoWriter, - "", // Use the default path to ensure a predictable target for github's upload-artifact action - &local.LocalNetwork{ - LocalConfig: local.LocalConfig{ - ExecPath: avalancheGoExecPath, - }, - }, - testnet.DefaultNodeCount, - testnet.DefaultFundedKeyCount, - ) - require.NoError(err) - ginkgo.DeferCleanup(func() { - tests.Outf("Shutting down network\n") - require.NoError(network.Stop()) - }) - - tests.Outf("{{green}}Successfully started network{{/}}\n") + network = e2e.StartLocalNetwork(avalancheGoExecPath, e2e.DefaultNetworkDir) } uris := network.GetURIs() diff --git a/utils/timer/adaptive_timeout_manager_test.go b/utils/timer/adaptive_timeout_manager_test.go index 660401eb357f..781686261b52 100644 --- a/utils/timer/adaptive_timeout_manager_test.go +++ b/utils/timer/adaptive_timeout_manager_test.go @@ -22,7 +22,7 @@ func TestAdaptiveTimeoutManagerInit(t *testing.T) { expectedErr error } - tests := []test{ + tests := []*test{ { config: AdaptiveTimeoutConfig{ InitialTimeout: time.Second, @@ -84,7 +84,7 @@ func TestAdaptiveTimeoutManagerInit(t *testing.T) { } for _, test := range tests { - _, err := NewAdaptiveTimeoutManager(&test.config, "", prometheus.NewRegistry()) + _, err := NewAdaptiveTimeoutManager(&test.config, "", prometheus.NewRegistry()) //nolint:gosec require.ErrorIs(t, err, test.expectedErr) } } diff --git a/version/compatibility.json b/version/compatibility.json index 2953f71110fb..1f500a1497e5 100644 --- a/version/compatibility.json +++ b/version/compatibility.json @@ -1,7 +1,8 @@ { "28": [ "v1.10.9", - "v1.10.10" + "v1.10.10", + "v1.10.11" ], "27": [ "v1.10.5", diff --git a/version/constants.go b/version/constants.go index 4d276235649d..11aad9dbe7ec 100644 --- a/version/constants.go +++ b/version/constants.go @@ -21,7 +21,7 @@ var ( Current = &Semantic{ Major: 1, Minor: 10, - Patch: 10, + Patch: 11, } CurrentApp = &Application{ Major: Current.Major, diff --git a/vms/avm/txs/import_tx.go b/vms/avm/txs/import_tx.go index c3066ccc5c40..94a12442f4a8 100644 --- a/vms/avm/txs/import_tx.go +++ b/vms/avm/txs/import_tx.go @@ -31,7 +31,7 @@ func (t *ImportTx) InputUTXOs() []*avax.UTXOID { utxos := t.BaseTx.InputUTXOs() for _, in := range t.ImportedIns { in.Symbol = true - utxos = append(utxos, &in.UTXOID) + utxos = append(utxos, &in.UTXOID) //nolint:gosec } return utxos } diff --git a/vms/avm/vm.go b/vms/avm/vm.go index 9ef3f6cad65e..b055dd23e6bc 100644 --- a/vms/avm/vm.go +++ b/vms/avm/vm.go @@ -535,7 +535,7 @@ func (vm *VM) initGenesis(genesisBytes []byte) error { } tx := &txs.Tx{ - Unsigned: &genesisTx.CreateAssetTx, + Unsigned: &genesisTx.CreateAssetTx, //nolint:gosec } if err := vm.parser.InitializeGenesisTx(tx); err != nil { return err diff --git a/vms/components/avax/base_tx.go b/vms/components/avax/base_tx.go index 2bcafa24e497..a57793a48213 100644 --- a/vms/components/avax/base_tx.go +++ b/vms/components/avax/base_tx.go @@ -35,7 +35,7 @@ type BaseTx struct { func (t *BaseTx) InputUTXOs() []*UTXOID { utxos := make([]*UTXOID, len(t.Ins)) for i, in := range t.Ins { - utxos[i] = &in.UTXOID + utxos[i] = &in.UTXOID //nolint:gosec } return utxos } diff --git a/vms/components/avax/utxo_id_test.go b/vms/components/avax/utxo_id_test.go index 391f87014230..5e86dfde4801 100644 --- a/vms/components/avax/utxo_id_test.go +++ b/vms/components/avax/utxo_id_test.go @@ -57,7 +57,7 @@ func TestUTXOIDLess(t *testing.T) { id2 UTXOID expected bool } - tests := []test{ + tests := []*test{ { name: "same", id1: UTXOID{}, @@ -99,7 +99,7 @@ func TestUTXOIDLess(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expected, tt.id1.Less(&tt.id2)) + require.Equal(t, tt.expected, tt.id1.Less(&tt.id2)) //nolint:gosec }) } } diff --git a/vms/platformvm/genesis/genesis.go b/vms/platformvm/genesis/genesis.go index 6a62f978b701..570846432d48 100644 --- a/vms/platformvm/genesis/genesis.go +++ b/vms/platformvm/genesis/genesis.go @@ -59,7 +59,7 @@ func ParseState(genesisBytes []byte) (*State, error) { utxos := make([]*avax.UTXO, 0, len(genesis.UTXOs)) for _, utxo := range genesis.UTXOs { - utxos = append(utxos, &utxo.UTXO) + utxos = append(utxos, &utxo.UTXO) //nolint:gosec } return &State{ diff --git a/vms/platformvm/service.go b/vms/platformvm/service.go index 3f306be6744c..b917b5e4a5e7 100644 --- a/vms/platformvm/service.go +++ b/vms/platformvm/service.go @@ -292,7 +292,7 @@ utxoFor: continue utxoFor } - response.UTXOIDs = append(response.UTXOIDs, &utxo.UTXOID) + response.UTXOIDs = append(response.UTXOIDs, &utxo.UTXOID) //nolint:gosec } balances := maps.Clone(lockedStakeables) diff --git a/vms/platformvm/txs/executor/standard_tx_executor.go b/vms/platformvm/txs/executor/standard_tx_executor.go index e3f446c02130..66bf4c0345b1 100644 --- a/vms/platformvm/txs/executor/standard_tx_executor.go +++ b/vms/platformvm/txs/executor/standard_tx_executor.go @@ -154,7 +154,7 @@ func (e *StandardTxExecutor) ImportTx(tx *txs.ImportTx) error { for index, input := range tx.Ins { utxo, err := e.State.GetUTXO(input.InputID()) if err != nil { - return fmt.Errorf("failed to get UTXO %s: %w", &input.UTXOID, err) + return fmt.Errorf("failed to get UTXO %s: %w", &input.UTXOID, err) //nolint:gosec } utxos[index] = utxo } diff --git a/vms/platformvm/utxo/handler.go b/vms/platformvm/utxo/handler.go index 2d652103fee2..b617783bca0b 100644 --- a/vms/platformvm/utxo/handler.go +++ b/vms/platformvm/utxo/handler.go @@ -443,7 +443,7 @@ func (h *handler) VerifySpend( if err != nil { return fmt.Errorf( "failed to read consumed UTXO %s due to: %w", - &input.UTXOID, + &input.UTXOID, //nolint:gosec err, ) } diff --git a/wallet/chain/x/builder.go b/wallet/chain/x/builder.go index 0b639a7776ad..ba88db984833 100644 --- a/wallet/chain/x/builder.go +++ b/wallet/chain/x/builder.go @@ -655,7 +655,7 @@ func (b *builder) mintFTs( // add the operation to the array operations = append(operations, &txs.Operation{ Asset: utxo.Asset, - UTXOIDs: []*avax.UTXOID{&utxo.UTXOID}, + UTXOIDs: []*avax.UTXOID{&utxo.UTXOID}, //nolint:gosec Op: &secp256k1fx.MintOperation{ MintInput: secp256k1fx.Input{ SigIndices: inputSigIndices, @@ -717,7 +717,7 @@ func (b *builder) mintNFTs( operations = append(operations, &txs.Operation{ Asset: avax.Asset{ID: assetID}, UTXOIDs: []*avax.UTXOID{ - &utxo.UTXOID, + &utxo.UTXOID, //nolint:gosec }, Op: &nftfx.MintOperation{ MintInput: secp256k1fx.Input{ @@ -773,7 +773,7 @@ func (b *builder) mintProperty( operations = append(operations, &txs.Operation{ Asset: avax.Asset{ID: assetID}, UTXOIDs: []*avax.UTXOID{ - &utxo.UTXOID, + &utxo.UTXOID, //nolint:gosec }, Op: &propertyfx.MintOperation{ MintInput: secp256k1fx.Input{ @@ -829,7 +829,7 @@ func (b *builder) burnProperty( operations = append(operations, &txs.Operation{ Asset: avax.Asset{ID: assetID}, UTXOIDs: []*avax.UTXOID{ - &utxo.UTXOID, + &utxo.UTXOID, //nolint:gosec }, Op: &propertyfx.BurnOperation{ Input: secp256k1fx.Input{