Skip to content

Commit 6be29f0

Browse files
committed
chore: Add more logging to loading conferences from savedata.
Better error messages than "something went wrong in type 20". Also fix bazel-asan/tsan builds. tweag/rules_nixpkgs#442 is blocking fuzz tests under asan.
1 parent 1195271 commit 6be29f0

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

.circleci/bazel-test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ set -eux
44

55
git submodule update --init --recursive
66
/src/workspace/tools/inject-repo c-toxcore
7+
# TODO(iphydf): Re-enable fuzz-test when https://github.com/tweag/rules_nixpkgs/issues/442 is fixed.
78
cd /src/workspace && bazel test -k \
9+
--config=ci \
810
--config=remote \
9-
--build_tag_filters=-haskell \
10-
--test_tag_filters=-haskell \
11-
--remote_download_minimal \
11+
--build_tag_filters=-haskell,-fuzz-test \
12+
--test_tag_filters=-haskell,-fuzz-test \
1213
-- \
1314
//c-toxcore/... \
1415
"$@"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
61c4cff326cf3a32fa5edad1c899c9eb586e4ebfcb8d11c9cf55d120fc7ab467 /usr/local/bin/tox-bootstrapd
1+
036adfc1e993624ae0bf49f08c2890bb44e6d4224a07a8c7fd2e2b5a8be6bf4c /usr/local/bin/tox-bootstrapd

testing/fuzzing/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cc_library(
2828

2929
cc_fuzz_test(
3030
name = "bootstrap_fuzz_test",
31-
#size = "small",
31+
size = "small",
3232
srcs = ["bootstrap_harness.cc"],
3333
copts = ["-UNDEBUG"],
3434
corpus = ["//tools/toktok-fuzzer/corpus:bootstrap_fuzzer"],
@@ -43,7 +43,7 @@ cc_fuzz_test(
4343

4444
cc_fuzz_test(
4545
name = "e2e_fuzz_test",
46-
#size = "small",
46+
size = "small",
4747
srcs = ["e2e_fuzz_test.cc"],
4848
copts = ["-UNDEBUG"],
4949
corpus = ["//tools/toktok-fuzzer/corpus:e2e_fuzz_test"],
@@ -59,7 +59,7 @@ cc_fuzz_test(
5959

6060
cc_fuzz_test(
6161
name = "toxsave_fuzz_test",
62-
#size = "small",
62+
size = "small",
6363
srcs = ["toxsave_harness.cc"],
6464
copts = ["-UNDEBUG"],
6565
corpus = ["//tools/toktok-fuzzer/corpus:toxsave_fuzzer"],
@@ -92,7 +92,7 @@ fuzzing_binary(
9292

9393
cc_fuzz_test(
9494
name = "protodump_reduce",
95-
#size = "small",
95+
size = "small",
9696
srcs = ["protodump_reduce.cc"],
9797
copts = ["-UNDEBUG"],
9898
deps = [

toxcore/Messenger.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,6 +2988,7 @@ static State_Load_Status load_nospam_keys(Messenger *m, const uint8_t *data, uin
29882988
load_secret_key(m->net_crypto, data + sizeof(uint32_t) + CRYPTO_PUBLIC_KEY_SIZE);
29892989

29902990
if (!pk_equal(data + sizeof(uint32_t), nc_get_self_public_key(m->net_crypto))) {
2991+
LOGGER_ERROR(m->log, "public key stored in savedata does not match its secret key");
29912992
return STATE_LOAD_STATUS_ERROR;
29922993
}
29932994

toxcore/group.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ static int addpeer(Group_Chats *g_c, uint32_t groupnumber, const uint8_t *real_p
802802

803803
if (peer_index != -1) {
804804
if (!pk_equal(g->group[peer_index].real_pk, real_pk)) {
805+
LOGGER_ERROR(g_c->m->log, "peer public key is incorrect for peer %d", peer_number);
805806
return -1;
806807
}
807808

@@ -3679,6 +3680,7 @@ static State_Load_Status load_conferences_helper(Group_Chats *g_c, const uint8_t
36793680

36803681
if (groupnumber == -1) {
36813682
// If this fails there's a serious problem, don't bother with cleanup
3683+
LOGGER_ERROR(g_c->m->log, "conference creation failed");
36823684
return STATE_LOAD_STATUS_ERROR;
36833685
}
36843686

@@ -3696,6 +3698,7 @@ static State_Load_Status load_conferences_helper(Group_Chats *g_c, const uint8_t
36963698
assert(ret);
36973699
}
36983700

3701+
LOGGER_ERROR(g_c->m->log, "conference loading failed");
36993702
return STATE_LOAD_STATUS_ERROR;
37003703
}
37013704

@@ -3705,6 +3708,7 @@ static State_Load_Status load_conferences_helper(Group_Chats *g_c, const uint8_t
37053708
nullptr, true, false);
37063709

37073710
if (peer_index == -1) {
3711+
LOGGER_ERROR(g_c->m->log, "adding peer %d failed", g->peer_number);
37083712
return STATE_LOAD_STATUS_ERROR;
37093713
}
37103714

toxcore/state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int state_load(const Logger *log, state_load_cb *state_load_callback, void *oute
5252
}
5353

5454
case STATE_LOAD_STATUS_ERROR: {
55-
LOGGER_ERROR(log, "Error occcured in state file (type: %u).", type);
55+
LOGGER_ERROR(log, "Error occcured in state file (type: 0x%02x).", type);
5656
return -1;
5757
}
5858

0 commit comments

Comments
 (0)