Commit graph

429 commits

Author SHA1 Message Date
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
Daniel Liu
26fe46c008 eth/gasprice: implement feeHistory API (#23033) 2024-11-01 11:36:52 +08:00
Daniel Liu
b02922fc53 core, internal: expose effectiveGasPrice in receipts (#23050) 2024-11-01 11:36:52 +08:00
Daniel Liu
18bc355e89 core, internal: support various eth_call invocations post 1559 (#23027) 2024-11-01 11:36:52 +08:00
Daniel Liu
ef1dbd0772 internal/ethapi: support for eip-1559 txs in clef (#22966) 2024-11-01 11:36:52 +08:00
Daniel Liu
4c096de9b0 all: rename internal 1559 gas fields (#23010) 2024-11-01 11:36:52 +08:00
Daniel Liu
bfd1c0c9e0 core, eth, internal, les: RPC methods and fields for EIP 1559 (#22964) 2024-11-01 11:36:52 +08:00
Daniel Liu
e18553b855 all: implement eip-1559 (#22837) 2024-11-01 11:36:52 +08:00
liam.icheng.lai
59a7eb1f9f resolve conflict from master 2024-10-30 16:47:26 -07:00
wgr523
71b9005f34
feat: add api xdpos_getBlockInfoByEpochNum (#674)
* feat: add api xdpos_getBlockInfoByEpochNum

* feat: add cache round2epochBlockInfo

* fix: round2epochBlockInfo contains round now

* feat: binary search in GetBlockByEpochNumber

* fix: change some code back, refine style
2024-10-28 00:14:30 -07:00
Daniel Liu
dd6822bc3c internal/ethapi, contracts/trc21issuer: fix staticcheck warning SA1012: pass nil Context 2024-10-25 18:29:08 +08:00
Daniel Liu
a79411fa06 all: fix staticcheck warning ST1005: incorrectly formatted error string 2024-10-24 09:48:20 +08:00