Commit Graph

14739 Commits

Author SHA1 Message Date
Felix Lange
8c2d455ccd
build: upgrade to golangci-lint v1.55.2 (#28712)
This is primarily to make lint work again on macOS 14. The older version of golangci-lint kept crashing. 

Also included is a fix for a goroutine leak in the recently-introduced function MustRunCommandWithOutput.
2023-12-20 15:36:10 +01:00
Martin HS
d3452a22cc
accounts: properly close managed wallets when closing manager (#28710) 2023-12-20 13:41:40 +01:00
Felix Lange
7124057bad
internal/build: fix crash in MustRunCommandWithOutput (#28709) 2023-12-20 07:56:41 +01:00
Felix Lange
9258a44b8f params: begin go-ethereum v1.13.8 release cycle 2023-12-19 13:32:25 +01:00
Felix Lange
3fd568855f params: go-ethereum v1.13.7 stable 2023-12-19 13:25:03 +01:00
dependabot[bot]
0cc192bd3a
build(deps): bump golang.org/x/crypto from 0.15.0 to 0.17.0 (#28702)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.15.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-19 10:50:02 +01:00
Martin HS
435bed5da0
ci: disable lint on travis (#28706) 2023-12-19 10:35:02 +01:00
Martin HS
5a9dda64ce
.travis: set lower GOGC value (#28705)
As documented on https://golangci-lint.run/usage/performance/ , a lower
GOGC value causes less peak mem consumption when running the linter.

Exceeding 3Gb is a common cause for build failures, according to
https://docs.travis-ci.com/user/common-build-problems/#my-build-script-is-killed-without-any-error
2023-12-19 09:24:23 +01:00
Martin HS
952b343cb3
build: make linter emit output (#28704) 2023-12-19 08:55:04 +01:00
wangyifan
cd58897f18
core/rawdb: implement size reporting for live items in freezer_table (#28525)
This is the fix to issue #27483. A new hiddenBytes() is introduced to calculate the byte size of hidden items in the freezer table. When reporting the size of the freezer table, size of the hidden items will be subtracted from the total size.

---------

Co-authored-by: Yifan <Yifan Wang>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2023-12-18 20:10:54 +01:00
Delweng
54a400ee71
internal/ethapi: ethSendTransaction check baseFee (#27834)
If the EIP-1559 is activated, reject 0-priced transactions in the rpc level
2023-12-18 20:09:41 +01:00
Felix Lange
4410c1416a params: begin v1.13.7 release cycle 2023-12-18 19:10:11 +01:00
Felix Lange
a18b845ecd params: release go-ethereum v1.13.6 stable 2023-12-18 18:53:47 +01:00
Delweng
c18c5c3d92
cmd/evm: t8n support custom tracers (#28557)
This change implements ability for the `evm t8n` tool to use custom tracers; either 'native' golang tracers or javascript tracers.
2023-12-18 15:16:25 +01:00
Martin HS
553bafc127
cmd/evm, cmd/clef, cmd/bootnode: fix / unify logging (#28696)
This change fixes a problem with our non-core binaries: evm, clef, bootnode.

First of all, they failed to convert from legacy loglevels 1 to 5, to the new slog loglevels -4 to 4.

Secondly, the logging was actually setup in the init phase, and then overridden in the main. This is not needed for evm, since it used the same flag name as the main geth verbosity. Better to let the flags/internal handle the logging init.
2023-12-18 14:11:27 +01:00
jwasinger
05bbc56677
cmd/evm: default to mirror mainnet forks enabled (#28691)
cmd/evm:  default to using dev chain config (all mainnet HFs activated at block/timestamp 0
2023-12-18 13:56:27 +01:00
Sebastian Stammler
02766d349a
internal/flags: add missing flag types for auto-env-var generation (#28692)
Certain flags, such as `--rpc.txfeecap` currently do not have an env-var auto-generated for them. This change adds three missing cli flag types to the auto env-var helper function to fix this.
2023-12-18 13:28:41 +01:00
Felix Lange
5b22a472d6
p2p/discover: add liveness check in collectTableNodes (#28686)
* p2p/discover: add liveness check in collectTableNodes

* p2p/discover: fix test

* p2p/discover: rename to appendLiveNodes

* p2p/discover: add dedup logic back

* p2p/discover: simplify

* p2p/discover: fix issue found by test
2023-12-18 10:47:21 +01:00
alex
edc864f9ba
all: fix typos in comments (#28682)
chore(core,eth):fix a couple of typos
2023-12-18 09:35:12 +01:00
FletcherMan
f1794ba278
miner: eliminate the dead loop possibility for newWorkLoop and mainLoop (#28677)
discard the intervalAdjust message if the channel is full
2023-12-15 11:48:55 +08:00
Elias Rad
0f74aad641
all: fix typos in comments (#28662)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-12-13 23:33:46 +01:00
Ursulafe
b2ced97ac4
eth/fetcher, eth/gasestimator: fix typos in comments (#28675) 2023-12-13 23:32:17 +01:00
ucwong
81fd1b3cf9
core/txpool : small cleanup refactors (#28654) 2023-12-12 17:23:36 +02:00
Ford
17c2b3c194
eth/protocols/eth: fix typos in comments (#28652) 2023-12-12 14:47:59 +01:00
Ng Wei Han
a3ca1b2818
cmd/utils: fix HTTPHost, WSHost flag priority (#28669)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-12-12 14:40:50 +01:00
rjl493456442
e206d3f897
trie: remove inconsistent trie nodes during sync in path mode (#28595)
This fixes a database corruption issue that could occur during state healing.
When sync is aborted while certain modifications were already committed, and a
reorg occurs, the database would contain incorrect trie nodes stored by path.
These nodes need to detected/deleted in order to obtain a complete and fully correct state
after state healing.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-12-08 14:28:23 +01:00
Péter Szilágyi
d98d70f670
cmd/utils, eth: disallow invalid snap sync / snapshot flag combos (#28657)
* eth: prevent startup in snap mode without snapshots

* cmd/utils: try to fix bad flag combos wrt snap sync and snapshot generation
2023-12-08 15:16:04 +02:00
Felföldi Zsolt
fff843cfaf
beacon/light: add CommitteeChain (#27766)
This change implements CommitteeChain which is a key component of the beacon light client. It is a passive data structure that can validate, hold and update a chain of beacon light sync committees and updates, starting from a checkpoint that proves the starting committee through a beacon block hash, header and corresponding state. Once synced to the current sync period, CommitteeChain can also validate signed beacon headers.
2023-12-08 13:38:00 +01:00
Martin HS
1048e2d6a3
cmd/evm: fix dump after state-test exec (#28650)
The dump after state-test didn't work, the problem was an error, "Already committed", which was silently ignored. 

This change re-initialises the state, so the dumping works again.
2023-12-08 11:06:01 +01:00
Martin HS
5a45e7a631
rpc: fix ns/µs mismatch in metrics (#28649)
The rpc/duration/all meter was in nanoseconds, the individual meter in microseconds.
This PR changes it so both of them use nanoseconds.
2023-12-08 09:40:50 +01:00
Marius Kjærstad
77c4bbcaa5
build: upgrade -dlgo version to Go 1.21.5 (#28648) 2023-12-07 12:45:09 +02:00
Guillaume Ballet
a113497dd7
tests/fuzzers/bls12381: deactivate BLS fuzzer when CGO_ENABLED=0 (#28653)
tests/fuzzers/bls12381: deactivate fuzzer when CGO_ENABLED=0
2023-12-07 10:07:20 +01:00
Marius van der Wijden
55b483d82a
ethdb/pebble: remove a dependency (#28627)
The dependency was not really used anyway, so we can get rid of it.

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-12-06 11:41:04 +01:00
Guillaume Ballet
69576df254
.github: use github actions to run 32-bit linux tests (#28549)
use github actions to run 32-bit linux tests
2023-12-05 14:45:40 +01:00
Martin Holst Swende
b8d44ed98b
log: remove lazy, remove unused interfaces, unexport methods (#28622)
This change 

- Removes interface `log.Format`, 
- Removes method `log.FormatFunc`, 
- unexports `TerminalHandler.TerminalFormat` formatting methods (renamed to `TerminalHandler.format`)
- removes the notion of `log.Lazy` values


The lazy handler was useful in the old log package, since it
could defer the evaluation of costly attributes until later in the
log pipeline: thus, if the logging was done at 'Trace', we could
skip evaluation if logging only was set to 'Info'.

With the move to slog, this way of deferring evaluation is no longer
needed, since slog introduced 'Enabled': the caller can thus do
the evaluate-or-not decision at the callsite, which is much more
straight-forward than dealing with lazy reflect-based evaluation.

Also, lazy evaluation would not work with 'native' slog, as in, these
two statements would be evaluated differently:

```golang
  log.Info("foo", "my lazy", lazyObj)
  slog.Info("foo", "my lazy", lazyObj)
```
2023-12-05 11:54:44 +01:00
Martin Holst Swende
3dc071e036
eth/tracers/logger: make structlog/json-log stack hex again (#28628)
* common/hexutil: define hex wrappers for uint256.Int

* eth/tracers/logger: make structlog/json-log stack hex again

* common/hexutil: goimports
2023-12-05 09:37:48 +01:00
Håvard Anda Estensen
2e13b01046
accounts: run tests in parallel (#28544) 2023-12-04 14:55:06 +01:00
Manav Darji
70fd0b635e
eth/fetcher: fix invalid tracking of received at time for block (#28637)
eth/fetcher: fix invalid tracking of received at time
2023-12-04 14:25:17 +02:00
BorkBorked
f04e5bde74
accounts/abi/bind: fixed typos (#28634)
* Update auth.go

* Update backend.go

* Update bind.go

* Update bind_test.go
2023-12-04 11:53:42 +02:00
ddl
6e488c2449
cmd/evm: fix Env struct json tag (#28635) 2023-12-04 11:52:55 +02:00
Delweng
5fb8ebc9ec
eth/tracers: tx-level state in debug_traceCall (#28460) 2023-12-01 16:38:52 +03:30
Martin Holst Swende
dd0d0a2522
slog: faster and less memory-consumption (#28621)
These changes improves the performance of the non-coloured terminal formatting, _quite a lot_. 

```
name               old time/op    new time/op    delta
TerminalHandler-8    10.2µs ±15%     5.4µs ± 9%  -47.02%  (p=0.008 n=5+5)

name               old alloc/op   new alloc/op   delta
TerminalHandler-8    2.17kB ± 0%    0.40kB ± 0%  -81.46%  (p=0.008 n=5+5)

name               old allocs/op  new allocs/op  delta
TerminalHandler-8      33.0 ± 0%       5.0 ± 0%  -84.85%  (p=0.008 n=5+5)
```

I tried to _somewhat_ organize the commits, but the it might still be a bit chaotic. Some core insights: 

- The function `terminalHandler.Handl` uses a mutex, and writes all output immediately to 'upstream'. Thus, it can reuse a scratch-buffer every time. 
- This buffer can be propagated internally, making all the internal formatters either write directly to it,
- OR, make  use of the `tmp := buf.AvailableBuffer()` in some cases, where a byte buffer "extra capacity" can be temporarily used. 
- The `slog` package  uses `Attr` by value. It makes sense to minimize operating on them, since iterating / collecting into a new slice, iterating again etc causes copy-on-heap. Better to operate on them only once. 
- If we want to do padding, it's better to copy from a constant `space`-buffer than to invoke `bytes.Repeat` every single time.
2023-12-01 13:28:20 +01:00
BorkBorked
f2b509d8a1
accounts/abi/bind: fix typo (#28630) 2023-12-01 09:51:50 +01:00
Maciej Kulawik
fa0df76f3c
trie/triedb/hashdb: take lock around access to dirties cache (#28542)
Add read locking of db lock around access to dirties cache in hashdb.Database to prevent
data race versus hashdb.Database.dereference which can modify the dirities map by deleting
an item.

Fixes #28541

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2023-11-30 10:50:48 +01:00
rjl493456442
ab0eb46a84
core/state: make stateobject.create selfcontain (#28459) 2023-11-29 16:07:51 +08:00
jwasinger
28e7371701
all: replace log15 with slog (#28187)
This PR replaces Geth's logger package (a fork of [log15](https://github.com/inconshreveable/log15)) with an implementation using slog, a logging library included as part of the Go standard library as of Go1.21.

Main changes are as follows:
* removes any log handlers that were unused in the Geth codebase.
* Json, logfmt, and terminal formatters are now slog handlers.
* Verbosity level constants are changed to match slog constant values.  Internal translation is done to make this opaque to the user and backwards compatible with existing `--verbosity` and `--vmodule` options.
* `--log.backtraceat` and `--log.debug` are removed.

The external-facing API is largely the same as the existing Geth logger.  Logger method signatures remain unchanged.

A small semantic difference is that a `Handler` can only be set once per `Logger` and not changed dynamically.  This just means that a new logger must be instantiated every time the handler of the root logger is changed.

----
For users of the `go-ethereum/log` module. If you were using this module for your own project, you will need to change the initialization. If you previously did 
```golang
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
```
You now instead need to do 
```golang
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
```
See more about reasoning here: https://github.com/ethereum/go-ethereum/issues/28558#issuecomment-1820606613
2023-11-29 08:33:50 +01:00
Péter Szilágyi
61b844f2b2
eth/gasestimator: allow slight estimation error in favor of less iterations (#28618)
* eth/gasestimator: early exit for plain transfer and error allowance

* core, eth/gasestimator: hard guess at a possible required gas

* internal/ethapi: update estimation tests with the error ratio

* eth/gasestimator: I hate you linter

* graphql: fix gas estimation test

---------

Co-authored-by: Oren <orenyomtov@users.noreply.github.com>
2023-11-28 22:31:47 +02:00
Jakub Freebit
e0c7ad01ab
consensus: verify the nonexistence of shanghai- and cancun-specific header fields (#28605) 2023-11-28 21:29:00 +01:00
Guillaume Ballet
34dcd74935
crypto/secp256k1: fix 32-bit tests when CGO_ENABLED=0 (#28602) 2023-11-28 19:16:50 +01:00
Sina Mahmoodi
bbc5db8405
eth/tracers/js: fix type inconsistencies (#28488)
This change fixes two type-inconsistencies in the JS tracer:

- In most places we return byte arrays as a `Uint8Array` to the tracer. However it seems we missed doing the conversion for `ctx` fields which are passed to the tracer during `result`. They are passed as simple arrays. I think Uint8Arrays are more suitable and we should change this inconsistency. Note: this will be a breaking-change. But I believe the effect is small. If we look at our tracers we see that these fields (`ctx.from`, `ctx.to`, etc.) are used in 2 ways. Passed to `toHex` which takes both array or buffer. Or the length was measured which is the same for both types.
- The `slice` taking in `int, int` params versus `memory.slice` taking `int64, int64` params. I suggest changing `slice` types to `int64`. This should have no effect almost in any case.
2023-11-28 15:00:35 +01:00