diff options
Diffstat (limited to 'src/benchmark')
-rw-r--r-- | src/benchmark/Makefile.am | 10 | ||||
-rw-r--r-- | src/benchmark/bank-benchmark-cs.conf | 123 | ||||
-rw-r--r-- | src/benchmark/bank-benchmark-rsa.conf | 130 | ||||
-rw-r--r-- | src/benchmark/benchmark-common.conf | 59 | ||||
-rw-r--r-- | src/benchmark/benchmark-cs.conf | 116 | ||||
-rw-r--r-- | src/benchmark/benchmark-rsa.conf | 121 | ||||
-rw-r--r-- | src/benchmark/coins-cs.conf | 58 | ||||
-rw-r--r-- | src/benchmark/coins-rsa.conf | 63 | ||||
-rwxr-xr-x | src/benchmark/taler-benchmark-setup.sh | 556 | ||||
-rw-r--r-- | src/benchmark/taler-exchange-benchmark.c | 27 |
10 files changed, 781 insertions, 482 deletions
diff --git a/src/benchmark/Makefile.am b/src/benchmark/Makefile.am index b62e8846..de93cc74 100644 --- a/src/benchmark/Makefile.am +++ b/src/benchmark/Makefile.am @@ -15,6 +15,10 @@ bin_PROGRAMS = \ taler-bank-benchmark \ taler-exchange-benchmark +bin_SCRIPTS = \ + taler-benchmark-setup.sh + + taler_aggregator_benchmark_SOURCES = \ taler-aggregator-benchmark.c taler_aggregator_benchmark_LDADD = \ @@ -64,6 +68,12 @@ taler_exchange_benchmark_LDADD = \ $(XLIB) EXTRA_DIST = \ + benchmark-common.conf \ benchmark-cs.conf \ benchmark-rsa.conf \ + bank-benchmark-cs.conf \ + bank-benchmark-rsa.conf \ + coins-cs.conf \ + coins-rsa.conf \ + $(bin_SCRIPTS) \ exchange_benchmark_home/.local/share/taler/exchange/offline-keys/master.priv diff --git a/src/benchmark/bank-benchmark-cs.conf b/src/benchmark/bank-benchmark-cs.conf index e32370f8..d1d75d74 100644 --- a/src/benchmark/bank-benchmark-cs.conf +++ b/src/benchmark/bank-benchmark-cs.conf @@ -1,128 +1,17 @@ # This file is in the public domain. -# -[paths] -# Persistent data storage for the testcase -# This value is a default for `taler_config_home' -taler_test_home = exchange_benchmark_home/ - -[taler] -# Currency supported by the exchange (can only be one) -currency = EUR -CURRENCY_ROUND_UNIT = EUR:0.01 - -[exchange] -# how long is one signkey valid? -signkey_duration = 4 weeks -signkey_legal_duration = 2 years -# how long do we provide to clients denomination and signing keys -# ahead of time? -# Keep it short so the test runs fast. -lookahead_sign = 12h -# HTTP port the exchange listens to -port = 8081 -# Master public key used to sign the exchange's various keys -master_public_key = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG -# How to access our database -DB = postgres -# Base URL of the exchange. Must be set to a URL where the -# exchange (or the twister) is actually listening. -base_url = "http://localhost:8081/" - -WIREWATCH_IDLE_SLEEP_INTERVAL = 500 ms - -[exchange-offline] -MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv - -[auditor] -BASE_URL = "http://localhost:8083/" - -[exchangedb-postgres] -config = "postgres:///talercheck" - -[benchmark-remote-exchange] -host = localhost -# Adjust $HOME to match remote target! -dir = $HOME/repos/taler/exchange/src/benchmark - -[bank] -HTTP_PORT = 8082 -SERVE = http -MAX_DEBT = EUR:100000000000.0 -MAX_DEBT_BANK = EUR:1000000000000000.0 - -[benchmark] -USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42?receiver-name=user42 +@INLINE@ benchmark-common.conf +@INLINE@ coins-cs.conf [exchange-account-2] # What is the payto://-URL of the exchange (to generate wire response) PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange?receiver-name=Exchange" -enable_debit = YES -enable_credit = YES +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES [exchange-accountcredentials-2] # What is the bank account (with the "Taler Bank" demo system)? Must end with "/". WIRE_GATEWAY_URL = http://localhost:8082/Exchange/ # Authentication information for basic authentication WIRE_GATEWAY_AUTH_METHOD = "basic" -username = Exchange -password = x - - - - -# Sections starting with "coin_" specify which denominations -# the exchange should support (and their respective fee structure) -[coin_eur_ct_1] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_ct_10] -value = EUR:0.10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_1] -value = EUR:1 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_5] -value = EUR:5 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_10] -value = EUR:10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS +USERNAME = Exchange +PASSWORD = x diff --git a/src/benchmark/bank-benchmark-rsa.conf b/src/benchmark/bank-benchmark-rsa.conf index 41934b08..d1d75d74 100644 --- a/src/benchmark/bank-benchmark-rsa.conf +++ b/src/benchmark/bank-benchmark-rsa.conf @@ -1,133 +1,17 @@ # This file is in the public domain. -# -[paths] -# Persistent data storage for the testcase -# This value is a default for `taler_config_home' -taler_test_home = exchange_benchmark_home/ - -[taler] -# Currency supported by the exchange (can only be one) -currency = EUR -CURRENCY_ROUND_UNIT = EUR:0.01 - -[exchange] -# how long is one signkey valid? -signkey_duration = 4 weeks -signkey_legal_duration = 2 years -# how long do we provide to clients denomination and signing keys -# ahead of time? -# Keep it short so the test runs fast. -lookahead_sign = 12h -# HTTP port the exchange listens to -port = 8081 -# Master public key used to sign the exchange's various keys -master_public_key = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG -# How to access our database -DB = postgres -# Base URL of the exchange. Must be set to a URL where the -# exchange (or the twister) is actually listening. -base_url = "http://localhost:8081/" - -WIREWATCH_IDLE_SLEEP_INTERVAL = 1500 ms - -[exchange-offline] -MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv - -[auditor] -BASE_URL = "http://localhost:8083/" - -[exchangedb-postgres] -config = "postgres://exchange:taler@192.168.42.42/exchange" - -[benchmark-remote-exchange] -host = localhost -# Adjust $HOME to match remote target! -dir = $HOME/repos/taler/exchange/src/benchmark - -[bank] -HTTP_PORT = 8082 -SERVE = http -MAX_DEBT = EUR:100000000000.0 -MAX_DEBT_BANK = EUR:1000000000000000.0 - -[benchmark] -USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42 +@INLINE@ benchmark-common.conf +@INLINE@ coins-cs.conf [exchange-account-2] # What is the payto://-URL of the exchange (to generate wire response) -PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange" -enable_debit = YES -enable_credit = YES +PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange?receiver-name=Exchange" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES [exchange-accountcredentials-2] # What is the bank account (with the "Taler Bank" demo system)? Must end with "/". WIRE_GATEWAY_URL = http://localhost:8082/Exchange/ # Authentication information for basic authentication WIRE_GATEWAY_AUTH_METHOD = "basic" -username = Exchange -password = x - - - - -# Sections starting with "coin_" specify which denominations -# the exchange should support (and their respective fee structure) -[coin_eur_ct_1] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_ct_10] -value = EUR:0.10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_1] -value = EUR:1 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_5] -value = EUR:5 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_10] -value = EUR:10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 +USERNAME = Exchange +PASSWORD = x diff --git a/src/benchmark/benchmark-common.conf b/src/benchmark/benchmark-common.conf new file mode 100644 index 00000000..1cd28d62 --- /dev/null +++ b/src/benchmark/benchmark-common.conf @@ -0,0 +1,59 @@ +# This file is in the public domain. +[paths] +TALER_TEST_HOME=exchange_benchmark_home/ + +[taler] +CURRENCY=EUR +CURRENCY_ROUND_UNIT=EUR:0.01 + +[exchange] +AML_THRESHOLD=EUR:99999999 +SIGNKEY_LEGAL_DURATION=2 years +PORT=8081 +MASTER_PUBLIC_KEY=98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG +DB=postgres +BASE_URL="http://localhost:8081/" +AGGREGATOR_SHARD_SIZE=67108864 +WIREWATCH_IDLE_SLEEP_INTERVAL=5 ms + +[taler-exchange-secmod-rsa] +LOOKAHEAD_SIGN="1 d" + +[taler-exchange-secmod-cs] +LOOKAHEAD_SIGN="1 d" + +[taler-exchange-secmod-eddsa] +DURATION="2 d" +LOOKAHEAD_SIGN="1 d" + +[exchangedb-postgres] +CONFIG="postgres:///talercheck" + +[exchange-offline] +MASTER_PRIV_FILE=${TALER_DATA_HOME}/exchange/offline-keys/master.priv + +[bank] +HTTP_PORT=8082 +SERVE=http +MAX_DEBT=EUR:100000000000.0 +MAX_DEBT_BANK=EUR:1000000000000000.0 +DATABASE=bank-db.sqlite3 + +[libeufin-nexus] +DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix." +#DB_CONNECTION="jdbc:sqlite:libeufin-nexus.sqlite3" + +[libeufin-sandbox] +DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix." +#DB_CONNECTION="jdbc:sqlite:libeufin-sandbox.sqlite3" + +[auditor] +BASE_URL="http://localhost:8083/" + +[benchmark-remote-exchange] +HOST=localhost +# Adjust $HOME to match remote target! +DIR=$HOME/repos/taler/exchange/src/benchmark + +[benchmark] +USER_PAYTO_URI="payto://x-taler-bank/localhost:8082/42?receiver-name=user42" diff --git a/src/benchmark/benchmark-cs.conf b/src/benchmark/benchmark-cs.conf index 79721be1..db44e4d1 100644 --- a/src/benchmark/benchmark-cs.conf +++ b/src/benchmark/benchmark-cs.conf @@ -1,60 +1,6 @@ # This file is in the public domain. -# -[paths] -# Persistent data storage for the testcase -# This value is a default for `taler_config_home' -TALER_TEST_HOME = exchange_benchmark_home/ - -[taler] -# Currency supported by the exchange (can only be one) -CURRENCY = EUR -CURRENCY_ROUND_UNIT = EUR:0.01 - -[exchange] - -AML_THRESHOLD = EUR:99999999 -SIGNKEY_LEGAL_DURATION = 2 years - -# HTTP port the exchange listens to -PORT = 8081 -# Master public key used to sign the exchange's various keys -MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG -# How to access our database -DB = postgres -# Base URL of the exchange. Must be set to a URL where the -# exchange (or the twister) is actually listening. -BASE_URL = "http://localhost:8081/" - -AGGREGATOR_SHARD_SIZE = 67108864 -#AGGREGATOR_SHARD_SIZE = 2147483648 - - - -WIREWATCH_IDLE_SLEEP_INTERVAL = 5 ms - -[exchange-offline] -MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv - -[auditor] -BASE_URL = "http://localhost:8083/" - -[exchangedb-postgres] -CONFIG = "postgres:///talercheck" - -[benchmark-remote-exchange] -HOST = localhost -# Adjust $HOME to match remote target! -DIR = $HOME/repos/taler/exchange/src/benchmark - -[bank] -HTTP_PORT = 8082 -SERVE = http -MAX_DEBT = EUR:100000000000.0 -MAX_DEBT_BANK = EUR:1000000000000000.0 -DATABASE = bank-db.sqlite3 - -[benchmark] -USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42 +@INLINE@ benchmark-common.conf +@INLINE@ coins-cs.conf [exchange-account-test] # What is the bank account (with the "Taler Bank" demo system)? Must end with "/". @@ -68,61 +14,3 @@ WIRE_GATEWAY_URL = http://localhost:8082/Exchange/ WIRE_GATEWAY_AUTH_METHOD = "basic" USERNAME = Exchange PASSWORD = x - - -# Sections starting with "coin_" specify which denominations -# the exchange should support (and their respective fee structure) -[coin_eur_ct_1] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_ct_10] -value = EUR:0.10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_1] -value = EUR:1 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_5] -value = EUR:5 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS - -[coin_eur_10] -value = EUR:10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS diff --git a/src/benchmark/benchmark-rsa.conf b/src/benchmark/benchmark-rsa.conf index 5e44781d..bd4a90cf 100644 --- a/src/benchmark/benchmark-rsa.conf +++ b/src/benchmark/benchmark-rsa.conf @@ -1,60 +1,6 @@ # This file is in the public domain. -# -[paths] -# Persistent data storage for the testcase -# This value is a default for `taler_config_home' -TALER_TEST_HOME = exchange_benchmark_home/ - -[taler] -# Currency supported by the exchange (can only be one) -CURRENCY = EUR -CURRENCY_ROUND_UNIT = EUR:0.01 - -[exchange] - -AML_THRESHOLD = EUR:99999999 -SIGNKEY_LEGAL_DURATION = 2 years - -# HTTP port the exchange listens to -PORT = 8081 -# Master public key used to sign the exchange's various keys -MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG -# How to access our database -DB = postgres -# Base URL of the exchange. Must be set to a URL where the -# exchange (or the twister) is actually listening. -BASE_URL = "http://localhost:8081/" - -AGGREGATOR_SHARD_SIZE = 67108864 -#AGGREGATOR_SHARD_SIZE = 2147483648 - - - -WIREWATCH_IDLE_SLEEP_INTERVAL = 5 ms - -[exchange-offline] -MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv - -[auditor] -BASE_URL = "http://localhost:8083/" - -[exchangedb-postgres] -CONFIG = "postgres:///talercheck" - -[benchmark-remote-exchange] -HOST = localhost -# Adjust $HOME to match remote target! -DIR = $HOME/repos/taler/exchange/src/benchmark - -[bank] -HTTP_PORT = 8082 -SERVE = http -MAX_DEBT = EUR:100000000000.0 -MAX_DEBT_BANK = EUR:1000000000000000.0 -DATABASE = bank-db.sqlite3 - -[benchmark] -USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42 +@INLINE@ benchmark-common.conf +@INLINE@ coins-rsa.conf [exchange-account-test] # What is the bank account (with the "Taler Bank" demo system)? Must end with "/". @@ -68,66 +14,3 @@ WIRE_GATEWAY_URL = http://localhost:8082/Exchange/ WIRE_GATEWAY_AUTH_METHOD = "basic" USERNAME = Exchange PASSWORD = x - - -# Sections starting with "coin_" specify which denominations -# the exchange should support (and their respective fee structure) -[coin_eur_ct_1] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_ct_10] -value = EUR:0.10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_1] -value = EUR:1 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_5] -value = EUR:5 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 - -[coin_eur_10] -value = EUR:10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 2048 diff --git a/src/benchmark/coins-cs.conf b/src/benchmark/coins-cs.conf new file mode 100644 index 00000000..c4b5a45c --- /dev/null +++ b/src/benchmark/coins-cs.conf @@ -0,0 +1,58 @@ +# This file is in the public domain. +# +# Sections starting with "coin_" specify which denominations +# the exchange should support (and their respective fee structure) +[coin_eur_ct_1] +value = EUR:0.01 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.00 +fee_deposit = EUR:0.00 +fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_ct_10] +value = EUR:0.10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_1] +value = EUR:1 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_5] +value = EUR:5 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_10] +value = EUR:10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS diff --git a/src/benchmark/coins-rsa.conf b/src/benchmark/coins-rsa.conf new file mode 100644 index 00000000..42eb8acf --- /dev/null +++ b/src/benchmark/coins-rsa.conf @@ -0,0 +1,63 @@ +# This file is in the public domain. +# +# Sections starting with "coin_" specify which denominations +# the exchange should support (and their respective fee structure) +[coin_eur_ct_1] +value = EUR:0.01 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.00 +fee_deposit = EUR:0.00 +fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 2048 + +[coin_eur_ct_10] +value = EUR:0.10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 2048 + +[coin_eur_1] +value = EUR:1 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 2048 + +[coin_eur_5] +value = EUR:5 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 2048 + +[coin_eur_10] +value = EUR:10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 2048 diff --git a/src/benchmark/taler-benchmark-setup.sh b/src/benchmark/taler-benchmark-setup.sh new file mode 100755 index 00000000..52e0e08b --- /dev/null +++ b/src/benchmark/taler-benchmark-setup.sh @@ -0,0 +1,556 @@ +#!/bin/bash +# +# This file is part of TALER +# Copyright (C) 2023 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 -eu + +# Exit, with status code "skip" (no 'real' failure) +function exit_skip() { + echo " SKIP: " "$@" + exit 77 +} + +# Exit, with error message (hard failure) +function exit_fail() { + echo " FAIL: " "$@" + exit 1 +} + +# Cleanup to run whenever we exit +function cleanup() +{ + for n in $(jobs -p) + do + kill $n 2> /dev/null || true + done + wait +} + +# Install cleanup handler (except for kill -9) +trap cleanup EXIT + +START_AUDITOR=0 +START_EXCHANGE=0 +START_FAKEBANK=0 +START_MERCHANT=0 +START_NEXUS=0 +START_SANDBOX=0 +CONF_ORIG="~/.config/taler.conf" +LOGLEVEL="DEBUG" + +# Parse command-line options +while getopts ':abc:efhl:ms' OPTION; do + case "$OPTION" in + a) + START_AUDITOR="1" + ;; + c) + CONF_ORIG="$OPTARG" + ;; + e) + START_EXCHANGE="1" + ;; + f) + START_FAKEBANK="1" + ;; + h) + echo 'Supported options:' + echo ' -a -- start auditor' + echo ' -c $CONF -- set configuration' + echo ' -e -- start exchange' + echo ' -f -- start fakebank' + echo ' -h -- print this help' + echo ' -l $LOGLEVEL -- set log level' + echo ' -m -- start merchant' + echo ' -n -- start nexus' + echo ' -s -- start sandbox' + exit 0 + ;; + l) + LOGLEVEL="$OPTARG" + ;; + m) + START_MERCHANT="1" + ;; + n) + START_NEXUS="1" + ;; + s) + START_SANDBOX="1" + ;; + ?) + exit_fail "Unrecognized command line option" + ;; + esac +done + +echo "Starting with configuration file at: $CONF_ORIG" +CONF="$CONF_ORIG.edited" +cp "${CONF_ORIG}" "${CONF}" + +echo -n "Testing for jq" +jq -h > /dev/null || exit_skip " jq required" +echo " FOUND" + +if [ "1" = "$START_EXCHANGE" ] +then + echo -n "Testing for Taler exchange" + taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange-httpd required" + echo " FOUND" +fi + +if [ "1" = "$START_MERCHANT" ] +then + echo -n "Testing for Taler merchant" + taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant-httpd required" + echo " FOUND" +fi + +if [ "1" = "$START_NEXUS" ] +then + echo -n "Testing for libeufin-cli" + libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING" + echo " FOUND" +fi + +EXCHANGE_URL=$(taler-config -c "$CONF" -s "EXCHANGE" -o "BASE_URL") +CURRENCY=$(taler-config -c "$CONF" -s "TALER" -o "CURRENCY") + +register_sandbox_account() { + export LIBEUFIN_SANDBOX_USERNAME="$1" + export LIBEUFIN_SANDBOX_PASSWORD="$2" + libeufin-cli sandbox \ + demobank \ + register --name "$3" + unset LIBEUFIN_SANDBOX_USERNAME + unset LIBEUFIN_SANDBOX_PASSWORD +} + + +BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT") +if [ "1" = "$START_NEXUS" ] +then + NEXUS_PORT="$BANK_PORT" + SANDBOX_PORT="1$BANK_PORT" +else + NEXUS_PORT="0" + SANDBOX_PORT="1$BANK_PORT" +fi + +if [ "1" = "$START_SANDBOX" ] +then + export LIBEUFIN_SANDBOX_DB_CONNECTION=$(taler-config -c "$CONF" -s "libeufin-sandbox" -o "DB_CONNECTION") + + # Create the default demobank. + libeufin-sandbox config --currency "$CURRENCY" default + export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret" + libeufin-sandbox serve \ + --port "$SANDBOX_PORT" \ + > libeufin-sandbox-stdout.log \ + 2> libeufin-sandbox-stderr.log & + echo $! > libeufin-sandbox.pid + export LIBEUFIN_SANDBOX_URL="http://localhost:$SANDBOX_PORT/" + set +e + OK="0" + echo -n "Waiting for Sandbox ..." + for n in $(seq 1 100); do + echo -n "." + sleep 0.2 + if wget --timeout=1 \ + --tries=3 \ + --waitretry=0 \ + -o /dev/null \ + -O /dev/null \ + "$LIBEUFIN_SANDBOX_URL"; + then + OK="1" + break + fi + done + if [ "1" != "$OK" ] + then + exit_skip "Failed to launch services (sandbox)" + fi + echo "OK" + set -e + echo -n "Register Sandbox users ..." + register_sandbox_account fortytwo x "Forty Two" + register_sandbox_account fortythree x "Forty Three" + register_sandbox_account exchange x "Exchange Company" + register_sandbox_account tor x "Tor Project" + register_sandbox_account gnunet x "GNUnet" + register_sandbox_account tutorial x "Tutorial" + register_sandbox_account survey x "Survey" + echo " DONE" + + echo -n "Fixing up exchange's PAYTO_URI in the config ..." + export LIBEUFIN_SANDBOX_USERNAME="exchange" + export LIBEUFIN_SANDBOX_PASSWORD="x" + EXCHANGE_PAYTO=$(libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri') + taler-config -c "$CONF" -s exchange-account-1 -o "PAYTO_URI" -V "$EXCHANGE_PAYTO" + echo " OK" + + echo -n "Setting this exchange as the bank's default ..." + libeufin-sandbox default-exchange "$EXCHANGE_URL" "$EXCHANGE_PAYTO" + echo " OK" + + # Prepare EBICS: create Ebics host and Exchange subscriber. + # Shortly becoming admin to setup Ebics. + export LIBEUFIN_SANDBOX_USERNAME="admin" + export LIBEUFIN_SANDBOX_PASSWORD="secret" + echo -n "Create EBICS host at Sandbox.." + libeufin-cli sandbox \ + --sandbox-url "$LIBEUFIN_SANDBOX_URL" \ + ebicshost create --host-id talerebics + echo "OK" + echo -n "Create exchange EBICS subscriber at Sandbox.." + libeufin-cli sandbox \ + demobank new-ebicssubscriber --host-id talerebics \ + --user-id exchangeebics --partner-id talerpartner \ + --bank-account exchange # that's a username _and_ a bank account name + echo "OK" + unset LIBEUFIN_SANDBOX_USERNAME + unset LIBEUFIN_SANDBOX_PASSWORD +fi + +if [ "1" = "$START_NEXUS" ] +then + echo "Setting up Nexus ..." + + # Prepare Nexus, which is the side actually talking + # to the exchange. + export LIBEUFIN_SANDBOX_DB_CONNECTION=$(taler-config -c "$CONF" -s "libeufin-nexus" -o "DB_CONNECTION") + + # For convenience, username and password are + # identical to those used at the Sandbox. + echo -n "Create exchange Nexus user ..." + libeufin-nexus superuser exchange --password x + echo "OK" + libeufin-nexus serve --port "$NEXUS_PORT" \ + 2> libeufin-nexus-stderr.log \ + > libeufin-nexus-stdout.log & + echo $! > libeufin-nexus.pid + export LIBEUFIN_NEXUS_URL="http://localhost:$NEXUS_PORT" + echo -n "Waiting for Nexus ..." + set +e + OK="0" + for n in $(seq 1 100); do + echo -n "." + sleep 0.2 + if wget --timeout=1 \ + --tries=3 \ + --waitretry=0 \ + -o /dev/null \ + -O /dev/null \ + "$LIBEUFIN_NEXUS_URL"; + then + OK="1" + break + fi + done + if [ "1" != "$OK" ] + then + exit_skip "Failed to launch services (bank)" + fi + set -e + echo " OK" + + export LIBEUFIN_NEXUS_USERNAME=exchange + export LIBEUFIN_NEXUS_PASSWORD=x + echo -n "Creating a EBICS connection at Nexus ..." + libeufin-cli connections new-ebics-connection \ + --ebics-url "http://localhost:$SANDBOX_PORT/ebicsweb" \ + --host-id talerebics \ + --partner-id talerpartner \ + --ebics-user-id exchangeebics \ + talerconn + echo "OK" + + echo -n "Setup EBICS keying ..." + libeufin-cli connections connect talerconn > /dev/null + echo "OK" + echo -n "Download bank account name from Sandbox ..." + libeufin-cli connections download-bank-accounts talerconn + echo "OK" + echo -n "Importing bank account info into Nexus ..." + libeufin-cli connections import-bank-account \ + --offered-account-id exchange \ + --nexus-bank-account-id exchange-nexus \ + talerconn + echo "OK" + echo -n "Setup payments submission task..." + # Tries every second. + libeufin-cli accounts task-schedule \ + --task-type submit \ + --task-name exchange-payments \ + --task-cronspec "* * *" \ + exchange-nexus + echo "OK" + # Tries every second. Ask C52 + echo -n "Setup history fetch task..." + libeufin-cli accounts task-schedule \ + --task-type fetch \ + --task-name exchange-history \ + --task-cronspec "* * *" \ + --task-param-level report \ + --task-param-range-type latest \ + exchange-nexus + echo "OK" + # create Taler facade. + echo -n "Create the Taler facade at Nexus..." + libeufin-cli facades \ + new-taler-wire-gateway-facade \ + --currency TESTKUDOS --facade-name test-facade \ + talerconn exchange-nexus + echo "OK" + # Facade schema: http://localhost:$NEXUS_PORT/facades/test-facade/taler-wire-gateway/ + # FIXME: set the above URL automatically in the configuration? +fi + +if [ "1" = "$START_FAKEBANK" ] +then + echo "Setting up fakebank ..." + taler-fakebank-run -c "$CONF" -L "$LOGLEVEL" 2> taler-fakebank-run.log & +fi + + +if [ "1" = "$START_EXCHANGE" ] +then + echo -n "Starting exchange ..." + + MASTER_PRIV_FILE=$(taler-config -f -c "${CONF}" -s "EXCHANGE-OFFLINE" -o "MASTER_PRIV_FILE") + MASTER_PRIV_DIR=$(dirname "$MASTER_PRIV_FILE") + mkdir -p "${MASTER_PRIV_DIR}" + gnunet-ecc -g1 "$MASTER_PRIV_FILE" > /dev/null 2> /dev/null + MASTER_PUB=$(gnunet-ecc -p "${MASTER_PRIV_FILE}") + MPUB=$(taler-config -c "$CONF" -s exchange -o MASTER_PUBLIC_KEY) + if [ "$MPUB" != "$MASTER_PUB" ] + then + echo -n " patching master_pub ($MASTER_PUB)..." + taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V "$MASTER_PUB" + fi + taler-exchange-dbinit -c "$CONF" + taler-exchange-secmod-eddsa -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-eddsa.log & + taler-exchange-secmod-rsa -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-rsa.log & + taler-exchange-secmod-cs -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-cs.log & + taler-exchange-httpd -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-httpd.log & + EXCHANGE_HTTPD_PID=$! + taler-exchange-wirewatch -c "$CONF" 2> taler-exchange-wirewatch.log & + WIREWATCH_PID=$! + echo " DONE" +fi + +if [ "1" = "$START_MERCHANT" ] +then + echo -n "Starting merchant ..." + MERCHANT_PORT=$(taler-config -c "$CONF" -s MERCHANT -o PORT) + MERCHANT_URL="http://localhost:${MERCHANT_PORT}/" + taler-merchant-dbinit -c "$CONF" + taler-merchant-httpd -c "$CONF" -L "$LOGLEVEL" 2> taler-merchant-httpd.log & + MERCHANT_HTTPD_PID=$! + echo " DONE" +fi + +if [ "1" = "$START_AUDITOR" ] +then + echo -n "Starting auditor ..." + AUDITOR_URL="http://localhost:8083/" + AUDITOR_PRIV_FILE=$(taler-config -f -c "$CONF" -s AUDITOR -o AUDITOR_PRIV_FILE) + AUDITOR_PRIV_DIR=$(dirname "$AUDITOR_PRIV_FILE") + mkdir -p "$AUDITOR_PRIV_DIR" + gnunet-ecc -g1 "$AUDITOR_PRIV_FILE" > /dev/null 2> /dev/null + AUDITOR_PUB=$(gnunet-ecc -p "${AUDITOR_PRIV_FILE}") + taler-auditor-dbinit -c "$CONF" + taler-auditor-exchange -c "$CONF" -m "$MASTER_PUB" -u "$EXCHANGE_URL" + taler-auditor-httpd -L "$LOGLEVEL" -c "$CONF" 2> taler-auditor-httpd.log & + echo " DONE" +fi + +if [[ "1" = "$START_NEXUS" || "1" = "$START_FAKEBANK" ]] +then + echo -n "Waiting for the bank" + # Wait for bank to be available (usually the slowest) + OK="0" + for n in $(seq 1 300) + do + echo -n "." + sleep 0.1 + # bank + wget --tries=1 \ + --waitretry=0 \ + --timeout=1 \ + --user admin \ + --password secret \ + "http://localhost:8082/" \ + -o /dev/null \ + -O /dev/null >/dev/null || continue + OK="1" + break + done + if [ "1" != "$OK" ] + then + exit_skip "Failed to launch services (bank)" + fi + echo " OK" +fi + +echo -n "Waiting for Taler services ..." +# Wait for all other taler services to be available +for n in $(seq 1 20) +do + echo -n "." + sleep 0.1 + OK="0" + if [ "1" = "$START_EXCHANGE" ] + then + wget \ + --tries=1 \ + --timeout=1 \ + "http://localhost:8081/seed" \ + -o /dev/null \ + -O /dev/null >/dev/null || continue + fi + if [ "1" = "$START_MERCHANT" ] + then + wget \ + --tries=1 \ + --timeout=1 \ + "http://localhost:9966/" \ + -o /dev/null \ + -O /dev/null >/dev/null || continue + fi + if [ "1" = "$START_AUDITOR" ] + then + wget \ + --tries=1 \ + --timeout=1 \ + "http://localhost:8083/" \ + -o /dev/null \ + -O /dev/null >/dev/null || continue + fi + OK="1" + break +done +if [ 1 != "$OK" ] +then + exit_skip "Failed to launch (some) Taler services" +fi +echo " OK" + +if [ "1" = "$START_EXCHANGE" ] +then + set +e + echo -n "Wait for exchange /management/keys to be ready " + OK="0" + LAST_RESPONSE=$(mktemp tmp-last-response.XXXXXXXX) + for n in $(seq 1 50) + do + echo -n "." + sleep 0.1 + # exchange + wget \ + --tries=3 \ + --waitretry=0 \ + --timeout=1 \ + "http://localhost:8081/management/keys"\ + -o /dev/null \ + -O "$LAST_RESPONSE" \ + >/dev/null + DENOMS_COUNT=$(jq '.future_denoms|length' < $LAST_RESPONSE) + SIGNKEYS_COUNT=$(jq '.future_signkeys|length' < $LAST_RESPONSE) + [[ -z "$SIGNKEYS_COUNT" || "$SIGNKEYS_COUNT" == "0" || -z "$DENOMS_COUNT" || "$DENOMS_COUNT" == "0" ]] && continue + OK="1" + break; + done + set -e + if [ "1" != "$OK" ] + then + exit_skip "Failed to setup exchange keys, check secmod logs" + fi + rm "$LAST_RESPONSE" + echo " OK" + + echo -n "Setting up exchange keys ..." + taler-exchange-offline -c "$CONF" \ + download \ + sign \ + wire-fee now iban "$CURRENCY:0.01" "$CURRENCY:0.01" \ + global-fee now "$CURRENCY:0.01" "$CURRENCY:0.01" "$CURRENCY:0.01" 1h 1year 5 \ + upload &> taler-exchange-offline.log + echo "OK" + for ASEC in $(taler-config -c "$CONF" -S | grep -i "exchange-account-") + do + ENABLED=$(taler-config -c "$CONF" -s "$ASEC" -o "ENABLE_CREDIT") + if [ "YES" = "$ENABLED" ] + then + echo -n "Configuring bank account $ASEC ..." + EXCHANGE_PAYTO_URI=$(taler-config -c "$CONF" -s "$ASEC" -o "PAYTO_URI") + taler-exchange-offline -c "$CONF" \ + enable-account "$EXCHANGE_PAYTO_URI" \ + upload &> "taler-exchange-offline-account-$ASEC.log" + echo "OK" + fi + done + if [ "1" = "$START_AUDITOR" ] + then + echo -n "Enabling auditor ..." + taler-exchange-offline -c "$CONF" \ + enable-auditor $AUDITOR_PUB $AUDITOR_URL "$CURRENCY Auditor" \ + upload &> taler-exchange-offline-auditor.log + echo "OK" + fi + + echo -n "Checking /keys " + OK="0" + for n in $(seq 1 3) + do + echo -n "." + wget \ + --tries=1 \ + --timeout=1 \ + "http://localhost:8081/keys" \ + -o /dev/null \ + -O /dev/null >/dev/null || continue + OK="1" + break + done + if [ "1" != "$OK" ] + then + exit_skip " Failed to setup keys" + fi + echo " OK" +fi + +if [ "1" = "$START_AUDITOR" ] +then + echo -n "Setting up auditor signatures ..." + taler-auditor-offline -c "$CONF" \ + download \ + sign \ + upload &> taler-auditor-offline.log + echo " OK" +fi + +# Signal caller that we are ready. +echo "<<READY>>" + +# Wait until caller stops us. +read + +exit 0 diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c index 8e61129f..e29e117d 100644 --- a/src/benchmark/taler-exchange-benchmark.c +++ b/src/benchmark/taler-exchange-benchmark.c @@ -306,8 +306,9 @@ run (void *cls, GNUNET_asprintf (&amount_5, "%s:5", currency); GNUNET_asprintf (&amount_4, "%s:4", currency); GNUNET_asprintf (&amount_1, "%s:1", currency); - GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (currency, - &total_reserve_amount)); + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (currency, + &total_reserve_amount)); total_reserve_amount.value = 5 * howmany_coins; GNUNET_asprintf (&withdraw_fee_str, "%s:0.1", @@ -537,7 +538,8 @@ parallel_benchmark (TALER_TESTING_Main main_cb, struct GNUNET_OS_Process *exchange_slave = NULL; struct GNUNET_DISK_PipeHandle *exchange_slave_pipe; - if ( (MODE_CLIENT == mode) || (MODE_BOTH == mode) ) + if ( (MODE_CLIENT == mode) || + (MODE_BOTH == mode) ) { if (use_fakebank) { @@ -587,7 +589,8 @@ parallel_benchmark (TALER_TESTING_Main main_cb, "-c", config_file, "-C", NULL); - if ( (NULL == exchanged) && (MODE_BOTH == mode) ) + if ( (NULL == exchanged) && + (MODE_BOTH == mode) ) { if (-1 != fakebank) { @@ -978,15 +981,19 @@ main (int argc, logfile); if (NULL == mode_str) mode = MODE_BOTH; - else if (0 == strcmp (mode_str, "exchange")) + else if (0 == strcmp (mode_str, + "exchange")) mode = MODE_EXCHANGE; - else if (0 == strcmp (mode_str, "client")) + else if (0 == strcmp (mode_str, + "client")) mode = MODE_CLIENT; - else if (0 == strcmp (mode_str, "both")) + else if (0 == strcmp (mode_str, + "both")) mode = MODE_BOTH; else { - TALER_LOG_ERROR ("Unknown mode given: '%s'\n", mode_str); + TALER_LOG_ERROR ("Unknown mode given: '%s'\n", + mode_str); GNUNET_free (cfg_filename); return BAD_CONFIG_FILE; } @@ -1137,7 +1144,9 @@ main (int argc, if (GNUNET_OK == result) { struct rusage usage; - GNUNET_assert (0 == getrusage (RUSAGE_CHILDREN, &usage)); + + GNUNET_assert (0 == getrusage (RUSAGE_CHILDREN, + &usage)); fprintf (stdout, "Executed (Withdraw=%u, Deposit=%u, Refresh~=%5.2f) * Reserve=%u * Parallel=%u, operations in %s\n", howmany_coins, |