diff options
| author | Christian Grothoff <christian@grothoff.org> | 2017-11-08 19:07:21 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2017-11-08 19:07:21 +0100 | 
| commit | 166594115404baba540968398e1fa420993fed50 (patch) | |
| tree | d98f725a2f0816d63a68b16df2f98b7468917c0a | |
| parent | 1139f74ffe89ea31b5a15f0a2c174e054e19e2b6 (diff) | |
fix misc typos in auditor report logic
| -rw-r--r-- | contrib/auditor-report.tex.j2 | 44 | ||||
| -rwxr-xr-x | contrib/render.py | 4 | ||||
| -rw-r--r-- | contrib/samples/auditor.json | 162 | ||||
| -rw-r--r-- | contrib/samples/wire-auditor.json | 5 | ||||
| -rw-r--r-- | src/auditor/taler-auditor.c | 14 | ||||
| -rw-r--r-- | src/auditor/taler-wire-auditor.c | 2 | 
6 files changed, 144 insertions, 87 deletions
| diff --git a/contrib/auditor-report.tex.j2 b/contrib/auditor-report.tex.j2 index d852f90c..62db4db8 100644 --- a/contrib/auditor-report.tex.j2 +++ b/contrib/auditor-report.tex.j2 @@ -14,15 +14,15 @@  The balance of the escrow account should  be {\bf  \mbox{ -  {{ data.report_denomination_balance[0].total_escrow_balance.value }}.{{ data.report_denomination_balance[0].total_escrow_balance.fraction }} -  {{ data.report_denomination_balance[0].total_escrow_balance.currency }}}}. +  {{ data.total_escrow_balance.value }}.{{ data.total_escrow_balance.fraction }} +  {{ data.total_escrow_balance.currency }}}}.  \noindent  The active operational risk stands at  \mbox{  {\bf -  {{ data.report_denomination_balance[0].total_active_risk.value }}.{{ data.report_denomination_balance[0].total_active_risk.fraction }} -  {{ data.report_denomination_balance[0].total_active_risk.currency }}}}. +  {{ data.total_active_risk.value }}.{{ data.total_active_risk.fraction }} +  {{ data.total_active_risk.currency }}}}.  \section{Income} @@ -120,17 +120,17 @@ the financial damage done to the customer).    {\bf Operation} & {\bf Table row} & \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\    \hline \hline  \endfirsthead -  {\bf Operation} & {\bf Table row} & \ \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\ \hline \hline +  {\bf Operation} & {\bf Table row} & \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\ \hline \hline  \endhead    \hline \hline -  {\bf Operation} & {\bf Table row} & \ \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\ +  {\bf Operation} & {\bf Table row} & \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\  \endfoot    \hline    {\bf Total} & &    {{ data.total_arithmetic_delta_plus.value }}.{{ data.total_arithmetic_delta_plus.fraction }} &    {{ data.total_arithmetic_delta_plus.currency }} &    {{ data.total_arithmetic_delta_minus.value }}.{{ data.total_arithmetic_delta_minus.fraction }} & -  {{ data.total_arithmetic_delta_minus.currency }} & +  {{ data.total_arithmetic_delta_minus.currency }} \\      \caption{Arithmetic inconsistencies.}      \label{table:amount:arithmetic:inconsistencies}  \endlastfoot @@ -192,7 +192,7 @@ that is a separate check).  Note that not making the wire transfer  would be reported separately in Section~\ref{sec:wire_check_out}. -{% if data.reserve_wire_out_inconsistencies|length() == 0 %} +{% if data.wire_out_inconsistencies|length() == 0 %}    {\bf All aggregations matched up.}  {% else %}    \begin{longtable}{p{1.5cm}|l|rl|rl} @@ -238,17 +238,17 @@ any effects on its own balance, those entries are excluded from the total.    {\bf Operation} & {\bf Coin public key} & \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\    \hline \hline  \endfirsthead -  {\bf Operation} & {\bf Coin public key} & \ \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\ \hline \hline +  {\bf Operation} & {\bf Coin public key} & \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\ \hline \hline  \endhead    \hline \hline -  {\bf Operation} & {\bf Coin public key} & \ \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\ +  {\bf Operation} & {\bf Coin public key} & \multicolumn{2}{|c|}{ {\bf Exchange}} & \multicolumn{2}{|c|}{ {\bf Auditor}} \\  \endfoot    \hline    {\bf Total} & &    {{ data.total_coin_delta_plus.value }}.{{ data.total_coin_delta_plus.fraction }} &    {{ data.total_coin_delta_plus.currency }} &    - {{ data.total_coin_delta_minus.value }}.{{ data.total_coin_delta_minus.fraction }} & -  {{ data.total_coin_delta_minus.currency }} & +  {{ data.total_coin_delta_minus.currency }} \\      \caption{Arithmetic inconsistencies of amount calculations involving a coin.}      \label{table:amount:arithmetic:coin:inconsistencies}  \endlastfoot @@ -279,7 +279,7 @@ the (hash of the) denomination public key for  ``payback-verify'' and ``deposit-verify'' operations, and the master  public key for ``payback-master'' operations. -{% if data.reserve_wire_out_inconsistencies|length() == 0 %} +{% if data.bad_sig_losses|length() == 0 %}    {\bf All signatures were valid.}  {% else %}    \begin{longtable}{p{1.5cm}|c|l|rl} @@ -314,7 +314,7 @@ public key for ``payback-master'' operations.  This section highlights cases where the exchange's record about  incoming wire transfers does not match with that of the bank. -{% if wire.reserve_in_amount_inconsistencies() == 0 %} +{% if wire.reserve_in_amount_inconsistencies|length() == 0 %}    {\bf All incoming wire transfer amounts and subjects matched up.}  {% else %}    \begin{longtable}{p{6.5cm}|rl|rl} @@ -331,9 +331,9 @@ incoming wire transfers does not match with that of the bank.    {\bf Diagnostic}               & \multicolumn{2}{|c|}{ {\bf Row}} & \multicolumn{2}{|c|}{ {\bf Timestamp}}  \\  \endfoot    \hline -  {\bf Total deltas}  & & -  {{ wire.total_bad_amount_in_plus.value}}.{{ wire.total_bad_amount_in_plus.fraction}} & {{ wire.total_bad_amount_in_plus.currency}} & -  - {{ wire.total_bad_amount_in_minus.value}}.{{ wire.total_bad_amount_in_minus.fraction}} & {{ wire.total_bad_amount_in_minus.currency}} \\ +  {\bf Total deltas}  & +  {{ wire.total_wire_in_delta_plus.value}}.{{ wire.total_wire_in_delta_plus.fraction}} & {{ wire.total_wire_in_delta_plus.currency}} & +  - {{ wire.total_wire_in_delta_minus.value}}.{{ wire.total_wire_in_delta_minus.fraction}} & {{ wire.total_wire_in_delta_minus.currency}} \\    \caption{Incoming wire transfer amounts not matching up.}    \label{table:wire_in:transfer_amount_inconsistencies}  \endlastfoot @@ -347,7 +347,7 @@ incoming wire transfers does not match with that of the bank.    &    {{ item.diagnostic }} &    {{ item.row }} & -  {{ item.timestmap }} \\ \hline +  {{ item.timestamp }} \\ \hline  {% endfor %}    \end{longtable}  {% endif %} @@ -362,7 +362,7 @@ is closed and the remaining balance is refunded to the original  account. -{% if wire.missattribution_in_inconsistencies() == 0 %} +{% if wire.missattribution_in_inconsistencies|length() == 0 %}    {\bf All incoming wire transfer sender accounts matched up.}  {% else %}    \begin{longtable}{p{6.5cm}|rl} @@ -397,7 +397,7 @@ account.  This section highlights cases where the exchange missbehaved  with respect to outgoing wire transfers. -{% if wire.wire_out_amount_inconsistencies() == 0 %} +{% if wire.wire_out_amount_inconsistencies|length() == 0 %}    {\bf All outgoing wire transfers matched up.}  {% else %}    \begin{longtable}{p{6.5cm}|rl|rl} @@ -415,8 +415,8 @@ with respect to outgoing wire transfers.  \endfoot    \hline    {\bf Total deltas}  & & -  {{ wire.total_bad_amount_out_plus.value}}.{{ wire.total_bad_amount_out_plus.fraction}} & {{ wire.total_bad_amount_out_plus.currency}} & -  - {{ wire.total_bad_amount_out_minus.value}}.{{ wire.total_bad_amount_out_minus.fraction}} & {{ wire.total_bad_amount_out_minus.currency}} \\ +  {{ wire.total_wire_out_delta_plus.value}}.{{ wire.total_wire_out_delta_plus.fraction}} & {{ wire.total_wire_out_delta_plus.currency}} & +  - {{ wire.total_wire_out_delta_minus.value}}.{{ wire.total_bad_amount_out_minus.fraction}} & {{ wire.total_wire_out_delta_minus.currency}} \\    \caption{Outgoing wire transfer amounts not matching up.}    \label{table:wire_out:transfer_amount_inconsistencies}  \endlastfoot @@ -485,7 +485,7 @@ have a clear financial impact.  {% if wire.row_inconsistencies|length() == 0 %}    {\bf No wire row inconsistencies found.}  {% else %} -  \begin{longtable}{p{1.5cm}|l|p{5.5}} +  \begin{longtable}{p{1.5cm}|l|p{5.5cm}}    {\bf Table} & {\bf Row} & {\bf Diagnostic} \\    \hline \hline  \endfirsthead diff --git a/contrib/render.py b/contrib/render.py index 093db355..47c00bb2 100755 --- a/contrib/render.py +++ b/contrib/render.py @@ -31,10 +31,10 @@ class StdinLoader(BaseLoader):  jsonFile1 = open (sys.argv[1], 'r') -jsonData1 = json.load(jsonFile) +jsonData1 = json.load(jsonFile1)  jsonFile2 = open (sys.argv[2], 'r') -jsonData2 = json.load(jsonFile) +jsonData2 = json.load(jsonFile2)  jinjaEnv = jinja2.Environment(loader=StdinLoader(),                                lstrip_blocks=True, diff --git a/contrib/samples/auditor.json b/contrib/samples/auditor.json index 18754d1a..441ab4f3 100644 --- a/contrib/samples/auditor.json +++ b/contrib/samples/auditor.json @@ -1,60 +1,112 @@  { +  "reserve_balance_insufficient_inconsistencies": [], +  "total_loss_balance_insufficient": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "reserve_balance_summary_wrong_inconsistencies": [], +  "total_balance_summary_delta_plus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_balance_summary_delta_minus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_escrow_balance": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_active_risk": { +    "currency": "KUDOS", +    "value": 150, +    "fraction": 0 +  }, +  "total_withdraw_fee_income": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 30000000 +  }, +  "total_deposit_fee_income": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 30000000 +  }, +  "total_melt_fee_income": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_refund_fee_income": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "income_fee_total": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 60000000 +  },    "emergencies": [], -  "row_inconsistencies": [], -  "row_minor_inconsistencies": [], -  "reserve_inconsistencies": [], +  "emergencies_risk_total": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "reserve_not_closed_inconsistencies": [], +  "total_balance_reserve_not_closed": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  },    "wire_out_inconsistencies": [], +  "total_wire_out_delta_plus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_wire_out_delta_minus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "bad_sig_losses": [], +  "total_bad_sig_loss": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "row_inconsistencies": [], +  "denomination_key_validity_withdraw_inconsistencies": [],    "coin_inconsistencies": [], -  "reserve_balance": [ -    { -      "total_escrow_balance": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 0 -      }, -      "total_withdraw_fee_income": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 30000000 -      } -    } -  ], -  "aggregation_fee_balance": [ -    { -      "total_aggregation_fee_income": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 0 -      } -    } -  ], -  "report_denomination_balance": [ -    { -      "total_escrow_balance": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 0 -      }, -      "total_active_risk": { -        "currency": "KUDOS", -        "value": 150, -        "fraction": 0 -      }, -      "total_deposit_fee_income": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 30000000 -      }, -      "total_melt_fee_income": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 0 -      }, -      "total_refund_fee_income": { -        "currency": "KUDOS", -        "value": 0, -        "fraction": 0 -      } -    } -  ] +  "total_coin_delta_plus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_coin_delta_minus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "amount_arithmetic_inconsistencies": [], +  "total_arithmetic_delta_plus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_arithmetic_delta_minus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }, +  "total_aggregation_fee_income": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  }  }
\ No newline at end of file diff --git a/contrib/samples/wire-auditor.json b/contrib/samples/wire-auditor.json index cf801945..44e33827 100644 --- a/contrib/samples/wire-auditor.json +++ b/contrib/samples/wire-auditor.json @@ -28,6 +28,11 @@        "diagnostic": "incoming wire transfer claimed by exchange not found"      }    ], +  "total_wire_in_delta_plus": { +    "currency": "KUDOS", +    "value": 0, +    "fraction": 0 +  },    "total_wire_in_delta_minus": {      "currency": "KUDOS",      "value": 5, diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index e801ec77..d33b23df 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -4072,8 +4072,7 @@ run (void *cls,                        " s:o, s:o, s:o, s:o, s:o,"                        " s:o, s:o, s:o, s:o, s:o,"                        " s:o, s:o, s:o, s:o, s:o," -                      " s:o, s:o, s:o, s:o, s:o," -                      " s:o}", +                      " s:o, s:o, s:o, s:o, s:o}",                        /* blocks of 5 for easier counting/matching to format string */                        /* block */  		      "reserve_balance_insufficient_inconsistencies", @@ -4096,8 +4095,8 @@ run (void *cls,                        "total_deposit_fee_income",                        TALER_JSON_from_amount (&total_deposit_fee_income),                        "total_melt_fee_income", -                      /* block */                        TALER_JSON_from_amount (&total_melt_fee_income), +                      /* block */                        "total_refund_fee_income",                        TALER_JSON_from_amount (&total_refund_fee_income),                        "income_fee_total", @@ -4106,9 +4105,9 @@ run (void *cls,                        report_emergencies,                        "emergencies_risk_total",                        TALER_JSON_from_amount (&reported_emergency_sum), -                      /* block */  		      "reserve_not_closed_inconsistencies",                        report_reserve_not_closed_inconsistencies, +                      /* block */                        "total_balance_reserve_not_closed",                        TALER_JSON_from_amount (&total_balance_reserve_not_closed),  		      "wire_out_inconsistencies", @@ -4117,9 +4116,9 @@ run (void *cls,                        TALER_JSON_from_amount (&total_wire_out_delta_plus),                        "total_wire_out_delta_minus",                        TALER_JSON_from_amount (&total_wire_out_delta_minus), -                      /* block */                        "bad_sig_losses",                        report_bad_sig_losses, +                      /* block */                        "total_bad_sig_loss",                        TALER_JSON_from_amount (&total_bad_sig_loss),  		      "row_inconsistencies", @@ -4128,9 +4127,9 @@ run (void *cls,                        denomination_key_validity_withdraw_inconsistencies,  		      "coin_inconsistencies",                        report_coin_inconsistencies, -                      /* block */                        "total_coin_delta_plus",                        TALER_JSON_from_amount (&total_coin_delta_plus), +                      /* block */                        "total_coin_delta_minus",                        TALER_JSON_from_amount (&total_coin_delta_minus),                        "amount_arithmetic_inconsistencies", @@ -4139,10 +4138,11 @@ run (void *cls,                        TALER_JSON_from_amount (&total_arithmetic_delta_plus),                        "total_arithmetic_delta_minus",                        TALER_JSON_from_amount (&total_arithmetic_delta_minus), -                      /* block */  		      "total_aggregation_fee_income",                        TALER_JSON_from_amount (&total_aggregation_fee_income) +                      /* block */                        ); +  GNUNET_break (NULL != report);    json_dumpf (report,  	      stdout,  	      JSON_INDENT (2)); diff --git a/src/auditor/taler-wire-auditor.c b/src/auditor/taler-wire-auditor.c index 13a293c3..f34fc7e7 100644 --- a/src/auditor/taler-wire-auditor.c +++ b/src/auditor/taler-wire-auditor.c @@ -314,7 +314,7 @@ do_shutdown (void *cls)                          TALER_JSON_from_amount (&total_bad_amount_out_minus),  			"reserve_in_amount_inconsistencies",                          report_reserve_in_inconsistencies, -                        "total_wire_in_delta_minus", +                        "total_wire_in_delta_plus",                          TALER_JSON_from_amount (&total_bad_amount_in_plus),                          /* block */                          "total_wire_in_delta_minus", | 
