upgrade status-go to bugfix-updated-cht-#185-gd84d10d
changes in shh API according to https://github.com/ethereum/go-ethereum/wiki/Whisper-v5-RPC-API
This commit is contained in:
parent
7c82f3f0c3
commit
43a5d91ca2
|
@ -43,7 +43,6 @@
|
|||
"react-native-http-bridge",
|
||||
"emojilib",
|
||||
"react-native-mapbox-gl",
|
||||
"bignumber.js",
|
||||
"react-native-config",
|
||||
"react-native-svg"
|
||||
],
|
||||
|
|
|
@ -32,51 +32,56 @@ node {
|
|||
sh 'lein prod-build'
|
||||
}
|
||||
|
||||
// Android
|
||||
stage('Build (Android)') {
|
||||
sh 'cd android && ./gradlew assembleRelease'
|
||||
}
|
||||
stage('Deploy (Android)') {
|
||||
withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
|
||||
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@android/app/build/outputs/apk/app-release.apk -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
|
||||
sh 'sleep 10'
|
||||
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
||||
apkUrl = 'https://i.diawi.com/' + hash
|
||||
// Android
|
||||
stage('Build (Android)') {
|
||||
sh 'cd android && ./gradlew assembleRelease'
|
||||
}
|
||||
stage('Deploy (Android)') {
|
||||
withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
|
||||
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@android/app/build/outputs/apk/app-release.apk -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
|
||||
sh 'sleep 10'
|
||||
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
||||
apkUrl = 'https://i.diawi.com/' + hash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// try {
|
||||
// stage('Test (Android)') {
|
||||
// sauce('b9aded57-5cc1-4f6b-b5ea-42d989987852') {
|
||||
// sh 'cd test/appium && mvn -DapkUrl=' + apkUrl + ' test'
|
||||
// saucePublisher()
|
||||
// }
|
||||
// }
|
||||
// } catch(e) {
|
||||
// testPassed = false
|
||||
// }
|
||||
// try {
|
||||
// stage('Test (Android)') {
|
||||
// sauce('b9aded57-5cc1-4f6b-b5ea-42d989987852') {
|
||||
// sh 'cd test/appium && mvn -DapkUrl=' + apkUrl + ' test'
|
||||
// saucePublisher()
|
||||
// }
|
||||
// }
|
||||
// } catch(e) {
|
||||
// testPassed = false
|
||||
// }
|
||||
|
||||
stage('Slack Notification Android') {
|
||||
def c = (testPassed ? 'good' : 'warning' )
|
||||
slackSend color: c, message: 'Branch: ' + env.BRANCH_NAME + '\nTests: ' + (testPassed ? ':+1:' : ':-1:') + ')\nAndroid: ' + apkUrl
|
||||
}
|
||||
|
||||
// iOS
|
||||
stage('Build (iOS)') {
|
||||
sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'
|
||||
sh 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist /Users/Xcloud/archive.plist'
|
||||
sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'
|
||||
sh 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist /Users/Xcloud/archive.plist'
|
||||
}
|
||||
stage('Deploy (iOS)') {
|
||||
withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
|
||||
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
|
||||
sh 'sleep 10'
|
||||
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
||||
ipaUrl = 'https://i.diawi.com/' + hash
|
||||
}
|
||||
withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
|
||||
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
|
||||
sh 'sleep 10'
|
||||
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
||||
ipaUrl = 'https://i.diawi.com/' + hash
|
||||
}
|
||||
}
|
||||
|
||||
stage('Slack Notification iOS') {
|
||||
def c = (testPassed ? 'good' : 'warning' )
|
||||
slackSend color: c, message: 'Branch: ' + env.BRANCH_NAME + '\nTests: ' + (testPassed ? ':+1:' : ':-1:') + ')\niOS: ' + ipaUrl
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
slackSend color: 'bad', message: env.BRANCH_NAME + ' failed to build. ' + env.BUILD_URL
|
||||
throw e
|
||||
}
|
||||
|
||||
stage('Slack Notification') {
|
||||
def c = (testPassed ? 'good' : 'warning' )
|
||||
slackSend color: c, message: 'Branch: ' + env.BRANCH_NAME + '\nTests: ' + (testPassed ? ':+1:' : ':-1:') + ')\nAndroid: ' + apkUrl + '\n iOS: ' + ipaUrl
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,5 +15,5 @@ android {
|
|||
dependencies {
|
||||
compile 'com.facebook.react:react-native:+'
|
||||
compile 'com.instabug.library:instabug:3+'
|
||||
compile(group: 'status-im', name: 'status-go', version: 'bug-whisper-on-geth1.6.1-g3f6f0fa+', ext: 'aar')
|
||||
compile(group: 'status-im', name: 'status-go', version: 'bugfix-updated-cht-#185-gd84d10d', ext: 'aar')
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<artifactItem>
|
||||
<groupId>status-im</groupId>
|
||||
<artifactId>status-go-ios-simulator</artifactId>
|
||||
<version>bug-whisper-on-geth1.6.1-g3f6f0fa+</version>
|
||||
<version>bugfix-updated-cht-#185-gd84d10d</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,7 +22,7 @@
|
|||
"babel-plugin-transform-regenerator": "6.20.0",
|
||||
"babel-preset-react-native": "1.9.0",
|
||||
"babel-register": "6.18.0",
|
||||
"bignumber.js": "^4.0.2",
|
||||
"bignumber.js": "github:status-im/bignumber.js#master",
|
||||
"browserify-zlib": "^0.1.4",
|
||||
"buffer": "^3.6.0",
|
||||
"chance": "1.0.4",
|
||||
|
@ -79,7 +79,7 @@
|
|||
"react-native-tcp": "^3.2.1",
|
||||
"react-native-udp": "^2.0.0",
|
||||
"react-native-vector-icons": "^4.0.1",
|
||||
"react-native-webview-bridge": "github:status-im/react-native-webview-bridge#0.33.15",
|
||||
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#status-go-bugfix-updated-cht",
|
||||
"readable-stream": "1.0.33",
|
||||
"realm": "^0.14.3",
|
||||
"stream-browserify": "^1.0.0",
|
||||
|
@ -88,7 +88,7 @@
|
|||
"tty-browserify": "0.0.0",
|
||||
"url": "^0.10.3",
|
||||
"vm-browserify": "0.0.4",
|
||||
"web3": "github:farazdagi/web3.js#geth/1.6.1-unstable"
|
||||
"web3": "github:status-im/web3.js#status-develop"
|
||||
},
|
||||
"browser": {
|
||||
"crypto": "react-native-crypto",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,14 +25,14 @@
|
|||
|
||||
(defn save
|
||||
[{:keys [id to group-id message] :as pending-message}]
|
||||
(let [{:keys [sig key type topic payload]} message
|
||||
(let [{:keys [sig symKeyID pubKey topic payload]} message
|
||||
id' (get-id id to)
|
||||
chat-id (or group-id to)
|
||||
message' (-> pending-message
|
||||
(assoc :id id'
|
||||
:sig sig
|
||||
:key key
|
||||
:key-type type
|
||||
:sym-key-id symKeyID
|
||||
:pub-key pubKey
|
||||
:message-id id
|
||||
:chat-id chat-id
|
||||
:payload payload
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
[status-im.data-store.realm.schemas.account.v8.core :as v8]
|
||||
[status-im.data-store.realm.schemas.account.v9.core :as v9]
|
||||
[status-im.data-store.realm.schemas.account.v10.core :as v10]
|
||||
[status-im.data-store.realm.schemas.account.v11.core :as v11]))
|
||||
[status-im.data-store.realm.schemas.account.v11.core :as v11]
|
||||
[status-im.data-store.realm.schemas.account.v12.core :as v12]
|
||||
))
|
||||
|
||||
;; put schemas ordered by version
|
||||
(def schemas [{:schema v1/schema
|
||||
|
@ -44,4 +46,7 @@
|
|||
:migration v10/migration}
|
||||
{:schema v11/schema
|
||||
:schemaVersion 11
|
||||
:migration v11/migration}])
|
||||
:migration v11/migration}
|
||||
{:schema v12/schema
|
||||
:schemaVersion 12
|
||||
:migration v12/migration}])
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
(ns status-im.data-store.realm.schemas.account.v12.core
|
||||
(:require [status-im.data-store.realm.schemas.account.v11.chat :as chat]
|
||||
[status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact]
|
||||
[status-im.data-store.realm.schemas.account.v6.command :as command]
|
||||
[status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter]
|
||||
[status-im.data-store.realm.schemas.account.v7.contact :as contact]
|
||||
[status-im.data-store.realm.schemas.account.v1.discover :as discover]
|
||||
[status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store]
|
||||
[status-im.data-store.realm.schemas.account.v10.message :as message]
|
||||
[status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message]
|
||||
[status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message]
|
||||
[status-im.data-store.realm.schemas.account.v1.request :as request]
|
||||
[status-im.data-store.realm.schemas.account.v1.tag :as tag]
|
||||
[status-im.data-store.realm.schemas.account.v1.user-status :as user-status]
|
||||
[status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group]
|
||||
[status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact]
|
||||
[status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def schema [chat/schema
|
||||
chat-contact/schema
|
||||
command/schema
|
||||
command-parameter/schema
|
||||
contact/schema
|
||||
discover/schema
|
||||
kv-store/schema
|
||||
message/schema
|
||||
pending-message/schema
|
||||
processed-message/schema
|
||||
request/schema
|
||||
tag/schema
|
||||
user-status/schema
|
||||
contact-group/schema
|
||||
group-contact/schema
|
||||
local-storage/schema])
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating v12 account database: " old-realm new-realm)
|
||||
(chat/migration old-realm new-realm))
|
|
@ -0,0 +1,36 @@
|
|||
(ns status-im.data-store.realm.schemas.account.v12.pending-message
|
||||
(:require [taoensso.timbre :as log]))
|
||||
|
||||
(def schema {:name :pending-message
|
||||
:primaryKey :id
|
||||
:properties {:id :string
|
||||
:message-id :string
|
||||
:chat-id {:type :string
|
||||
:optional true}
|
||||
:ack? :bool
|
||||
:requires-ack? :bool
|
||||
:sig :string
|
||||
:pub-key {:type :string
|
||||
:optional true}
|
||||
:sym-key-id {:type :string
|
||||
:optional true}
|
||||
:to {:type :string
|
||||
:optional true}
|
||||
:payload :string
|
||||
:type :string
|
||||
:topic :string
|
||||
:attempts :int
|
||||
:was-sent? :bool}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating pending-message schema v12")
|
||||
(let [messages (.objects old-realm "pending-message")
|
||||
new-messages (.objects new-realm "pending-message")]
|
||||
(dotimes [i (.-length messages)]
|
||||
(let [message (aget messages i)
|
||||
new-message (aget new-messages i)
|
||||
key-type (aget message "key-type")
|
||||
key (aget message "key")]
|
||||
(if (= key-type "sym")
|
||||
(aset new-message "sym-key-id" key)
|
||||
(aset new-message "pub-key" key))))))
|
|
@ -7,4 +7,3 @@
|
|||
(def homoglyph-finder (js/require "homoglyph-finder"))
|
||||
(def identicon-js (js/require "identicon.js"))
|
||||
(def Web3 (js/require "web3"))
|
||||
(def BigNumber (js/require "bignumber.js"))
|
||||
|
|
|
@ -106,4 +106,4 @@
|
|||
web3
|
||||
(assoc options :online-message online-message)))
|
||||
(doseq [pending-message pending-messages]
|
||||
(d/add-prepeared-pending-message! web3 pending-message))))
|
||||
(d/add-prepared-pending-message! web3 pending-message))))
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
(s/def :message/ttl (s/and int? pos?))
|
||||
(s/def :message/from string?)
|
||||
(s/def :message/sig :message/from)
|
||||
(s/def :message/key string?)
|
||||
(s/def :message/privateKeyID (s/nilable string?))
|
||||
(s/def :message/pub-key (s/nilable string?))
|
||||
(s/def :message/sym-key-id (s/nilable string?))
|
||||
(s/def :message/topic string?)
|
||||
(s/def :message-key/type #{:sym :asym "sym" "asym"})
|
||||
(s/def :message/to (s/nilable string?))
|
||||
(s/def :message/message-id string?)
|
||||
(s/def :message/requires-ack? boolean?)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
(defn prepare-message
|
||||
[web3 {:keys [payload keypair to from topics ttl key-password]
|
||||
:as message}
|
||||
:as message}
|
||||
callback]
|
||||
(let [{:keys [public]} keypair
|
||||
|
||||
|
@ -37,22 +37,23 @@
|
|||
(callback
|
||||
(merge
|
||||
(select-keys message [:ttl])
|
||||
{:type (if to :asym :sym)
|
||||
:sig from
|
||||
:key (or to status-key-id)
|
||||
:topic (first topics)
|
||||
:payload payload'}))))))
|
||||
(let [type (if to :asym :sym)]
|
||||
(cond-> {:sig from
|
||||
:topic (first topics)
|
||||
:payload payload'}
|
||||
to (assoc :pubKey to)
|
||||
(not to) (assoc :symKeyID status-key-id)))))))))
|
||||
|
||||
(s/def :shh/pending-message
|
||||
(s/keys :req-un [:message/sig :message-key/type :shh/payload :message/topic]
|
||||
:opt-un [:message/ttl :message/key]))
|
||||
(s/keys :req-un [:message/sig :shh/payload :message/topic]
|
||||
:opt-un [:message/ttl :message/pubKey :message/symKeyID]))
|
||||
|
||||
(defonce pending-mesage-callback (atom nil))
|
||||
(defonce pending-message-callback (atom nil))
|
||||
(defonce recipient->pending-message (atom {}))
|
||||
|
||||
(defn set-pending-mesage-callback!
|
||||
[callback]
|
||||
(reset! pending-mesage-callback callback))
|
||||
(reset! pending-message-callback callback))
|
||||
|
||||
(defn add-pending-message!
|
||||
[web3 {:keys [type message-id requires-ack? to ack?] :as message}]
|
||||
|
@ -74,25 +75,26 @@
|
|||
:requires-ack? (boolean requires-ack?)
|
||||
:attempts 0
|
||||
:was-sent? false}]
|
||||
(when (and @pending-mesage-callback requires-ack?)
|
||||
(@pending-mesage-callback :pending pending-message))
|
||||
(when (and @pending-message-callback requires-ack?)
|
||||
(@pending-message-callback :pending pending-message))
|
||||
(swap! messages assoc-in [web3 message-id to] pending-message)
|
||||
(when to
|
||||
(swap! recipient->pending-message
|
||||
update to set/union #{[web3 message-id to]}))))))))
|
||||
|
||||
(s/def :delivery/pending-message
|
||||
(s/keys :req-un [:message/sig :message/key :message/to :shh/payload
|
||||
:message/requires-ack? :payload/ack? ::id :message/topic
|
||||
::attempts ::was-sent?]))
|
||||
(s/keys :req-un [:message/sig :message/to :shh/payload :payload/ack? ::id
|
||||
:message/requires-ack? :message/topic ::attempts ::was-sent?]
|
||||
:opt-un [:message/pubKey :message/symKeyID]))
|
||||
|
||||
(defn add-prepeared-pending-message!
|
||||
[web3 {:keys [message-id to key-type] :as pending-message}]
|
||||
(defn add-prepared-pending-message!
|
||||
[web3 {:keys [message-id to sym-key-id pub-key] :as pending-message}]
|
||||
{:pre [(valid? :delivery/pending-message pending-message)]}
|
||||
(debug :add-prepeared-pending-message!)
|
||||
(let [message (-> pending-message
|
||||
(select-keys [:sig :key :topic :payload])
|
||||
(assoc :type key-type))
|
||||
(debug :add-prepared-pending-message!)
|
||||
(let [message (assoc
|
||||
(select-keys pending-message [:sig :topic :payload])
|
||||
:symKeyID sym-key-id
|
||||
:pubKey pub-key)
|
||||
pending-message' (assoc pending-message :message message
|
||||
:id message-id)]
|
||||
(swap! messages assoc-in [web3 message-id to] pending-message')
|
||||
|
@ -130,10 +132,10 @@
|
|||
(if message'
|
||||
(assoc-in messages [id to] message')
|
||||
messages))))]
|
||||
(when @pending-mesage-callback
|
||||
(when @pending-message-callback
|
||||
(let [message (get-in messages' [web3 id to])]
|
||||
(when message
|
||||
(@pending-mesage-callback :sent message))))))
|
||||
(@pending-message-callback :sent message))))))
|
||||
|
||||
(defn attempt-was-made! [web3 id to]
|
||||
(debug :attempt-was-made id)
|
||||
|
@ -183,7 +185,7 @@
|
|||
;; if message was not send less then max-attempts-number times
|
||||
;; continue attempts
|
||||
(<= attempts max-attempts-number)
|
||||
;; check retransmition interval
|
||||
;; check retransmission interval
|
||||
(<= (+ last-attempt (* 1000 ack-not-received-s-interval)) (u/timestamp)))))
|
||||
|
||||
(defn- check-ttl
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
(swap! filters update web3 dissoc options)))
|
||||
|
||||
(defn add-shh-filter!
|
||||
[web3 options callback]
|
||||
(let [options' (update options :type (fn [t] (or t :asym)))
|
||||
filter (.filter (u/shh web3) (clj->js options')
|
||||
callback
|
||||
#(log/warn :add-filter-error options %))]
|
||||
[web3 {:keys [key type] :as options} callback]
|
||||
(let [type (or type :asym)
|
||||
options' (cond-> (dissoc options :key)
|
||||
(= type :asym) (assoc :privateKeyID key)
|
||||
(= type :sym) (assoc :symKeyID key))
|
||||
filter (.newMessageFilter (u/shh web3) (clj->js options')
|
||||
callback
|
||||
#(log/warn :add-filter-error (.stringify js/JSON (clj->js options')) %))]
|
||||
(swap! filters assoc-in [web3 options] filter)))
|
||||
|
||||
(defn add-filter!
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[web3 password callback]
|
||||
(.. web3
|
||||
-shh
|
||||
(addSymmetricKeyFromPassword password callback)))
|
||||
(generateSymKeyFromPassword password callback)))
|
||||
|
||||
(defn get-sym-key [web3 password callback]
|
||||
(if-let [key-id (get @password->keys password)]
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
(s/def :shh/payload string?)
|
||||
(s/def :shh/message
|
||||
(s/keys
|
||||
:req-un [:shh/payload :message/ttl :message/key :message/sig
|
||||
:message/topic :message-key/type]))
|
||||
:req-un [:shh/payload :message/ttl :message/sig :message/topic]))
|
||||
|
||||
(defn post-message!
|
||||
[web3 message callback]
|
||||
{:pre [(valid? :shh/message message)]}
|
||||
(debug :post-message message)
|
||||
(let [shh (u/shh web3)]
|
||||
(.post shh (clj->js message) callback)))
|
||||
(let [shh (u/shh web3)
|
||||
message' (assoc message
|
||||
:powTarget 0.001
|
||||
:powTime 1)]
|
||||
(.post shh (clj->js message') callback)))
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
(slurp "resources/js/vendors/jquery-3.1.1.min.js")
|
||||
"}"))
|
||||
(def web3 (str "; if (typeof Web3 == 'undefined') {"
|
||||
(slurp "resources/web3.0_16_0.min.js")
|
||||
(slurp "node_modules/web3/dist/web3.min.js")
|
||||
"}"))
|
||||
(defn web3-init [provider-address]
|
||||
(str "var providerAddress = \"" provider-address "\";"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
;; (str 111122223333441239) => "111122223333441230"
|
||||
|
||||
(defn bignumber [n]
|
||||
(dependencies/BigNumber. (str n)))
|
||||
(dependencies/Web3.prototype.toBigNumber (str n)))
|
||||
|
||||
(def ether-unit-value (bignumber "1000000000000000000"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue