chore: bump go-waku
This commit is contained in:
parent
02d70899df
commit
37b06cd3b1
2
go.mod
2
go.mod
|
@ -51,7 +51,7 @@ require (
|
||||||
github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d // indirect
|
github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d // indirect
|
||||||
github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a
|
github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a
|
||||||
github.com/status-im/doubleratchet v3.0.0+incompatible
|
github.com/status-im/doubleratchet v3.0.0+incompatible
|
||||||
github.com/status-im/go-waku v0.0.0-20220224134018-cdc0c9c69d18
|
github.com/status-im/go-waku v0.0.0-20220302160213-b820d797c85b
|
||||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432
|
github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432
|
||||||
github.com/status-im/markdown v0.0.0-20210405121740-32e5a5055fb6
|
github.com/status-im/markdown v0.0.0-20210405121740-32e5a5055fb6
|
||||||
github.com/status-im/migrate/v4 v4.6.2-status.2
|
github.com/status-im/migrate/v4 v4.6.2-status.2
|
||||||
|
|
8
go.sum
8
go.sum
|
@ -1208,14 +1208,14 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
|
||||||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
||||||
github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY=
|
github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY=
|
||||||
github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU=
|
github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU=
|
||||||
github.com/status-im/go-discover v0.0.0-20211207185514-87bd8c3fe429 h1:9WvvSmX33Cng0sldAFmnkB9yzsfs5tSHP4BpM2NFTB0=
|
github.com/status-im/go-discover v0.0.0-20220220162124-91b97a3e0efe h1:Wz82CcseYsvh71f5tbomwjOc3lMohohqjyvfOhplLsI=
|
||||||
github.com/status-im/go-discover v0.0.0-20211207185514-87bd8c3fe429/go.mod h1:sfq3nyUDYY7Z4SnmDZ/KxTNj/7vu+Eyp4bsm1Hfj1QQ=
|
github.com/status-im/go-discover v0.0.0-20220220162124-91b97a3e0efe/go.mod h1:sfq3nyUDYY7Z4SnmDZ/KxTNj/7vu+Eyp4bsm1Hfj1QQ=
|
||||||
github.com/status-im/go-ethereum v1.10.4-status.3 h1:RF618iSCvqJtXu3ZSg7XNg6MJaSTgZNJQZkjpTgV3C8=
|
github.com/status-im/go-ethereum v1.10.4-status.3 h1:RF618iSCvqJtXu3ZSg7XNg6MJaSTgZNJQZkjpTgV3C8=
|
||||||
github.com/status-im/go-ethereum v1.10.4-status.3/go.mod h1:GvIhpdCOgMHI6i5xVPEZOrv/qSMeOFHbZh77AoyZUoE=
|
github.com/status-im/go-ethereum v1.10.4-status.3/go.mod h1:GvIhpdCOgMHI6i5xVPEZOrv/qSMeOFHbZh77AoyZUoE=
|
||||||
github.com/status-im/go-multiaddr-ethv4 v1.2.1 h1:09v9n6426NAojNOvdgegqrAotgffWW/UPDwrpJ85DNE=
|
github.com/status-im/go-multiaddr-ethv4 v1.2.1 h1:09v9n6426NAojNOvdgegqrAotgffWW/UPDwrpJ85DNE=
|
||||||
github.com/status-im/go-multiaddr-ethv4 v1.2.1/go.mod h1:SlBebvQcSUM5+/R/YfpfMuu5WyraW47XFmIqLYBmlKU=
|
github.com/status-im/go-multiaddr-ethv4 v1.2.1/go.mod h1:SlBebvQcSUM5+/R/YfpfMuu5WyraW47XFmIqLYBmlKU=
|
||||||
github.com/status-im/go-waku v0.0.0-20220224134018-cdc0c9c69d18 h1:pykYGtdQZemOQaeqmOTYoERuG2CGRUjKrZhP6ThN37I=
|
github.com/status-im/go-waku v0.0.0-20220302160213-b820d797c85b h1:PcN3ahtAmF5kZ8TsQNHHb3HBQIyk0qKsN8XYHhoEM10=
|
||||||
github.com/status-im/go-waku v0.0.0-20220224134018-cdc0c9c69d18/go.mod h1:JVJzXmxDWPcSg2CAuVBw0WBMLSpyqtyvv/HnTkYky8U=
|
github.com/status-im/go-waku v0.0.0-20220302160213-b820d797c85b/go.mod h1:7SH3xYPUpUwiwSkSSuqPoJQo01ulLD5hSFDvGZzjsvo=
|
||||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432 h1:cbNFU38iimo9fY4B7CdF/fvIF6tNPJIZjBbpfmW2EY4=
|
github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432 h1:cbNFU38iimo9fY4B7CdF/fvIF6tNPJIZjBbpfmW2EY4=
|
||||||
github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432/go.mod h1:A8t3i0CUGtXCA0aiLsP7iyikmk/KaD/2XVvNJqGCU20=
|
github.com/status-im/go-waku-rendezvous v0.0.0-20211018070416-a93f3b70c432/go.mod h1:A8t3i0CUGtXCA0aiLsP7iyikmk/KaD/2XVvNJqGCU20=
|
||||||
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
||||||
|
|
|
@ -25,6 +25,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||||
|
"github.com/status-im/go-discover/discover/v5wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UDPConn is a network connection on which discovery can operate.
|
// UDPConn is a network connection on which discovery can operate.
|
||||||
|
@ -35,6 +36,10 @@ type UDPConn interface {
|
||||||
LocalAddr() net.Addr
|
LocalAddr() net.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type V5Config struct {
|
||||||
|
ProtocolID [6]byte
|
||||||
|
}
|
||||||
|
|
||||||
// Config holds settings for the discovery listener.
|
// Config holds settings for the discovery listener.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// These settings are required and configure the UDP listener:
|
// These settings are required and configure the UDP listener:
|
||||||
|
@ -48,6 +53,7 @@ type Config struct {
|
||||||
ValidSchemes enr.IdentityScheme // allowed identity schemes
|
ValidSchemes enr.IdentityScheme // allowed identity schemes
|
||||||
Clock mclock.Clock
|
Clock mclock.Clock
|
||||||
ValidNodeFn func(enode.Node) bool // function to validate a node before it's added to routing tables
|
ValidNodeFn func(enode.Node) bool // function to validate a node before it's added to routing tables
|
||||||
|
V5Config V5Config // DiscV5 settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg Config) withDefaults() Config {
|
func (cfg Config) withDefaults() Config {
|
||||||
|
@ -60,6 +66,9 @@ func (cfg Config) withDefaults() Config {
|
||||||
if cfg.Clock == nil {
|
if cfg.Clock == nil {
|
||||||
cfg.Clock = mclock.System{}
|
cfg.Clock = mclock.System{}
|
||||||
}
|
}
|
||||||
|
if len(cfg.V5Config.ProtocolID) == 0 {
|
||||||
|
cfg.V5Config.ProtocolID = v5wire.DefaultProtocolID
|
||||||
|
}
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ func newUDPv5(conn UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv5, error) {
|
||||||
callDoneCh: make(chan *callV5),
|
callDoneCh: make(chan *callV5),
|
||||||
respTimeoutCh: make(chan *callTimeout),
|
respTimeoutCh: make(chan *callTimeout),
|
||||||
// state of dispatch
|
// state of dispatch
|
||||||
codec: v5wire.NewCodec(ln, cfg.PrivateKey, cfg.Clock),
|
codec: v5wire.NewCodec(ln, cfg.PrivateKey, cfg.Clock, cfg.V5Config.ProtocolID),
|
||||||
activeCallByNode: make(map[enode.ID]*callV5),
|
activeCallByNode: make(map[enode.ID]*callV5),
|
||||||
activeCallByAuth: make(map[v5wire.Nonce]*callV5),
|
activeCallByAuth: make(map[v5wire.Nonce]*callV5),
|
||||||
callQueue: make(map[enode.ID][]*callV5),
|
callQueue: make(map[enode.ID][]*callV5),
|
||||||
|
|
|
@ -94,7 +94,7 @@ const (
|
||||||
randomPacketMsgSize = 20
|
randomPacketMsgSize = 20
|
||||||
)
|
)
|
||||||
|
|
||||||
var protocolID = [6]byte{'d', 'i', 's', 'c', 'v', '5'}
|
var DefaultProtocolID = [6]byte{'d', 'i', 's', 'c', 'v', '5'}
|
||||||
|
|
||||||
// Errors.
|
// Errors.
|
||||||
var (
|
var (
|
||||||
|
@ -134,6 +134,8 @@ type Codec struct {
|
||||||
privkey *ecdsa.PrivateKey
|
privkey *ecdsa.PrivateKey
|
||||||
sc *SessionCache
|
sc *SessionCache
|
||||||
|
|
||||||
|
protocolID [6]byte
|
||||||
|
|
||||||
// encoder buffers
|
// encoder buffers
|
||||||
buf bytes.Buffer // whole packet
|
buf bytes.Buffer // whole packet
|
||||||
headbuf bytes.Buffer // packet header
|
headbuf bytes.Buffer // packet header
|
||||||
|
@ -145,12 +147,13 @@ type Codec struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCodec creates a wire codec.
|
// NewCodec creates a wire codec.
|
||||||
func NewCodec(ln *enode.LocalNode, key *ecdsa.PrivateKey, clock mclock.Clock) *Codec {
|
func NewCodec(ln *enode.LocalNode, key *ecdsa.PrivateKey, clock mclock.Clock, protocolID [6]byte) *Codec {
|
||||||
c := &Codec{
|
c := &Codec{
|
||||||
sha256: sha256.New(),
|
sha256: sha256.New(),
|
||||||
localnode: ln,
|
localnode: ln,
|
||||||
privkey: key,
|
privkey: key,
|
||||||
sc: NewSessionCache(1024, clock),
|
sc: NewSessionCache(1024, clock),
|
||||||
|
protocolID: protocolID,
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
@ -250,7 +253,7 @@ func (c *Codec) makeHeader(toID enode.ID, flag byte, authsizeExtra int) Header {
|
||||||
}
|
}
|
||||||
return Header{
|
return Header{
|
||||||
StaticHeader: StaticHeader{
|
StaticHeader: StaticHeader{
|
||||||
ProtocolID: protocolID,
|
ProtocolID: c.protocolID,
|
||||||
Version: version,
|
Version: version,
|
||||||
Flag: flag,
|
Flag: flag,
|
||||||
AuthSize: uint16(authsize),
|
AuthSize: uint16(authsize),
|
||||||
|
@ -429,7 +432,7 @@ func (c *Codec) Decode(input []byte, addr string) (src enode.ID, n *enode.Node,
|
||||||
c.reader.Reset(staticHeader)
|
c.reader.Reset(staticHeader)
|
||||||
binary.Read(&c.reader, binary.BigEndian, &head.StaticHeader)
|
binary.Read(&c.reader, binary.BigEndian, &head.StaticHeader)
|
||||||
remainingInput := len(input) - sizeofStaticPacketData
|
remainingInput := len(input) - sizeofStaticPacketData
|
||||||
if err := head.checkValid(remainingInput); err != nil {
|
if err := head.checkValid(remainingInput, c.protocolID); err != nil {
|
||||||
return enode.ID{}, nil, nil, err
|
return enode.ID{}, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +619,7 @@ func (c *Codec) decryptMessage(input, nonce, headerData, readKey []byte) (Packet
|
||||||
|
|
||||||
// checkValid performs some basic validity checks on the header.
|
// checkValid performs some basic validity checks on the header.
|
||||||
// The packetLen here is the length remaining after the static header.
|
// The packetLen here is the length remaining after the static header.
|
||||||
func (h *StaticHeader) checkValid(packetLen int) error {
|
func (h *StaticHeader) checkValid(packetLen int, protocolID [6]byte) error {
|
||||||
if h.ProtocolID != protocolID {
|
if h.ProtocolID != protocolID {
|
||||||
return errInvalidHeader
|
return errInvalidHeader
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,13 +92,14 @@ func NewDBStore(log *zap.SugaredLogger, options ...DBOption) (*DBStore, error) {
|
||||||
|
|
||||||
func (d *DBStore) createTable() error {
|
func (d *DBStore) createTable() error {
|
||||||
sqlStmt := `CREATE TABLE IF NOT EXISTS message (
|
sqlStmt := `CREATE TABLE IF NOT EXISTS message (
|
||||||
id BLOB PRIMARY KEY,
|
id BLOB,
|
||||||
receiverTimestamp INTEGER NOT NULL,
|
receiverTimestamp INTEGER NOT NULL,
|
||||||
senderTimestamp INTEGER NOT NULL,
|
senderTimestamp INTEGER NOT NULL,
|
||||||
contentTopic BLOB NOT NULL,
|
contentTopic BLOB NOT NULL,
|
||||||
pubsubTopic BLOB NOT NULL,
|
pubsubTopic BLOB NOT NULL,
|
||||||
payload BLOB,
|
payload BLOB,
|
||||||
version INTEGER NOT NULL DEFAULT 0
|
version INTEGER NOT NULL DEFAULT 0,
|
||||||
|
CONSTRAINT messageIndex PRIMARY KEY (senderTimestamp, id, pubsubTopic)
|
||||||
) WITHOUT ROWID;`
|
) WITHOUT ROWID;`
|
||||||
_, err := d.db.Exec(sqlStmt)
|
_, err := d.db.Exec(sqlStmt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -132,6 +132,9 @@ func NewDiscoveryV5(host host.Host, ipAddr net.IP, tcpPort int, priv *ecdsa.Priv
|
||||||
// TODO: track https://github.com/status-im/nim-waku/issues/770 for improvements over validation func
|
// TODO: track https://github.com/status-im/nim-waku/issues/770 for improvements over validation func
|
||||||
return evaluateNode(&n)
|
return evaluateNode(&n)
|
||||||
},
|
},
|
||||||
|
V5Config: discover.V5Config{
|
||||||
|
ProtocolID: [6]byte{'d', '5', 'w', 'a', 'k', 'u'},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
udpAddr: &net.UDPAddr{
|
udpAddr: &net.UDPAddr{
|
||||||
IP: net.IPv4zero,
|
IP: net.IPv4zero,
|
||||||
|
|
|
@ -76,6 +76,7 @@ type Index struct {
|
||||||
Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
|
Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
|
||||||
ReceiverTime int64 `protobuf:"zigzag64,2,opt,name=receiverTime,proto3" json:"receiverTime,omitempty"`
|
ReceiverTime int64 `protobuf:"zigzag64,2,opt,name=receiverTime,proto3" json:"receiverTime,omitempty"`
|
||||||
SenderTime int64 `protobuf:"zigzag64,3,opt,name=senderTime,proto3" json:"senderTime,omitempty"`
|
SenderTime int64 `protobuf:"zigzag64,3,opt,name=senderTime,proto3" json:"senderTime,omitempty"`
|
||||||
|
PubsubTopic string `protobuf:"bytes,4,opt,name=pubsubTopic,proto3" json:"pubsubTopic,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
@ -135,6 +136,13 @@ func (m *Index) GetSenderTime() int64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Index) GetPubsubTopic() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.PubsubTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type PagingInfo struct {
|
type PagingInfo struct {
|
||||||
PageSize uint64 `protobuf:"varint,1,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
|
PageSize uint64 `protobuf:"varint,1,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
|
||||||
Cursor *Index `protobuf:"bytes,2,opt,name=cursor,proto3" json:"cursor,omitempty"`
|
Cursor *Index `protobuf:"bytes,2,opt,name=cursor,proto3" json:"cursor,omitempty"`
|
||||||
|
@ -465,41 +473,41 @@ func init() {
|
||||||
func init() { proto.RegisterFile("waku_store.proto", fileDescriptor_ca6891f77a46e680) }
|
func init() { proto.RegisterFile("waku_store.proto", fileDescriptor_ca6891f77a46e680) }
|
||||||
|
|
||||||
var fileDescriptor_ca6891f77a46e680 = []byte{
|
var fileDescriptor_ca6891f77a46e680 = []byte{
|
||||||
// 534 bytes of a gzipped FileDescriptorProto
|
// 543 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6a, 0x13, 0x4f,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6e, 0xd3, 0x4c,
|
||||||
0x14, 0xc7, 0x3b, 0xf9, 0xd7, 0xec, 0x49, 0x7e, 0xe9, 0xfe, 0x8e, 0x20, 0x6b, 0xd1, 0x10, 0x17,
|
0x10, 0xc5, 0xbb, 0x49, 0x93, 0xc6, 0x93, 0x7c, 0xa9, 0xbf, 0x41, 0x42, 0xa6, 0x82, 0x28, 0x58,
|
||||||
0x2c, 0x01, 0x61, 0x0b, 0x29, 0x08, 0x5e, 0xa6, 0x49, 0x8b, 0x41, 0x4d, 0xea, 0xb4, 0xda, 0xcb,
|
0xa2, 0x8a, 0x84, 0xe4, 0x4a, 0xa9, 0x84, 0xc4, 0x65, 0x9a, 0xb4, 0x22, 0x02, 0x92, 0xb2, 0x2d,
|
||||||
0xb0, 0xd9, 0x3d, 0x86, 0xa1, 0x76, 0x77, 0x3b, 0xb3, 0xab, 0xd6, 0x6b, 0x1f, 0xc2, 0x77, 0xf0,
|
0xf4, 0x32, 0x72, 0xec, 0x21, 0x5a, 0x95, 0xda, 0xee, 0xae, 0x0d, 0x94, 0x6b, 0x78, 0x07, 0xde,
|
||||||
0x3d, 0xc4, 0x4b, 0xc1, 0x17, 0x90, 0xf8, 0x22, 0xb2, 0x93, 0xc9, 0x5f, 0x04, 0x2f, 0xcf, 0xf7,
|
0x81, 0xf7, 0x40, 0x5c, 0x22, 0xf1, 0x02, 0x28, 0xbc, 0x08, 0xf2, 0x66, 0xf3, 0x17, 0x24, 0x2e,
|
||||||
0x7c, 0x36, 0xdf, 0xef, 0x39, 0x67, 0x02, 0xf6, 0x07, 0xff, 0x2a, 0x1b, 0xab, 0x34, 0x96, 0xe4,
|
0xe7, 0xcc, 0x91, 0xe7, 0x77, 0x66, 0xd6, 0x60, 0xbf, 0xf3, 0x2f, 0xb3, 0x91, 0x4a, 0x63, 0x49,
|
||||||
0x25, 0x32, 0x4e, 0x63, 0x2c, 0x24, 0x93, 0x7d, 0xd4, 0xea, 0x35, 0x29, 0xe5, 0x4f, 0x8d, 0xee,
|
0x5e, 0x22, 0xe3, 0x34, 0xc6, 0x42, 0x32, 0xde, 0x43, 0xad, 0x5e, 0x91, 0x52, 0xfe, 0xc4, 0xe8,
|
||||||
0x06, 0x50, 0x1e, 0x44, 0x21, 0x7d, 0xc4, 0xbb, 0x50, 0x09, 0xc5, 0x94, 0x54, 0xea, 0xb0, 0x16,
|
0xee, 0x27, 0x06, 0xa5, 0x7e, 0x14, 0xd2, 0x7b, 0xbc, 0x0d, 0xe5, 0x50, 0x4c, 0x48, 0xa5, 0x0e,
|
||||||
0x6b, 0xd7, 0xb9, 0xa9, 0xd0, 0x85, 0xba, 0xa4, 0x80, 0xc4, 0x7b, 0x92, 0x17, 0xe2, 0x9a, 0x9c,
|
0x6b, 0xb2, 0x56, 0x8d, 0x9b, 0x0a, 0x5d, 0xa8, 0x49, 0x0a, 0x48, 0xbc, 0x25, 0x79, 0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e7, 0x28,
|
||||||
0x09, 0xf8, 0x16, 0x88, 0x1e, 0x40, 0xb2, 0x9c, 0xd6, 0x29, 0xe9, 0x4d, 0x35, 0x36, 0x77, 0xc0,
|
0xa7, 0xd8, 0x2c, 0xb6, 0xaa, 0xed, 0xff, 0xf3, 0x30, 0x6b, 0x04, 0x7c, 0xc3, 0x88, 0x1e, 0x40,
|
||||||
0xd7, 0x08, 0xbc, 0x0f, 0x96, 0x4a, 0x7d, 0x99, 0xea, 0xfb, 0x94, 0xf5, 0x7d, 0x56, 0x02, 0x3a,
|
0xb2, 0x48, 0xab, 0x37, 0x5e, 0x6d, 0xd7, 0xd7, 0x77, 0xc0, 0x57, 0x1c, 0x78, 0x17, 0x2c, 0x95,
|
||||||
0xb0, 0x4b, 0x51, 0xa8, 0x7b, 0x15, 0xdd, 0x5b, 0x94, 0xee, 0x37, 0x06, 0x7b, 0x66, 0x2a, 0x4e,
|
0xfa, 0x32, 0xd5, 0x17, 0x2c, 0xe9, 0x0b, 0x2e, 0x05, 0x74, 0x60, 0x87, 0xa2, 0x50, 0xf7, 0xca,
|
||||||
0x2a, 0x89, 0x23, 0x45, 0xf8, 0x18, 0xaa, 0xe6, 0x09, 0x29, 0xa7, 0xa0, 0x03, 0xef, 0xe5, 0xce,
|
0xba, 0x37, 0x2f, 0xdd, 0xaf, 0x0c, 0x76, 0x4d, 0x2a, 0x4e, 0x2a, 0x89, 0x23, 0x45, 0xf8, 0x10,
|
||||||
0x97, 0xfe, 0x55, 0xf6, 0x72, 0xae, 0xf3, 0x25, 0xb0, 0x15, 0xb4, 0xf8, 0xcf, 0xa0, 0x87, 0x50,
|
0x2a, 0xe6, 0x95, 0x29, 0xa7, 0xa0, 0x81, 0x77, 0xf3, 0xc9, 0x17, 0xfe, 0x65, 0xf6, 0x7c, 0xa6,
|
||||||
0x26, 0x29, 0x63, 0xa9, 0x67, 0x6a, 0x74, 0xee, 0xe5, 0xe8, 0x56, 0x00, 0xef, 0x24, 0x07, 0xf8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||||
0xbe, 0x84, 0x8e, 0xed, 0xef, 0xb3, 0x26, 0xfb, 0x31, 0x6b, 0xb2, 0x5f, 0xb3, 0x26, 0xfb, 0xf2,
|
0x00, 0x15, 0x69, 0xa8, 0x4c, 0xb6, 0x5b, 0x7f, 0x01, 0xe6, 0x0b, 0xd3, 0x91, 0xfd, 0x6d, 0xda,
|
||||||
0xbb, 0xb9, 0x33, 0xa9, 0xe8, 0xbf, 0xe1, 0xd1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x14, 0x8f,
|
0x60, 0xdf, 0xa7, 0x0d, 0xf6, 0x73, 0xda, 0x60, 0x9f, 0x7f, 0x35, 0xb6, 0xc6, 0x65, 0xfd, 0xa7,
|
||||||
0x84, 0xdf, 0xb2, 0x03, 0x00, 0x00,
|
0x1e, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x33, 0xe0, 0xf4, 0x43, 0xd5, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Index) Marshal() (dAtA []byte, err error) {
|
func (m *Index) Marshal() (dAtA []byte, err error) {
|
||||||
|
@ -526,6 +534,13 @@ func (m *Index) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
i -= len(m.XXX_unrecognized)
|
i -= len(m.XXX_unrecognized)
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
copy(dAtA[i:], m.XXX_unrecognized)
|
||||||
}
|
}
|
||||||
|
if len(m.PubsubTopic) > 0 {
|
||||||
|
i -= len(m.PubsubTopic)
|
||||||
|
copy(dAtA[i:], m.PubsubTopic)
|
||||||
|
i = encodeVarintWakuStore(dAtA, i, uint64(len(m.PubsubTopic)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
}
|
||||||
if m.SenderTime != 0 {
|
if m.SenderTime != 0 {
|
||||||
i = encodeVarintWakuStore(dAtA, i, uint64((uint64(m.SenderTime)<<1)^uint64((m.SenderTime>>63))))
|
i = encodeVarintWakuStore(dAtA, i, uint64((uint64(m.SenderTime)<<1)^uint64((m.SenderTime>>63))))
|
||||||
i--
|
i--
|
||||||
|
@ -842,6 +857,10 @@ func (m *Index) Size() (n int) {
|
||||||
if m.SenderTime != 0 {
|
if m.SenderTime != 0 {
|
||||||
n += 1 + sozWakuStore(uint64(m.SenderTime))
|
n += 1 + sozWakuStore(uint64(m.SenderTime))
|
||||||
}
|
}
|
||||||
|
l = len(m.PubsubTopic)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovWakuStore(uint64(l))
|
||||||
|
}
|
||||||
if m.XXX_unrecognized != nil {
|
if m.XXX_unrecognized != nil {
|
||||||
n += len(m.XXX_unrecognized)
|
n += len(m.XXX_unrecognized)
|
||||||
}
|
}
|
||||||
|
@ -1078,6 +1097,38 @@ func (m *Index) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63)
|
v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63)
|
||||||
m.SenderTime = int64(v)
|
m.SenderTime = int64(v)
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field PubsubTopic", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowWakuStore
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthWakuStore
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthWakuStore
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.PubsubTopic = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipWakuStore(dAtA[iNdEx:])
|
skippy, err := skipWakuStore(dAtA[iNdEx:])
|
||||||
|
|
|
@ -8,6 +8,7 @@ message Index {
|
||||||
bytes digest = 1;
|
bytes digest = 1;
|
||||||
sint64 receiverTime = 2;
|
sint64 receiverTime = 2;
|
||||||
sint64 senderTime = 3;
|
sint64 senderTime = 3;
|
||||||
|
string pubsubTopic = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PagingInfo {
|
message PagingInfo {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -380,6 +381,7 @@ func computeIndex(env *protocol.Envelope) (*pb.Index, error) {
|
||||||
Digest: env.Hash(),
|
Digest: env.Hash(),
|
||||||
ReceiverTime: utils.GetUnixEpoch(),
|
ReceiverTime: utils.GetUnixEpoch(),
|
||||||
SenderTime: env.Message().Timestamp,
|
SenderTime: env.Message().Timestamp,
|
||||||
|
PubsubTopic: env.PubsubTopic(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,18 +392,35 @@ func indexComparison(x, y *pb.Index) int {
|
||||||
// returns 1 if x > y
|
// returns 1 if x > y
|
||||||
|
|
||||||
var timecmp int = 0
|
var timecmp int = 0
|
||||||
|
|
||||||
|
if x.SenderTime != 0 && y.SenderTime != 0 {
|
||||||
if x.SenderTime > y.SenderTime {
|
if x.SenderTime > y.SenderTime {
|
||||||
timecmp = 1
|
timecmp = 1
|
||||||
} else if x.SenderTime < y.SenderTime {
|
} else if x.SenderTime < y.SenderTime {
|
||||||
timecmp = -1
|
timecmp = -1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
digestcm := bytes.Compare(x.Digest, y.Digest)
|
|
||||||
if timecmp != 0 {
|
if timecmp != 0 {
|
||||||
return timecmp // timestamp has a higher priority for comparison
|
return timecmp // timestamp has a higher priority for comparison
|
||||||
}
|
}
|
||||||
|
|
||||||
|
digestcm := bytes.Compare(x.Digest, y.Digest)
|
||||||
|
if digestcm != 0 {
|
||||||
return digestcm
|
return digestcm
|
||||||
|
}
|
||||||
|
|
||||||
|
pubsubTopicCmp := strings.Compare(x.PubsubTopic, y.PubsubTopic)
|
||||||
|
if pubsubTopicCmp != 0 {
|
||||||
|
return pubsubTopicCmp
|
||||||
|
}
|
||||||
|
|
||||||
|
// receiverTimestamp (a fallback only if senderTimestamp unset on either side, and all other fields unequal)
|
||||||
|
if x.ReceiverTime > y.ReceiverTime {
|
||||||
|
timecmp = 1
|
||||||
|
} else if x.ReceiverTime < y.ReceiverTime {
|
||||||
|
timecmp = -1
|
||||||
|
}
|
||||||
|
return timecmp
|
||||||
}
|
}
|
||||||
|
|
||||||
func indexedWakuMessageComparison(x, y IndexedWakuMessage) int {
|
func indexedWakuMessageComparison(x, y IndexedWakuMessage) int {
|
||||||
|
@ -416,7 +435,7 @@ func findIndex(msgList []IndexedWakuMessage, index *pb.Index) int {
|
||||||
// returns the position of an IndexedWakuMessage in msgList whose index value matches the given index
|
// returns the position of an IndexedWakuMessage in msgList whose index value matches the given index
|
||||||
// returns -1 if no match is found
|
// returns -1 if no match is found
|
||||||
for i, indexedWakuMessage := range msgList {
|
for i, indexedWakuMessage := range msgList {
|
||||||
if bytes.Equal(indexedWakuMessage.index.Digest, index.Digest) && indexedWakuMessage.index.ReceiverTime == index.ReceiverTime {
|
if bytes.Equal(indexedWakuMessage.index.Digest, index.Digest) && indexedWakuMessage.index.SenderTime == index.SenderTime && indexedWakuMessage.index.PubsubTopic == index.PubsubTopic {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -615,6 +634,7 @@ func (store *WakuStore) Next(ctx context.Context, r *Result) (*Result, error) {
|
||||||
Digest: r.cursor.Digest,
|
Digest: r.cursor.Digest,
|
||||||
ReceiverTime: r.cursor.ReceiverTime,
|
ReceiverTime: r.cursor.ReceiverTime,
|
||||||
SenderTime: r.cursor.SenderTime,
|
SenderTime: r.cursor.SenderTime,
|
||||||
|
PubsubTopic: r.cursor.PubsubTopic,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,13 +447,13 @@ github.com/shopspring/decimal
|
||||||
github.com/spacemonkeygo/spacelog
|
github.com/spacemonkeygo/spacelog
|
||||||
# github.com/status-im/doubleratchet v3.0.0+incompatible
|
# github.com/status-im/doubleratchet v3.0.0+incompatible
|
||||||
github.com/status-im/doubleratchet
|
github.com/status-im/doubleratchet
|
||||||
# github.com/status-im/go-discover v0.0.0-20211207185514-87bd8c3fe429
|
# github.com/status-im/go-discover v0.0.0-20220220162124-91b97a3e0efe
|
||||||
github.com/status-im/go-discover/discover
|
github.com/status-im/go-discover/discover
|
||||||
github.com/status-im/go-discover/discover/v4wire
|
github.com/status-im/go-discover/discover/v4wire
|
||||||
github.com/status-im/go-discover/discover/v5wire
|
github.com/status-im/go-discover/discover/v5wire
|
||||||
# github.com/status-im/go-multiaddr-ethv4 v1.2.1
|
# github.com/status-im/go-multiaddr-ethv4 v1.2.1
|
||||||
github.com/status-im/go-multiaddr-ethv4
|
github.com/status-im/go-multiaddr-ethv4
|
||||||
# github.com/status-im/go-waku v0.0.0-20220224134018-cdc0c9c69d18
|
# github.com/status-im/go-waku v0.0.0-20220302160213-b820d797c85b
|
||||||
github.com/status-im/go-waku/waku/persistence
|
github.com/status-im/go-waku/waku/persistence
|
||||||
github.com/status-im/go-waku/waku/try
|
github.com/status-im/go-waku/waku/try
|
||||||
github.com/status-im/go-waku/waku/v2
|
github.com/status-im/go-waku/waku/v2
|
||||||
|
|
Loading…
Reference in New Issue