Skip to content

Commit

Permalink
Merge pull request ethereum#437 from ethersphere/bump-protocol-versions
Browse files Browse the repository at this point in the history
swarm/network: bump versions for protocols bzz, hive and stream to 3
  • Loading branch information
nonsense authored Apr 26, 2018
2 parents 1e94e31 + 060af59 commit a50bf69
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions swarm/network/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const (
// BzzSpec is the spec of the generic swarm handshake
var BzzSpec = &protocols.Spec{
Name: "bzz",
Version: 1,
Version: 3,
MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{
HandshakeMsg{},
Expand All @@ -69,7 +69,7 @@ var BzzSpec = &protocols.Spec{
// DiscoverySpec is the spec for the bzz discovery subprotocols
var DiscoverySpec = &protocols.Spec{
Name: "hive",
Version: 1,
Version: 3,
MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{
peersMsg{},
Expand Down Expand Up @@ -188,7 +188,7 @@ func (b *Bzz) Protocols() []p2p.Protocol {
func (b *Bzz) APIs() []rpc.API {
return []rpc.API{{
Namespace: "hive",
Version: "1.0",
Version: "3.0",
Service: b.Hive,
}}
}
Expand Down
8 changes: 4 additions & 4 deletions swarm/network/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (s *bzzTester) testHandshake(lhs, rhs *HandshakeMsg, disconnects ...*p2ptes

func correctBzzHandshake(addr *BzzAddr) *HandshakeMsg {
return &HandshakeMsg{
Version: 1,
Version: 3,
NetworkID: 322,
Addr: addr,
}
Expand All @@ -199,7 +199,7 @@ func TestBzzHandshakeNetworkIDMismatch(t *testing.T) {

err := s.testHandshake(
correctBzzHandshake(addr),
&HandshakeMsg{Version: 1, NetworkID: 321, Addr: NewAddrFromNodeID(id)},
&HandshakeMsg{Version: 3, NetworkID: 321, Addr: NewAddrFromNodeID(id)},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): network id mismatch 321 (!= 322)")},
)

Expand All @@ -216,7 +216,7 @@ func TestBzzHandshakeVersionMismatch(t *testing.T) {
err := s.testHandshake(
correctBzzHandshake(addr),
&HandshakeMsg{Version: 0, NetworkID: 322, Addr: NewAddrFromNodeID(id)},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= 1)")},
&p2ptest.Disconnect{Peer: id, Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= 3)")},
)

if err != nil {
Expand All @@ -231,7 +231,7 @@ func TestBzzHandshakeSuccess(t *testing.T) {

err := s.testHandshake(
correctBzzHandshake(addr),
&HandshakeMsg{Version: 1, NetworkID: 322, Addr: NewAddrFromNodeID(id)},
&HandshakeMsg{Version: 3, NetworkID: 322, Addr: NewAddrFromNodeID(id)},
)

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions swarm/network/stream/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (r *TestRegistry) APIs() []rpc.API {
a := r.Registry.APIs()
a = append(a, rpc.API{
Namespace: "stream",
Version: "0.1",
Version: "3.0",
Service: r,
Public: true,
})
Expand Down Expand Up @@ -264,7 +264,7 @@ func (r *TestExternalRegistry) APIs() []rpc.API {
a := r.Registry.APIs()
a = append(a, rpc.API{
Namespace: "stream",
Version: "0.1",
Version: "3.0",
Service: r,
Public: true,
})
Expand Down
4 changes: 2 additions & 2 deletions swarm/network/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ func (c *clientParams) clientCreated() {
// Spec is the spec of the streamer protocol
var Spec = &protocols.Spec{
Name: "stream",
Version: 1,
Version: 3,
MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{
UnsubscribeMsg{},
Expand Down Expand Up @@ -675,7 +675,7 @@ func (r *Registry) APIs() []rpc.API {
return []rpc.API{
{
Namespace: "stream",
Version: "0.1",
Version: "3.0",
Service: r.api,
Public: true,
},
Expand Down
4 changes: 2 additions & 2 deletions swarm/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,14 @@ func (self *Swarm) APIs() []rpc.API {
// public APIs
{
Namespace: "bzz",
Version: "0.1",
Version: "3.0",
Service: &Info{self.config, chequebook.ContractParams},
Public: true,
},
// admin APIs
{
Namespace: "bzz",
Version: "0.1",
Version: "3.0",
Service: api.NewControl(self.api, self.bzz.Hive),
Public: false,
},
Expand Down

0 comments on commit a50bf69

Please sign in to comment.