exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit dae29a7e4ba3e6d8a16d5822ed68e4ab674b5bce
parent 7f3f96f9f2e3d5b1e5081dc91adc2b27f85ff2f1
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 27 May 2025 14:19:31 +0200

work on #9900: get first auditr tests to pass again

Diffstat:
Msrc/auditor/taler-helper-auditor-coins.c | 30+++++++++++++++++++++++++++---
Msrc/auditor/test-auditor.sh | 17++++++++---------
Msrc/exchangedb/pg_select_refreshes_above_serial_id.c | 2++
3 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c @@ -1142,6 +1142,9 @@ check_known_coin ( .operation_specific_pub = coin_pub->eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify coin denomination signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); @@ -1318,7 +1321,9 @@ refresh_session_cb (void *cls, .operation_specific_pub = coin_pub->eddsa_pub }; - GNUNET_break_op (0); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify coin melt signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); @@ -1614,10 +1619,12 @@ deposit_cb (void *cls, .operation_specific_pub = deposit->coin.coin_pub.eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify coin deposit signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); - if (0 > qs) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); @@ -1750,6 +1757,9 @@ refund_cb (void *cls, .operation_specific_pub = coin_pub->eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify merchant refund signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); @@ -2027,6 +2037,9 @@ check_recoup (struct CoinContext *cc, .operation_specific_pub = coin->coin_pub.eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify coin signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); @@ -2099,6 +2112,9 @@ check_recoup (struct CoinContext *cc, .operation_specific_pub = coin->coin_pub.eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Recoup allowed on non-revoked denomination in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsldnr); @@ -2169,10 +2185,12 @@ recoup_cb (void *cls, .operation_specific_pub = coin->coin_pub.eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify recoup signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); - if (qs < 0) { GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); @@ -2302,6 +2320,9 @@ recoup_refresh_cb (void *cls, .operation_specific_pub = coin->coin_pub.eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify recoup-refresh signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); @@ -2498,6 +2519,9 @@ purse_deposit_cb ( .operation_specific_pub = deposit->coin_pub.eddsa_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Failed to verify purse deposit signature in row %llu\n", + (unsigned long long) rowid); qs = TALER_ARL_adb->insert_bad_sig_losses ( TALER_ARL_adb->cls, &bsl); diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh @@ -938,20 +938,19 @@ function test_6() { } -# Test where h_wire in the deposit table is wrong +# Test where signature in the withdraw table is wrong function test_7() { - echo "===========7: reserves_out signature wrong=================" + echo "===========7: withdraw signature wrong=================" # Modify reserve_sig, so it is bogus - HBE=$(echo 'SELECT h_blind_ev FROM exchange.reserves_out LIMIT 1;' | psql "$DB" -Aqt) - OLD_SIG=$(echo "SELECT reserve_sig FROM exchange.reserves_out WHERE h_blind_ev='$HBE';" | psql "$DB" -Aqt) - A_VAL=$(echo "SELECT (amount_with_fee).val FROM exchange.reserves_out WHERE h_blind_ev='$HBE';" | psql "$DB" -Aqt) - A_FRAC=$(echo "SELECT (amount_with_fee).frac FROM exchange.reserves_out WHERE h_blind_ev='$HBE';" | psql "$DB" -Aqt) + HBE=$(echo 'SELECT withdraw_id FROM exchange.withdraw LIMIT 1;' | psql "$DB" -Aqt) + OLD_SIG=$(echo "SELECT reserve_sig FROM exchange.withdraw WHERE withdraw_id='$HBE';" | psql "$DB" -Aqt) + A_VAL=$(echo "SELECT (amount_with_fee).val FROM exchange.withdraw WHERE withdraw_id='$HBE';" | psql "$DB" -Aqt) + A_FRAC=$(echo "SELECT (amount_with_fee).frac FROM exchange.withdraw WHERE withdraw_id='$HBE';" | psql "$DB" -Aqt) # Normalize, we only deal with cents in this test-case A_FRAC=$(( A_FRAC / 1000000)) # shellcheck disable=SC2028 - echo "UPDATE exchange.reserves_out SET reserve_sig='\x9ef381a84aff252646a157d88eded50f708b2c52b7120d5a232a5b628f9ced6d497e6652d986b581188fb014ca857fd5e765a8ccc4eb7e2ce9edcde39accaa4b' WHERE h_blind_ev='$HBE'" \ + echo "UPDATE exchange.withdraw SET reserve_sig='\x9ef381a84aff252646a157d88eded50f708b2c52b7120d5a232a5b628f9ced6d497e6652d986b581188fb014ca857fd5e765a8ccc4eb7e2ce9edcde39accaa4b' WHERE withdraw_id='$HBE'" \ | psql -Aqt "$DB" - run_audit check_auditor_running @@ -982,7 +981,7 @@ function test_7() { "wrong total bad sig loss" # Undo: - echo "UPDATE exchange.reserves_out SET reserve_sig='$OLD_SIG' WHERE h_blind_ev='$HBE'" | psql -Aqt "$DB" + echo "UPDATE exchange.withdraw SET reserve_sig='$OLD_SIG' WHERE withdraw_id='$HBE'" | psql -Aqt "$DB" full_reload cleanup } diff --git a/src/exchangedb/pg_select_refreshes_above_serial_id.c b/src/exchangedb/pg_select_refreshes_above_serial_id.c @@ -97,6 +97,8 @@ refreshs_serial_helper_cb (void *cls, &amount_with_fee), GNUNET_PQ_result_spec_uint64 ("refresh_id", &rowid), + GNUNET_PQ_result_spec_auto_from_type ("rc", + &rc), GNUNET_PQ_result_spec_array_uint64 (pg->conn, "new_denominations_serials", &num_nds,