Skip to content

Commit

Permalink
refactor_: remove mailservers code
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Aug 23, 2024
1 parent 05e3a35 commit 67d8078
Show file tree
Hide file tree
Showing 65 changed files with 90 additions and 5,927 deletions.
113 changes: 51 additions & 62 deletions appdatabase/node_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,51 +124,50 @@ func randomNodeConfig() *params.NodeConfig {
privK, _ := crypto.GenerateKey()

return &params.NodeConfig{
NetworkID: uint64(int64(randomInt(math.MaxInt64))),
DataDir: randomString(),
KeyStoreDir: randomString(),
NodeKey: randomString(),
NoDiscovery: randomBool(),
Rendezvous: randomBool(),
ListenAddr: randomString(),
AdvertiseAddr: randomString(),
Name: randomString(),
Version: randomString(),
APIModules: randomString(),
TLSEnabled: randomBool(),
MaxPeers: randomInt(math.MaxInt64),
MaxPendingPeers: randomInt(math.MaxInt64),
EnableStatusService: randomBool(),
BridgeConfig: params.BridgeConfig{Enabled: randomBool()},
WalletConfig: params.WalletConfig{Enabled: randomBool()},
LocalNotificationsConfig: params.LocalNotificationsConfig{Enabled: randomBool()},
BrowsersConfig: params.BrowsersConfig{Enabled: randomBool()},
PermissionsConfig: params.PermissionsConfig{Enabled: randomBool()},
MailserversConfig: params.MailserversConfig{Enabled: randomBool()},
Web3ProviderConfig: params.Web3ProviderConfig{Enabled: randomBool()},
ConnectorConfig: params.ConnectorConfig{Enabled: randomBool()},
SwarmConfig: params.SwarmConfig{Enabled: randomBool()},
MailServerRegistryAddress: randomString(),
HTTPEnabled: randomBool(),
HTTPHost: randomString(),
HTTPPort: randomInt(math.MaxInt64),
HTTPVirtualHosts: randomStringSlice(),
HTTPCors: randomStringSlice(),
WSEnabled: false, // NOTE: leaving ws field idle since we are moving away from the storing the whole config
WSHost: "",
WSPort: 0,
IPCEnabled: randomBool(),
IPCFile: randomString(),
LogEnabled: randomBool(),
LogMobileSystem: randomBool(),
LogDir: randomString(),
LogFile: randomString(),
LogLevel: randomString(),
LogMaxBackups: randomInt(math.MaxInt64),
LogMaxSize: randomInt(math.MaxInt64),
LogCompressRotated: randomBool(),
LogToStderr: randomBool(),
UpstreamConfig: params.UpstreamRPCConfig{Enabled: randomBool(), URL: randomString()},
NetworkID: uint64(int64(randomInt(math.MaxInt64))),
DataDir: randomString(),
KeyStoreDir: randomString(),
NodeKey: randomString(),
NoDiscovery: randomBool(),
Rendezvous: randomBool(),
ListenAddr: randomString(),
AdvertiseAddr: randomString(),
Name: randomString(),
Version: randomString(),
APIModules: randomString(),
TLSEnabled: randomBool(),
MaxPeers: randomInt(math.MaxInt64),
MaxPendingPeers: randomInt(math.MaxInt64),
EnableStatusService: randomBool(),
BridgeConfig: params.BridgeConfig{Enabled: randomBool()},
WalletConfig: params.WalletConfig{Enabled: randomBool()},
LocalNotificationsConfig: params.LocalNotificationsConfig{Enabled: randomBool()},
BrowsersConfig: params.BrowsersConfig{Enabled: randomBool()},
PermissionsConfig: params.PermissionsConfig{Enabled: randomBool()},
MailserversConfig: params.MailserversConfig{Enabled: randomBool()},
Web3ProviderConfig: params.Web3ProviderConfig{Enabled: randomBool()},
ConnectorConfig: params.ConnectorConfig{Enabled: randomBool()},
SwarmConfig: params.SwarmConfig{Enabled: randomBool()},
HTTPEnabled: randomBool(),
HTTPHost: randomString(),
HTTPPort: randomInt(math.MaxInt64),
HTTPVirtualHosts: randomStringSlice(),
HTTPCors: randomStringSlice(),
WSEnabled: false, // NOTE: leaving ws field idle since we are moving away from the storing the whole config
WSHost: "",
WSPort: 0,
IPCEnabled: randomBool(),
IPCFile: randomString(),
LogEnabled: randomBool(),
LogMobileSystem: randomBool(),
LogDir: randomString(),
LogFile: randomString(),
LogLevel: randomString(),
LogMaxBackups: randomInt(math.MaxInt64),
LogMaxSize: randomInt(math.MaxInt64),
LogCompressRotated: randomBool(),
LogToStderr: randomBool(),
UpstreamConfig: params.UpstreamRPCConfig{Enabled: randomBool(), URL: randomString()},
ClusterConfig: params.ClusterConfig{
Enabled: randomBool(),
Fleet: randomString(),
Expand Down Expand Up @@ -227,23 +226,13 @@ func randomNodeConfig() *params.NodeConfig {
AutoUpdate: randomBool(),
},
WakuConfig: params.WakuConfig{
Enabled: randomBool(),
LightClient: randomBool(),
FullNode: randomBool(),
EnableMailServer: randomBool(),
DataDir: randomString(),
MinimumPoW: randomFloat(math.MaxInt64),
MailServerPassword: randomString(),
MailServerRateLimit: randomInt(math.MaxInt64),
MailServerDataRetention: randomInt(math.MaxInt64),
TTL: randomInt(math.MaxInt64),
MaxMessageSize: uint32(randomInt(math.MaxInt64)),
DatabaseConfig: params.DatabaseConfig{
PGConfig: params.PGConfig{
Enabled: randomBool(),
URI: randomString(),
},
},
Enabled: randomBool(),
LightClient: randomBool(),
FullNode: randomBool(),
DataDir: randomString(),
MinimumPoW: randomFloat(math.MaxInt64),
TTL: randomInt(math.MaxInt64),
MaxMessageSize: uint32(randomInt(math.MaxInt64)),
EnableRateLimiter: randomBool(),
PacketRateLimitIP: int64(randomInt(math.MaxInt64)),
PacketRateLimitPeerID: int64(randomInt(math.MaxInt64)),
Expand Down
16 changes: 4 additions & 12 deletions cmd/statusd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ var (
torrentClientPort = flag.Int("torrent-client-port", 9025, "Port for BitTorrent protocol connections")
version = flag.Bool("version", false, "Print version and dump configuration")

dataDir = flag.String("dir", getDefaultDataDir(), "Directory used by node to store data")
register = flag.Bool("register", false, "Register and make the node discoverable by other nodes")
mailserver = flag.Bool("mailserver", false, "Enable Mail Server with default configuration")
networkID = flag.Int(
dataDir = flag.String("dir", getDefaultDataDir(), "Directory used by node to store data")
register = flag.Bool("register", false, "Register and make the node discoverable by other nodes")
networkID = flag.Int(
"network-id",
params.GoerliNetworkID,
fmt.Sprintf(
Expand Down Expand Up @@ -118,9 +117,6 @@ func main() {
}

opts := []params.Option{params.WithFleet(*fleet)}
if *mailserver {
opts = append(opts, params.WithMailserver())
}

config, err := params.NewNodeConfigWithDefaultsAndFiles(
*dataDir,
Expand All @@ -140,9 +136,7 @@ func main() {
config.ListenAddr = *listenAddr
}

if *register && *mailserver {
config.RegisterTopics = append(config.RegisterTopics, params.MailServerDiscv5Topic)
} else if *register {
if *register {
config.RegisterTopics = append(config.RegisterTopics, params.WhisperDiscv5Topic)
}

Expand Down Expand Up @@ -251,7 +245,6 @@ func main() {
identity,
gethbridge.NewNodeBridge(backend.StatusNode().GethNode(), backend.StatusNode().WakuService(), backend.StatusNode().WakuV2Service()),
installationID.String(),
nil,
config.Version,
options...,
)
Expand Down Expand Up @@ -324,7 +317,6 @@ func main() {
identity,
gethbridge.NewNodeBridge(backend.StatusNode().GethNode(), backend.StatusNode().WakuService(), backend.StatusNode().WakuV2Service()),
installationID.String(),
nil,
config.Version,
options...,
)
Expand Down
8 changes: 0 additions & 8 deletions config/cli/mailserver-enabled.json

This file was deleted.

3 changes: 0 additions & 3 deletions eth-node/bridge/geth/envelope_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gethbridge

import (
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/waku"

wakucommon "github.com/status-im/status-go/waku/common"
wakuv2common "github.com/status-im/status-go/wakuv2/common"
Expand All @@ -21,8 +20,6 @@ func NewWakuEnvelopeEventWrapper(envelopeEvent *wakucommon.EnvelopeEvent) *types
for index := range data {
wrappedData[index] = *NewWakuEnvelopeErrorWrapper(&data[index])
}
case *waku.MailServerResponse:
wrappedData = NewWakuMailServerResponseWrapper(data)
}
return &types.EnvelopeEvent{
Event: types.EventType(envelopeEvent.Event),
Expand Down
19 changes: 0 additions & 19 deletions eth-node/bridge/geth/mailserver_response.go

This file was deleted.

29 changes: 0 additions & 29 deletions eth-node/types/mailserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,3 @@ func (r *MessagesRequest) SetDefaults(now time.Time) {
}
}
}

// MailServerResponse is the response payload sent by the mailserver.
type MailServerResponse struct {
LastEnvelopeHash Hash
Cursor []byte
Error error
}

// SyncMailRequest contains details which envelopes should be synced
// between Mail Servers.
type SyncMailRequest struct {
// Lower is a lower bound of time range for which messages are requested.
Lower uint32
// Upper is a lower bound of time range for which messages are requested.
Upper uint32
// Bloom is a bloom filter to filter envelopes.
Bloom []byte
// Limit is the max number of envelopes to return.
Limit uint32
// Cursor is used for pagination of the results.
Cursor []byte
}

// SyncEventResponse is a response from the Mail Server
// form which the peer received envelopes.
type SyncEventResponse struct {
Cursor []byte
Error string
}
3 changes: 0 additions & 3 deletions eth-node/types/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,4 @@ type Whisper interface {
GetFilter(id string) Filter
Unsubscribe(id string) error
UnsubscribeMany(ids []string) error

// SyncMessages can be sent between two Mail Servers and syncs envelopes between them.
SyncMessages(peerID []byte, req SyncMailRequest) error
}
43 changes: 0 additions & 43 deletions mailserver/README.md

This file was deleted.

85 changes: 0 additions & 85 deletions mailserver/cleaner.go

This file was deleted.

Loading

0 comments on commit 67d8078

Please sign in to comment.