get test-auditor and #7181 to pass

This commit is contained in:
Christian Grothoff 2022-02-28 20:37:19 +01:00
parent 8f77bda2e0
commit 23bc09fe3c
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
17 changed files with 428 additions and 168 deletions

View File

@ -200,7 +200,6 @@ EXTRA_DIST = \
taler-auditor.in \ taler-auditor.in \
taler-helper-auditor-render.py \ taler-helper-auditor-render.py \
auditor.conf \ auditor.conf \
test-auditor.conf \
test-sync-in.conf \ test-sync-in.conf \
test-sync-out.conf \ test-sync-out.conf \
generate-auditor-basedb.sh \ generate-auditor-basedb.sh \
@ -209,8 +208,10 @@ EXTRA_DIST = \
generate-auditor-basedb-template.conf \ generate-auditor-basedb-template.conf \
$(check_SCRIPTS) \ $(check_SCRIPTS) \
auditor-basedb.age \ auditor-basedb.age \
auditor-basedb.conf \
auditor-basedb.sql \ auditor-basedb.sql \
auditor-basedb.mpub \ auditor-basedb.mpub \
revoke-basedb.age \ revoke-basedb.age \
revoke-basedb.conf \
revoke-basedb.sql \ revoke-basedb.sql \
revoke-basedb.mpub revoke-basedb.mpub

View File

@ -0,0 +1,186 @@
[arm]
CONFIG = /research/taler/exchange/src/auditor/auditor-basedb.conf
[benchmark]
MERCHANT_DETAILS = merchant_details.json
BANK_DETAILS = bank_details.json
[coin_kudos_10]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:10
[coin_kudos_8]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.04
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.02
fee_withdraw = TESTKUDOS:0.05
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:8
[coin_kudos_5]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:5
[coin_kudos_4]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.02
fee_refresh = TESTKUDOS:0.04
fee_deposit = TESTKUDOS:0.03
fee_withdraw = TESTKUDOS:0.03
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:4
[coin_kudos_2]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.02
fee_refresh = TESTKUDOS:0.04
fee_deposit = TESTKUDOS:0.03
fee_withdraw = TESTKUDOS:0.03
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:2
[coin_kudos_1]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.02
fee_withdraw = TESTKUDOS:0.02
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:1
[coin_kudos_ct_10]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:0.10
[coin_kudos_ct_1]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:0.01
[payments-generator]
exchange = http://localhost:8081/
exchange-admin = http://localhost:18080/
exchange_admin = http://localhost:18080/
merchant = http://localhost:9966/
bank = http://localhost:8082/
instance = default
currency = TESTKUDOS
[merchant-exchange-default]
CURRENCY = TESTKUDOS
EXCHANGE_BASE_URL = http://localhost:8081/
MASTER_KEY = TMQ09D9G18Z8TFEABD833SDJ6JQWRYKFHPTWT6DMPQS54ZC66RDG
[merchant-account-merchant]
ACTIVE_default = YES
HONOR_default = YES
PAYTO_URI = payto://x-taler-bank/localhost/42
[exchange-accountcredentials-1]
PASSWORD = x
USERNAME = Exchange
WIRE_GATEWAY_AUTH_METHOD = basic
WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
[exchange-account-1]
enable_credit = yes
enable_debit = yes
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
[instance-default]
NAME = Merchant Inc.
KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv
[taler]
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
CURRENCY = TESTKUDOS
[merchantdb-postgres]
CONFIG = postgres:///auditor-basedb
[merchant]
DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
WIREFORMAT = default
WIRE_TRANSFER_DELAY = 1 minute
FORCE_AUDIT = YES
UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
[exchangedb-postgres]
CONFIG = postgres:///auditor-basedb
[exchange]
LOOKAHEAD_SIGN = 32 weeks 1 day
SIGNKEY_DURATION = 4 weeks
MASTER_PUBLIC_KEY = TMQ09D9G18Z8TFEABD833SDJ6JQWRYKFHPTWT6DMPQS54ZC66RDG
SIGNKEY_LEGAL_DURATION = 4 weeks
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
[bank]
SERVE = http
ALLOW_REGISTRATIONS = YES
SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
SUGGESTED_EXCHANGE = http://localhost:8081/
HTTP_PORT = 8082
MAX_DEBT_BANK = TESTKUDOS:100000.0
MAX_DEBT = TESTKUDOS:50.0
DATABASE = postgres:///taler-auditor-basedb
[auditordb-postgres]
CONFIG = postgres:///taler-auditor-basedb
[auditor]
PUBLIC_KEY = 95FVPHMW4110HTPVSGMT2YMDE2BSGXZEV5WSV0TD1DXMF2RQ5HN0
TINY_AMOUNT = TESTKUDOS:0.01
BASE_URL = http://localhost:8083/
[PATHS]
TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
TALER_CONFIG_HOME = $TALER_HOME/.config/taler/
TALER_DATA_HOME = $TALER_HOME/.local/share/taler/
TALER_HOME = ${PWD}/generate_auditordb_home/

View File

@ -41,9 +41,9 @@ BASEDB=${1:-"auditor-basedb"}
# Name of the Postgres database we will use for the script. # Name of the Postgres database we will use for the script.
# Will be dropped, do NOT use anything that might be used # Will be dropped, do NOT use anything that might be used
# elsewhere # elsewhere
TARGET_DB=taler-auditor-basedb export TARGET_DB=${BASEDB}
WALLET_DB=${BASEDB:-"wallet"}.wdb export WALLET_DB=${BASEDB:-"wallet"}.wdb
# delete existing wallet database # delete existing wallet database
rm -f $WALLET_DB rm -f $WALLET_DB

View File

@ -32,7 +32,7 @@ export BASEDB=${1:-"revoke-basedb"}
# Name of the Postgres database we will use for the script. # Name of the Postgres database we will use for the script.
# Will be dropped, do NOT use anything that might be used # Will be dropped, do NOT use anything that might be used
# elsewhere # elsewhere
export TARGET_DB=taler-auditor-revokedb export TARGET_DB=${BASEDB}
TMP_DIR=`mktemp -d revocation-tmp-XXXXXX` TMP_DIR=`mktemp -d revocation-tmp-XXXXXX`
export WALLET_DB=wallet-revocation.json export WALLET_DB=wallet-revocation.json
rm -f $WALLET_DB rm -f $WALLET_DB

View File

@ -186,6 +186,7 @@ TALER_ARL_get_denomination_info_by_hash (
NULL); NULL);
if (0 > qs) if (0 > qs)
{ {
GNUNET_break (0);
*issue = NULL; *issue = NULL;
return qs; return qs;
} }
@ -211,6 +212,7 @@ TALER_ARL_get_denomination_info_by_hash (
&issue); &issue);
if (qs <= 0) if (qs <= 0)
{ {
GNUNET_break (qs >= 0);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Denomination %s not found\n", "Denomination %s not found\n",
@ -598,38 +600,34 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
if (GNUNET_is_zero (&TALER_ARL_auditor_pub)) if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{ {
/* private key not available, try configuration for public key */
char *auditor_public_key_str; char *auditor_public_key_str;
if (GNUNET_OK != if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (c, GNUNET_CONFIGURATION_get_value_string (c,
"auditor", "auditor",
"PUBLIC_KEY", "PUBLIC_KEY",
&auditor_public_key_str)) &auditor_public_key_str))
{ {
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, if (GNUNET_OK !=
"auditor", GNUNET_CRYPTO_eddsa_public_key_from_string (
"PUBLIC_KEY"); auditor_public_key_str,
return GNUNET_SYSERR; strlen (auditor_public_key_str),
} &TALER_ARL_auditor_pub.eddsa_pub))
if (GNUNET_OK != {
GNUNET_CRYPTO_eddsa_public_key_from_string ( GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
auditor_public_key_str, "auditor",
strlen (auditor_public_key_str), "PUBLIC_KEY",
&TALER_ARL_auditor_pub.eddsa_pub)) "invalid key");
{ GNUNET_free (auditor_public_key_str);
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, return GNUNET_SYSERR;
"auditor", }
"PUBLIC_KEY",
"invalid key");
GNUNET_free (auditor_public_key_str); GNUNET_free (auditor_public_key_str);
return GNUNET_SYSERR;
} }
GNUNET_free (auditor_public_key_str);
} }
if (GNUNET_is_zero (&TALER_ARL_auditor_pub)) if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{ {
/* public key not configured */
/* try loading private key and deriving public key */ /* try loading private key and deriving public key */
char *fn; char *fn;
@ -656,6 +654,14 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
} }
} }
if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO,
"auditor",
"PUBLIC_KEY/AUDITOR_PRIV_FILE");
return GNUNET_SYSERR;
}
if (GNUNET_OK != if (GNUNET_OK !=
TALER_config_get_currency (TALER_ARL_cfg, TALER_config_get_currency (TALER_ARL_cfg,
&TALER_ARL_currency)) &TALER_ARL_currency))

View File

@ -390,7 +390,7 @@ struct WireCheckContext
* @param[out] deposit_gain amount the coin contributes excluding refunds * @param[out] deposit_gain amount the coin contributes excluding refunds
* @return #GNUNET_OK on success, #GNUNET_SYSERR if the transaction must fail (hard error) * @return #GNUNET_OK on success, #GNUNET_SYSERR if the transaction must fail (hard error)
*/ */
static int static enum GNUNET_GenericReturnValue
check_transaction_history_for_deposit ( check_transaction_history_for_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
@ -683,6 +683,7 @@ check_transaction_history_for_deposit (
* @param rowid which row in the table is the information from (for diagnostics) * @param rowid which row in the table is the information from (for diagnostics)
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param account_pay_uri where did we transfer the funds? * @param account_pay_uri where did we transfer the funds?
* @param h_payto hash over @a account_payto_uri as it is in the DB
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract_terms which proposal was this payment about * @param h_contract_terms which proposal was this payment about
* @param denom_pub denomination of @a coin_pub * @param denom_pub denomination of @a coin_pub
@ -698,6 +699,7 @@ wire_transfer_information_cb (
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_pay_uri, const char *account_pay_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
@ -712,7 +714,18 @@ wire_transfer_information_cb (
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
struct TALER_CoinPublicInfo coin; struct TALER_CoinPublicInfo coin;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct TALER_PaytoHashP hpt;
TALER_payto_hash (account_pay_uri,
&hpt);
if (0 !=
GNUNET_memcmp (&hpt,
h_payto))
{
report_row_inconsistency ("wire_targets",
rowid,
"h-payto does not match payto URI");
}
/* Obtain coin's transaction history */ /* Obtain coin's transaction history */
qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls, qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls,
coin_pub, coin_pub,

View File

@ -866,10 +866,10 @@ function test_13() {
echo "===========13: wrong melt signature ===========" echo "===========13: wrong melt signature ==========="
# Modify denom_sig, so it is wrong # Modify denom_sig, so it is wrong
COIN_ID=`echo "SELECT old_known_coin_id FROM refresh_commitments LIMIT 1;" | psql $DB -Aqt` COIN_PUB=`echo "SELECT old_coin_pub FROM refresh_commitments LIMIT 1;" | psql $DB -Aqt`
OLD_SIG=`echo "SELECT old_coin_sig FROM refresh_commitments WHERE old_known_coin_id='$COIN_ID';" | psql $DB -Aqt` OLD_SIG=`echo "SELECT old_coin_sig FROM refresh_commitments WHERE old_known_pub='$COIN_PUB';" | psql $DB -Aqt`
NEW_SIG="\xba588af7c13c477dca1ac458f65cc484db8fba53b969b873f4353ecbd815e6b4c03f42c0cb63a2b609c2d726e612fd8e0c084906a41f409b6a23a08a83c89a02" NEW_SIG="\xba588af7c13c477dca1ac458f65cc484db8fba53b969b873f4353ecbd815e6b4c03f42c0cb63a2b609c2d726e612fd8e0c084906a41f409b6a23a08a83c89a02"
echo "UPDATE refresh_commitments SET old_coin_sig='$NEW_SIG' WHERE old_known_coin_id='$COIN_ID'" | psql -Aqt $DB echo "UPDATE refresh_commitments SET old_coin_sig='$NEW_SIG' WHERE old_coin_pub='$COIN_PUB'" | psql -Aqt $DB
run_audit run_audit
@ -943,42 +943,27 @@ fi
} }
# Test where salt in the deposit table is wrong
# Test where h_wire in the deposit table is wrong
function test_15() { function test_15() {
echo "===========15: deposit wire hash wrong=================" echo "===========15: deposit wire salt wrong================="
# Check wire transfer lag reported (no aggregator!) # Modify wire_salt hash, so it is inconsistent
SALT=`echo "SELECT wire_salt FROM deposits WHERE deposit_serial_id=1;" | psql -Aqt $DB`
echo "UPDATE deposits SET wire_salt='\x1197cd7f7b0e13ab1905fedb36c536a2' WHERE deposit_serial_id=1;" | psql -Aqt $DB
# NOTE: This test is EXPECTED to fail for ~1h after run_audit
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in echo -n "Testing inconsistency detection... "
# taler-helper-auditor-wire.c) OP=`jq -r .bad_sig_losses[0].operation < test-audit-coins.json`
if [ $DATABASE_AGE -gt 3600 ] if test "x$OP" != "xdeposit"
then then
exit_fail "Reported operation wrong: $OP"
# Modify h_wire hash, so it is inconsistent with 'wire'
echo "UPDATE deposits SET h_wire='\x973e52d193a357940be9ef2939c19b0575ee1101f52188c3c01d9005b7d755c397e92624f09cfa709104b3b65605fe5130c90d7e1b7ee30f8fc570f39c16b853' WHERE deposit_serial_id=1" | psql -Aqt $DB
# The auditor checks h_wire consistency only for
# coins where the wire transfer has happened, hence
# run aggregator first to get this test to work.
run_audit aggregator
echo -n "Testing inconsistency detection... "
TABLE=`jq -r .row_inconsistencies[0].table < test-audit-aggregation.json`
if test "x$TABLE" != "xaggregation" -a "x$TABLE" != "xdeposits"
then
exit_fail "Reported table wrong: $TABLE"
fi
echo PASS
# cannot easily undo aggregator, hence full reload
full_reload
else
echo "Test skipped (database too new)"
fi fi
echo PASS
# Restore DB
echo "UPDATE deposits SET wire_salt='$SALT' WHERE deposit_serial_id=1;" | psql -Aqt $DB
} }
@ -1181,14 +1166,14 @@ then
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_uuid='${RES_UUID}';" | psql $DB -Aqt` OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_pub='${RES_PUB}';" | psql $DB -Aqt`
VAL_DELTA=1 VAL_DELTA=1
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true` NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true`
echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
# Need to run with the aggregator so the reserve closure happens # Need to run with the aggregator so the reserve closure happens
run_audit aggregator run_audit aggregator
@ -1219,11 +1204,11 @@ echo "===========20: reserve closure missing ================="
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + 100 || true` NEW_CREDIT=`expr $OLD_VAL + 100 || true`
echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
# This time, run without the aggregator so the reserve closure is skipped! # This time, run without the aggregator so the reserve closure is skipped!
run_audit run_audit
@ -1240,7 +1225,7 @@ fi
# Undo # Undo
echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
} }
@ -1259,19 +1244,18 @@ then
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_uuid='${RES_UUID}';" | psql $DB -Aqt` OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_pub='${RES_PUB}';" | psql $DB -Aqt`
VAL_DELTA=1 VAL_DELTA=1
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true` NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true`
echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
# Need to first run the aggregator so the transfer is marked as done exists # Need to first run the aggregator so the transfer is marked as done exists
pre_audit aggregator pre_audit aggregator
# remove transaction from bank DB # remove transaction from bank DB
echo "DELETE FROM app_banktransaction WHERE debit_account_id=2 AND amount='TESTKUDOS:${VAL_DELTA}';" | psql -Aqt $DB echo "DELETE FROM app_banktransaction WHERE debit_account_id=2 AND amount='TESTKUDOS:${VAL_DELTA}';" | psql -Aqt $DB
@ -1312,7 +1296,7 @@ S_DENOM=`echo 'SELECT denominations_serial FROM reserves_out LIMIT 1;' | psql $D
OLD_START=`echo "SELECT valid_from FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt` OLD_START=`echo "SELECT valid_from FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt`
OLD_WEXP=`echo "SELECT expire_withdraw FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt` OLD_WEXP=`echo "SELECT expire_withdraw FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt`
# Basically expires 'immediately', so that the withdraw must have been 'invalid' # Basically expires 'immediately', so that the withdraw must have been 'invalid'
NEW_WEXP=`expr $OLD_START + 1 || true` NEW_WEXP=$OLD_START
echo "UPDATE denominations SET expire_withdraw=${NEW_WEXP} WHERE denominations_serial='${S_DENOM}';" | psql -Aqt $DB echo "UPDATE denominations SET expire_withdraw=${NEW_WEXP} WHERE denominations_serial='${S_DENOM}';" | psql -Aqt $DB
@ -1320,7 +1304,7 @@ echo "UPDATE denominations SET expire_withdraw=${NEW_WEXP} WHERE denominations_s
run_audit run_audit
echo -n "Testing inconsistency detection... " echo -n "Testing inconsistency detection... "
jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Denomination key withdraw inconsistency not detected" jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Denomination key withdraw inconsistency for $S_DENOM not detected"
echo PASS echo PASS
@ -1793,6 +1777,50 @@ fi
# Test where h_payto in the wire_targets table is wrong
function test_33() {
echo "===========33: h_payto wrong================="
# Check wire transfer lag reported (no aggregator!)
# NOTE: this test is BRAND NEW and expected
# to fail until we implement the check in the auditor!
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
# Modify h_payto hash, so it is inconsistent with 'wire'
WTSID=`echo "SELECT wire_target_serial_id FROM deposits WHERE deposit_serial_id=1;" | psql -Aqt $DB`
echo "UPDATE wire_targets SET h_payto='\x973e52d193a357940be9ef2939c19b0575ee1101f52188c3c01d9005b7d755c397e92624f09cfa709104b3b65605fe5130c90d7e1b7ee30f8fc570f39c16b853' WHERE wire_target_serial_id=$WTSID" | psql -Aqt $DB
# The auditor checks h_wire consistency only for
# coins where the wire transfer has happened, hence
# run aggregator first to get this test to work.
run_audit aggregator
echo -n "Testing inconsistency detection... "
TABLE=`jq -r .row_inconsistencies[0].table < test-audit-aggregation.json`
if test "x$TABLE" != "xwire_targets"
then
exit_fail "Reported table wrong: $TABLE"
fi
echo PASS
# cannot easily undo aggregator, hence full reload
full_reload
else
echo "Test skipped (database too new)"
fi
}
# *************** Main test loop starts here ************** # *************** Main test loop starts here **************
@ -1840,10 +1868,10 @@ check_with_database()
# ####### Setup globals ###### # ####### Setup globals ######
# Postgres database to use # Postgres database to use
DB=taler-auditor-test DB=auditor-basedb
# Configuration file to use # Configuration file to use
CONF=test-auditor.conf CONF=${DB}.conf
# test required commands exist # test required commands exist
echo "Testing for jq" echo "Testing for jq"

View File

@ -482,11 +482,11 @@ check_with_database()
# *************** Main logic starts here ************** # *************** Main logic starts here **************
# ####### Setup globals ###### # ####### Setup globals ######
# Postgres database to use (must match test-auditor.conf) # Postgres database to use (must match revoke-basedb.conf)
DB=taler-auditor-test DB=taler-auditor-test
# Configuration file to use # Configuration file to use
CONF=test-auditor.conf CONF=revoke-basedb.conf
# test required commands exist # test required commands exist
echo "Testing for jq" echo "Testing for jq"

View File

@ -260,6 +260,7 @@ struct WtidTransactionContext
* @param rowid which row in the DB is the information from (for diagnostics), ignored * @param rowid which row in the DB is the information from (for diagnostics), ignored
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param account_payto_uri where the funds were sent * @param account_payto_uri where the funds were sent
* @param h_payto hash over @a account_payto_uri as it is in the DB
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract_terms which proposal was this payment about * @param h_contract_terms which proposal was this payment about
* @param denom_pub denomination public key of the @a coin_pub (ignored) * @param denom_pub denomination public key of the @a coin_pub (ignored)
@ -272,6 +273,7 @@ handle_deposit_data (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,

View File

@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS wire_targets_default
PARTITION OF wire_targets PARTITION OF wire_targets
FOR VALUES WITH (MODULUS 1, REMAINDER 0); FOR VALUES WITH (MODULUS 1, REMAINDER 0);
-- FIXME partition by serial_id rather than h_payto, -- FIXME partition by serial_id rather than h_payto,
-- it is used more in join conditions - crucial for sharding to select this. -- it is used more in join conditions - crucial for sharding to select this.
-- Author: (Boss Marco) -- Author: (Boss Marco)
CREATE INDEX IF NOT EXISTS wire_targets_serial_id_index CREATE INDEX IF NOT EXISTS wire_targets_serial_id_index
@ -108,19 +108,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'reserves' 'reserves'
ELSE ELSE
'reserves_' || shard_suffix 'reserves_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (reserve_pub);' 'PARTITION BY HASH (reserve_pub);'
ELSE ELSE
';' ';'
END; END;
@ -189,19 +189,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'reserves_in' 'reserves_in'
ELSE ELSE
'reserves_in_' || shard_suffix 'reserves_in_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (reserve_pub);' 'PARTITION BY HASH (reserve_pub);'
ELSE ELSE
';' ';'
END; END;
@ -267,19 +267,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'reserves_close' 'reserves_close'
ELSE ELSE
'reserves_close_' || shard_suffix 'reserves_close_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (reserve_pub);' 'PARTITION BY HASH (reserve_pub);'
ELSE ELSE
';' ';'
END; END;
@ -335,19 +335,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'reserves_out' 'reserves_out'
ELSE ELSE
'reserves_out_' || shard_suffix 'reserves_out_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (h_blind_ev);' 'PARTITION BY HASH (h_blind_ev);'
ELSE ELSE
';' ';'
END; END;
@ -488,19 +488,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'known_coins' 'known_coins'
ELSE ELSE
'known_coins_' || shard_suffix 'known_coins_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (coin_pub);' -- FIXME: or include denominations_serial? or multi-level partitioning? 'PARTITION BY HASH (coin_pub);' -- FIXME: or include denominations_serial? or multi-level partitioning?
ELSE ELSE
';' ';'
END; END;
@ -559,19 +559,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'refresh_commitments' 'refresh_commitments'
ELSE ELSE
'refresh_commitments_' || shard_suffix 'refresh_commitments_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (rc);' 'PARTITION BY HASH (rc);'
ELSE ELSE
';' ';'
END; END;
@ -632,19 +632,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'refresh_revealed_coins' 'refresh_revealed_coins'
ELSE ELSE
'refresh_revealed_coins_' || shard_suffix 'refresh_revealed_coins_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (melt_serial_id);' 'PARTITION BY HASH (melt_serial_id);'
ELSE ELSE
';' ';'
END; END;
@ -715,19 +715,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'refresh_transfer_keys' 'refresh_transfer_keys'
ELSE ELSE
'refresh_transfer_keys_' || shard_suffix 'refresh_transfer_keys_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (melt_serial_id);' 'PARTITION BY HASH (melt_serial_id);'
ELSE ELSE
';' ';'
END; END;
@ -790,19 +790,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'deposits' 'deposits'
ELSE ELSE
'deposits_' || shard_suffix 'deposits_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (shard);' 'PARTITION BY HASH (shard);'
ELSE ELSE
';' ';'
END; END;
@ -902,19 +902,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'refunds' 'refunds'
ELSE ELSE
'refunds_' || shard_suffix 'refunds_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (deposit_serial_id);' 'PARTITION BY HASH (deposit_serial_id);'
ELSE ELSE
';' ';'
END; END;
@ -969,19 +969,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'wire_out' 'wire_out'
ELSE ELSE
'wire_out_' || shard_suffix 'wire_out_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (wtid_raw);' 'PARTITION BY HASH (wtid_raw);'
ELSE ELSE
';' ';'
END; END;
@ -1037,19 +1037,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'aggregation_tracking' 'aggregation_tracking'
ELSE ELSE
'aggregation_tracking_' || shard_suffix 'aggregation_tracking_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (deposit_serial_id);' 'PARTITION BY HASH (deposit_serial_id);'
ELSE ELSE
';' ';'
END; END;
@ -1123,19 +1123,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'recoup' 'recoup'
ELSE ELSE
'recoup_' || shard_suffix 'recoup_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (known_coin_id);' 'PARTITION BY HASH (known_coin_id);'
ELSE ELSE
';' ';'
END; END;
@ -1199,19 +1199,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'recoup_refresh' 'recoup_refresh'
ELSE ELSE
'recoup_refresh_' || shard_suffix 'recoup_refresh_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (known_coin_id);' 'PARTITION BY HASH (known_coin_id);'
ELSE ELSE
';' ';'
END; END;
@ -1273,19 +1273,19 @@ DECLARE
partition_str VARCHAR; partition_str VARCHAR;
BEGIN BEGIN
table_name = CASE table_name = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'prewire' 'prewire'
ELSE ELSE
'prewire_' || shard_suffix 'prewire_' || shard_suffix
END; END;
partition_str = CASE partition_str = CASE
shard_suffix shard_suffix
WHEN '' THEN WHEN '' THEN
'PARTITION BY HASH (prewire_uuid);' 'PARTITION BY HASH (prewire_uuid);'
ELSE ELSE
';' ';'
END; END;
@ -1697,8 +1697,8 @@ IF EXISTS (
SELECT 1 SELECT 1
FROM information_Schema.constraint_column_usage FROM information_Schema.constraint_column_usage
WHERE table_name='wire_out' WHERE table_name='wire_out'
AND constraint_name='wire_out_ref') AND constraint_name='wire_out_ref')
THEN THEN
SET CONSTRAINTS wire_out_ref DEFERRED; SET CONSTRAINTS wire_out_ref DEFERRED;
END IF; END IF;

View File

@ -1240,6 +1240,7 @@ prepare_statements (struct PostgresClosure *pg)
" aggregation_serial_id" " aggregation_serial_id"
",deposits.h_contract_terms" ",deposits.h_contract_terms"
",payto_uri" ",payto_uri"
",h_payto"
",kc.coin_pub" ",kc.coin_pub"
",deposits.merchant_pub" ",deposits.merchant_pub"
",wire_out.execution_date" ",wire_out.execution_date"
@ -7160,6 +7161,7 @@ handle_wt_result (void *cls,
uint64_t rowid; uint64_t rowid;
struct TALER_PrivateContractHashP h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_PaytoHashP h_payto;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Timestamp exec_time; struct GNUNET_TIME_Timestamp exec_time;
struct TALER_Amount amount_with_fee; struct TALER_Amount amount_with_fee;
@ -7172,6 +7174,8 @@ handle_wt_result (void *cls,
&h_contract_terms), &h_contract_terms),
GNUNET_PQ_result_spec_string ("payto_uri", GNUNET_PQ_result_spec_string ("payto_uri",
&payto_uri), &payto_uri),
GNUNET_PQ_result_spec_auto_from_type ("h_payto",
&h_payto),
TALER_PQ_result_spec_denom_pub ("denom_pub", TALER_PQ_result_spec_denom_pub ("denom_pub",
&denom_pub), &denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub", GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@ -7200,6 +7204,7 @@ handle_wt_result (void *cls,
rowid, rowid,
&merchant_pub, &merchant_pub,
payto_uri, payto_uri,
&h_payto,
exec_time, exec_time,
&h_contract_terms, &h_contract_terms,
&denom_pub, &denom_pub,

View File

@ -536,6 +536,7 @@ cb_wt_never (void *cls,
uint64_t serial_id, uint64_t serial_id,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
@ -576,6 +577,7 @@ cb_wt_check (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,

View File

@ -1950,6 +1950,7 @@ typedef void
* @param rowid which row in the table is the information from (for diagnostics) * @param rowid which row in the table is the information from (for diagnostics)
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param account_payto_uri which account did the transfer go to? * @param account_payto_uri which account did the transfer go to?
* @param h_payto hash over @a account_payto_uri as it is in the DB
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract_terms which proposal was this payment about * @param h_contract_terms which proposal was this payment about
* @param denom_pub denomination of @a coin_pub * @param denom_pub denomination of @a coin_pub
@ -1963,6 +1964,7 @@ typedef void
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHashP *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,

View File

@ -97,6 +97,20 @@ extract_amount_nbo_helper (PGresult *result,
r_amount_nbo->fraction = *(uint32_t *) PQgetvalue (result, r_amount_nbo->fraction = *(uint32_t *) PQgetvalue (result,
row, row,
frac_num); frac_num);
if (GNUNET_ntohll (r_amount_nbo->value) >= TALER_AMOUNT_MAX_VALUE)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Field `%s' exceeds legal range\n",
val_name);
return GNUNET_SYSERR;
}
if (ntohl (r_amount_nbo->fraction) >= TALER_AMOUNT_FRAC_BASE)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Field `%s' exceeds legal range\n",
frac_name);
return GNUNET_SYSERR;
}
len = GNUNET_MIN (TALER_CURRENCY_LEN - 1, len = GNUNET_MIN (TALER_CURRENCY_LEN - 1,
strlen (currency)); strlen (currency));
memcpy (r_amount_nbo->currency, memcpy (r_amount_nbo->currency,

View File

@ -27,7 +27,7 @@ BASE_URL = "http://localhost:8083/"
# HTTP port the auditor listens to # HTTP port the auditor listens to
PORT = 8083 PORT = 8083
PUBLIC_KEY = XNYZPJJ6YPSQ4C6QPW120ACG9B5E5GBTTSYWXDMDB6G4X74TDBPG
TINY_AMOUNT = EUR:0.01 TINY_AMOUNT = EUR:0.01
[exchange] [exchange]

View File

@ -27,6 +27,7 @@ BASE_URL = "http://localhost:8083/"
# HTTP port the auditor listens to # HTTP port the auditor listens to
PORT = 8083 PORT = 8083
PUBLIC_KEY = XNYZPJJ6YPSQ4C6QPW120ACG9B5E5GBTTSYWXDMDB6G4X74TDBPG
TINY_AMOUNT = EUR:0.01 TINY_AMOUNT = EUR:0.01