all: new p2p node representation (#17643)
Package p2p/enode provides a generalized representation of p2p nodes
which can contain arbitrary information in key/value pairs. It is also
the new home for the node database. The "v4" identity scheme is also
moved here from p2p/enr to remove the dependency on Ethereum crypto from
that package.
Record signature handling is changed significantly. The identity scheme
registry is removed and acceptable schemes must be passed to any method
that needs identity. This means records must now be validated explicitly
after decoding.
The enode API is designed to make signature handling easy and safe: most
APIs around the codebase work with enode.Node, which is a wrapper around
a valid record. Going from enr.Record to enode.Node requires a valid
signature.
* p2p/discover: port to p2p/enode
This ports the discovery code to the new node representation in
p2p/enode. The wire protocol is unchanged, this can be considered a
refactoring change. The Kademlia table can now deal with nodes using an
arbitrary identity scheme. This requires a few incompatible API changes:
- Table.Lookup is not available anymore. It used to take a public key
as argument because v4 protocol requires one. Its replacement is
LookupRandom.
- Table.Resolve takes *enode.Node instead of NodeID. This is also for
v4 protocol compatibility because nodes cannot be looked up by ID
alone.
- Types Node and NodeID are gone. Further commits in the series will be
fixes all over the the codebase to deal with those removals.
* p2p: port to p2p/enode and discovery changes
This adapts package p2p to the changes in p2p/discover. All uses of
discover.Node and discover.NodeID are replaced by their equivalents from
p2p/enode.
New API is added to retrieve the enode.Node instance of a peer. The
behavior of Server.Self with discovery disabled is improved. It now
tries much harder to report a working IP address, falling back to
127.0.0.1 if no suitable address can be determined through other means.
These changes were needed for tests of other packages later in the
series.
* p2p/simulations, p2p/testing: port to p2p/enode
No surprises here, mostly replacements of discover.Node, discover.NodeID
with their new equivalents. The 'interesting' API changes are:
- testing.ProtocolSession tracks complete nodes, not just their IDs.
- adapters.NodeConfig has a new method to create a complete node.
These changes were needed to make swarm tests work.
Note that the NodeID change makes the code incompatible with old
simulation snapshots.
* whisper/whisperv5, whisper/whisperv6: port to p2p/enode
This port was easy because whisper uses []byte for node IDs and
URL strings in the API.
* eth: port to p2p/enode
Again, easy to port because eth uses strings for node IDs and doesn't
care about node information in any way.
* les: port to p2p/enode
Apart from replacing discover.NodeID with enode.ID, most changes are in
the server pool code. It now deals with complete nodes instead
of (Pubkey, IP, Port) triples. The database format is unchanged for now,
but we should probably change it to use the node database later.
* node: port to p2p/enode
This change simply replaces discover.Node and discover.NodeID with their
new equivalents.
* swarm/network: port to p2p/enode
Swarm has its own node address representation, BzzAddr, containing both
an overlay address (the hash of a secp256k1 public key) and an underlay
address (enode:// URL).
There are no changes to the BzzAddr format in this commit, but certain
operations such as creating a BzzAddr from a node ID are now impossible
because node IDs aren't public keys anymore.
Most swarm-related changes in the series remove uses of
NewAddrFromNodeID, replacing it with NewAddr which takes a complete node
as argument. ToOverlayAddr is removed because we can just use the node
ID directly.
2018-09-25 01:59:00 +03:00
|
|
|
{"nodes":[{"node":{"config":{"id":"c42f36bf6728b24721ce5ac1272a1058e202a236d276af1265a1eaa675f8fd85","private_key":"79eaaa1c3a9339a90cf54c511649caf683f2910588a872d2c12919355b7d5d28","name":"node01","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"11b53fa40926ac84d75d9d698f46b9611b90194857c1397e117931a890447078","private_key":"b067839f81534251ade8651e682dbd8324dfb83c7034aff4a48909e9310c990a","name":"node02","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"60cbf513366da3f6ee288d3572dc3971ae256b02e5492595e63c31a7b1b0d5a8","private_key":"4233e4c480ae197c265975cc7c83cc7b0cf1a8d67e4728bac4bcecaee63ad935","name":"node03","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"869fc21fff150ce9e1bc4512b183559433767cfc1cb7b6baae6d2a1313245ae8","private_key":"ca0c9f1baad4f60ddeaafe287d43b4ef8ec4b96c4ef12da194074325ca6cc4ef","name":"node04","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"a20d591ea15722712e83fcc6c17732f2370034ef870234a0fa0b2f4aea572fd5","private_key":"b6c09a581c2a6d85a63c11e586391346fe9d9d24292de15333ae230a33c52c1e","name":"node05","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"18b0fcbba2350241088129e8f6a07742857c3edaacd6ef1ec0861cc8e48492ce","private_key":"378e3e11e738557d2eea27e070d52c8355f8abe0c5f8607ac0792455a1d50bae","name":"node06","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"f84317ef488d8c1495b429b7a1fa21ea53a73e737b3c1aa890c20e38658ab148","private_key":"e6710b29bb9b7f00ee1e921bd548fc7622d73a0aae3f25de7a3f3650191147a8","name":"node07","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"0f19fb4d0c6cfe36f7f59c8fe54d2e169687603e1bde0fe6b3a5e864fa51f2f0","private_key":"2bed1cf9737dbf8239f560ab8b4e57dc47cf57a28ebd203e6fb159093fbe52c0","name":"node08","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"7c992ceefe03187bce1edbf8f80ccd1cab80b3908e625a61fef21ec6d35d04a3","private_key":"3f63c3dd3bf2b5be6e9af3ce596eb65cb58a36749d0baff1759d8dc6f4da8993","name":"node09","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"66f6ff5fbc2526c1db5db491e49138362bef23032c6344ed4ead7dcb58bd1e6c","private_key":"38ffbfff1b5ab2f905daabcbbc12a5e28aad826a80d0a40988a04d6653942a50","name":"node10","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"171f8d32719c1c3a330cdec42e47f0a5876bb2cc1cac8f13579f9cd19887c531","private_key":"aa2cc30f2f6e589ca122890fc95845f4a81ad7e57f2661343ff6af3d401c46f3","name":"node11","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"74a4ffb0d717a523ec72e07cc5efe3e98d55932d6e0592ef45fe54b378e4e952","private_key":"5b4a4da121c72f3d0d453394e6f09fc9ddaa5a13e44acb1ef6684867b4cac14c","name":"node12","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"20c4c3a3523960ad74538e726e1caaeda987cbc16dcd3beeb63fca6eebd31405","private_key":"98f5b9f4be5d997b66834ae619c58f54d941623dfcb9a6783bfce77fdb3f3d4b","name":"node13","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"45cdaac4c087e6b737507fa29936d09f2fbea14f49ef0ce91c18080456a7459b","private_key":"cbbe3c5ab5aafd2dae03deda6db9a3e7e58ffaad5c1edd37d7a13951aa733590","name":"node14","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"81748a1a38162f9e8613ffa562add1b75893b66199840e74c0774db92bfd7ca0","private_key":"62a83d45655860933bf8a2348695dd695176f3225f4ba72e70284b648130d330","name":"node15","services":["pss","bzz"],"enable_msg_events":false,"port":0},"up":true}},{"node":{"config":{"id":"cd944ad4c50c4357005ff26ef26369ba3375a1205eec532b6e51b22bf25510bc","private_key":"8c72a0c564073065c5300e822a476fe3dd8b373cfd0dabaf0cdb056ca0ece2f9
|