Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse 32 bytes enodes in TOML configuration file #21156

Closed
DefiCake opened this issue Jun 1, 2020 · 4 comments
Closed

Cannot parse 32 bytes enodes in TOML configuration file #21156

DefiCake opened this issue Jun 1, 2020 · 4 comments

Comments

@DefiCake
Copy link

DefiCake commented Jun 1, 2020

System information

Geth
Version: 1.9.14-stable
Git Commit: 6d74d1e
Git Commit Date: 20200513
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.14.2
Operating System: linux
GOPATH=
GOROOT=/usr/local/go

Expected behaviour

I expect to be able to run geth with a TOML config file.

Actual behaviour

Unable to start geth with a config file where bootnodes are specified in the 32 bytes format (don't know if 64 bytes format works). My current guess is this change #17643 wasn't propagated to the config parser, but have not taken a look into the sources.

Steps to reproduce the behaviour

Take any TOML file with bootnodes specified, for example the following one:

[Eth]
NetworkId = 19080880
SyncMode = "fast"
NoPruning = false
NoPrefetch = false
LightPeers = 100
UltraLightFraction = 75
DatabaseCache = 512
DatabaseFreezer = ""
TrieCleanCache = 256
TrieDirtyCache = 256
TrieTimeout = 3600000000000
EnablePreimageRecording = false
EWASMInterpreter = ""
EVMInterpreter = ""

[Eth.Miner]
Etherbase = "0xdcf7baece1802d21a8226c013f7be99db5941bea"
GasFloor = 15000000
GasCeil = 8000000
GasPrice = 0
Recommit = 3000000000
Noverify = false

[Eth.Ethash]
CacheDir = "ethash"
CachesInMem = 2
CachesOnDisk = 3
DatasetDir = "/home/mad/.ethash"
DatasetsInMem = 1
DatasetsOnDisk = 2
PowMode = 0

[Eth.TxPool]
Locals = []
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 4096
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000

[Eth.GPO]
Blocks = 20
Percentile = 60

[Shh]
MaxMessageSize = 1048576
MinimumAcceptedPOW = 2e-01
RestrictConnectionBetweenLightClients = true

[Node]
DataDir = "/datadir"
omitempty = ""
NoUSB = true
IPCPath = "geth.ipc"
HTTPPort = 8545
HTTPVirtualHosts = ["localhost"]
HTTPModules = ["net", "web3", "eth", "shh"]
WSPort = 8546
WSModules = ["net", "web3", "eth", "shh"]
GraphQLPort = 8547
GraphQLVirtualHosts = ["localhost"]

[Node.P2P]
MaxPeers = 50
NoDiscovery = true
BootstrapNodes = ["enode://de2bff7934321b702bd9b657874ba7095b93a54cb4007049c100bf430d3026ea@172.0.254.129:30303"]
BootstrapNodesV5 = []
StaticNodes = []
TrustedNodes = []
ListenAddr = ":30303"
EnableMsgEvents = false

[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000

And try to run geth, geth --config /config/config.toml --nousb.

Backtrace

INFO [06-01|10:26:56.549] Maximum peer count                       ETH=50 LES=0 total=50
INFO [06-01|10:26:56.549] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
ERROR[06-01|10:26:56.549] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[06-01|10:26:56.549] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[06-01|10:26:56.549] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=1 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[06-01|10:26:56.550] Failed to enumerate USB devices          hub=ledger vendor=11415 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[06-01|10:26:56.550] Failed to enumerate USB devices          hub=trezor vendor=21324 failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
ERROR[06-01|10:26:56.550] Failed to enumerate USB devices          hub=trezor vendor=4617  failcount=2 err="failed to initialize libusb: libusb: unknown error [code -99]"
INFO [06-01|10:26:56.575] Starting Geth on Ethereum mainnet... 
INFO [06-01|10:26:56.575] Bumping default cache on mainnet         provided=1024 updated=4096
Fatal: /config/config.toml, line 72: (p2p.Config.BootstrapNodes) invalid public key (wrong length, want 128 hex chars)
@karalabe
Copy link
Member

karalabe commented Jun 1, 2020

The enode addresses are public keys, which are 64 bytes, so 128 hex characters. The PR you linked introduces an internal 32 byte representation to allow different crypto in the future. I don't think it was meant to change anything related to enode addresses.

@DefiCake
Copy link
Author

DefiCake commented Jun 1, 2020

I see, so if we were to get the enode from a nodekey with the bootnode binary, is there a way to get the 64 bytes representation? Right now, it is printing it in 32 bytes format, is this intended / expected? I 'd expect that the output of the bootnode utility could be used in the config file.

The only way I have found to get the 64 bytes format is to actually boot up a geth node and check the console output, where the enode is shown in its 64 bytes format.

Related:
https://stackoverflow.com/questions/52835449/the-output-length-of-bootnode-writeaddress-command-is-64-bytes-not-128-bytes-a (note the title is misleading, the author probably meant 64/128 characters, not bytes).

@DefiCake DefiCake closed this as completed Jun 4, 2020
@fjl
Copy link
Contributor

fjl commented Jun 9, 2020

I will add a new command to cmd/devp2p to create enode URLs from a private key.

@fjl
Copy link
Contributor

fjl commented Jun 9, 2020

#21202 adds those commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants