a free (libre) open source, mobile OS for Ethereum https://status.im
Go to file
Andrea Maria Piana c69863cda2
Fix message ordering and improve performance rec. messages
This commit does a few things:

==== Ordering of messages ====

Change the ordering of messages from a mixture of timestamp/clock-value to use
only clock-value.

Datemarks are now not used for sorting anymore, which means that the
order of messages is always causally related (not the case before, as we
were breaking this property by sorting by datemark), but datemark
calculation is unreliable (a reply to a message might have a timestamp <
then the message that is replied to).
So for timestamp calculation we
naively group them ignoring "out-of-order timestamp" messages, although
there's much to improve.
It fixes an issue whereby the user would change their time and the
message will be displayed in the past, although it is still possible to
craft a message with a lower clock value and order it in the past
(there's no way we can prevent this to some extent, but there are ways
to mitigate, but outside the scope of this PR).

==== Performance of receiving messages ====

The app would freeze on pulling messages from a mailserver (100 or so).
This is due to the JS Thread being hogged by CPU calculation, coupled
with the fact that we always tried to process messages all in one go.

This strategy can't scale, and given x is big enough (200,300,1000) the
UI will freeze.

Instead, each message is now processed separately, and we leave a gap
between processing each message for the UI to respond to user input
(otherwise the app freezes again).
Pulling messages will be longer overall, but the app will be usuable
while this happen (albeit it might slow down).
Other strategies are possible (calculate off-db and do a big swap,
avoiding many re-renders etc), but this is the reccommended strategy by
re-frame author (Solving the CPU Hog problem), so sounds like a safe
base point.

The underlying data structure for holding messages was also changed, we
used an immutable Red and Black Tree, same as a sorted map for clojure, but we use
a js library as is twice as performing then clojure sorted map.

We also don't sort messages again each time we receive them O(nlogn), but we
insert them in order O(logn).

Other data structures considered but discarded:
1) Plain vector, but performance prepending/insertion in the middle
(both O(n)) were not great, as not really suited for these operations.

2) Linked list, appealing as append/prepend is O(1), while insertion is
O(n). This is probably acceptable as messages tend to come in order
(from the db, so adding N messages is O(n)), or the network (most of
them prepends, or close to the head), while mailserver would not follow this path.
An implementation of a linked list was built, which performed roughtly the
same as a clojure sorted-map (although faster append/prepend), but not
worth the complexity of having our own implementation.

3) Clojure sorted-map, probably the most versatile, performance were
acceptable, but nowhere near the javascript implementation we decided on

4) Priority map, much slower than a sorted map (twice as slow)

5) Mutable sorted map, js implementation, (bintrees), not explored this very much, but from
just a quick benchmark, performance were much worse that clojure
immutable sorted map

Given that each message is now processed separately, saving the chat /
messages is also debounced to avoid spamming status-go with network
requests. This is a temporary measure for now until that's done directly
in status-go, without having to ping-pong with status-react.

Next steps performance wise is to move stuff to status-go, parsing of
transit, validation, which is heavy, at which point we can re-consider
performance and how to handle messages.

Fixes also an issue with the last message in the chat, we were using the
last message in the chat list, which might not necessarely be the last
message the chat has seen, in case messages were not loaded and a more
recent message is the database (say you fetch historical messages for
1-to-1 A, you don't have any messages in 1-to-1 chat B loaded, you receive an
historical message for chat B, it sets it as last message).

Also use clj beans instead of js->clj for type conversion

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-11-01 23:59:26 +01:00
.dependabot Filter for security updates only in Dependabot 2019-10-17 11:05:34 +02:00
.github Enable high priority tests in PRs 2019-10-14 13:52:49 +02:00
android fixes animated gifs on Android 2019-11-01 13:05:03 +01:00
ci fix type of shell used for s3cmd uploads 2019-10-18 11:27:37 +02:00
components/src/status_im Onboarding UI fixes 2019-10-10 21:00:29 +02:00
deployment Desktop works with react-navigation v3 2019-10-02 10:19:37 +03:00
desktop Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
dev/status_im [perf] Move translation to node_modules in release build 2019-06-05 18:40:53 +03:00
doc remove realm 2019-09-09 18:40:15 +02:00
env Onboarding sign-in 2019-07-11 15:46:24 +03:00
fastlane combined node package upgrade prs 2019-10-17 12:43:17 +02:00
fiddle remove firebase 2019-10-29 15:03:58 +01:00
ios Bump @react-native-community/netinfo in /mobile/js_filesBumps [@react-native-community/netinfo](https://github.com/react-native-community/react-native-netinfo) from 4.2.2 to 4.4.0.- [Release notes](https://github.com/react-native-community/react-native-netinfo/releases)- [Changelog](https://github.com/react-native-community/react-native-netinfo/blob/master/CHANGELOG.md)- [Commits](https://github.com/react-native-community/react-native-netinfo/compare/v4.2.2...v4.4.0)Signed-off-by: dependabot-preview[bot] <support@dependabot.com> 2019-10-31 11:12:11 +01:00
mobile/js_files Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
modules remove firebase 2019-10-29 15:03:58 +01:00
nix fixes animated gifs on Android 2019-11-01 13:05:03 +01:00
patches Switch desktop app to react-native-desktop 0.57.8 (#7264) 2019-01-17 12:10:40 +02:00
prod/status_im Remove RAM bundle support 2019-08-30 17:13:35 +02:00
react-native/src remove firebase 2019-10-29 15:03:58 +01:00
resources drop les 2019-10-15 13:55:39 +02:00
scripts nix: Upgrade expected Xcode version to 11.1 2019-10-15 18:40:26 +02:00
src/status_im Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
status-modules [perf] Move translation to node_modules in release build 2019-06-05 18:40:53 +03:00
test Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
translations [#9233, #9173] fix some screens 2019-10-30 15:17:28 +01:00
.TOOLVERSIONS Only bring in Android dependencies in gomobile if targetting Android 2019-07-05 13:40:31 +02:00
.babelrc Move files that don't change per platform to the root 2019-06-06 16:56:24 +02:00
.buckconfig upgrade react-native and packages - but broken 2016-04-24 15:07:08 +07:00
.dockerignore Create Nix package for building status-go 2019-04-09 12:44:39 +02:00
.env Desktop works with react-navigation v3 2019-10-02 10:19:37 +03:00
.env.e2e Desktop works with react-navigation v3 2019-10-02 10:19:37 +03:00
.env.jenkins Desktop works with react-navigation v3 2019-10-02 10:19:37 +03:00
.env.nightly Desktop works with react-navigation v3 2019-10-02 10:19:37 +03:00
.env.release Desktop works with react-navigation v3 2019-10-02 10:19:37 +03:00
.envrc Migrate from installing tooling the traditional way to Nix 2019-03-21 13:56:57 +01:00
.eslintrc.js Upgrade react-native to 0.60.5 2019-09-12 16:13:42 +02:00
.flowconfig Upgrade react-native to 0.60.5 2019-09-12 16:13:42 +02:00
.gitattributes Desktop branch merged into develop (#5266) 2018-07-23 18:21:31 +03:00
.gitignore Make root folder less busy 2019-09-12 16:54:12 +02:00
.mailmap fix my name 2019-02-28 14:50:42 +01:00
.nycrc add coverage test 2019-07-10 16:15:44 -04:00
.prettierrc.js Upgrade react-native to 0.60.5 2019-09-12 16:13:42 +02:00
.watchmanconfig Ensure shell.nix uses same nixpkgs as the rest of the environment 2019-06-20 09:18:24 -04:00
ICONS.md [#8977] [Multi-account] Allow user to choose wallet for DApp transactions 2019-10-11 11:08:56 +02:00
LICENSE.md Create LICENSE.md 2016-09-21 10:00:44 +08:00
Makefile avoid spawning too many Nix shells 2019-10-25 18:00:23 +02:00
README.md add coverage test 2019-07-10 16:15:44 -04:00
REVIEW.md typos in REVIEW.md 2019-09-23 14:06:40 +02:00
TROUBLESHOOTING.md replace require-macro for defnstyle and defstyle 2019-09-25 17:18:26 +02:00
VERSION Move files that don't change per platform to the root 2019-06-06 16:56:24 +02:00
app.json update react-native and project dependencies 2017-12-15 16:06:13 +01:00
build.clj [perf] Move translation to node_modules in release build 2019-06-05 18:40:53 +03:00
clj-rn.conf.edn Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
default.nix build status-go for Nix cache 2019-07-23 01:01:41 -04:00
deps.edn remove dev-server and extensions for v1 2019-08-20 17:42:02 +02:00
export-icons.gif [#8977] [Multi-account] Allow user to choose wallet for DApp transactions 2019-10-11 11:08:56 +02:00
externs.js Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
figwheel-bridge.js Use multiple app instances simultaneously 2018-11-28 19:10:12 +02:00
findSymlinkedModules.js.patch RN weird Jenkins stuff fix 2017-12-16 23:46:45 +01:00
prepare-modules.js [perf] prod version of slurp 2019-06-11 15:52:23 +03:00
project.clj Fix message ordering and improve performance rec. messages 2019-11-01 23:59:26 +01:00
react-native.config.js Upgrade react-native to 0.60.5 2019-09-12 16:13:42 +02:00
rn-cli.config.js Make root folder less busy 2019-09-12 16:54:12 +02:00
shell.nix customize TMPDIR and clean it 2019-10-18 09:40:11 +02:00
status-go-version.json Use payload & avoid transforming in clojure objects. 2019-10-23 15:52:32 +02:00
supervisord.conf Add docker-compose for development build 2018-04-11 14:58:38 +01:00
ubuntu-server.js remove realm 2019-09-09 18:40:15 +02:00

README.md

Status - a Mobile Ethereum Operating System

Join us in creating a browser, messenger, and gateway to a decentralized world. Status is a free (libre) open source mobile client targeting Android & iOS built entirely on Ethereum technologies. That's right, no middle men and go-ethereum running directly on your device.

Getting started with Status

Why?

We believe in a medium of pure free trade, economies with fair, permission-less access and a world without intermediaries. We want to create policies that can exist between friends or scale globally, we want to communicate securely and be uninhibited by legacy systems.

We want to take responsibility for our data, the way we conduct ourselves privately and promote this way of life to a mass audience.

We want deep insights into our own economies so we can make informed, data-driven decisions on how to make our lives better. The Ethereum blockchain, Smart Contracts, Swarm and Whisper provides us a path forward.

If this interests you, help us make Status a reality - anyone can contribute and we need everyone at any skill level to participate.

How to Contribute?

Go straight to the docs or join our chat and choose what interests you:

  • Developer Developers are the heart of software and to keep Status beating we need all the help we can get! If you're looking to code in ClojureScript or Golang then Status is the project for you! We use React Native and there is even some Java/Objective-C too!
    Want to learn more about it? Start by reading our Developer Introduction which guides you through the technology stack and start browsing beginner issues. Then you can read how to Build Status, which talks about managing project dependencies, coding guidelines and testing procedures.

  • Community Management
    Metcalfe's law states that the value of a network is proportional to the square of the number of connected users of the system - without community Status is meaningless. We're looking to create a positive, fun environment to explore new ideas, experiment and grow the Status community. Building a community takes a lot of work but the people you'll meet and long lasting relationships you form will be well worth it, check out our Community Principles

  • Specification / Documentation
    John Dewey once said "Education is not preparation for life; education is life itself ". Developers & Designers need guidance and it all starts from documentation and specifications. Our software is only as good as its documentation, head over to our docs and see how you can improve what we have.

  • Blog Writing
    Content is King, keeping our blog up to date and informing the community of news helps keep everyone on the same page. Jump into our chat and discuss with the team how you can contribute!

  • Testers
    It's bug hunting season! Status is currently in Alpha and there is sure to be a bunch of learning, build status from scratch or if an android user check out our nightly builds. You can shake your phone to submit bug reports, or start browsing our Github Issues. Every bug you find brings Status closer to stable, usable software for everyone to enjoy!

  • Security
    Status is a visual interface to make permanent changes on the Blockchain, it handles crypto-tokens that have real value and allows 3rd party code execution. Security is paramount to its success. You are given permission to break Status as hard as you can, as long as you share your findings with the community!

  • Evangelism
    Help us spread the word! Tell a friend right now, in fact tell everyone - yell from a mountain if you have to, every person counts! If you've got a great story to tell or have some interesting way you've spread the word about Status let us know about it in our chat

Status API

View our API Docs and learn how to integrate your DApp into Status. You can read more about how to add your DApp to Status here.

Give me Binaries!

You can get our Beta builds for both Android and iOS on our website, through our nightly builds or by building it yourself.

Core Contributors

Core Team Members

Special thanks to @adrian-tiberius. Without the dedication of these outstanding individuals, Status would not exist.

Contact us

Feel free to email us at support@status.im or better yet, join our chat.

License

Licensed under the Mozilla Public License v2.0

Testing Supported by

BrowserStack Status

Coverage Status