Skip to content

Commit

Permalink
All Commits From Geth Since go-quai Was Created (dominant-strategies#84)
Browse files Browse the repository at this point in the history
* internal/ethapi: accept both hex and decimal for blockCount (#23363)

* core/state/pruner: fix state bloom sync permission in Windows

* mobile: remove deprecated code (#23357)

* core/state/snapshot: fix typo in comment (#23219)

* core/state/snapshot: clarify comment about snapshot repair (#23305)

Co-authored-by: Tyler Chambers <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* internal/ethapi: return maxFeePerGas for gasPrice for EIP-1559 txs (#23345)

* internal/ethapi, accounts/abi/bind: cap highest gas limit by account balance for 1559 fee parameters (#23309)

* 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 <[email protected]>

* core/state/snapshot: gofmt

* travis: transition from docker auto builds to manual pushes

* build: fix docker tag to include `v` prefix in version string

* internal/ethapi: add back missing check for maxfee < maxPriorityFee

* params: release Geth v1.10.7

* params: begin v1.10.8 release cycle

* core/rawdb: implement sequential reads in freezer_table (#23117)

* core/rawdb: implement sequential reads in freezer_table

* core/rawdb, ethdb: add sequential reader to db interface

* core/rawdb: lint nitpicks

* core/rawdb: fix some nitpicks

* core/rawdb: fix flaw with deferred reads not being performed

* core/rawdb: better documentation

* accounts/external: handle 0 chainid as not-set for the Clef API (#23394)

* accounts/external: handle 0 chainid as not-set for the Clef API

* accounts/external: document SignTx

Co-authored-by: Felix Lange <[email protected]>

* cmd, metrics: add support for influxdb-v2 (cherry-picking from italoacasas' changes), leave existing support for v1 to maintain backwards-compatibility. (#23194)

This PR adds flag to enable InfluxDB v2 (--metrics.influxdbv2), flags for v2-specific features (--metrics.influxdb.token, --metrics.influxdb.bucket), also carries over addition of support for specifying organization (--metrics.influxdb.organization), but still retains backwards compatibility with InfluxDB v1.

* eth/downloader: fix typo in comment (#23413)

* signer/core/apitypes: remove dependency on internal/ethapi (#23362)

* go.mod: upgrade golang.org/x/sys for go1.17 support (#23406)

* core/vm: faster code analysis (#23381)

* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying

* params: release Geth v1.10.8

* params: begin Geth v1.10.9 release cycle

* trie, les: add missing calls to Ticker.Stop (#23415)

* p2p, p2p/enode: fix data races (#23434)

In p2p/dial.go, conn.flags was accessed without using sync/atomic.
This race is fixed by removing the access.

In p2p/enode/iter_test.go, a similar race is resolved by writing the field atomically.

Co-authored-by: Felix Lange <[email protected]>

* core/bloombits: avoid crash when storing errors of different type (#23437)

This fixes a rare crash which could occur when two different errors happened
in the same bloombits.MatcherSession.

* tests/testdata: make submodule shallow (#23412)

Before:

316M .git/modules/tests/

After:

171M .git/modules/tests/

* core/vm: fix typo in comment (#23450)

* core/types: add benchmarks for rlp encoding/decoding (#23190)

Co-authored-by: Felix Lange <[email protected]>
Co-authored-by: Sina Mahmoodi <[email protected]>

* node: add comment about --nousb being deprecated (#23439)

Co-authored-by: Felix Lange <[email protected]>

* tests/fuzzers: fix go vet warning about ReadByte (#23380)

* core: make txpool reject too sudden changes (#23095)

* core: make txpool reject too sudden changes

* core: add some metrics to txpool

* cmd/utils: fix typo in variable name (#23451)

* metrics: fix compilation for GOOS=js (#23449)

* core, light, tests, trie: add state metrics (#23433)

* go.mod: update goleveldb (#23417)

* build: upgrade to golangci-lint v1.42.0 (#23461)

The new linter version is built with go 1.17 and thus includes the go vet
check for mismatched +build and go:build lines.

Fortunately, no new warnings are reported with this update.

* build, .travis.yml: upgrade to Go 1.17 (#23464)

* cmd/evm: add difficulty calculation to t8n tool (#23353)

This PR adds functionality to the evm t8n to calculate ethash difficulty. If the caller does not provide a currentDifficulty, but instead provides the parentTimestamp (well, semi-optional, will default to 0 if not given), and parentDifficulty, we can calculate it for him.

The caller can also provide a parentUncleHash. In most, but not all cases, the parent uncle hash also affects the formula. If no such hash is provided (or, if the empty all-zero hash is provided), it's assumed that there were no uncles.

* tests: avoid performance tests during CI runs (#23304)

* Dockerfile: upgrade to Go 1.17 (#23465)

* crypto/cloudflare/bn256: fix in-place addition and unmarshalling (#23419)

* all: add go:build lines (#23468)

Generated by go1.17 fmt ./...

* rlp: minor optimizations for slice/array encoding (#23467)

As per benchmark results below, these changes speed up encoding/decoding of
consensus objects a bit.

    name                             old time/op    new time/op    delta
    EncodeRLP/legacy-header-8           384ns ± 1%     331ns ± 3%  -13.83%  (p=0.000 n=7+8)
    EncodeRLP/london-header-8           411ns ± 1%     359ns ± 2%  -12.53%  (p=0.000 n=8+8)
    EncodeRLP/receipt-for-storage-8     251ns ± 0%     239ns ± 0%   -4.97%  (p=0.000 n=8+8)
    EncodeRLP/receipt-full-8            319ns ± 0%     300ns ± 0%   -5.89%  (p=0.000 n=8+7)
    EncodeRLP/legacy-transaction-8      389ns ± 1%     387ns ± 1%     ~     (p=0.099 n=8+8)
    EncodeRLP/access-transaction-8      607ns ± 0%     581ns ± 0%   -4.26%  (p=0.000 n=8+8)
    EncodeRLP/1559-transaction-8        627ns ± 0%     606ns ± 1%   -3.44%  (p=0.000 n=8+8)
    DecodeRLP/legacy-header-8           831ns ± 1%     813ns ± 1%   -2.20%  (p=0.000 n=8+8)
    DecodeRLP/london-header-8           824ns ± 0%     804ns ± 1%   -2.44%  (p=0.000 n=8+7)

* rlp: pass length to byteArrayBytes

This makes it possible to inline byteArrayBytes. For arrays, the length is known
at encoder construction time, so the call to v.Len() can be avoided.

* rlp: avoid IsNil for pointer encoding

It's actually cheaper to use Elem first, because it performs less checks
on the value. If the pointer was nil, the result of Elem is 'invalid'.

* rlp: minor optimizations for slice/array encoding

For empty slices/arrays, we can avoid storing a list header entry in the
encoder buffer. Also avoid doing the tail check at encoding time because
it is already known at encoder construction time.

* cmd/devp2p/internal/ethtest: remove WriteTo method (#23379)

WriteTo is unused, and go vet warns about it because it
doesn't match the usual signature of the io.WriterTo method.

* rpc: add BlockNumber.MarshalText (#23324)

Currently rpc.BlockNumber is marshalled to JSON as a numeric value, which is
wrong because BlockNumber.UnmarshalJSON() wants it to either be hex-encoded
or string "earliest"/"latest"/"pending". As a result, the call chain

    rpc.BlockNumberOrHashWithNumber(123) -> json.Marshal() -> json.Unmarshal()

fails with error "cannot unmarshal object into Go value of type string".

* build: stop publishing deb packages for Ubuntu 20.10 Groovy Gorilla (#23470)

Support for this Ubuntu release has ended on July 22 2021 and
Launchpad no longer accepts uploads for it.

* internal/ethapi: support both input and data for personal_sendTransaction (#23476)

Currently, setDefaults overwrites the transaction input value if only input is provided. This causes personal_sendTransaction to estimate the gas based on a transaction with empty data. eth_estimateGas never calls setDefaults so it was unaffected by this.

* core/vm: rework jumpdest analysis benchmarks (#23499)

* core/vm: rework jumpdest analysis benchmarks

For BenchmarkJumpdestOpAnalysis use fixed code size of ~1.2MB
and classic benchmark loop.

* core/vm: clear bitvec in jumpdest analysis benchmark

* docs: add links to more audits in SECURITY.md (#23482)

* core: fix typo in iterator.go (#23502)

strorage -> storage

* common: fixes format verb (#23495)

* cmd/evm: add tests for evm t8n (#23507)

* trie: add missing copyright header (#23530)

* Add missing copyright header

* Update stacktrie_test.go

Co-authored-by: Péter Szilágyi <[email protected]>

* docs: add post-mortem (#23518)

* docs: add post-mortem

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <[email protected]>

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <[email protected]>

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <[email protected]>

* Update docs/postmortems/2021-08-22-split-postmortem.md

* Update 2021-08-22-split-postmortem.md

* Update docs/postmortems/2021-08-22-split-postmortem.md

Co-authored-by: Sina Mahmoodi <[email protected]>

Co-authored-by: Sina Mahmoodi <[email protected]>

* internal/debug: remove deprecated flags (#23368)

* internal/debug: remove deprecated flags

The removed flags are removed in the main portion of geth, this removes it internally too.

* internal/debug: remove legacy --debug and legacy --backtrace flag

* Update flags.go

Co-authored-by: Martin Holst Swende <[email protected]>

* core/rawdb: freezer batch write (#23462)

This change is a rewrite of the freezer code.

When writing ancient chain data to the freezer, the previous version first encoded each
individual item to a temporary buffer, then wrote the buffer. For small item sizes (for
example, in the block hash freezer table), this strategy causes a lot of system calls for
writing tiny chunks of data. It also allocated a lot of temporary []byte buffers.

In the new version, we instead encode multiple items into a re-useable batch buffer, which
is then written to the file all at once. This avoids performing a system call for every
inserted item.

To make the internal batching work, the ancient database API had to be changed. While
integrating this new API in BlockChain.InsertReceiptChain, additional optimizations were
also added there.

Co-authored-by: Felix Lange <[email protected]>

* p2p/enode: use unix timestamp as base ENR sequence number (#19903)

This PR ensures that wiping all data associated with a node (apart from its nodekey)
will not generate already used sequence number for the ENRs, since all remote nodes
would reject them until they out-number the previously published largest one.

The big complication with this scheme is that every local update to the ENR can
potentially bump the sequence number by one. In order to ensure that local updates
do not outrun the clock, the sequence number is a millisecond-precision timestamp,
and updates are throttled to occur at most once per millisecond.

Co-authored-by: Felix Lange <[email protected]>

* core: 64bit alignment of testBlockChain.gasLimit (#23543)

This fixes crashes in txpool tests on 32bit platforms.

* appveyor.yml: add linux/amd64 build job (#23548)

* README: add londonBlock to example genesis config (#23565)

Updated example genesis.json configuration section, added londonBlock within config.

* cmd/evm: transaction validation tool (#23494)

* cmd/evm: transaction validation tool

* cmd/evm: add hash to t9n tool

* cmd/evm: lint nits

* cmd/evm: nitpicks

* core, rpc: disable memory output by default in traces (#23558)

* core: cmd: invert disableMemory

* core: fix missed inversion

* cmd/evm: preserve Flags but change default value

* Apply suggestions from code review

Co-authored-by: Martin Holst Swende <[email protected]>

Co-authored-by: Martin Holst Swende <[email protected]>

* cmd/devp2p/internal/ethtest: only use eth66 if eth66 is negotiated (#23568)

* cmd/devp2p/internal/ethtest: only use eth66 if eth66 is negotiated

* cmd/devp2p/internal/ethtest: switch on concrete type not pointer

* cmd/devp2p/internal/ethtest: switch on concrete type not pointer

* eth/tracers: abort evm execution when trace is aborted (#23580)

* core,eth: call frame tracing (#23087)

This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:

    enter: type (opcode), from, to, input, gas, value
    exit: output, gasUsed, error

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.

* ethclient, accounts/keystore: fix flaky tests (#23599)

* ethclient/gethclient: fix flaky test (due to map key ordering)

* accounts/keystore: fix test failing due to rand collision due to low time resolution on windows

* docs: fix spelling on 2021-08-22 postmortem (#23595)

Spelling update

* internal: support optional filter expression for debug.stacks (#23605)

* internal: support optional filter expression for debug.stacks

* internal/debug: fix string regexp

* internal/debug: support searching for line numbers too

* internal/debug: make gosimple linter happy

* go.mod: fix module file to prevent go from updating it during build

* console: add note about typing exit to exit (#23602)

* add explicit note about typing exit in console

* Add note about typing exit as alternative

* rpc: set scheme for ws and ipc conns to the server (#23615)

* rpc: set scheme for ws and ipc conns to the server

* rpc: review fixes

* rpc: bugfix

* rpc: empty default scheme

* accounts/abi: fix resolving single struct argument (#23573)

* rpc: set pong read deadline (#23556)

This PR adds a 30s timeout for the remote part to answer a ping message, thus detecting (silent) disconnnects

* cmd/puppeth: remove shh from Dockerfile (#23634)

* eth/tracers: re-write of 4byte tracer using enter/exit (#23622)

* eth/tracers: add re-write of 4byte tracer using enter/exit

* eth/tracers: fix 4byte indent

* eth/tracers: implement debug.intermediateRoots (#23594)

This PR implements a new debug method, which I've talked briefly about to some other client developers. It allows the caller to obtain the intermediate state roots for a block (which might be either a canon block or a 'bad' block).

* core/rawdb: avoid unnecessary receipt processing for log filtering (#23147)

* core/types: rm extranous check in test

* core/rawdb: add lightweight types for block logs

* core/rawdb,eth: use lightweight accessor for log filtering

* core/rawdb: add bench for decoding into rlpLogs

* accounts/abi/bind: check event signature before parsing (#23230)

* accounts/abi/bind: check event signature before parsing

* remove redundant break line

* eth/tracers: avoid unsyncronized mutations on trie database (#23632)

This PR fixes an issue in traceChain, where the statedb Commit operation was performed asynchronously with dereference-operations agains the underlying trie.Database instance. Due to how the reference counting works within the trie database (where parent count is recursively updated when new parents are added), doing dereferencing in the middle of Commit can cause the refcount to become wrong, leading to an inconsistent state.

This was fixed by doing Commit/Deref from the same routine.

* eth/protocols/eth: simplify peer known block/txs caches (#23649)

* Simplify peer known block/txns cache

* Address minor changes

* Add more minor comments

* Minor changes from review

* graphql: add storage slots to access list (#23650)

Fixes #23640

* eth/protocols/snap, trie: better error-handling (#23657)

* params: release go-ethereum v1.10.9 stable

* params: begin v1.10.10 release cycle

* core: fix typo in comment (#23658)

* internal/ethapi: support retrieving header RLPs too

* eth/tracers: fix callTracer fault handling (#23667)

* eth/tracers: fix calltracer fault handling

* eth/tracers: fix calltracer indentation

* internal/ethapi: make header/block rlp retrieval canonical

* core/state: fix typo in comment (#23665)

* eth/filters: fix TestPendingLogsSubscription (#23619)

The test did not synchronize with per-case goroutines, and thus didn't notice
that some tests were just hanging. This change adds missing synchronization
and fixes the broken tests.

* eth/protocols/eth: replace array with counter in txn broadcaster (#23656)

* eth/api: add rpc method to obtain which states are accessible (#23646)

This PR adds a method to the debug namespace, to iterate over the blocks and check where we have the roots on disk.

* go.mod: upgrade github.com/karalable/usb (#23684)

This update includes fixes for the *BSD build and go module vendoring.

* cmd, core, eth, miner: deprecate miner.gastarget flag (#23213)

* params: update CHTs for the 1.10.7 release

* eth: drop eth/65, the last non-reqid protocol version

* tests: update, enable legacy tests, remove vm tests (#23350)

* tests: update, enable legacy tests, remove vm tests

* tests: minor fixes

* cmd, core: remove calaveras testnet (#23366)

Removes references to the short-lived Calaveras testnet

* cmd/utils: add --nousb to the list of deprecated flags (#23388)

Adds --nousb as a deprecated flag when someone runs the geth show-deprecated-flags command.

* Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426)

* core: only check sendernoeoa in non fake mode (#23424)

* eth/gasprice: feeHistory improvements (#23422)

* eth/gasprice: cache feeHistory results

* eth/gasprice: changed feeHistory block count limitation

* eth/gasprice: do not use embedded struct in blockFees

* eth/gasprice: fee processing logic cleanup

* eth/gasprice: purge feeHistory cache at chain reorgs

* Revert "Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426)" (#23456)

This reverts commit c368f728c19e7fd7a9613513edda68ffcb503af0.

* node: remove dependency on wallet backend packages (#23019)

* accounts: new AddBackends method in manager

* node,cmd/geth: mv accman backend init to cmd/geth

* node,cmd/geth: mv scrypt config downstreawm from node

* accounts: use static buffer size for accman sub chan

minor fix

* accounts,cmd/geth: update accman backends through its event loop

* accounts,node: add comments

* accounts: un-export newBackendEvent

* accounts: use chan instead of wg in newBlockEvent

* node: rename isKeyDirEphem

* accounts,cmd: AddBackends->AddBackend

* accounts: fix potential blocking when adding backend

* Revert "eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)" (#23466)

This reverts commit 57feabea663496109e59df669238398239438fb1.

* core: fix race conditions in txpool (#23474)

* core: fix race conditions in txpool

* core: fixed races in the txpool

* core: rebased on master

* core: move reheap mutex

* core: renamed mutex

* core: revert Reheap changes

* cmd/geth, cmd/utils: remove legacy rpc flags (#23358)

* remove rpc flags

* remove legacy rpc flags

* remove legacy rpc flags

* remove legacy rpc commands

* (hopefully) fix most of the build errors

* fix build errors

https://app.travis-ci.com/github/ethereum/go-ethereum/jobs/530318686

* cmd/utils: fix syntax error

* empty commit to unbreak travis ci

* fix syntax error

* syntax fixes

* syntax fixes

* fix

fixes "cmd/geth/usage.go:234:7: expected '(', found init (typecheck)"

* fix

* various fixes in usage.go

* various fixes in flags.go

* adds extra space

reverts the spacing to how it was before I resolved the merge conflict

* more fixes in usage.go

* fix

fix for cmd/geth/usage.go:243:17: expected operand, found ':=' (typecheck) in travis

* Update cmd/utils/flags.go

Co-authored-by: Martin Holst Swende <[email protected]>

* fix error

 fixes these errors:
cmd/utils/flags_legacy.go:21:2: "strings" imported but not used (typecheck)

	"strings"

	^

cmd/utils/flags_legacy.go:24:2: "github.com/ethereum/go-ethereum/node" imported but not used (typecheck)

	"github.com/ethereum/go-ethereum/node"

	^

* goimports

Co-authored-by: Martin Holst Swende <[email protected]>

* core: make txPricedList.stales the first field for 64bit alignment (#23542)

This fixes crashes on 32bit builds.

* consensus/clique: prevent 0 len extradata from panicing (#23538)

Closes #23522

Co-authored-by: Martin Holst Swende <[email protected]>

* eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)

Makes the RPC block return the POA sealer for clique blocks on the 'miner' field (was previously zeroes)

* eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)

Makes the RPC block return the POA sealer for clique blocks on the 'miner' field (was previously zeroes)

* core: only check sendernoeoa in non fake mode (#23424)

* les: fix data races in tests (#23457)

* Revert "eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)" (#23466)

This reverts commit 57feabea663496109e59df669238398239438fb1.

* les: duplicate downloader and fetcher to allow progressive refactoring

* core/state: move state account to core/types + abstracted "write account to trie" (#23567)

* core/state: abstracted "write account to trie" method

* fix appveyor build

* Apply suggestions from code review

Co-authored-by: Martin Holst Swende <[email protected]>

* review feedback

* core/state/accounts: move Account to core/types

* core/types: rename Account -> StateAccount

* core/state: restore EncodeRLP for stateObject

* core/types: add the missing file

* more review feedback

* more review feedback

Co-authored-by: Martin Holst Swende <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* internal/ethapi: support retrieving header RLPs too

* internal/ethapi: support retrieving header RLPs too

* internal/ethapi: make header/block rlp retrieval canonical

* core/types: copy tx recipient address (#23376)

This resolves a long-standing TODO. The point of copying the address is
to ensure that all data referenced by types.Transaction is independent of the
data passed into the constructor.

Co-authored-by: Felix Lange <[email protected]>

* Updated eth_upstream

Co-authored-by: Felföldi Zsolt <[email protected]>
Co-authored-by: Péter Szilágyi <[email protected]>
Co-authored-by: Zachinquarantine <[email protected]>
Co-authored-by: Ziyuan Zhong <[email protected]>
Co-authored-by: Tyler Chambers <[email protected]>
Co-authored-by: Tyler Chambers <[email protected]>
Co-authored-by: Felix Lange <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: Martin Holst Swende <[email protected]>
Co-authored-by: jwasinger <[email protected]>
Co-authored-by: chuwt <[email protected]>
Co-authored-by: ucwong <[email protected]>
Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: Pedro Gomes <[email protected]>
Co-authored-by: ligi <[email protected]>
Co-authored-by: Guillaume Ballet <[email protected]>
Co-authored-by: Sina Mahmoodi <[email protected]>
Co-authored-by: baptiste-b-pegasys <[email protected]>
Co-authored-by: Ivan Bogatyy <[email protected]>
Co-authored-by: gary rong <[email protected]>
Co-authored-by: Dmitry Zenovich <[email protected]>
Co-authored-by: Paweł Bylica <[email protected]>
Co-authored-by: Fredrik Svantes <[email protected]>
Co-authored-by: Ikko Ashimine <[email protected]>
Co-authored-by: Alexander Yastrebov <[email protected]>
Co-authored-by: aaronbuchwald <[email protected]>
Co-authored-by: Jonathan Verhees <[email protected]>
Co-authored-by: Pete <[email protected]>
Co-authored-by: Thad Guidry <[email protected]>
Co-authored-by: Jordan Krage <[email protected]>
Co-authored-by: Zachinquarantine <[email protected]>
Co-authored-by: Yihau Chen <[email protected]>
Co-authored-by: Ferran Borreguero <[email protected]>
Co-authored-by: hsyodyssey <[email protected]>
Co-authored-by: Miro <[email protected]>
Co-authored-by: 陈佳 <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 333 changed files with 17,060 additions and 3,039 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "tests"]
path = tests/testdata
url = https://github.com/ethereum/tests
shallow = true
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file configures github.com/golangci/golangci-lint.

run:
timeout: 3m
timeout: 5m
tests: true
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
Expand Down
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
allow_failures:
- stage: build
os: osx
go: 1.15.x
go: 1.17.x
env:
- azure-osx
- azure-ios
Expand All @@ -16,7 +16,7 @@ jobs:
- stage: lint
os: linux
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- lint
git:
Expand All @@ -31,7 +31,7 @@ jobs:
os: linux
arch: amd64
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- docker
services:
Expand All @@ -41,14 +41,14 @@ jobs:
before_install:
- export DOCKER_CLI_EXPERIMENTAL=enabled
script:
- go run build/ci.go docker -image -manifest amd64,arm64 -upload karalabe/geth-docker-test
- go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go

- stage: build
if: type = push
os: linux
arch: arm64
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- docker
services:
Expand All @@ -58,14 +58,14 @@ jobs:
before_install:
- export DOCKER_CLI_EXPERIMENTAL=enabled
script:
- go run build/ci.go docker -image -manifest amd64,arm64 -upload karalabe/geth-docker-test
- go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go

# This builder does the Ubuntu PPA upload
- stage: build
if: type = push
os: linux
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- ubuntu-ppa
- GO111MODULE=on
Expand All @@ -90,7 +90,7 @@ jobs:
os: linux
dist: bionic
sudo: required
go: 1.16.x
go: 1.17.x
env:
- azure-linux
- GO111MODULE=on
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
dist: bionic
services:
- docker
go: 1.16.x
go: 1.17.x
env:
- azure-linux-mips
- GO111MODULE=on
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
- stage: build
if: type = push
os: osx
go: 1.16.x
go: 1.17.x
env:
- azure-osx
- azure-ios
Expand Down Expand Up @@ -224,7 +224,7 @@ jobs:
os: linux
arch: amd64
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- GO111MODULE=on
script:
Expand All @@ -235,7 +235,7 @@ jobs:
os: linux
arch: arm64
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- GO111MODULE=on
script:
Expand All @@ -244,7 +244,7 @@ jobs:
- stage: build
os: linux
dist: bionic
go: 1.15.x
go: 1.16.x
env:
- GO111MODULE=on
script:
Expand All @@ -255,7 +255,7 @@ jobs:
if: type = cron
os: linux
dist: bionic
go: 1.16.x
go: 1.17.x
env:
- azure-purge
- GO111MODULE=on
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.16-alpine as builder
FROM golang:1.17-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.16-alpine as builder
FROM golang:1.17-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ aware of and agree upon. This consists of a small JSON file (e.g. call it `genes
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"berlinBlock": 0
"berlinBlock": 0,
"londonBlock": 0
},
"alloc": {},
"coinbase": "0x0000000000000000000000000000000000000000",
Expand Down
2 changes: 2 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Audit reports are published in the `docs` folder: https://github.com/ethereum/go
| ------- | ------- | ----------- |
| `geth` | 20170425 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2017-04-25_Geth-audit_Truesec.pdf) |
| `clef` | 20180914 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2018-09-14_Clef-audit_NCC.pdf) |
| `Discv5` | 20191015 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2019-10-15_Discv5_audit_LeastAuthority.pdf) |
| `Discv5` | 20200124 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2020-01-24_DiscV5_audit_Cure53.pdf) |

## Reporting a Vulnerability

Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/argument.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (arguments Arguments) copyAtomic(v interface{}, marshalledValues interface{
dst := reflect.ValueOf(v).Elem()
src := reflect.ValueOf(marshalledValues)

if dst.Kind() == reflect.Struct && src.Kind() != reflect.Struct {
if dst.Kind() == reflect.Struct {
return set(dst.Field(0), src)
}
return set(dst, src)
Expand Down
19 changes: 15 additions & 4 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,19 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
} else {
hi = b.pendingBlock.GasLimit()
}
// Normalize the max fee per gas the call is willing to spend.
var feeCap *big.Int
if call.GasPrice != nil && (call.GasFeeCap != nil || call.GasTipCap != nil) {
return 0, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
} else if call.GasPrice != nil {
feeCap = call.GasPrice
} else if call.GasFeeCap != nil {
feeCap = call.GasFeeCap
} else {
feeCap = common.Big0
}
// Recap the highest gas allowance with account's balance.
if call.GasPrice != nil && call.GasPrice.BitLen() != 0 {
if feeCap.BitLen() != 0 {
balance := b.pendingState.GetBalance(call.From) // from can't be nil
available := new(big.Int).Set(balance)
if call.Value != nil {
Expand All @@ -498,14 +509,14 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
}
available.Sub(available, call.Value)
}
allowance := new(big.Int).Div(available, call.GasPrice)
allowance := new(big.Int).Div(available, feeCap)
if allowance.IsUint64() && hi > allowance.Uint64() {
transfer := call.Value
if transfer == nil {
transfer = new(big.Int)
}
log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance,
"sent", transfer, "gasprice", call.GasPrice, "fundable", allowance)
"sent", transfer, "feecap", feeCap, "fundable", allowance)
hi = allowance.Uint64()
}
}
Expand Down Expand Up @@ -784,7 +795,7 @@ type callMsg struct {

func (m callMsg) From() common.Address { return m.CallMsg.From }
func (m callMsg) Nonce() uint64 { return 0 }
func (m callMsg) CheckNonce() bool { return false }
func (m callMsg) IsFake() bool { return true }
func (m callMsg) To() *common.Address { return m.CallMsg.To }
func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice }
func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap }
Expand Down
23 changes: 23 additions & 0 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,26 @@ func TestEstimateGasWithPrice(t *testing.T) {
Value: big.NewInt(100000000000),
Data: nil,
}, 21000, errors.New("gas required exceeds allowance (10999)")}, // 10999=(2.2ether-1000wei)/(2e14)

{"EstimateEIP1559WithHighFees", ethereum.CallMsg{
From: addr,
To: &addr,
Gas: 0,
GasFeeCap: big.NewInt(1e14), // maxgascost = 2.1ether
GasTipCap: big.NewInt(1),
Value: big.NewInt(1e17), // the remaining balance for fee is 2.1ether
Data: nil,
}, params.TxGas, nil},

{"EstimateEIP1559WithSuperHighFees", ethereum.CallMsg{
From: addr,
To: &addr,
Gas: 0,
GasFeeCap: big.NewInt(1e14), // maxgascost = 2.1ether
GasTipCap: big.NewInt(1),
Value: big.NewInt(1e17 + 1), // the remaining balance for fee is 2.1ether
Data: nil,
}, params.TxGas, errors.New("gas required exceeds allowance (20999)")}, // 20999=(2.2ether-0.1ether-1wei)/(1e14)
}
for i, c := range cases {
got, err := sim.EstimateGas(context.Background(), c.message)
Expand All @@ -592,6 +612,9 @@ func TestEstimateGasWithPrice(t *testing.T) {
}
continue
}
if c.expectError == nil && err != nil {
t.Fatalf("test %d: didn't expect error, got %v", i, err)
}
if got != c.expect {
t.Fatalf("test %d: gas estimation mismatch, want %d, got %d", i, c.expect, got)
}
Expand Down
6 changes: 6 additions & 0 deletions accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]inter

// UnpackLog unpacks a retrieved log into the provided output structure.
func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log) error {
if log.Topics[0] != c.abi.Events[event].ID {
return fmt.Errorf("event signature mismatch")
}
if len(log.Data) > 0 {
if err := c.abi.UnpackIntoInterface(out, event, log.Data); err != nil {
return err
Expand All @@ -447,6 +450,9 @@ func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log)

// UnpackLogIntoMap unpacks a retrieved log into the provided map.
func (c *BoundContract) UnpackLogIntoMap(out map[string]interface{}, event string, log types.Log) error {
if log.Topics[0] != c.abi.Events[event].ID {
return fmt.Errorf("event signature mismatch")
}
if len(log.Data) > 0 {
if err := c.abi.UnpackIntoMap(out, event, log.Data); err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions accounts/abi/bind/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const hexData = "0x000000000000000000000000376c47978271565f56deb45495afa69e59c16
func TestUnpackIndexedStringTyLogIntoMap(t *testing.T) {
hash := crypto.Keccak256Hash([]byte("testName"))
topics := []common.Hash{
common.HexToHash("0x0"),
crypto.Keccak256Hash([]byte("received(string,address,uint256,bytes)")),
hash,
}
mockLog := newMockLog(topics, common.HexToHash("0x0"))
Expand All @@ -135,7 +135,7 @@ func TestUnpackIndexedSliceTyLogIntoMap(t *testing.T) {
}
hash := crypto.Keccak256Hash(sliceBytes)
topics := []common.Hash{
common.HexToHash("0x0"),
crypto.Keccak256Hash([]byte("received(string[],address,uint256,bytes)")),
hash,
}
mockLog := newMockLog(topics, common.HexToHash("0x0"))
Expand All @@ -160,7 +160,7 @@ func TestUnpackIndexedArrayTyLogIntoMap(t *testing.T) {
}
hash := crypto.Keccak256Hash(arrBytes)
topics := []common.Hash{
common.HexToHash("0x0"),
crypto.Keccak256Hash([]byte("received(address[2],address,uint256,bytes)")),
hash,
}
mockLog := newMockLog(topics, common.HexToHash("0x0"))
Expand All @@ -187,7 +187,7 @@ func TestUnpackIndexedFuncTyLogIntoMap(t *testing.T) {
var functionTy [24]byte
copy(functionTy[:], functionTyBytes[0:24])
topics := []common.Hash{
common.HexToHash("0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8"),
crypto.Keccak256Hash([]byte("received(function,address,uint256,bytes)")),
common.BytesToHash(functionTyBytes),
}
mockLog := newMockLog(topics, common.HexToHash("0x5c698f13940a2153440c6d19660878bc90219d9298fdcf37365aa8d88d40fc42"))
Expand All @@ -208,7 +208,7 @@ func TestUnpackIndexedBytesTyLogIntoMap(t *testing.T) {
bytes := []byte{1, 2, 3, 4, 5}
hash := crypto.Keccak256Hash(bytes)
topics := []common.Hash{
common.HexToHash("0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8"),
crypto.Keccak256Hash([]byte("received(bytes,address,uint256,bytes)")),
hash,
}
mockLog := newMockLog(topics, common.HexToHash("0x5c698f13940a2153440c6d19660878bc90219d9298fdcf37365aa8d88d40fc42"))
Expand Down
Loading

0 comments on commit c345709

Please sign in to comment.