Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First PR for the detoks transaction engine #149

Open
wants to merge 95 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
e666993
Add TransactionCommunity
Nealzahar Mar 5, 2023
1153d5d
Merge branch 'Tribler:master' into master
bbrockbernd Mar 6, 2023
58826bb
Text + button
bbrockbernd Mar 6, 2023
496034c
WIP: conntected ui elements with ipv8 overlay
bbrockbernd Mar 6, 2023
0a28c4e
resized text
bbrockbernd Mar 6, 2023
a5aa797
Configure new android module for transaction engine
Nealzahar Mar 11, 2023
ab1390c
WIP tokenstore, added sqldelight db, and new activity to explore peer…
bbrockbernd Mar 12, 2023
d856472
Bug fixes
bbrockbernd Mar 12, 2023
6021c79
Bug fixes
bbrockbernd Mar 12, 2023
f03a462
more bugfixes + ui improvements
bbrockbernd Mar 15, 2023
3635f0c
Merge pull request #1 from bbrockbernd/tokenstore
bbrockbernd Mar 15, 2023
fcf24a3
Added remove all button and fixed freezing ui after receiving token. …
bbrockbernd Mar 15, 2023
bb1fb83
Merge branch 'master' into sync_fork
bbrockbernd Mar 19, 2023
f37dc39
Merge branch 'my_master' into sync_fork
bbrockbernd Mar 19, 2023
daefd5f
Merge pull request #2 from bbrockbernd/sync_fork
bbrockbernd Mar 19, 2023
6d3ace5
Merge branch 'my_master' into tokenstore
bbrockbernd Mar 19, 2023
c82d9e6
Merge pull request #3 from bbrockbernd/tokenstore
bbrockbernd Mar 19, 2023
74b8f52
Fix refresh button by using the existing list instead of assigning ou…
bbrockbernd Mar 20, 2023
4fd038e
feat: group msg by recipient
C6H5-NO2 Mar 22, 2023
c0c51a1
Merge pull request #4 from bbrockbernd/fix_refresh
bbrockbernd Mar 22, 2023
05dcbe6
Fix refresh button by using the existing list instead of assigning ou…
bbrockbernd Mar 23, 2023
3c2f6ee
Merge remote-tracking branch 'origin/use_trustchain' into group_trans…
C6H5-NO2 Mar 26, 2023
37fdb9b
wip
bbrockbernd Mar 29, 2023
30ec503
Create README.md
AkramNexus Apr 1, 2023
ccba8ef
feat: grouping and resending for trustchain
C6H5-NO2 Apr 2, 2023
a8ad3c7
Merge pull request #5 from bbrockbernd/group_transaction
C6H5-NO2 Apr 7, 2023
c5ed80e
Disable other apps
Nealzahar Apr 8, 2023
197daa7
bugfixes trustchain
bbrockbernd Apr 11, 2023
310182f
Merge branch 'my_master' into use_trustchain
bbrockbernd Apr 12, 2023
48d42b3
Merged community and grouped adapter
bbrockbernd Apr 12, 2023
30a5973
wip
bbrockbernd Apr 12, 2023
dafe16e
bugfixes
bbrockbernd Apr 12, 2023
4aed949
add some documentation for public methods
bbrockbernd Apr 12, 2023
b222fe6
added benchmark page and debugged fetching tokens from blockchain
bbrockbernd Apr 13, 2023
59cdd80
fix tokenupdate
bbrockbernd Apr 13, 2023
c3797e9
bugfix multiple clients running
bbrockbernd Apr 13, 2023
8f86cb6
Merge branch 'use_trustchain' into test_enviroment
Nealzahar Apr 13, 2023
2d368b3
Add first throughput checker
Nealzahar Apr 13, 2023
6e4dbdc
Add benchmarks for packets received and throughput
Nealzahar Apr 14, 2023
cb4f4d2
Add latency benchmark
Nealzahar Apr 14, 2023
336974d
Fix all the benchmarks
Nealzahar Apr 14, 2023
c757f27
Add minor fixes
Nealzahar Apr 17, 2023
2ce418a
Merge pull request #7 from bbrockbernd/test_enviroment
nealsweijen61 Apr 17, 2023
c7c4f96
feat: add sender unit test
C6H5-NO2 Apr 17, 2023
afab7f7
Update README.md
SDuveen Apr 18, 2023
6b86b8e
Add files via upload
SDuveen Apr 18, 2023
f734148
Update README.md
SDuveen Apr 18, 2023
4f55823
Update README.md
SDuveen Apr 18, 2023
d4aa5d7
Update README.md
SDuveen Apr 18, 2023
fa894dc
Update README.md
SDuveen Apr 18, 2023
717ddfa
Update README.md
SDuveen Apr 18, 2023
135e08f
Update README.md
SDuveen Apr 18, 2023
4ad8b9f
Add files via upload
SDuveen Apr 18, 2023
2096ab3
Update README.md
SDuveen Apr 18, 2023
f72d5c9
Update README.md
SDuveen Apr 18, 2023
c7317e3
Added the section on how to properly use the app
AkramNexus Apr 18, 2023
a4d1d90
Update README.md
SDuveen Apr 18, 2023
28d1bd2
Update README.md
AkramNexus Apr 18, 2023
b8dbf2d
Update README.md
AkramNexus Apr 18, 2023
f1f3ca0
Update README.md
AkramNexus Apr 18, 2023
19eb4f6
Add files via upload
SDuveen Apr 18, 2023
c38fa47
Update README.md
SDuveen Apr 18, 2023
0e7a648
Update README.md
SDuveen Apr 18, 2023
c63a31c
Update README.md
SDuveen Apr 18, 2023
897e4b2
Update README.md
SDuveen Apr 18, 2023
7fa7fef
Update README.md
SDuveen Apr 18, 2023
74527f5
Add files via upload
SDuveen Apr 18, 2023
0a7ca88
Update README.md
SDuveen Apr 18, 2023
9a9131c
fixes
bbrockbernd Apr 18, 2023
33fe0e7
Now 10000 instead of 10 10000
SDuveen Apr 18, 2023
24d328d
bugfix multiple peers order of sending tokens
bbrockbernd Apr 18, 2023
5407211
added comment
bbrockbernd Apr 18, 2023
458decb
fix ui thingy
bbrockbernd Apr 18, 2023
25d0e04
Merge pull request #8 from bbrockbernd/last_fixes
bbrockbernd Apr 18, 2023
c6e51a8
Update README.md
SDuveen Apr 18, 2023
f356310
Update README.md
SDuveen Apr 18, 2023
b78d60e
Update README.md
SDuveen Apr 18, 2023
b118b5b
Add files via upload
SDuveen Apr 19, 2023
4898ac0
Update README.md
SDuveen Apr 19, 2023
3e772e8
Update README.md
SDuveen Apr 19, 2023
98cb571
Update README.md
SDuveen Apr 19, 2023
1745393
reactive the other apps
Nealzahar Apr 19, 2023
977257e
Merge pull request #9 from bbrockbernd/activate_apps
nealsweijen61 Apr 19, 2023
1899780
Update README.md
bbrockbernd Apr 19, 2023
2f32abb
Merge pull request #10 from bbrockbernd/Documentation
AkramNexus Apr 19, 2023
fdcc69d
Add files via upload
bbrockbernd Apr 19, 2023
74478d1
Delete util folder
Nealzahar Apr 19, 2023
ff3b201
Merge pull request #11 from bbrockbernd/delete_util
nealsweijen61 Apr 19, 2023
566d57d
Update README.md
bbrockbernd Apr 19, 2023
887fa86
Merge pull request #12 from bbrockbernd/Documentation
bbrockbernd Apr 19, 2023
519ef22
Change fragment_detoks
Nealzahar Apr 19, 2023
9b87baf
Merge pull request #13 from bbrockbernd/detok_engine_unit_test
C6H5-NO2 Apr 19, 2023
c31e408
fix unit test
C6H5-NO2 Apr 19, 2023
6cd040d
bugfix multiple clients running
bbrockbernd Apr 20, 2023
a6a8793
Merge pull request #14 from bbrockbernd/add_actual_tests
bbrockbernd Apr 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ dependencies {
implementation project(':atomic-swap')
implementation project(':literaturedao')
implementation project(':detoks')
implementation project(':detoks-engine')
api(project(':common')) {
exclude group: 'net.java.dev.jna'
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/nl/tudelft/trustchain/app/AppDefinition.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import nl.tudelft.trustchain.trader.ui.TrustChainTraderActivity
import nl.tudelft.trustchain.valuetransfer.ValueTransferMainActivity
import nl.tudelft.trustchain.voting.VotingActivity
import nl.tudelft.trustchain.detoks.DeToksActivity
import nl.tudelft.trustchain.detoks_engine.DeToksEngineMainActivity

enum class AppDefinition(
@DrawableRes val icon: Int,
Expand All @@ -36,6 +37,13 @@ enum class AppDefinition(
DeToksActivity::class.java,
true,
),
DETOKS_ENGINE(
R.drawable.ic_detox_logo,
"DeToksEngine",
R.color.purple,
DeToksEngineMainActivity::class.java,
true,
),
EIGHTEEN_PLUS(
R.drawable.ic_18_plus,
"18+",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ import nl.tudelft.trustchain.common.bitcoin.WalletService
import nl.tudelft.trustchain.common.eurotoken.GatewayStore
import nl.tudelft.trustchain.common.eurotoken.TransactionRepository
import nl.tudelft.trustchain.currencyii.CoinCommunity
import nl.tudelft.trustchain.detoks_engine.TransactionCommunity
import nl.tudelft.trustchain.detoks.DeToksCommunity
import nl.tudelft.trustchain.detoks_engine.trustchain.CommunityAdapter
import nl.tudelft.trustchain.detoks_engine.trustchain.TrustChainTransactionCommunity
import nl.tudelft.trustchain.eurotoken.community.EuroTokenCommunity
import nl.tudelft.trustchain.eurotoken.db.TrustStore
import nl.tudelft.trustchain.gossipML.RecommenderCommunity
Expand Down Expand Up @@ -107,6 +110,10 @@ class TrustChainApplication : Application() {
createPeerChatCommunity(),
createEuroTokenCommunity(),
createTFTPCommunity(),
createIdentityCommunity(),
createDeToksCommunity(),
createTransactionCommunity(),
createTrustChainTransactionCommunity(),
createDemoCommunity(),
createWalletCommunity(),
createAtomicSwapCommunity(),
Expand All @@ -117,9 +124,7 @@ class TrustChainApplication : Application() {
createMusicCommunity(),
createLiteratureCommunity(),
createRecommenderCommunity(),
createIdentityCommunity(),
createFOCCommunity(),
createDeToksCommunity()
),
walkerInterval = 5.0
)
Expand Down Expand Up @@ -283,6 +288,27 @@ class TrustChainApplication : Application() {
)
}

private fun createTransactionCommunity(): OverlayConfiguration<TransactionCommunity> {
val randomWalk = RandomWalk.Factory()
return OverlayConfiguration(
Overlay.Factory(TransactionCommunity::class.java),
listOf(randomWalk)
)
}

private fun createTrustChainTransactionCommunity(): OverlayConfiguration<TrustChainTransactionCommunity> {
val randomWalk = RandomWalk.Factory()
val blockTypesBcDisabled: Set<String> = setOf(CommunityAdapter.TOKEN_BLOCK_TYPE)
val settings = TrustChainSettings(blockTypesBcDisabled)
val driver = AndroidSqliteDriver(Database.Schema, this, "trustchaindetoks.db")
val store = TrustChainSQLiteStore(Database(driver))

return OverlayConfiguration(
TrustChainTransactionCommunity.Factory(settings, store),
listOf(randomWalk)
)
}

private fun createDiscoveryCommunity(): OverlayConfiguration<DiscoveryCommunity> {
val randomWalk = RandomWalk.Factory()
val randomChurn = RandomChurn.Factory()
Expand Down
1 change: 1 addition & 0 deletions detoks-engine/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
141 changes: 141 additions & 0 deletions detoks-engine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Blockchain Engineering 2023 - Token Transaction Engine II

This folder contains our implemented and working token transaction engine. This engine allows for a fast and lightweight solution for fast token transactions based on the [Trustchain](https://github.com/Tribler/kotlin-ipv8/blob/master/doc/TrustChainCommunity.md). We make use of an [IPv8](https://github.com/Tribler/kotlin-ipv8) overlay on which we've built forward. The concept of Trustchain is one used for communicating and bookkeeping, to make sure the transactions are communicated properly, and that also the integrity can be maintained and ensured.

## Content

Our app has the following content:

- **Token generation:** With our app it is possible to generate tokens on a large scale. The purpose of this is to create some form of currency to send to other peers currently active, you will also be able to see what tokens you have, and which ones you've recieved. To generate a token, simply use the button to generate one, then, select a peer in the current peers list, and then hit send to give them a token! If for some reason you don't like one of the tokens you've generated, you can select them and delete them too, or just delete them all.

- **Visible peers:** We maintain a list of the peers currently in proximity. It's very easily possible to see what peers are currently around with their id's in a handy list. It's also possible to refresh, as other peers may have joined in as well during the usage.

- **Sending tokens to peers:** It is possible to send many tokens at once to other peers in the vicinity, this can be done individually to a scale of a thousand tokens per second

## The structure of the project

The project and the code can be found in the current folder, the ```trustchain-superapp/detoks-engine``` folder. Our code is split up into multiple files, with each having their own specific role to play. Most of the related code to the transaction engine can be found in the TransactionCommunty file, where we handle tasks such as message grouping. In addition, we split up the code handling the SQLite database management and the token management code up as well. In ```db``` the tasks regarding the former are handled, while in the ```manage_tokens``` folder the latter is done.

## Using the app

Whilst first enabling our app in the trustchain-superapp, you'll be greeted with the entrance screen of the detoks engine. This screen has some video, and a button to take you to the sending tokens page. This app has a couple of important parts, which we will all discuss here to ensure proper app usage. Firstly, the numbers on the top show:

- How many tokens you're currently in possesion of
- The percentage (%) of tokens recieved when sending
- The amount of tokens that are being sent per second, if applicable
- The latency between sending and recieving the tokens

These statistics are an important part of knowing if your token may or may no have arrived, and also to know how well the performance of the app is, which may be key for benchmarking. In addition in the list below, you can see the fellow peers that you're able to send the tokens to if you wish so. These peers are selectable by ID.

Lastly, the buttons on the bottom allow you to not only generate the tokens on a large scale (1000 or 100000), but also send them to a peer, this is done as follows:

1) Ensure you have some tokens to send, use the generate token buttons at the bottom to do so
2) Next, select a peer from the list to send tokens to by tapping on them, you may need to go back one screen and enter again to force a refresh
3) Determine if you want to send many tokens at once or some per second, and press the button
4) Afterwards the statistics on the top of the screen will update accordingly

## Design

When opening the application, you see a page with two buttons. These buttons both bring you to a different page. Manage tokens, where you can send and generate tokens, and benchmarks, where you can also see some statistics.

<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/Screenshot_20230417_182253.png" width="180">

On the manage tokens page, you will find a list of all your tokens at the top, followed by a list of currently available peers. To create a new token, you can click on the "gen token" button located at the bottom of the page. Once you have accumulated enough tokens, you can send them to a selected peer by clicking on either the "send", "send 2", or "send 5" buttons, which will respectively send 1, 2, or 5 tokens. The application operates on the FIFO principle, meaning that the tokens generated first will be sent first. Lastly, you can refresh the page by clicking on the refresh button.

<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/Screenshot_20230418_135848.png" width="180"> <img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/token%20manager.gif" width="180">

The benchmarks page displays various statistics related to the application. At the top, you can view the number of tokens that you currently possess. Following that, you can find the percentage of sent packets that have successfully reached the designated peer. The throughput, measured in tokens per second, is displayed below the percentage. At the end of the statistics, you see the latency. After the statistics, a list of the currently available peers is displayed. At the bottom of the screen, you can find buttons specifically meant for generating or sending a large number of tokens.

<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/Screenshot_20230418_145945.png" width="180"> <img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/benchmark.gif" width="180">

### Do you want to add your own app?

- [Adding your own app to the TrustChain Super App](doc/AppTutorial.md)

## Performance

The statistics are all calculated for three different group sizes. These sizes are 1, 10 and 100.

### Latency
Below, the average latency plotted over time is displayed. Here it is clear what the optimal group size is. The latency for groups of size 10 never rises above the latency of other group sizes. Groups of size 100 start with a latency that is better than the latency for groups of size 1 but rises above it for a while at the end. Finally, the latency for groups of size 1 starts high but spikes at the end.

<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/latency.png" width="400">

### Received packages
Below, you see the percentage of sent packets that have been received by a chosen peer over time. Depending on what you are looking for, there are two optimal sizes. The percentage of received packages for groups of size 1 gradually increases over time but only reaches 100% after significantly more time than the other sizes. For groups of size 100, the percentage of received packages does decrease for a while but reaches 100% the fastest out of all group sizes.

<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/packetsreceived.png" width="400">

### Throughput
Lastly, you see the throughput plotted over time. The optimal group size, in this case, is 100, as it results in a throughput that stays the highest out of all groups. Next is group size 10, and last is group size 1.

<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/Throughput.png" width="400">

### Flame chart
This flame chart shows the performance during sending 5000 tokens at a rate of 1000 tokens per second.
<img src="https://github.com/bbrockbernd/trustchain-superapp/blob/Documentation/detoks-engine/flamechart.jpeg" width="1200">

## Implementation

The core of the application is the CommunityAdapter.kt file. Here all communication over the TrustChainCommunity is handled. The following functions are all public and can be used by anyone that wants to use our implementation:

```sendTokens(amount: Int, peer: Peer)```: This function takes an integer and a peer as arguments. It then sends a number of tokens equal to that integer to the specified peer.

```injectTokens(tokens: List<String>)```: This function takes a list of tokens as an argument and adds a new token to it. In other words, this function handles token generation.

```setReceiveTransactionHandler(handler: ((transaction: Transaction) -> Unit))```: This function takes a handler as an argument and makes sure that this handler gets called for every transaction that is received.

```setReceiveAgreementHandler(handler: (transaction: Transaction) -> Unit)```: This function takes a handler as an argument and makes sure that this handler gets called for every agreement that is received.

```getPeers()```: This function returns a list of all currently available peers that you can communicate with.

```getTokens()```: This function returns a list of all your available tokens.

```getTokenCount()```: Returns the amount of tokens available

## Build

If you want to build an APK, run the following command:

```
./gradlew :app:buildDebug
```

The resulting APK will be stored in `app/build/outputs/apk/debug/app-debug.apk`.

## Install

You can also build and automatically install the app on all connected Android devices with a single command:

```
./gradlew :app:installDebug
```

*Note: It is required to have an Android device connected with USB debugging enabled before running this command.*

## Tests

Run unit tests:
```
./gradlew test
```

Run instrumented tests:
```
./gradlew connectedAndroidTest
```

## Code style

[Ktlint](https://ktlint.github.io/) is used to enforce a consistent code style across the whole project.

Check code style:
```
./gradlew ktlintCheck
```

Run code formatter:
```
./gradlew ktlintFormat
```

Binary file added detoks-engine/Screenshot_20230417_182253.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added detoks-engine/Screenshot_20230418_135848.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added detoks-engine/Screenshot_20230418_145945.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added detoks-engine/Throughput.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added detoks-engine/benchmark.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions detoks-engine/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

apply plugin: 'com.squareup.sqldelight'

sqldelight {
Database {
packageName = "nl.tudelft.token_engine.sqldelight"
sourceFolders = ["sqldelight"]
schemaOutputDirectory = file("src/main/sqldelight/databases")
}
}

android {
namespace 'nl.tudelft.trustchain.detoks_engine'
compileSdkVersion 33

defaultConfig {
minSdkVersion 22
targetSdkVersion 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}


buildFeatures {
viewBinding = true
}
}

dependencies {
implementation project(':common')

// AndroidX
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.fragment:fragment-ktx:$fragment_version"
implementation "androidx.preference:preference:1.2.0"
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"

// Material
implementation 'com.google.android.material:material:1.8.0'

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

// Logging
implementation 'io.github.microutils:kotlin-logging:1.7.7'
implementation 'com.github.tony19:logback-android:2.0.0'

implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'

// Testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
testImplementation "io.mockk:mockk:1.9.3"

// TODO fix direct import, this should rely on common.
// BitTorrent
implementation files('../common/libs/jlibtorrent-' + jlibtorrent_version + '.jar')
implementation files('../common/libs/jlibtorrent-android-arm64-' + jlibtorrent_version + '.jar')
implementation files('../common/libs/jlibtorrent-android-arm-' + jlibtorrent_version + '.jar')
implementation files('../common/libs/jlibtorrent-android-x86-' + jlibtorrent_version + '.jar')
implementation files('../common/libs/jlibtorrent-android-x86_64-' + jlibtorrent_version + '.jar')

implementation 'com.devbrackets.android:exomedia:4.3.0'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.freeCompilerArgs += [
"-opt-in=kotlin.RequiresOptIn", "-Werror"
]
}
Empty file.
Binary file added detoks-engine/flamechart.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added detoks-engine/latency.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added detoks-engine/packetsreceived.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions detoks-engine/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package nl.tudelft.detoks_engine

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.detoks_engine.test", appContext.packageName)
}
}
Loading