Commit graph

440 commits

Author SHA1 Message Date
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
Daniel Liu
c668279c48 internal/ethapi: don't estimate gas if no limit provided in eth_createAccessList (#25467) 2024-11-01 11:36:53 +08:00
Daniel Liu
9535b3ade5 ethclient: add FeeHistory support (#25403) 2024-11-01 11:36:53 +08:00
Daniel Liu
fa83f32e5c internal/ethapi: error if tx args includes ChainId not match local (#25157) 2024-11-01 11:36:53 +08:00
Daniel Liu
77e2ad90cf internal/ethapi: add comment explaining return of nil instead of error (#25097) 2024-11-01 11:36:53 +08:00
Daniel Liu
588847ccea internal/ethapi: use same receiver names (#24252) 2024-11-01 11:36:53 +08:00
Daniel Liu
d850fc4081 core: only check sendernoeoa in non fake mode (#23424) 2024-11-01 11:36:53 +08:00
Daniel Liu
e4895bf5c5 internal/ethapi: add back missing check for maxfee < maxPriorityFee (#23384) 2024-11-01 11:36:53 +08:00
Daniel Liu
48616d5d4b internal/ethapi/api: return maxFeePerGas for gasPrice for EIP-1559 txs (#23345) 2024-11-01 11:36:53 +08:00
Daniel Liu
655fb584b3 internal/ethapi: make ext signer sign legacy (#23274) 2024-11-01 11:36:53 +08:00
Daniel Liu
62a70f0cde internal/ethapi: fix panic in accesslist creation (#23225) 2024-11-01 11:36:52 +08:00
Daniel Liu
7500b0ac95 Use hexutil.Uint for blockCount parameter and oldestBlock result value in feeHistory method (#23239) 2024-11-01 11:36:52 +08:00
Daniel Liu
5b01b23af6 internal: get pending and queued transaction by address (#22992) 2024-11-01 11:36:52 +08:00
Daniel Liu
93dd33b607 internal/ethapi: fix transaction APIs (#23179) 2024-11-01 11:36:52 +08:00
Daniel Liu
5766ca4520 eth/gasprice, internal/ethapi: minor feehistory fixes (#23178) 2024-11-01 11:36:52 +08:00
Daniel Liu
5d4ad88364 internal/ethapi: fix panic in access list creation (#23133) 2024-11-01 11:36:52 +08:00