Prior to this change, f.begin (and possibly end) stay negative, leading to strange results later in the code. With this change, filters using "safe" and "finalized" block produce results consistent w/ the overall behavior of this RPC method.
Co-authored-by: Martin Holst Swende <martin@swende.se>
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.
This adds a cache for block logs which is shared by all filters. The cache
size of is configurable using the `--cache.blocklogs` flag.
Co-authored-by: Felix Lange <fjl@twurst.com>
This enables the following linters
- typecheck
- unused
- staticcheck
- bidichk
- durationcheck
- exportloopref
- gosec
WIth a few exceptions.
- We use a deprecated protobuf in trezor. I didn't want to mess with that, since I cannot meaningfully test any changes there.
- The deprecated TypeMux is used in a few places still, so the warning for it is silenced for now.
- Using string type in context.WithValue is apparently wrong, one should use a custom type, to prevent collisions between different places in the hierarchy of callers. That should be fixed at some point, but may require some attention.
- The warnings for using weak random generator are squashed, since we use a lot of random without need for cryptographic guarantees.
* accounts/abi/bind: fix duplicate field names in the generated go struct #24627
* accounts, cmd/abigen: resolve name conflicts
* ci lint, accounts/abi: remove unused function overloadedArgName
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
If a pending contract call errors, return that error right away rather
than ignoring it to allow an error somewhere else. This is helpful for
callers to know if perhaps a call failed because of the context deadline
being expired. This change mirrors the behavior of non-pending contract
calls.
This commit replaces ioutil.TempDir with t.TempDir in tests. The
directory created by t.TempDir is automatically removed when the test
and all its subtests complete.
Prior to this commit, temporary directory created using ioutil.TempDir
had to be removed manually by calling os.RemoveAll, which is omitted in
some tests. The error handling boilerplate e.g.
defer func() {
if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
}
is also tedious, but t.TempDir handles this for us nicely.
Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This replaces the simple selector parser in signer/fourbyte with one that
can actually handle most types. The new parser is added in accounts/abi
to also make it useable elsewhere.
This change makes it so WaitMined no longer logs an error when the receipt
is unavailable. It also changes the simulated backend to return NotFound for
unavailable receipts, just like ethclient does.
The `structs` map is populated by iterating over all methods except the constructor, which results in a nil-pointer dereference.
I've first reproduced the problem with a new test and then implemented the fix.
Co-authored-by: Arran Schlosberg <me@arranschlosberg.com>
This is the initial step for support of Solidity errors in contract bindings.
As of this change, errors can be decoded, but are not supported in
bindings yet.
Closes#23157
This fixes a bug where gas-related fields of the TransactOpts passed
to transaction methods would be modified, skipping gas estimation for
subsequent transactions.
Co-authored-by: Yondon Fu <yondon.fu@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
This doesn't fix all go-critic warnings, just the most serious ones.
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
* internal/ethapi/api: cap highest gas limit by account balance for 1559 fee parameters
* accounts/abi/bind: port gas limit cap for 1559 parameters to simulated backend
* accounts/abi/bind: add test for 1559 gas estimates for the simulated backend
* internal/ethapi/api: fix comment
* accounts/abi/bind/backends, internal/ethapi: unify naming style
Co-authored-by: Péter Szilágyi <peterke@gmail.com>