Fix hash & start moving to lifecycle

Fix typeddata has and start moving from the legacy geth services
interfaces to the new Lifecycle interface
This commit is contained in:
Andrea Maria Piana 2021-06-28 09:28:59 +02:00
parent 799bd93451
commit d30df5a6fd
5 changed files with 15 additions and 60 deletions

View File

@ -8,8 +8,8 @@ import (
"github.com/status-im/status-go/eth-node/types"
)
// Make sure that NodeService implements node.Service interface.
var _ node.Service = (*NodeService)(nil)
// Make sure that NodeService implements node.Lifecycle interface.
var _ node.Lifecycle = (*NodeService)(nil)
type NodeService struct {
Node types.Node
@ -33,13 +33,13 @@ func (w *NodeService) APIs() []rpc.API {
}
// Start is run when a service is started.
// It does nothing in this case but is required by `node.Service` interface.
func (w *NodeService) Start(server *p2p.Server) error {
// It does nothing in this case but is required by `node.Lifecycle` interface.
func (w *NodeService) Start() error {
return nil
}
// Stop is run when a service is stopped.
// It does nothing in this case but is required by `node.Service` interface.
// It does nothing in this case but is required by `node.Lifecycle` interface.
func (w *NodeService) Stop() error {
return nil
}

View File

@ -8,8 +8,8 @@ import (
"github.com/status-im/status-go/eth-node/types"
)
// Make sure that WakuService implements node.Service interface.
var _ node.Service = (*WakuService)(nil)
// Make sure that WakuService implements node.Lifecycle interface.
var _ node.Lifecycle = (*WakuService)(nil)
type WakuService struct {
Waku types.Waku
@ -33,8 +33,8 @@ func (w *WakuService) APIs() []rpc.API {
}
// Start is run when a service is started.
// It does nothing in this case but is required by `node.Service` interface.
func (w *WakuService) Start(server *p2p.Server) error {
// It does nothing in this case but is required by `node.Lifecycle` interface.
func (w *WakuService) Start() error {
return nil
}

View File

@ -1,45 +0,0 @@
package nodebridge
import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rpc"
"github.com/status-im/status-go/eth-node/types"
)
// Make sure that WhisperService implements node.Service interface.
var _ node.Service = (*WhisperService)(nil)
type WhisperService struct {
Whisper types.Whisper
}
// Protocols returns a new protocols list. In this case, there are none.
func (w *WhisperService) Protocols() []p2p.Protocol {
return []p2p.Protocol{}
}
// APIs returns a list of new APIs.
func (w *WhisperService) APIs() []rpc.API {
return []rpc.API{
{
Namespace: "status",
Version: "1.0",
Service: w.Whisper,
Public: false,
},
}
}
// Start is run when a service is started.
// It does nothing in this case but is required by `node.Service` interface.
func (w *WhisperService) Start(server *p2p.Server) error {
return nil
}
// Stop is run when a service is stopped.
// It does nothing in this case but is required by `node.Service` interface.
func (w *WhisperService) Stop() error {
return nil
}

View File

@ -6,8 +6,8 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)
// Make sure that Service implements node.Service interface.
var _ node.Service = (*Service)(nil)
// Make sure that Service implements node.Lifecycle interface.
var _ node.Lifecycle = (*Service)(nil)
// Discoverer manages peer discovery.
type Discoverer interface {
@ -48,7 +48,7 @@ func (s *Service) SetDiscoverer(d Discoverer) {
// Start is run when a service is started.
// It does nothing in this case but is required by `node.Service` interface.
func (s *Service) Start(server *p2p.Server) error {
func (s *Service) Start() error {
return nil
}

View File

@ -15,8 +15,8 @@ import (
)
var (
bytes32Type, _ = abi.NewType("bytes32", nil)
int256Type, _ = abi.NewType("int256", nil)
bytes32Type, _ = abi.NewType("bytes32", "", nil)
int256Type, _ = abi.NewType("int256", "", nil)
errNotInteger = errors.New("not an integer")
)
@ -137,7 +137,7 @@ func toABITypeAndValue(f Field, data map[string]json.RawMessage, types Types) (v
}
func atomicType(f Field, data map[string]json.RawMessage) (val interface{}, typ abi.Type, err error) {
typ, err = abi.NewType(f.Type, nil)
typ, err = abi.NewType(f.Type, "", nil)
if err != nil {
return
}