Tribler / trustchain-superapp

Kotlin implementation of Trustchain and IPv8 with rich networking: multihoming of local Bluetooth+4G, decentral social networking, UDP hole punching, etc.
GNU General Public License v3.0
80 stars 63 forks source link

Superapp cleanup #161

Open kandrio opened 1 year ago

kandrio commented 1 year ago

After our discussion with @synctext (https://github.com/Tribler/tribler/issues/7438#issuecomment-1632366938), I'm creating this "parent" issue to describe what needs to be done in the trustchain-superapp in order to make it lighter and more efficient.

Here's a list of issues we need to tackle:

  1. Keep only 6 sub-modules:
  2. Ensure that, each time the superapp runs, only the needed module gets executed, and there are no unnecessary modules loaded or running in the background.
  3. Make musicdao a mature prototype by:
  4. Add/fix Github actions

Personal fork: https://github.com/kandrio/trustchain-superapp

kandrio commented 1 year ago

Today, I had a meeting with @InvictusRMC and we created a skeleton of my work for the upcoming weeks:

  1. Independence: Make the six modules that I mentioned in the previous comment completely independent (of one another and of other modules): Currently some of these modules import classes from other modules, so most probably I will need to move these class definitions into a common-code directory.
  2. Cleanup: Drop all other modules apart from these six.
  3. Testing: Use the espresso library (https://developer.android.com/training/testing/espresso) for e2e testing on musicdao. My work will be a baseline for testing for future projects that students will work on in the next years.
synctext commented 1 year ago

Solid plans! Please focus on a Google Play Store and live demo for 5 Sep @ TUDelft campus. So ask @InvictusRMC for a 1 Sep .APK upload for review to Google or obtain your own account from him.

For market leaders such as GoldRepublic it would be great to offer "GoldEuro" coins within our Superapp. So the demo is for offline token transfer. Web-of-Trust is great concept to explain. https://github.com/Tribler/trustchain-superapp#digital-euro Future work: we need a simple understandable rule around offline double spending. We re-define it as "overspending" with negative balance tied to your passport-level digital identity. Irrefutable, you can't escape your fraud. Second, "first-to-claim" rule. When coming online again the ordering is determined of the claims on an "overspender". This is the order the system follows on repayment of accumulated debt by overspender.

kandrio commented 1 year ago

MusicDAO Independence

MusicDAO depends from the following modules:

  1. currencyii (Luxury Communism): https://github.com/Tribler/trustchain-superapp/tree/master/currencyii
  2. gossipML: https://github.com/Tribler/trustchain-superapp/tree/master/gossipML

We plan to get rid of both of the above modules. Therefore, I will most probably put them under the common module (https://github.com/Tribler/trustchain-superapp/tree/master/common).

IDelft (valuetransfer) Independence

IDelft depends from the following modules:

  1. peerchat: https://github.com/Tribler/trustchain-superapp/tree/master/peerchat
  2. ig-ssi (18+): https://github.com/Tribler/trustchain-superapp/tree/master/ig-ssi
kandrio commented 1 year ago

Pruning of old, unused modules

Personal Fork

I've successfully pruned the following modules in my personal fork (https://github.com/kandrio/trustchain-superapp):

Upstream

I've successfully pruned from our GitHub repo the following modules:

Relevant PR: https://github.com/Tribler/trustchain-superapp/pull/162

Pruning of modules that are dependencies

In this section we list modules that are harder to prune because they are dependencies for the modules that we plan to keep.

Personal Fork

I've successfully pruned the following modules in my personal fork (https://github.com/kandrio/trustchain-superapp):

Upstream

I've successfully pruned from our GitHub repo the following modules:

kandrio commented 1 year ago

Trustchain Explorer and Notification

As specified in the comment above (https://github.com/Tribler/trustchain-superapp/issues/161#issuecomment-1645454443), the Trustchain Explorer is one of the modules we need to get rid of. However, there is one issue: the parent app invokes the TrustChainExplorerActivity Activity whenever the user clicks on the notification. Here's a more detailed explanation of the issue...

Issue with Trustchain Explorer

When the user installs the Trustchain Superapp on their device, there is a notification that looks like this:

When clicking on that notification, the Trustchain Explorer module opens up:

This is expected because in the TrustChainService.createNotification() member function, we set that the TrustChainExplorerActivity will get executed when the user taps on the notification. Here's the corresponding line of code:

Decisions to make

  1. Given the new information I found above, should we get rid of the Trustchain Explorer completely, or should we keep it? Maybe we want it to get spawned whenever the user taps on the notification, maybe not...
  2. If get rid of the Trustchain Explorer, what Activity will the notification spawn instead?

My personal opinion: We should get rid of the notification entirely. It does not seem to add to the user experience (constantly present on the drop-bar even if the user taps on it) and it does not provide much useful information (statically showing: "Running"). Followingly, we get rid of the Trustchain Explorer as well.

UPDATE: Feasible Solution

It turns out that we can't easily get rid of the notification. This is because the IPv8Service creates the notification for our trustchain-superapp. So, if we want to get rid of the notification, we need to update the kotlin-ipv8 code, which is in another repository. Specifically, here is the specific line where the IPv8Service creates a notification:

Therefore, one alternative solution would be to:

CC @InvictusRMC @synctext

synctext commented 1 year ago

agreed! just get rid of this notification entirely.

kandrio commented 1 year ago

@synctext I looked into dropping the notification entirely, but I found that we can't do it through the trustchain-superapp. Take a look at the UPDATE: Feasible Solution section of the above comment.

synctext commented 1 year ago

good idea. Smart, keep IPv8 unpatched. please also modify the notification into something sensible, like, superapp running.

kandrio commented 1 year ago

@InvictusRMC I created a PR (https://github.com/Tribler/trustchain-superapp/pull/162) where I prune all the old modules. These are the modules that are completely useless to the ones that we plan to keep. It will help to get rid of these first, and then to move to the remaining modules that need to be pruned.

The five modules that we plan to keep still depend on the following remaining modules: currencyii, peerchat, ig-ssi. I won't prune these three in this PR. However, I will get rid of them in my next PR.

kandrio commented 11 months ago

@InvictusRMC After the above PR (https://github.com/Tribler/trustchain-superapp/pull/162) that prunes 9 unwanted modules, I created another PR (https://github.com/Tribler/trustchain-superapp/pull/163) that prunes currencyii. The latter was harder since musicdao (which we plan to keep) heavily depends on currencyii. Hence, I created a standalone PR just for the prunning of currencyii.

CC @synctext

kandrio commented 11 months ago

@InvictusRMC I'm continuing the effort here. I created another PR (https://github.com/Tribler/trustchain-superapp/pull/164) that prunes ig-ssi. This one was a complex module to prune as well because iDelft depended on it.

synctext commented 11 months ago

perfect effort people! Please plan toward a Google Playstore upload of a fully operational .apk That process may take 7-10 days.

kandrio commented 11 months ago

Yet another PR here:

This PR prunes the last modules in our list:

Peerchat in particular was very difficult to prune as it was used not only by iDelft but also by the entire parent app.

This PR should conclude the effort of pruning all of the unnecessary modules. For a summary of what modules I pruned in total, take a look at this comment:

Summary of the cleanup work done

Here's a summary of the PRs that I've created (should be merged in that order):

  1. https://github.com/Tribler/trustchain-superapp/pull/162
  2. https://github.com/Tribler/trustchain-superapp/pull/163
  3. https://github.com/Tribler/trustchain-superapp/pull/164
  4. https://github.com/Tribler/trustchain-superapp/pull/165

CC @InvictusRMC @synctext

kandrio commented 10 months ago

Current State

We have:

Next Steps

Looking at the original list of tasks (https://github.com/Tribler/trustchain-superapp/issues/161#issue-1807532878), I see we have the following things remaining:

  1. PeerAI is not part of Tribler/trustchain-superapp. Instead, it currently lives in @quintene's repo: https://github.com/quintene/trustchain-superapp. We should create a PR and merge that to Tribler/trustchain-superapp.
  2. Make MusicDAO a mature prototype:
    • Review and merge the recommendation tab (relevant PR: https://github.com/Tribler/trustchain-superapp/pull/160).
    • Introduce testing (espresso library). Judging from the contents of the musicdao/src/test directory, there are no tests currently. We should start with unit tests and then add integration tests and e2e tests.
    • Fix the GUI: I don't know what that refers to. Are there specific problems with the GUI?
    • Improve code readability.
  3. Add/fix GitHub actions: I don't think that GitHub Actions are broken. Regarding adding more, any ideas?

@synctext @InvictusRMC any comments?

InvictusRMC commented 10 months ago

My ideas:

Issues I am aware of:

InvictusRMC commented 10 months ago

Also, see this minor issue: #168

kandrio commented 10 months ago

@InvictusRMC Thanks a lot for the update. I'm currently really busy with finishing my literature survey (https://github.com/Tribler/tribler/issues/7438#issuecomment-1673453795). So, I'll focus on the superapp towards the end of the week.

First things I plan to kill are: