mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-25 06:46:37 +00:00
Perf experiment spike: Change 1on1 send/filter to partial pub-key
- Add MANY_WHISPER_TOPICS_ENABLED flag - Jenknisfile.parameters
This commit is contained in:
parent
4a08d2a818
commit
3cdb05e5b8
2
.env
2
.env
@ -9,3 +9,5 @@ LOG_LEVEL=debug
|
|||||||
LOG_LEVEL_STATUS_GO=info
|
LOG_LEVEL_STATUS_GO=info
|
||||||
JSC_ENABLED=1
|
JSC_ENABLED=1
|
||||||
QUEUE_MESSAGE_ENABLED=1
|
QUEUE_MESSAGE_ENABLED=1
|
||||||
|
MANY_WHISPER_TOPICS_ENABLED=0
|
||||||
|
|
||||||
|
@ -9,3 +9,4 @@ LOG_LEVEL=debug
|
|||||||
LOG_LEVEL_STATUS_GO=info
|
LOG_LEVEL_STATUS_GO=info
|
||||||
JSC_ENABLED=1
|
JSC_ENABLED=1
|
||||||
QUEUE_MESSAGE_ENABLED=1
|
QUEUE_MESSAGE_ENABLED=1
|
||||||
|
MANY_WHISPER_TOPICS_ENABLED=0
|
@ -9,3 +9,4 @@ LOG_LEVEL=info
|
|||||||
LOG_LEVEL_STATUS_GO=info
|
LOG_LEVEL_STATUS_GO=info
|
||||||
JSC_ENABLED=0
|
JSC_ENABLED=0
|
||||||
QUEUE_MESSAGE_ENABLED=0
|
QUEUE_MESSAGE_ENABLED=0
|
||||||
|
MANY_WHISPER_TOPICS_ENABLED=0
|
||||||
|
@ -47,6 +47,7 @@ node ('macos1') {
|
|||||||
sh 'echo LOG_LEVEL_STATUS_GO=' + LOG_LEVEL_STATUS_GO + '>>' + '.env'
|
sh 'echo LOG_LEVEL_STATUS_GO=' + LOG_LEVEL_STATUS_GO + '>>' + '.env'
|
||||||
sh 'echo JSC_ENABLED=' + JSC_ENABLED + '>>' + '.env'
|
sh 'echo JSC_ENABLED=' + JSC_ENABLED + '>>' + '.env'
|
||||||
sh 'echo OFFLINE_INBOX_ENABLED=' + OFFLINE_INBOX_ENABLED + '>>' + '.env'
|
sh 'echo OFFLINE_INBOX_ENABLED=' + OFFLINE_INBOX_ENABLED + '>>' + '.env'
|
||||||
|
sh 'echo MANY_WHISPER_TOPICS_ENABLED=' + MANY_WHISPER_TOPICS_ENABLED + '>>' + '.env'
|
||||||
|
|
||||||
sh 'echo "**********************************************************************"'
|
sh 'echo "**********************************************************************"'
|
||||||
sh 'echo PARAMETERIZED BUILD - USING CUSTOM ENVIRONMENT'
|
sh 'echo PARAMETERIZED BUILD - USING CUSTOM ENVIRONMENT'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
(:require [cljs.spec.alpha :as s]
|
(:require [cljs.spec.alpha :as s]
|
||||||
[status-im.protocol.web3.filtering :as f]
|
[status-im.protocol.web3.filtering :as f]
|
||||||
[status-im.protocol.web3.delivery :as d]
|
[status-im.protocol.web3.delivery :as d]
|
||||||
[taoensso.timbre :refer-macros [debug]]
|
[taoensso.timbre :refer-macros [debug] :as log]
|
||||||
[status-im.protocol.validation :refer-macros [valid?]]))
|
[status-im.protocol.validation :refer-macros [valid?]]))
|
||||||
|
|
||||||
(def message-defaults
|
(def message-defaults
|
||||||
@ -17,10 +17,11 @@
|
|||||||
(defn send!
|
(defn send!
|
||||||
[{:keys [web3 message]}]
|
[{:keys [web3 message]}]
|
||||||
{:pre [(valid? ::user-message message)]}
|
{:pre [(valid? ::user-message message)]}
|
||||||
(let [message' (merge message-defaults
|
(let [topics (f/get-topics (:to message))
|
||||||
(assoc message
|
message' (assoc message
|
||||||
:type :message
|
:topics topics
|
||||||
:requires-ack? true))]
|
:type :message
|
||||||
|
:requires-ack? true)]
|
||||||
(debug :send-user-message message')
|
(debug :send-user-message message')
|
||||||
(d/add-pending-message! web3 message')))
|
(d/add-pending-message! web3 message')))
|
||||||
|
|
||||||
|
@ -98,13 +98,13 @@
|
|||||||
web3
|
web3
|
||||||
{:key identity
|
{:key identity
|
||||||
:allowP2P true
|
:allowP2P true
|
||||||
:topics [f/status-topic]}
|
:topics (f/get-topics identity)}
|
||||||
(l/message-listener listener-options))
|
(l/message-listener listener-options))
|
||||||
(inbox/initialize! web3))
|
(inbox/initialize! web3))
|
||||||
(f/add-filter!
|
(f/add-filter!
|
||||||
web3
|
web3
|
||||||
{:key identity
|
{:key identity
|
||||||
:topics [f/status-topic]}
|
:topics (f/get-topics identity)}
|
||||||
(l/message-listener listener-options)))
|
(l/message-listener listener-options)))
|
||||||
|
|
||||||
;; start listening to profiles
|
;; start listening to profiles
|
||||||
|
@ -1,11 +1,32 @@
|
|||||||
(ns status-im.protocol.web3.filtering
|
(ns status-im.protocol.web3.filtering
|
||||||
(:require [status-im.protocol.web3.utils :as u]
|
(:require [status-im.protocol.web3.utils :as u]
|
||||||
|
[status-im.utils.config :as config]
|
||||||
[cljs.spec.alpha :as s]
|
[cljs.spec.alpha :as s]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
|
;; XXX(oskarth): Perf issue to have one topic
|
||||||
|
;; See https://github.com/status-im/ideas/issues/55#issuecomment-355511183
|
||||||
(def status-topic "0xaabb11ee")
|
(def status-topic "0xaabb11ee")
|
||||||
|
|
||||||
(defonce filters (atom {}))
|
(defonce filters (atom {}))
|
||||||
|
|
||||||
|
;; NOTE(oskarth): This has concerns for upgradability and chatting cross
|
||||||
|
;; versions. How can we do this breaking change gradually?
|
||||||
|
|
||||||
|
;; NOTE(oskarth): Due to perf we don't want a single topic for all messages,
|
||||||
|
;; instead we want many. We need a way for user A and B to agree on which topics
|
||||||
|
;; to use. By using first 10 characters of the pub-key, we construct a topic
|
||||||
|
;; that requires no coordination for 1-1 chats.
|
||||||
|
(defn identity->topic [identity]
|
||||||
|
(apply str (take 10 identity)))
|
||||||
|
|
||||||
|
(defn get-topics [& [identity]]
|
||||||
|
(if config/many-whisper-topics-enabled?
|
||||||
|
(do (log/info "FLAG: many-whisper-topics-enabled ON")
|
||||||
|
[(identity->topic identity)])
|
||||||
|
(do (log/info "FLAG: many-whisper-topics-enabled OFF")
|
||||||
|
[status-topic])))
|
||||||
|
|
||||||
(s/def ::options (s/keys :opt-un [:message/to :message/topics]))
|
(s/def ::options (s/keys :opt-un [:message/to :message/topics]))
|
||||||
|
|
||||||
(defn remove-filter! [web3 options]
|
(defn remove-filter! [web3 options]
|
||||||
|
@ -32,3 +32,4 @@
|
|||||||
|
|
||||||
(def jsc-enabled? (enabled? (get-config :JSC_ENABLED 0)))
|
(def jsc-enabled? (enabled? (get-config :JSC_ENABLED 0)))
|
||||||
(def queue-message-enabled? (enabled? (get-config :QUEUE_MESSAGE_ENABLED 0)))
|
(def queue-message-enabled? (enabled? (get-config :QUEUE_MESSAGE_ENABLED 0)))
|
||||||
|
(def many-whisper-topics-enabled? (enabled? (get-config :MANY_WHISPER_TOPICS_ENABLED 0)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user