apply review suggestions
This commit is contained in:
parent
ba7afcbe07
commit
ae80cb4162
|
@ -52,7 +52,76 @@ go test -v -bench . -run BenchmarkJoin
|
||||||
|
|
||||||
For more information, see the [go test flags](https://golang.org/cmd/go/#hdr-Testing_flags) documentation.
|
For more information, see the [go test flags](https://golang.org/cmd/go/#hdr-Testing_flags) documentation.
|
||||||
|
|
||||||
### Stack Traces
|
### Getting Stack Traces
|
||||||
|
|
||||||
|
A stack trace provides a very detailed look into the current state of the geth node. It helps us to debug issues easier as it contains information about what is currently done by the node. Stack traces can be created by running `debug.stacks()` in the Geth console. If the node was started without the console command or with a script in the background, the following command can be used to dump the stack trace into a file.
|
||||||
|
|
||||||
|
```
|
||||||
|
geth attach <path-to-geth.ipc> --exec "debug.stacks()" > stacktrace.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Geth logs the location of the IPC endpoint on startup. It is typically under `/home/user/.ethereum/geth.ipc` or `/tmp/geth.ipc`.
|
||||||
|
|
||||||
|
`debug.stacks()` also takes an optional `filter` argument. Passing a package name or filepath to `filter` restricts the output to stack traces involcing only that package/file. For example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
debug.stacks("enode")
|
||||||
|
```
|
||||||
|
|
||||||
|
returns data that looks like:
|
||||||
|
|
||||||
|
```terminal
|
||||||
|
INFO [11-04|16:15:54.486] Expanded filter expression filter=enode expanded="`enode` in Value"
|
||||||
|
goroutine 121 [chan receive, 3 minutes]:
|
||||||
|
github.com/ethereum/go-ethereum/p2p/enode.(*FairMix).nextFromAny(...)
|
||||||
|
github.com/ethereum/go-ethereum/p2p/enode/iter.go:241
|
||||||
|
github.com/ethereum/go-ethereum/p2p/enode.(*FairMix).Next(0xc0008c6060)
|
||||||
|
github.com/ethereum/go-ethereum/p2p/enode/iter.go:215 +0x2c5
|
||||||
|
github.com/ethereum/go-ethereum/p2p.(*dialScheduler).readNodes(0xc00021c2c0, {0x18149b0, 0xc0008c6060})
|
||||||
|
github.com/ethereum/go-ethereum/p2p/dial.go:321 +0x9f
|
||||||
|
created by github.com/ethereum/go-ethereum/p2p.newDialScheduler
|
||||||
|
github.com/ethereum/go-ethereum/p2p/dial.go:179 +0x425
|
||||||
|
```
|
||||||
|
|
||||||
|
and
|
||||||
|
```sh
|
||||||
|
debug.stacks("consolecmd.go")
|
||||||
|
```
|
||||||
|
|
||||||
|
returns data that looks like:
|
||||||
|
|
||||||
|
```terminal
|
||||||
|
INFO [11-04|16:16:47.141] Expanded filter expression filter=consolecmd.go expanded="`consolecmd.go` in Value"
|
||||||
|
goroutine 1 [chan receive]:
|
||||||
|
github.com/ethereum/go-ethereum/internal/jsre.(*JSRE).Do(0xc0004223c0, 0xc0003c00f0)
|
||||||
|
github.com/ethereum/go-ethereum/internal/jsre/jsre.go:230 +0xf4
|
||||||
|
github.com/ethereum/go-ethereum/internal/jsre.(*JSRE).Evaluate(0xc00033eb60?, {0xc0013c00a0, 0x1e}, {0x180d720?, 0xc000010018})
|
||||||
|
github.com/ethereum/go-ethereum/internal/jsre/jsre.go:289 +0xb3
|
||||||
|
github.com/ethereum/go-ethereum/console.(*Console).Evaluate(0xc0005366e0, {0xc0013c00a0?, 0x0?})
|
||||||
|
github.com/ethereum/go-ethereum/console/console.go:353 +0x6d
|
||||||
|
github.com/ethereum/go-ethereum/console.(*Console).Interactive(0xc0005366e0)
|
||||||
|
github.com/ethereum/go-ethereum/console/console.go:481 +0x691
|
||||||
|
main.localConsole(0xc00026d580?)
|
||||||
|
github.com/ethereum/go-ethereum/cmd/geth/consolecmd.go:109 +0x348
|
||||||
|
github.com/ethereum/go-ethereum/internal/flags.MigrateGlobalFlags.func2.1(0x20b52c0?)
|
||||||
|
github.com/ethereum/go-ethereum/internal/flags/helpers.go:91 +0x36
|
||||||
|
github.com/urfave/cli/v2.(*Command).Run(0x20b52c0, 0xc000313540)
|
||||||
|
github.com/urfave/cli/v2@v2.17.2-0.20221006022127-8f469abc00aa/command.go:177 +0x719
|
||||||
|
github.com/urfave/cli/v2.(*App).RunContext(0xc0005501c0, {0x1816128?, 0xc000040110}, {0xc00003c180, 0x3, 0x3})
|
||||||
|
github.com/urfave/cli/v2@v2.17.2-0.20221006022127-8f469abc00aa/app.go:387 +0x1035
|
||||||
|
github.com/urfave/cli/v2.(*App).Run(...)
|
||||||
|
github.com/urfave/cli/v2@v2.17.2-0.20221006022127-8f469abc00aa/app.go:252
|
||||||
|
main.main()
|
||||||
|
github.com/ethereum/go-ethereum/cmd/geth/main.go:266 +0x47
|
||||||
|
|
||||||
|
goroutine 159 [chan receive, 4 minutes]:
|
||||||
|
github.com/ethereum/go-ethereum/node.(*Node).Wait(...)
|
||||||
|
github.com/ethereum/go-ethereum/node/node.go:529
|
||||||
|
main.localConsole.func1()
|
||||||
|
github.com/ethereum/go-ethereum/cmd/geth/consolecmd.go:103 +0x2d
|
||||||
|
created by main.localConsole
|
||||||
|
github.com/ethereum/go-ethereum/cmd/geth/consolecmd.go:102 +0x32e
|
||||||
|
```
|
||||||
|
|
||||||
If Geth is started with the `--pprof` option, a debugging HTTP server is made available on port 6060. Navigating to <http://localhost:6060/debug/pprof> displays the heap, running routines etc. By clicking "full goroutine stack dump" a trace can be generated that is useful for debugging.
|
If Geth is started with the `--pprof` option, a debugging HTTP server is made available on port 6060. Navigating to <http://localhost:6060/debug/pprof> displays the heap, running routines etc. By clicking "full goroutine stack dump" a trace can be generated that is useful for debugging.
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Clef and Geth should be started separately but with complementary configurations
|
||||||
clef --chainid 11155111 --keystore ~/.go-ethereum/sepolia-data/keystore --configdir ~/go-ethereum/sepolia-data/clef --http
|
clef --chainid 11155111 --keystore ~/.go-ethereum/sepolia-data/keystore --configdir ~/go-ethereum/sepolia-data/clef --http
|
||||||
```
|
```
|
||||||
|
|
||||||
Clef will now start running in the terminal, beginning with a disclaimer and a prompt to click "ok":
|
Clef will start running in the terminal, beginning with a disclaimer and a prompt to click "ok":
|
||||||
|
|
||||||
```terminal
|
```terminal
|
||||||
WARNING!
|
WARNING!
|
||||||
|
@ -42,7 +42,7 @@ Enter 'ok' to proceed:
|
||||||
>
|
>
|
||||||
```
|
```
|
||||||
|
|
||||||
Geth can now be started in a separate terminal. To connect to Clef, ensure the data directory is consistent with the path provided to Clef and pass the location of the the Clef IPC file - which Clef saves to the path provided to its `--configdir` flag - in this case we set it to `~/go-ethereum/sepolia-data/clef`:
|
Geth can be started in a separate terminal. To connect to Clef, ensure the data directory is consistent with the path provided to Clef and pass the location of the the Clef IPC file - which Clef saves to the path provided to its `--configdir` flag - in this case we set it to `~/go-ethereum/sepolia-data/clef`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
geth --sepolia --datadir sepolia <other flags> --signer=sepolia-data/clef/clef.ipc
|
geth --sepolia --datadir sepolia <other flags> --signer=sepolia-data/clef/clef.ipc
|
||||||
|
@ -93,7 +93,13 @@ geth account new
|
||||||
|
|
||||||
### Listing accounts
|
### Listing accounts
|
||||||
|
|
||||||
The accounts in the keystore can be listed to the terminal using `account_list` as follows:
|
The accounts in the keystore can be listed to the terminal using a simple CLI command as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
clef list-accounts --keystore <path-to-keystore>
|
||||||
|
```
|
||||||
|
|
||||||
|
or using `account_list` in a POST request as follows:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -X POST --data '{"id": 0, "jsonrpc": "2.0", "method": "account_list", "params": []}' http://localhost:8550 -H "Content-Type: application/json"
|
curl -X POST --data '{"id": 0, "jsonrpc": "2.0", "method": "account_list", "params": []}' http://localhost:8550 -H "Content-Type: application/json"
|
||||||
|
@ -109,6 +115,20 @@ The ordering of accounts when they are listed is lexicographic, but is effective
|
||||||
|
|
||||||
Accounts can also be listed in the Javascript console using `eth.accounts`, which will defer to Clef for approval.
|
Accounts can also be listed in the Javascript console using `eth.accounts`, which will defer to Clef for approval.
|
||||||
|
|
||||||
|
As well as individual account, any wallets managed by Clef can be listed (which will also print the wallet status and the address and URl of any accounts they contain. This uses the `list-wallets` CLI command.
|
||||||
|
|
||||||
|
```
|
||||||
|
clef list-wallets --keystore <path-to-keystore>
|
||||||
|
```
|
||||||
|
|
||||||
|
which returns:
|
||||||
|
|
||||||
|
```terminal
|
||||||
|
- Wallet 0 at keystore:///home/user/Code/go-ethereum/testdata/keystore/UTC--2022-11-01T17-05-01.517877299Z--4f4094babd1a8c433e0f52a6ee3b6ff32dee6a9c (Locked )
|
||||||
|
- Account 0: 0x4f4094BaBd1A8c433e0f52A6ee3B6ff32dEe6a9c (keystore:///home/user/go-ethereum/testdata/keystore/UTC--2022-11-01T17-05-01.517877299Z--4f4094babd1a8c433e0f52a6ee3b6ff32dee6a9c)
|
||||||
|
- Wallet 1 at keystore:///home/user/go-ethereum/testdata/keystore/UTC--2022-11-01T17-05-11.100536003Z--8ef15919f852a8034688a71d8b57ab0187364009 (Locked )
|
||||||
|
- Account 0: 0x8Ef15919F852A8034688a71d8b57Ab0187364009 (keystore:///home/user/go-ethereum/testdata/keystore/UTC--2022-11-01T17-05-11.100536003Z--8ef15919f852a8034688a71d8b57ab0187364009)
|
||||||
|
```
|
||||||
|
|
||||||
### Import a keyfile
|
### Import a keyfile
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,22 @@ Ethereum Node Records can be decoded, verified and displayed to the terminal usi
|
||||||
|
|
||||||
Use `devp2p enrdump <base64>` to verify and display an Ethereum Node Record.
|
Use `devp2p enrdump <base64>` to verify and display an Ethereum Node Record.
|
||||||
|
|
||||||
|
The following is an example of the data returned by `enrdump`:
|
||||||
|
|
||||||
|
```terminal
|
||||||
|
./devp2p enrdump "enr:-J24QG3pjTFObcDvTOTJr2qPOTDH3-YxDqS47Ylm-kgM5BUwb1oD5Id6fSRTfUzTahTa7y4TWx_HSV7wri7T6iYtyAQHg2V0aMfGhLjGKZ2AgmlkgnY0gmlwhJ1a19CJc2VjcDI1NmsxoQPlCNb7N__vcnsNC8YYkFkmNj8mibnR5NuvSowcRZsLU4RzbmFwwIN0Y3CCdl-DdWRwgnZf" Node ID: 001816492db22f7572e9eea1c871a2ffe75c28162a9fbc5a9d240e480a7c176f URLv4: ./devp2p enrdump "enr:-J24QG3pjTFObcDvTOTJr2qPOTDH3-YxDqS47Ylm-kgM5BUwb1oD5Id6fSRTfUzTahTa7y4TWx_HSV7wri7T6iYtyAQHg2V0aMfGhLjGKZ2AgmlkgnY0gmlwhJ1a19CJc2VjcDI1NmsxoQPlCNb7N__vcnsNC8YYkFkmNj8mibnR5NuvSowcRZsLU4RzbmFwwIN0Y3CCdl-DdWRwgnZf"
|
||||||
|
Node ID: 001816492db22f7572e9eea1c871a2ffe75c28162a9fbc5a9d240e480a7c176f
|
||||||
|
URLv4: enode://e508d6fb37ffef727b0d0bc618905926363f2689b9d1e4dbaf4a8c1c459b0b534dcdf84342b78250a6dc013c9ee9f89d095d7a6d1ef0c5f4c57a083b22c557ef@157.90.215.208:30303
|
||||||
|
Record has sequence number 7 and 7 key/value pairs.
|
||||||
|
"eth" c7c684b8c6299d80
|
||||||
|
"id" "v4"
|
||||||
|
"ip" 157.90.215.208
|
||||||
|
"secp256k1" a103e508d6fb37ffef727b0d0bc618905926363f2689b9d1e4dbaf4a8c1c459b0b53
|
||||||
|
"snap" c0
|
||||||
|
"tcp" 30303
|
||||||
|
"udp" 30303
|
||||||
|
```
|
||||||
|
|
||||||
Read more on [Ethereum Node Records](https://ethereum.org/en/developers/docs/networking-layer/network-addresses/#enr) or browse the [specs](https://github.com/ethereum/devp2p/blob/591edbd36eb57280384d07373a818c00bddf3b31/enr.md).
|
Read more on [Ethereum Node Records](https://ethereum.org/en/developers/docs/networking-layer/network-addresses/#enr) or browse the [specs](https://github.com/ethereum/devp2p/blob/591edbd36eb57280384d07373a818c00bddf3b31/enr.md).
|
||||||
|
|
||||||
## Node Key Management
|
## Node Key Management
|
||||||
|
|
Loading…
Reference in New Issue