This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.
In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.
With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.
- G404# Use of weak random number generator - lots of FP
- G107# Potential http request -- those are intentional
- G306 # G306:Expect WriteFile permissions to be 0600 or less
issues:
issues:
exclude-rules:
exclude-rules:
@ -58,16 +50,15 @@ issues:
- deadcode
- deadcode
- staticcheck
- staticcheck
- path:internal/build/pgp.go
- path:internal/build/pgp.go
text: 'SA1019:package golang.org/x/crypto/openpgp is deprecated'
text: 'SA1019:"golang.org/x/crypto/openpgp"is deprecated:this package is unmaintained except for security fixes.'
- path:core/vm/contracts.go
- path:core/vm/contracts.go
text: 'SA1019:package golang.org/x/crypto/ripemd160 is deprecated'
text: 'SA1019:"golang.org/x/crypto/ripemd160"is deprecated:RIPEMD-160 is a legacy hash and should not be used for new applications.'
- path:accounts/usbwallet/trezor.go
- path:accounts/usbwallet/trezor.go
text: 'SA1019:package github.com/golang/protobuf/proto is deprecated'
text: 'SA1019:"github.com/golang/protobuf/proto"is deprecated:Use the "google.golang.org/protobuf/proto" package instead.'
- path:accounts/usbwallet/trezor/
- path:accounts/usbwallet/trezor/
text: 'SA1019:package github.com/golang/protobuf/proto is deprecated'
text: 'SA1019:"github.com/golang/protobuf/proto"is deprecated:Use the "google.golang.org/protobuf/proto" package instead.'
exclude:
exclude:
- 'SA1019: event.TypeMux is deprecated:use Feed'
- 'SA1019: event.TypeMux is deprecated:use Feed'
- 'SA1019:strings.Title is deprecated'
- 'SA1019:strings.Title is deprecated'
- 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0:The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.'
- 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0:The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.'
- 'SA1029:should not use built-in type string as key for value'
- 'SA1029:should not use built-in type string as key for value'
- 'G306:Expect WriteFile permissions to be 0600 or less'
// The new gas metering is based on net gas costs (EIP-1283):
// The new gas metering is based on net gas costs (EIP-1283):
//
//
// 1. If current value equals new value (this is a no-op), 200 gas is deducted.
// (1.) If current value equals new value (this is a no-op), 200 gas is deducted.
// 2. If current value does not equal new value
// (2.) If current value does not equal new value
// 2.1. If original value equals current value (this storage slot has not been changed by the current execution context)
// (2.1.) If original value equals current value (this storage slot has not been changed by the current execution context)
// 2.1.1. If original value is 0, 20000 gas is deducted.
// (2.1.1.) If original value is 0, 20000 gas is deducted.
// 2.1.2. Otherwise, 5000 gas is deducted. If new value is 0, add 15000 gas to refund counter.
// (2.1.2.) Otherwise, 5000 gas is deducted. If new value is 0, add 15000 gas to refund counter.
// 2.2. If original value does not equal current value (this storage slot is dirty), 200 gas is deducted. Apply both of the following clauses.
// (2.2.) If original value does not equal current value (this storage slot is dirty), 200 gas is deducted. Apply both of the following clauses.
// 2.2.1. If original value is not 0
// (2.2.1.) If original value is not 0
// 2.2.1.1. If current value is 0 (also means that new value is not 0), remove 15000 gas from refund counter. We can prove that refund counter will never go below 0.
// (2.2.1.1.) If current value is 0 (also means that new value is not 0), remove 15000 gas from refund counter. We can prove that refund counter will never go below 0.
// 2.2.1.2. If new value is 0 (also means that current value is not 0), add 15000 gas to refund counter.
// (2.2.1.2.) If new value is 0 (also means that current value is not 0), add 15000 gas to refund counter.
// 2.2.2. If original value equals new value (this storage slot is reset)
// (2.2.2.) If original value equals new value (this storage slot is reset)
// 2.2.2.1. If original value is 0, add 19800 gas to refund counter.
// (2.2.2.1.) If original value is 0, add 19800 gas to refund counter.
// 2.2.2.2. Otherwise, add 4800 gas to refund counter.
// (2.2.2.2.) Otherwise, add 4800 gas to refund counter.