-
Notifications
You must be signed in to change notification settings - Fork 110
swarm, p2p: Prerequities for ENR replacing handshake #1296
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some calls to p2ptest.NewProtocolTester needs to be updated:
p2p/protocols/protocol_test.go:264:38:warning: unused variable or constant cannot use conf.ID (variable of type enode.ID) as *ecdsa.PrivateKey value in argument to p2ptest.NewProtocolTester (varcheck)
p2p/protocols/protocol_test.go:148:35:warning: unused variable or constant cannot use conf.ID (variable of type enode.ID) as *ecdsa.PrivateKey value in argument to p2ptest.NewProtocolTester (varcheck)
p2p/testing/protocoltester.go
Outdated
} | ||
if err := net.Start(peers[i].ID); err != nil { | ||
panic(fmt.Sprintf("error starting peer %v: %v", peers[i].ID, err)) | ||
panic(err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second panic impossible to happen.
@@ -0,0 +1,70 @@ | |||
package network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why to move this code to file named types.go? This utility names should be avoided. I propose name network.go instead types.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank @nolash.
swarm/api/config.go
Outdated
pubkey := crypto.FromECDSAPub(&prvKey.PublicKey) | ||
pubkeyhex := common.ToHex(pubkey) | ||
keyhex := crypto.Keccak256Hash(pubkey).Hex() | ||
//keyhex := crypto.Keccak256Hash(pubkey).Hex() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented line
submitted upstream ethereum/go-ethereum#19275 |
upstream merged |
This PR contains some preliminary changes to allow for using ENR to transmit the swarm overlay address between peers.
Currently, ENR is not being sent over the p2p handshake. The necessary changes for this to happen is pending an EIP submission (and approval, and implementation). This is described in this PR by @fjl which incidentally also contains a hack by him that provides a functional demonstration on how ENR record will be available through
PeerInfo
and on thep2p.Peer
object:ethereum/go-ethereum#19220
In the meantime, the aim is to include the maximum amount of changes here that can be made towards the goal without relying on the implementation of the EIP. Some of the changes are cherry-picked from an experimental branch https://github.com/ethersphere/go-ethereum/tree/enr-bzz-poc building on the in the above mentioned PR.
In the experimental branch all handshake related code has been removed, and includes a temporary POC test
swarm/network/simulation/protocol_new_test.go:TestENR
that demonstrates a successfulWaitTillHealthy()
only using ENR.My proposed steps towards the basic but sound transition to handshake-free Swarm are:
BEFORE EIP
AFTER EIP
swarm/network
swarm/network:BzzAddr
swarm/network:BzzPeer
andswarm/network:Peer
p2p/protocols
p2p/protocols
toswarm
package