Commit graph

455 commits

Author SHA1 Message Date
JukLee0ira
653b59710e core/rawdb: separate raw database access to own package (#16666 #19345) 2025-01-22 15:19:39 +08:00
Daniel Liu
588f61661c build: add imports for go generate tools (#24682) 2025-01-20 11:52:59 +08:00
Daniel Liu
00797dda0c build: add 'go mod tidy' checker 2025-01-15 10:10:38 +08:00
Daniel Liu
baea5d3da7 build: support golangci-lint v1.63.4 2025-01-11 23:56:59 +08:00
Daniel Liu
2baadc6e87 core: improve shutdown synchronization in BlockChain (#22853) 2024-12-28 10:44:49 +08:00
Daniel Liu
6e33633d28 common: drop BigMin and BigMax, they pollute our dep graph (#30645) 2024-12-28 09:06:31 +08:00
Daniel Liu
6ec35b9644 all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-12-28 09:06:31 +08:00
Daniel Liu
59b14ed2cb internal/ethapi: make NewAccount return EIP-55 format (#26973) 2024-12-28 09:06:31 +08:00
Daniel Liu
d6d6906881 internal: add db operations to api (#24739) 2024-12-28 09:06:30 +08:00
Daniel Liu
7cd3e56d18 accounts/abi/bind: stop using goimports in the binding generator (#17768 #20311) 2024-12-28 09:06:30 +08:00
JukLee0ira
517f4a16a6 internal/ethapi: fix Call handle revert error 2024-12-28 09:02:48 +08:00
JukLee0ira
48d1f22fde all: simplify function TransitionDb (#20830) 2024-12-28 09:02:48 +08:00
JukLee0ira
7491a7ba74 all: improve EstimateGas API (#20830) 2024-12-21 14:35:44 +08:00
Daniel Liu
3dee6675d2 metrics/exp: allow configuring metrics HTTP server on separate endpoint (#21290) 2024-12-13 14:00:12 +08:00
Daniel Liu
23bc924585 internal/debug: start pprof server by new function StartPProf (#16532) 2024-12-13 14:00:11 +08:00
Daniel Liu
ad5e7d6db3 crypto: add SignatureLength constant and use it everywhere (#19996) 2024-12-09 17:48:59 +08:00
Daniel Liu
02a59e8d84 all: replace strings.Replace with string.ReplaceAll (#24835) 2024-12-08 11:51:14 +08:00
Daniel Liu
ae56946690 internal/flags: remove low-use type TextMarshalerFlag (#30707) 2024-11-25 16:39:29 +08:00
Daniel Liu
a6192a5980 internal/flags: fix --miner.gasprice default listing (#28932) 2024-11-25 16:39:29 +08:00
Daniel Liu
ac611170d1 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.
2024-11-25 16:39:29 +08:00
Daniel Liu
4e192a5172 cmd/XDC, internal/flags: print envvar config source and bad names (#28119) 2024-11-25 16:39:29 +08:00
Daniel Liu
87ddf502ce internal/flags: fix loading env vars for custom flags (#28117) 2024-11-25 16:39:29 +08:00
Daniel Liu
197551c729 cmd/geth, internal/flags, go.mod: colorize cli help, support env vars (#28103) 2024-11-25 16:39:29 +08:00
Daniel Liu
fa69900737 Use filepath.clean instead of path.clean (#26404)
* internal/flags: use filepath.Clean instead of path.Clean

* internal/flags: fix windows pipe issue

* internal/flags: modify test for windows

* internal/flags: use backticks, fix test
2024-11-25 16:39:29 +08:00
Daniel Liu
9b8a82b91f internal/flags: fix issue with stringslice migration (#25830)
This fixes a cornercase bug where the flag migration would mess
up the value of StringSlice flags.
2024-11-25 16:39:29 +08:00
Daniel Liu
3e1ea87ca2 cmd/XDC: fix some cli parsing issues (#25234) 2024-11-25 16:39:29 +08:00
Daniel Liu
369d69649f all: normalize flag's name 2024-11-25 16:39:29 +08:00
Daniel Liu
b883b0b593 internal/flags: fix flag redefined bug for cli v2 aliases (#30796) 2024-11-25 16:39:29 +08:00
Daniel Liu
dcab7e8efb cmd: migrate to urfave/cli/v2 (#24751) 2024-11-25 16:39:29 +08:00
Daniel Liu
bd916d100a cmd/evm, internal/debug: use global functions when cli v1 2024-11-21 17:40:51 +08:00
Daniel Liu
9e034475c8 log: default JSON log handler should log all verbosity levels (#29471)
Co-authored-by: lightclient <lightclient@protonmail.com>
2024-11-15 10:02:42 +08:00
Daniel Liu
946c085f9f log: use native log/slog instead of golang/exp (#29302) 2024-11-15 10:02:42 +08:00
Daniel Liu
20a62e4743 log: add Handler getter to Logger interface (#28793)
log: Add Handler getter to Logger interface
2024-11-15 10:02:42 +08:00
Daniel Liu
14acdf2dd1 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)
```
2024-11-15 10:02:42 +08:00
Daniel Liu
9ae7402e35 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.
2024-11-15 10:02:42 +08:00
Daniel Liu
ec4ca1ed6a all: replace log15 with slog (#28187) 2024-11-15 10:02:42 +08:00
Daniel Liu
f9cae3b9aa internal, log: remove code for old unsupported go-versions (#28090) 2024-11-15 10:02:42 +08:00
Daniel Liu
7865057840 internal/debug: support color terminal for cygwin/msys2 (#17740) 2024-11-15 10:02:41 +08:00
Daniel Liu
d3c023ed37 cmd/XDC, internal, node: nuke XDC monitor (#19399) 2024-11-13 09:35:41 +08:00
Daniel Liu
f9f172af76 rpc: Add admin_addTrustedPeer and admin_removeTrustedPeer. (#16333) 2024-11-13 09:33:18 +08:00
Daniel Liu
416e5ac00f eth/tracers,internal/ethapi: use correct baseFee when BlockOverrides is provided in call/traceCall (#29051) 2024-11-01 11:36:53 +08:00
Daniel Liu
bc14c672f2 internal/ethapi: support unlimited rpc gas cap in eth_createAccessList (#28846) 2024-11-01 11:36:53 +08:00
Daniel Liu
0237985f58 internal/ethapi: ethSendTransaction check baseFee (#27834) 2024-11-01 11:36:53 +08:00
Daniel Liu
f23e1a648c internal/ethapi: implement eth_getBlockReceipts (#27702) 2024-11-01 11:36:53 +08:00
Daniel Liu
419f81f022 eth/gasprice: change feehistory input type from int to uint64 (#26922) 2024-11-01 11:36:53 +08:00
Daniel Liu
b8236888d4 internal/ethapi: avoid int overflow in GetTransactionReceipt (#26911) 2024-11-01 11:36:53 +08:00
Daniel Liu
2a9d450101 core/types: add EffectiveGasPrice in Receipt (#26713) 2024-11-01 11:36:53 +08:00
Daniel Liu
9b20ac785e consensus/misc: move eip1559 into a package (#27828) 2024-11-01 11:36:53 +08:00
ucwong
e4153f756d internal/ethapi: fix comment typo (#25548) 2024-11-01 11:36:53 +08:00
Daniel Liu
49b54aaede internal/ethapi: rework setDefaults for tx args so fee logic is separate (#25197) 2024-11-01 11:36:53 +08:00