diff --git a/.circleci/config.yml b/.circleci/config.yml index b17ac198..5fb9a5b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ workflows: name: 'test_go_<< matrix.go_version >>' matrix: parameters: - go_version: ['1.17'] + go_version: ['1.20.5'] jobs: test: diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 33c3183e..197fae69 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.3 - name: Generate and PR uses: algorand/generator/.github/actions/sdk-codegen/@master with: diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 640c8159..f97f3310 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -43,7 +43,7 @@ jobs: fi - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.3 with: fetch-depth: 0 diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index afe5fb36..2f3845da 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -6,23 +6,23 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code into the Go module directory - uses: actions/checkout@v2 + uses: actions/checkout@v3.5.3 with: fetch-depth: 0 # required for new-from-rev option in .golangci.yml - name: Install specific golang - uses: actions/setup-go@v2 + uses: actions/setup-go@v4.0.1 with: - go-version: '1.17.13' + go-version: '1.20.5' - name: Check format run: test -z `go fmt ./...` - name: Vet run: go vet ./... - name: reviewdog-golangci-lint - uses: reviewdog/action-golangci-lint@v2 + uses: reviewdog/action-golangci-lint@v2.3.1 with: - golangci_lint_version: "v1.47.3" + golangci_lint_version: "v1.53.2" golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners" - go_version: "1.17.13" + go_version: "1.20.5" reporter: "github-pr-review" tool_name: "Lint Errors" level: "error" diff --git a/.golangci.yml b/.golangci.yml index 30061ae5..a62927aa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,7 +8,6 @@ run: linters: disable-all: true enable: - - deadcode - errcheck - exportloopref - gci @@ -21,10 +20,8 @@ linters: - nolintlint - revive - staticcheck - - structcheck - typecheck - unused - - varcheck linters-settings: gci: @@ -61,6 +58,8 @@ issues: - "exported method (.*).Unwrap` should have comment or be unexported" # ignore issues about the way we use _struct fields to define encoding settings - "`_struct` is unused" + # we are not enforcing package-comments at this point + - "^package-comments: should have a package comment" # Enable some golangci-lint default exception rules: # "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok" diff --git a/Makefile b/Makefile index 15ee842c..ad6b9b40 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ TEST_SOURCES := $(shell cd $(SRCPATH) && go list ./...) TEST_SOURCES_NO_CUCUMBER := $(shell cd $(SRCPATH) && go list ./... | grep -v test) UNIT_TAGS := "$(shell awk '{print $2}' test/unit.tags | paste -s -d, -)" INTEGRATIONS_TAGS := "$(shell awk '{print $2}' test/integration.tags | paste -s -d, -)" -GO_IMAGE := golang:$(subst go,,$(shell go version | cut -d' ' -f 3 | cut -d'.' -f 1,2))-stretch +GO_IMAGE := golang:$(subst go,,$(shell go version | cut -d' ' -f 3 | cut -d'.' -f 1,2))-bookworm lint: golangci-lint run -c .golangci.yml diff --git a/go.mod b/go.mod index 98f11d2a..37b32c8f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/algorand/go-algorand-sdk/v2 -go 1.17 +go 1.20 require ( github.com/algorand/avm-abi v0.1.1 diff --git a/go.sum b/go.sum index e8b1fb2b..960ca0a0 100644 --- a/go.sum +++ b/go.sum @@ -3,7 +3,6 @@ github.com/algorand/avm-abi v0.1.1/go.mod h1:+CgwM46dithy850bpTeHh9MC99zpn2Snirb github.com/algorand/go-codec/codec v1.1.10 h1:zmWYU1cp64jQVTOG8Tw8wa+k0VfwgXIPbnDfiVa+5QA= github.com/algorand/go-codec/codec v1.1.10/go.mod h1:YkEx5nmr/zuCeaDYOIhlDg92Lxju8tj2d2NrYqP7g7k= github.com/chrismcguire/gobberish v0.0.0-20150821175641-1d8adb509a0e h1:CHPYEbz71w8DqJ7DRIq+MXyCQsdibK08vdcQTY4ufas= -github.com/chrismcguire/gobberish v0.0.0-20150821175641-1d8adb509a0e/go.mod h1:6Xhs0ZlsRjXLIiSMLKafbZxML/j30pg9Z1priLuha5s= github.com/cucumber/godog v0.8.1 h1:lVb+X41I4YDreE+ibZ50bdXmySxgRviYFgKY6Aw4XE8= github.com/cucumber/godog v0.8.1/go.mod h1:vSh3r/lM+psC1BPXvdkSEuNjmXfpVqrMGYAElF6hxnA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/protocol/config/consensus.go b/protocol/config/consensus.go index 80cc8652..209322d6 100644 --- a/protocol/config/consensus.go +++ b/protocol/config/consensus.go @@ -564,7 +564,7 @@ var MaxBytesKeyValueLen int var MaxExtraAppProgramLen int // MaxAvailableAppProgramLen is the largest supported app program size include the extra pages -//supported supported by any of the consensus protocols. used for decoding purposes. +// supported supported by any of the consensus protocols. used for decoding purposes. var MaxAvailableAppProgramLen int // MaxProposedExpiredOnlineAccounts is the maximum number of online accounts, which need diff --git a/test/helpers.go b/test/helpers.go index 6b465445..f362be89 100644 --- a/test/helpers.go +++ b/test/helpers.go @@ -4,7 +4,7 @@ import ( "container/ring" "encoding/base64" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "os" @@ -21,7 +21,7 @@ func loadMockJsons(commaDelimitedFilenames, pathToJsons string) ([][]byte, error if err != nil { return nil, err } - fileBytes, err := ioutil.ReadAll(jsonfile) + fileBytes, err := io.ReadAll(jsonfile) if err != nil { return nil, err } @@ -105,5 +105,5 @@ func expectErrorStringToContain(contains string) error { } func loadResource(filepath string) ([]byte, error) { - return ioutil.ReadFile(path.Join("features", "resources", filepath)) + return os.ReadFile(path.Join("features", "resources", filepath)) } diff --git a/test/utilities.go b/test/utilities.go index 8d9ffd89..fb68cc35 100644 --- a/test/utilities.go +++ b/test/utilities.go @@ -7,7 +7,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "log" "os" "sort" @@ -24,7 +24,7 @@ func VerifyResponse(expectedFile string, actual string) error { if err != nil { return err } - fileBytes, err := ioutil.ReadAll(jsonfile) + fileBytes, err := io.ReadAll(jsonfile) if err != nil { return err } diff --git a/transaction/transaction.go b/transaction/transaction.go index b79aa548..b7d40715 100644 --- a/transaction/transaction.go +++ b/transaction/transaction.go @@ -317,10 +317,11 @@ func MakeAssetCreateTxn(account string, note []byte, params types.SuggestedParam // MakeAssetConfigTxn creates a tx template for changing the // key configuration of an existing asset. // Important notes - -// * Every asset config transaction is a fresh one. No parameters will be inherited from the current config. -// * Once an address is set to to the empty string, IT CAN NEVER BE CHANGED AGAIN. For example, if you want to keep -// The current manager, you must specify its address again. -// Parameters - +// - Every asset config transaction is a fresh one. No parameters will be inherited from the current config. +// - Once an address is set to to the empty string, IT CAN NEVER BE CHANGED AGAIN. For example, if you want to keep +// The current manager, you must specify its address again. +// Parameters - +// // - account is a checksummed, human-readable address that will send the transaction // - note is an arbitrary byte array // - params is typically received from algod, it defines common-to-all-txns arguments like fee and validity period diff --git a/transaction/transactionSigner.go b/transaction/transactionSigner.go index d23e79b7..16fbea1a 100644 --- a/transaction/transactionSigner.go +++ b/transaction/transactionSigner.go @@ -11,8 +11,9 @@ import ( // @param txnGroup - The atomic group containing transactions to be signed // @param indexesToSign - An array of indexes in the atomic transaction group that should be signed // @returns An array of encoded signed transactions. The length of the -// array will be the same as the length of indexesToSign, and each index i in the array -// corresponds to the signed transaction from txnGroup[indexesToSign[i]] +// +// array will be the same as the length of indexesToSign, and each index i in the array +// corresponds to the signed transaction from txnGroup[indexesToSign[i]] type TransactionSigner interface { //nolint:revive // Ignore stuttering for backwards compatibility SignTransactions(txGroup []types.Transaction, indexesToSign []int) ([][]byte, error) Equals(other TransactionSigner) bool diff --git a/transaction/waitForConfirmation.go b/transaction/waitForConfirmation.go index 9725a6cc..af445a76 100644 --- a/transaction/waitForConfirmation.go +++ b/transaction/waitForConfirmation.go @@ -41,10 +41,9 @@ func WaitForConfirmation(c *algod.Client, txid string, waitRounds uint64, ctx co return } } - // ignore errors from PendingTransactionInformation, since it may return 404 if the algod - // instance is behind a load balancer and the request goes to a different algod than the - // one we submitted the transaction to - err = nil + // Note that we intentionally ignore errors from PendingTransactionInformation, since it + // may return 404 if the algod instance is behind a load balancer and the request goes + // to a different algod than the one we submitted the transaction to // Wait until the block for the `currentRound` is confirmed response, err = c.StatusAfterBlock(currentRound).Do(ctx, headers...) diff --git a/types/applications.go b/types/applications.go index 984dc326..fb9a5a94 100644 --- a/types/applications.go +++ b/types/applications.go @@ -66,6 +66,7 @@ const ( // OnCompletion is an enum representing some layer 1 side effect that an // ApplicationCall transaction will have if it is included in a block. +// //go:generate stringer -type=OnCompletion -output=application_string.go type OnCompletion uint64 diff --git a/types/block.go b/types/block.go index e15cfc9f..2e2a1f6c 100644 --- a/types/block.go +++ b/types/block.go @@ -276,6 +276,7 @@ type EvalDelta struct { // StateDelta is a map from key/value store keys to ValueDeltas, indicating // what should happen for that key +// //msgp:allocbound StateDelta config.MaxStateDeltaKeys type StateDelta map[string]ValueDelta diff --git a/types/statedelta.go b/types/statedelta.go index 22a1b45f..54c71fb5 100644 --- a/types/statedelta.go +++ b/types/statedelta.go @@ -38,6 +38,7 @@ type TealValue struct { // TealKeyValue represents a key/value store for use in an application's // LocalState or GlobalState +// //msgp:allocbound TealKeyValue EncodedMaxKeyValueEntries type TealKeyValue map[string]TealValue diff --git a/types/stateproof.go b/types/stateproof.go index 808ae1f5..c46ce40e 100644 --- a/types/stateproof.go +++ b/types/stateproof.go @@ -34,6 +34,7 @@ const ( ) // GenericDigest is a digest that implements CustomSizeDigest, and can be used as hash output. +// //msgp:allocbound GenericDigest MaxHashDigestSize type GenericDigest []byte @@ -72,6 +73,7 @@ const ( ) // HashFactory is responsible for generating new hashes accordingly to the type it stores. +// //msgp:postunmarshalcheck HashFactory Validate type HashFactory struct { _struct struct{} `codec:",omitempty,omitemptyarray"` @@ -129,6 +131,7 @@ type Participant struct { } // MerkleSignature represents a Falcon signature in a compressed-form +// //msgp:allocbound MerkleSignature FalconMaxSignatureSize type MerkleSignature []byte