-towards getting auditor tests to pass again with new logic

This commit is contained in:
Christian Grothoff 2022-02-28 16:13:24 +01:00
parent d7bbf934a0
commit 8f77bda2e0
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
8 changed files with 3756 additions and 2077 deletions

View File

@ -1 +1 @@
1638356946
1646042841

View File

@ -1 +1 @@
R8JBA9089F3YRRSQDPWB92CZ5V1V0J1BPVW8J1B0P8VCVH71CYY0
TMQ09D9G18Z8TFEABD833SDJ6JQWRYKFHPTWT6DMPQS54ZC66RDG

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ rm -f $WALLET_DB
# Configuration file will be edited, so we create one
# from the template.
CONF=generate-auditor-basedb-prod.conf
CONF=${BASEDB}.conf
cp generate-auditor-basedb-template.conf $CONF
@ -92,8 +92,11 @@ mkdir -p $AUDITOR_PRIV_DIR
gnunet-ecc -g1 $AUDITOR_PRIV_FILE > /dev/null
AUDITOR_PUB=`gnunet-ecc -p $AUDITOR_PRIV_FILE`
echo "AUDITOR PUB is $AUDITOR_PUB using file $AUDITOR_PRIV_FILE"
# patch configuration
taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB
taler-config -c $CONF -s auditor -o PUBLIC_KEY -V $AUDITOR_PUB
taler-config -c $CONF -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB
taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TARGET_DB
taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TARGET_DB
@ -238,7 +241,6 @@ echo "Final clean up"
dropdb $TARGET_DB
rm -rf $DATA_DIR || true
rm $CONF
echo "====================================="
echo " Finished generation of $BASEDB"

View File

@ -558,7 +558,7 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
"BASE_URL");
return GNUNET_SYSERR;
}
if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_master_pub))
if (GNUNET_is_zero (&TALER_ARL_master_pub))
{
/* -m option not given, try configuration */
char *master_public_key_str;
@ -596,32 +596,7 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
"Taler auditor running for exchange master public key %s\n",
TALER_B2S (&TALER_ARL_master_pub));
if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_auditor_pub))
{
/* try loading private key and deriving public key */
char *fn;
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_filename (c,
"auditor",
"AUDITOR_PRIV_FILE",
&fn))
{
struct TALER_AuditorPrivateKeyP auditor_priv;
if (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_key_from_file (fn,
GNUNET_NO, /* do NOT create it! */
&auditor_priv.eddsa_priv))
{
GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv,
&TALER_ARL_auditor_pub.eddsa_pub);
}
GNUNET_free (fn);
}
}
if (GNUNET_YES == 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;
@ -653,6 +628,34 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
GNUNET_free (auditor_public_key_str);
}
if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{
/* try loading private key and deriving public key */
char *fn;
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_filename (c,
"auditor",
"AUDITOR_PRIV_FILE",
&fn))
{
struct TALER_AuditorPrivateKeyP auditor_priv;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Loading offline private key from `%s' to get auditor public key\n",
fn);
if (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_key_from_file (fn,
GNUNET_NO, /* do NOT create it! */
&auditor_priv.eddsa_priv))
{
GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv,
&TALER_ARL_auditor_pub.eddsa_pub);
}
GNUNET_free (fn);
}
}
if (GNUNET_OK !=
TALER_config_get_currency (TALER_ARL_cfg,
&TALER_ARL_currency))

View File

@ -2194,7 +2194,12 @@ check_denomination (
&issue->denom_hash,
&TALER_ARL_auditor_pub,
&auditor_sig);
if (0 >= qs)
if (0 > qs)
{
GNUNET_break (0);
return; /* skip! */
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Encountered denomination `%s' (%s) valid from %s (%llu-%llu) that this auditor is not auditing!\n",

View File

@ -241,6 +241,7 @@ prepare_statements (struct PostgresClosure *pg)
"denomination_iterate",
"SELECT"
" master_sig"
",denom_pub_hash"
",valid_from"
",expire_withdraw"
",expire_deposit"
@ -1066,6 +1067,7 @@ prepare_statements (struct PostgresClosure *pg)
",merchant_pub"
",denom.denom_pub"
",kc.coin_pub"
",kc.age_commitment_hash"
",coin_sig"
",refund_deadline"
",wire_deadline"
@ -3093,6 +3095,7 @@ postgres_insert_denomination_info (
const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{
struct PostgresClosure *pg = cls;
struct TALER_DenominationHashP denom_hash;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash),
TALER_PQ_query_param_denom_pub (denom_pub),
@ -3111,8 +3114,13 @@ postgres_insert_denomination_info (
};
struct TALER_DenomFeeSet fees;
GNUNET_assert (denom_pub->age_mask.mask == issue->age_mask.mask);
GNUNET_assert (denom_pub->age_mask.mask ==
issue->age_mask.mask);
TALER_denom_pub_hash (denom_pub,
&denom_hash);
GNUNET_assert (0 ==
GNUNET_memcmp (&denom_hash,
&issue->properties.denom_hash));
GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
GNUNET_TIME_timestamp_ntoh (
issue->properties.start).abs_time));
@ -3244,9 +3252,12 @@ domination_cb_helper (void *cls,
{
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;
struct TALER_DenominationPublicKey denom_pub;
struct TALER_DenominationHashP denom_hash;
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&issue.signature),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&denom_hash),
GNUNET_PQ_result_spec_timestamp_nbo ("valid_from",
&issue.properties.start),
GNUNET_PQ_result_spec_timestamp_nbo ("expire_withdraw",
@ -3297,9 +3308,18 @@ domination_cb_helper (void *cls,
= htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
TALER_denom_pub_hash (&denom_pub,
&issue.properties.denom_hash);
dic->cb (dic->cb_cls,
&denom_pub,
&issue);
if (0 !=
GNUNET_memcmp (&issue.properties.denom_hash,
&denom_hash))
{
GNUNET_break (0);
}
else
{
dic->cb (dic->cb_cls,
&denom_pub,
&issue);
}
TALER_denom_pub_free (&denom_pub);
}
}
@ -6236,7 +6256,8 @@ add_revealed_coins (void *cls,
{
struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &grctx->rrcs[off];
struct GNUNET_PQ_ResultSpec rsi[] = {
GNUNET_PQ_result_spec_auto_from_type ("h_denom_pub",
/* NOTE: freshcoin_index selected and discarded here... */
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&rrc->h_denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("link_sig",
&rrc->orig_coin_link_sig),
@ -8146,6 +8167,10 @@ deposit_serial_helper_cb (void *cls,
&denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&deposit.coin.coin_pub),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
&deposit.coin.h_age_commitment),
&deposit.coin.no_age_commitment),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&deposit.csig),
GNUNET_PQ_result_spec_timestamp ("refund_deadline",
@ -8166,6 +8191,9 @@ deposit_serial_helper_cb (void *cls,
};
int ret;
memset (&deposit,
0,
sizeof (deposit));
if (GNUNET_OK !=
GNUNET_PQ_extract_result (result,
rs,

View File

@ -1,6 +1,6 @@
/*
This file is part of TALER
Copyright (C) 2021 Taler Systems SA
Copyright (C) 2021, 2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software