Skip to content

Commit 80ffdc8

Browse files
committed
fix(dev): updates to scripts, added documentation
1 parent 3359a93 commit 80ffdc8

File tree

4 files changed

+56
-16
lines changed

4 files changed

+56
-16
lines changed

lib/main.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
203203
final trades = await CakeHive.openBox<Trade>(Trade.boxName, encryptionKey: tradesBoxKey);
204204
final orders = await CakeHive.openBox<Order>(Order.boxName, encryptionKey: ordersBoxKey);
205205
final walletInfoSource = await CakeHive.openBox<WalletInfo>(WalletInfo.boxName);
206+
if (walletInfoSource.length == 0) {
207+
printV("WalletInfo corrupted: length == 0");
208+
} else {
209+
printV("WalletInfo normal: ${walletInfoSource.length}");
210+
}
206211
final templates = await CakeHive.openBox<Template>(Template.boxName);
207212
final exchangeTemplates = await CakeHive.openBox<ExchangeTemplate>(ExchangeTemplate.boxName);
208213
final anonpayInvoiceInfo = await CakeHive.openBox<AnonpayInvoiceInfo>(AnonpayInvoiceInfo.boxName);

scripts/android/debug/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Debug scripts
2+
3+
## `display_fuzzer_stats.sh`
4+
5+
Displays wallet fuzzer statistics in one screen for every emulator
6+
7+
## `record_tap.sh`
8+
9+
Used to configure wallet_fuzzer.sh - to unlock wallet and start fuzzer (or any action we wish to test)
10+
11+
## `wallet_fuzzer.sh`
12+
13+
Main logic to start wallet fuzzing scripts
14+
15+
## Extras
16+
17+
In order to install app on all devices you can run the following command:
18+
19+
```bash
20+
for device in $(adb devices | grep -w "device" | awk '{print $1}'); do
21+
echo "Installing on $device..."
22+
adb -s $device install -r build/app/outputs/flutter-apk/app-debug.apk
23+
done
24+
```
25+
26+
To watch for some log message:
27+
28+
```bash
29+
for device in $(adb devices | grep -w "device" | awk '{print $1}'); do
30+
echo "Watching logs on $device..."
31+
adb -s "$device" logcat | grep --line-buffered "WalletInfo corrupted" | sed "s/^/[$device] /" &
32+
done
33+
34+
wait
35+
```

scripts/android/debug/record_tap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,6 @@ adb shell getevent -lt "$TOUCH_DEVICE" | gawk -v sw="$SCREEN_WIDTH" -v sh="$SCRE
127127
scaled_x = int(raw_x * sw / rx)
128128
scaled_y = int(raw_y * sh / ry)
129129
# Print the input tap command.
130-
printf "adb shell input tap %d %d\n", scaled_x, scaled_y
130+
printf "adb -s \$device_id shell input tap %d %d\n", scaled_x, scaled_y
131131
}
132132
'

scripts/android/debug/wallet_fuzzer.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ function start_app() {
2626
# and then copy the output into the adb shell input tap commands below.
2727
# make sure to tap very briefly, otherwise multiple events will be generated.
2828
sleep 6
29-
adb -s $device_id shell input tap 602 1940
30-
sleep 2.664044
31-
adb -s $device_id shell input tap 473 1923
32-
sleep 2.713335
33-
adb -s $device_id shell input tap 459 2021
34-
sleep 2.668894
35-
adb -s $device_id shell input tap 515 2027
36-
sleep 3.871710
37-
adb -s $device_id shell input tap 977 141
38-
sleep 4.263207
39-
adb -s $device_id shell input tap 635 1801
40-
sleep 3.804010
41-
adb -s $device_id shell input tap 289 757
42-
sleep 3.833263
43-
adb -s $device_id shell input tap 962 2176
29+
adb -s $device_id shell input tap 435 1982
30+
sleep 2.596161
31+
adb -s $device_id shell input tap 532 1920
32+
sleep 2.583818
33+
adb -s $device_id shell input tap 594 1973
34+
sleep 2.549104
35+
adb -s $device_id shell input tap 539 2072
36+
sleep 3.529221
37+
adb -s $device_id shell input tap 979 139
38+
sleep 3.287868
39+
adb -s $device_id shell input tap 430 1645
40+
sleep 2.325175
41+
adb -s $device_id shell input tap 368 1784
42+
sleep 2.461983
43+
adb -s $device_id shell input tap 442 2164
4444
}
4545

4646
function stop_app() {

0 commit comments

Comments
 (0)