diff options
Diffstat (limited to 'src/auditordb')
26 files changed, 669 insertions, 7 deletions
diff --git a/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql new file mode 100644 index 000000000..712561ccc --- /dev/null +++ b/src/auditordb/0002-auditor_amount_arithmetic_inconsistency.sql @@ -0,0 +1,27 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_amount_arithmetic_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ operation BYTEA,
+ exchange_amount taler_amount,
+ auditor_amount taler_amount,
+ profitable BOOLEAN
+);
+COMMENT ON TABLE auditor_amount_arithmetic_inconsistency
+ IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_bad_sig_losses.sql b/src/auditordb/0002-auditor_bad_sig_losses.sql new file mode 100644 index 000000000..ac17a5120 --- /dev/null +++ b/src/auditordb/0002-auditor_bad_sig_losses.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_bad_sig_losses
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ operation BYTEA,
+ loss taler_amount,
+ operation_specific_pub BYTEA
+);
+COMMENT ON TABLE auditor_bad_sig_losses
+ IS 'Report a (serious) inconsistency with losses due to bad signatures';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_closure_lags.sql b/src/auditordb/0002-auditor_closure_lags.sql new file mode 100644 index 000000000..8473b25f9 --- /dev/null +++ b/src/auditordb/0002-auditor_closure_lags.sql @@ -0,0 +1,27 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_closure_lags
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ amount taler_amount,
+ deadline BIGINT,
+ wtid integer,
+ account BYTEA
+);
+COMMENT ON TABLE auditor_closure_lags
+ IS 'Report closure lags.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_coin_inconsistency.sql b/src/auditordb/0002-auditor_coin_inconsistency.sql new file mode 100644 index 000000000..91f954a68 --- /dev/null +++ b/src/auditordb/0002-auditor_coin_inconsistency.sql @@ -0,0 +1,28 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_coin_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ operation BYTEA,
+ exchange_amount taler_amount,
+ auditor_amount taler_amount,
+ coin_pub BYTEA,
+ profitable BOOLEAN
+);
+COMMENT ON TABLE auditor_coin_inconsistency
+ IS 'Report a (serious) inconsistency in the exchange''s database with respect to calculations involving amounts';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql b/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql new file mode 100644 index 000000000..fd18f35fb --- /dev/null +++ b/src/auditordb/0002-auditor_denomination_key_validity_withdraw_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_denomination_key_validity_withdraw_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ execution_date BIGINT,
+ reserve_pub BYTEA,
+ denompub_h BYTEA
+);
+COMMENT ON TABLE auditor_denomination_key_validity_withdraw_inconsistency
+ IS 'Report a (serious) denomination key validity withdraw inconsistency in the exchange''s database';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_denominations_without_sigs.sql b/src/auditordb/0002-auditor_denominations_without_sigs.sql new file mode 100644 index 000000000..86c83e94f --- /dev/null +++ b/src/auditordb/0002-auditor_denominations_without_sigs.sql @@ -0,0 +1,27 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_denominations_without_sigs
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ denompub_h BYTEA,
+ value taler_amount,
+ start_time BIGINT,
+ end_time BIGINT
+);
+COMMENT ON TABLE auditor_denominations_without_sigs
+ IS 'Report encountered denomination that auditor is not auditing.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_deposit_confirmations.sql b/src/auditordb/0002-auditor_deposit_confirmations.sql index a0725925c..dd85c0a62 100644 --- a/src/auditordb/0002-auditor_deposit_confirmations.sql +++ b/src/auditordb/0002-auditor_deposit_confirmations.sql @@ -41,4 +41,20 @@ COMMENT ON TABLE auditor_deposit_confirmations CREATE INDEX IF NOT EXISTS auditor_deposit_confirmations_not_ancient ON auditor_deposit_confirmations (exchange_timestamp ASC) - WHERE NOT ancient;
\ No newline at end of file + WHERE NOT ancient; + +CREATE OR REPLACE FUNCTION auditor_new_transactions_trigger() + RETURNS trigger + LANGUAGE plpgsql +AS $$ +BEGIN + NOTIFY XX81AFHF88YGN6ESNH39KR5VQE9MHD7GSSNMTCXB82SZ6T99ARHE0; + RETURN NEW; +END $$; +COMMENT ON FUNCTION auditor_new_transactions_trigger() + IS 'Call auditor_call_db_notify on new entry'; + +CREATE TRIGGER auditor_notify_helper_deposits + AFTER INSERT + ON auditor.deposit_confirmations +EXECUTE PROCEDURE auditor_new_transactions_trigger();
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_emergency.sql b/src/auditordb/0002-auditor_emergency.sql new file mode 100644 index 000000000..2bb13d7e5 --- /dev/null +++ b/src/auditordb/0002-auditor_emergency.sql @@ -0,0 +1,29 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_emergency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ denompub_h BYTEA,
+ denom_risk taler_amount,
+ denom_loss taler_amount,
+ deposit_start BIGINT,
+ deposit_end BIGINT,
+ value taler_amount
+);
+COMMENT ON TABLE auditor_emergency
+ IS 'Report an emergency denomination.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_emergency_by_count.sql b/src/auditordb/0002-auditor_emergency_by_count.sql new file mode 100644 index 000000000..4daa994a7 --- /dev/null +++ b/src/auditordb/0002-auditor_emergency_by_count.sql @@ -0,0 +1,30 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_emergency_by_count
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ denompub_h BYTEA,
+ num_issued integer,
+ num_known integer,
+ risk taler_amount,
+ start BIGINT,
+ deposit_end BIGINT,
+ value taler_amount
+);
+COMMENT ON TABLE auditor_emergency_by_count
+ IS 'Report an emergency denomination.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_exchange_signkeys.sql b/src/auditordb/0002-auditor_exchange_signkeys.sql index 127365e64..345870252 100644 --- a/src/auditordb/0002-auditor_exchange_signkeys.sql +++ b/src/auditordb/0002-auditor_exchange_signkeys.sql @@ -1,4 +1,4 @@ --- + -- -- This file is part of TALER -- Copyright (C) 2014--2022 Taler Systems SA -- diff --git a/src/auditordb/0002-auditor_fee_time_inconsistency.sql b/src/auditordb/0002-auditor_fee_time_inconsistency.sql new file mode 100644 index 000000000..b89cc59c7 --- /dev/null +++ b/src/auditordb/0002-auditor_fee_time_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_fee_time_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ type BYTEA,
+ time BIGINT,
+ diagnostic BYTEA
+);
+COMMENT ON TABLE auditor_fee_time_inconsistency
+ IS 'Report a (serious) fee time inconsistency in the exchange''s database';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql b/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql new file mode 100644 index 000000000..f786d0fdf --- /dev/null +++ b/src/auditordb/0002-auditor_misattribution_in_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_misattribution_in_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ amount taler_amount,
+ bank_row BIGINT,
+ reserve_pub BYTEA
+);
+COMMENT ON TABLE auditor_misattribution_in_inconsistency
+ IS 'Report wire transfer that was smaller than it should have been.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql b/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql new file mode 100644 index 000000000..5ffb6e85a --- /dev/null +++ b/src/auditordb/0002-auditor_purse_not_closed_inconsistencies.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_purse_not_closed_inconsistencies
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ purse_pub BYTEA,
+ amount taler_amount,
+ expiration_date BIGINT
+);
+COMMENT ON TABLE auditor_purse_not_closed_inconsistencies
+ IS 'Report expired purses';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_refreshes_hanging.sql b/src/auditordb/0002-auditor_refreshes_hanging.sql new file mode 100644 index 000000000..5544bc0d8 --- /dev/null +++ b/src/auditordb/0002-auditor_refreshes_hanging.sql @@ -0,0 +1,25 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_refreshes_hanging
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ amount taler_amount,
+ coin_pub BYTEA
+);
+COMMENT ON TABLE auditor_refreshes_hanging
+ IS 'Report a hanging refresh.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql b/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql new file mode 100644 index 000000000..bbc0c8118 --- /dev/null +++ b/src/auditordb/0002-auditor_reserve_balance_insufficient_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_reserve_balance_insufficient_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ reserve_pub BYTEA,
+ inconsistency_gain BOOLEAN,
+ inconsistency_amount taler_amount
+);
+COMMENT ON TABLE auditor_reserve_balance_insufficient_inconsistency
+ IS 'Report a (serious) balance insufficiency in the exchange''s database';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql b/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql new file mode 100644 index 000000000..26d872132 --- /dev/null +++ b/src/auditordb/0002-auditor_reserve_balance_summary_wrong_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_reserve_balance_summary_wrong_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ reserve_pub BYTEA,
+ exchange_amount taler_amount,
+ auditor_amount taler_amount
+);
+COMMENT ON TABLE auditor_reserve_balance_summary_wrong_inconsistency
+ IS 'Report a (serious) reserve balance insufficiency.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_reserve_in_inconsistency.sql b/src/auditordb/0002-auditor_reserve_in_inconsistency.sql new file mode 100644 index 000000000..bb90c4018 --- /dev/null +++ b/src/auditordb/0002-auditor_reserve_in_inconsistency.sql @@ -0,0 +1,29 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_reserve_in_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ amount_exchange_expected taler_amount,
+ amount_wired taler_amount,
+ reserve_pub BYTEA,
+ timestamp BIGINT,
+ account BYTEA,
+ diagnostic BYTEA
+);
+COMMENT ON TABLE auditor_reserve_in_inconsistency
+ IS 'Report an incoming wire transfer claimed by exchange not found.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql b/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql new file mode 100644 index 000000000..1147b4ae8 --- /dev/null +++ b/src/auditordb/0002-auditor_reserve_not_closed_inconsistency.sql @@ -0,0 +1,27 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_reserve_not_closed_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ reserve_pub BYTEA,
+ balance taler_amount,
+ expiration_time BIGINT,
+ diagnostic BYTEA
+);
+COMMENT ON TABLE auditor_reserve_not_closed_inconsistency
+ IS 'Report a (serious) reserve balance insufficiency.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_row_inconsistency.sql b/src/auditordb/0002-auditor_row_inconsistency.sql new file mode 100644 index 000000000..ece2e5661 --- /dev/null +++ b/src/auditordb/0002-auditor_row_inconsistency.sql @@ -0,0 +1,25 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_row_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ table BYTEA,
+ diagnostic BYTEA
+);
+COMMENT ON TABLE auditor_row_inconsistency
+ IS 'Report a (serious) row inconsistency in the exchange''s database';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_row_minor_inconsistencies.sql b/src/auditordb/0002-auditor_row_minor_inconsistencies.sql new file mode 100644 index 000000000..7836037c7 --- /dev/null +++ b/src/auditordb/0002-auditor_row_minor_inconsistencies.sql @@ -0,0 +1,25 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_row_minor_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ table BYTEA,
+ diagnostic BYTEA
+);
+COMMENT ON TABLE auditor_row_minor_inconsistency
+ IS 'Report a (serious) row inconsistency in the exchange''s database.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_wire_format_inconsistency.sql b/src/auditordb/0002-auditor_wire_format_inconsistency.sql new file mode 100644 index 000000000..1bc9af89d --- /dev/null +++ b/src/auditordb/0002-auditor_wire_format_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_wire_format_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ amount taler_amount,
+ wire_offset BIGINT,
+ diagnostic BYTEA
+);
+COMMENT ON TABLE auditor_wire_format_inconsistency
+ IS 'Report a (serious) format inconsistency.';
\ No newline at end of file diff --git a/src/auditordb/0002-auditor_wire_out_inconsistency.sql b/src/auditordb/0002-auditor_wire_out_inconsistency.sql new file mode 100644 index 000000000..6a49c24a0 --- /dev/null +++ b/src/auditordb/0002-auditor_wire_out_inconsistency.sql @@ -0,0 +1,26 @@ +--
+-- This file is part of TALER
+-- Copyright (C) 2014--2024 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+--
+
+SET search_path TO auditor;
+CREATE TABLE IF NOT EXISTS auditor_wire_out_inconsistency
+(
+ row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE PRIMARY KEY,
+ destination_account BYTEA,
+ expected taler_amount,
+ claimed taler_amount
+);
+COMMENT ON TABLE auditor_wire_out_inconsistency
+ IS 'Report a (serious) wire inconsistency in the exchange''s database';
\ No newline at end of file diff --git a/src/auditordb/Makefile.am b/src/auditordb/Makefile.am index dbbd4d1cc..573b1b980 100644 --- a/src/auditordb/Makefile.am +++ b/src/auditordb/Makefile.am @@ -108,16 +108,15 @@ libtaler_plugin_auditordb_postgres_la_SOURCES = \ pg_insert_purse_summary.h pg_insert_purse_summary.c \ pg_update_purse_summary.h pg_update_purse_summary.c \ pg_get_deposit_confirmations.h pg_get_deposit_confirmations.c -libtaler_plugin_auditordb_postgres_la_LIBADD = \ - $(LTLIBINTL) libtaler_plugin_auditordb_postgres_la_LDFLAGS = \ - $(TALER_PLUGIN_LDFLAGS) \ + $(TALER_PLUGIN_LDFLAGS) +libtaler_plugin_auditordb_postgres_la_LIBADD = \ + $(LTLIBINTL) \ $(top_builddir)/src/pq/libtalerpq.la \ $(top_builddir)/src/util/libtalerutil.la \ - -lpq \ -lgnunetpq \ -lgnunetutil \ - -lpthread \ + -lpq \ $(XLIB) lib_LTLIBRARIES = \ diff --git a/src/auditordb/pg_delete_deposit_confirmations.c b/src/auditordb/pg_delete_deposit_confirmations.c new file mode 100644 index 000000000..553e97121 --- /dev/null +++ b/src/auditordb/pg_delete_deposit_confirmations.c @@ -0,0 +1,62 @@ +/*
+ This file is part of TALER
+ Copyright (C) 2024 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
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+/**
+ * @file auditordb/pg_delete_deposit_confirmations.c
+ * @brief Implementation of the delete_deposit_confirmations function for Postgres
+ * @author Nicola Eigel
+ */
+#include "platform.h"
+#include "taler_error_codes.h"
+#include "taler_dbevents.h"
+#include "taler_pq_lib.h"
+#include "pg_delete_deposit_confirmations.h"
+#include "pg_helper.h"
+
+enum GNUNET_DB_QueryStatus
+TAH_PG_delete_deposit_confirmations (
+ void *cls,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
+ const struct TALER_MerchantWireHashP *h_wire,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct TALER_ExchangeSignatureP *exchange_sig,
+ const struct TALER_ExchangePublicKeyP *exchange_pub,
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
+ GNUNET_PQ_query_param_auto_from_type (h_wire),
+ GNUNET_PQ_query_param_auto_from_type (merchant_pub),
+ GNUNET_PQ_query_param_auto_from_type (exchange_sig),
+ GNUNET_PQ_query_param_auto_from_type (exchange_pub),
+ GNUNET_PQ_query_param_auto_from_type (master_sig),
+ GNUNET_PQ_query_param_end
+ };
+
+ PREPARE (pg,
+ "auditor_delete_deposit_confirmations",
+ "DELETE"
+ " FROM deposit_confirmations"
+ " WHERE h_contract_terms=$1"
+ " AND h_wire=$2"
+ " AND merchant_pub=$3"
+ " AND exchange_sig=$4"
+ " AND exchange_pub=$5"
+ " AND master_sig=$6;");
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "auditor_delete_deposit_confirmations",
+ params);
+}
diff --git a/src/auditordb/pg_delete_deposit_confirmations.h b/src/auditordb/pg_delete_deposit_confirmations.h new file mode 100644 index 000000000..f0339fd3d --- /dev/null +++ b/src/auditordb/pg_delete_deposit_confirmations.h @@ -0,0 +1,51 @@ +/* + This file is part of TALER + Copyright (C) 2024 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 + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ +/** + * @file auditordb/pg_delete_deposit_confirmations.h + * @brief implementation of the delete_deposit_confirmations function for Postgres + * @author Nicola Eigel + */ +#ifndef PG_DELETE_DEPOSIT_CONFIRMATIONS_H +#define PG_DELETE_DEPOSIT_CONFIRMATIONS_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + +/** + * Delete a row from the deposit confirmations table. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param h_contract_terms private contract hash + * @param h_wire merchant wire hash + * @param merchant_pub master key of the merchant + * @param exchange_sig signature of the exchange + * @param exchange_pub master key of the exchange + * @param master_sig master signature of the exchange + * @return + */ +enum GNUNET_DB_QueryStatus +TAH_PG_delete_deposit_confirmations ( + void *cls, + const struct TALER_PrivateContractHashP *h_contract_terms, + const struct TALER_MerchantWireHashP *h_wire, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_ExchangeSignatureP *exchange_sig, + const struct TALER_ExchangePublicKeyP *exchange_pub, + const struct TALER_MasterSignatureP *master_sig); + + +#endif diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 2b722a5ea..dc66990ba 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -77,6 +77,7 @@ #include "pg_insert_exchange_signkey.h" #include "pg_insert_deposit_confirmation.h" #include "pg_get_deposit_confirmations.h" +#include "pg_delete_deposit_confirmations.h" #include "pg_insert_auditor_progress_coin.h" #include "pg_update_auditor_progress_coin.h" #include "pg_get_auditor_progress_coin.h" |