View Issue Details

IDProjectCategoryView StatusLast Update
0006812Talermerchant backendpublic2024-01-12 13:04
Reportersebasjm Assigned ToChristian Grothoff Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Versiongit (master) 
Target Version0.8Fixed in Version0.8 
Summary0006812: creation of default instance fail after soft delete
DescriptionAssertion failed when checking that there is just one instance after db insert

ERROR Assertion failed at taler-merchant-httpd_private-post-instances.c:451.
TagsNo tags attached.
Attached Files
script-recreate-default.sh (1,599 bytes)   
#/bin/bash

ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)

HOST=https://backend.demo.taler.net
AUTH="ApiKey sandbox"
CURRENCY=KUDOS

set -x
curl -q $HOST/private/instances     -H "Authorization: $AUTH" --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"auth": { "method": "external" },"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"'$CURRENCY':2","default_max_deposit_fee":"'$CURRENCY':1","payto_uris":["payto://asd/asd"],"name":"qwe","id":"'$ID'"}'

echo delete with purge work as expeced 

curl -q "$HOST/private/instances/$ID?purge=yes"     -H "Authorization: $AUTH" -X DELETE

curl -q $HOST/private/instances     -H "Authorization: $AUTH" --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"auth": { "method": "external" },"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"'$CURRENCY':2","default_max_deposit_fee":"'$CURRENCY':1","payto_uris":["payto://asd/asd"],"name":"qwe","id":"'$ID'"}'

echo this fill make the next create fail

curl -q "$HOST/private/instances/$ID"     -H "Authorization: $AUTH" -X DELETE


curl -q $HOST/private/instances     -H "Authorization: $AUTH" --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"auth": { "method": "external" },"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"'$CURRENCY':2","default_max_deposit_fee":"'$CURRENCY':1","payto_uris":["payto://asd/asd"],"name":"qwe","id":"'$ID'"}'
script-recreate-default.sh (1,599 bytes)   

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

sebasjm

2021-03-17 18:26

developer   ~0017626

this is specially bad when soft deleting default instance

should the backend allow default instance deletion?

Christian Grothoff

2021-03-30 21:37

manager   ~0017660

Good question. I think we should allow deletion, after all that is a good way to clean up everything in test cases. Also, one could conceivably deliberately delete the default instance to disable instance management while keeping other instances around. Now, if deleting the default instance, the only way to recover to the point of being able to do instance management is to setup a fresh instance.

I think the funky case is deleting the default instance without purging it ("soft delete" as you called it). In that case, one cannot create a fresh default instance. But again, I think purging should then still be possible, right? I'll add some tests around this...

Christian Grothoff

2021-04-02 13:28

manager   ~0017671

fd1cac5..9bec95f fixes the error code being returned (409 if instance was deleted but not purged).

Still to do: allow purge after deletion, this currently fails (updated script to create issue attached).
script-recreate-default-2.sh (1,674 bytes)   
#/bin/bash

ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)

HOST=http://localhost:8080
AUTH="ApiKey sandbox"
CURRENCY=EUR

set -x
curl -q $HOST/private/instances     -H "Authorization: $AUTH" --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"auth": { "method": "external" },"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"'$CURRENCY':2","default_max_deposit_fee":"'$CURRENCY':1","payto_uris":["payto://asd/asd"],"name":"qwe","id":"'$ID'"}'

echo delete with purge work as expeced

curl -q "$HOST/instances/$ID/private?purge=yes"     -H "Authorization: $AUTH" -X DELETE

curl -q $HOST/private/instances     -H "Authorization: $AUTH" --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"auth": { "method": "external" },"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"'$CURRENCY':2","default_max_deposit_fee":"'$CURRENCY':1","payto_uris":["payto://asd/asd"],"name":"qwe","id":"'$ID'"}'

echo this fill make the next create fail

curl -q "$HOST/instances/$ID/private"     -H "Authorization: $AUTH" -X DELETE
curl -q "$HOST/instances/$ID/private?purge=yes"     -H "Authorization: $AUTH" -X DELETE

curl -q $HOST/private/instances     -H "Authorization: $AUTH" --data-raw '{"default_wire_transfer_delay":{"d_ms":2000},"auth": { "method": "external" },"default_pay_delay":{"d_ms":1000},"jurisdiction":{},"address":{},"default_wire_fee_amortization":10,"default_max_wire_fee":"'$CURRENCY':2","default_max_deposit_fee":"'$CURRENCY':1","payto_uris":["payto://asd/asd"],"name":"qwe","id":"'$ID'"}'
script-recreate-default-2.sh (1,674 bytes)   

Christian Grothoff

2021-04-02 13:58

manager   ~0017672

docs.git: b9d293e..0fd1ff5: GET /private/instances now indicates if an instance has been deleted but not purged.
merchant.git: 9bec95f..385fb34: allows purging previously deleted instances, which means that afterwards it is again possible to create a new instance of the same ID.

Christian Grothoff

2021-04-02 14:04

manager   ~0017673

Sebastian: I consider this resolved. Note: the SPA should now check for the 'deleted' flag and then can still allow the instance to be purged.
Some operations are not permitted on deleted (but not purged) instances, specifically, one cannot create orders, lock products, create refunds, create reserves (see: Tipping), or authorize tips. POSTing transfers I have allowed. See the 'allow_deleted_instance' field in the handler array for which endpoints are permitted for deleted but not purged instances. (I hope I got those right...).

Christian Grothoff

2021-09-02 16:23

manager   ~0018354

Fix committed to master branch.

Issue History

Date ModifiedUsernameFieldChange
2021-03-17 18:24sebasjmNew Issue
2021-03-17 18:24sebasjmStatusnew => assigned
2021-03-17 18:24sebasjmAssigned To => Christian Grothoff
2021-03-17 18:24sebasjmFile Added: script-recreate-default.sh
2021-03-17 18:26sebasjmNote Added: 0017626
2021-03-30 21:37Christian GrothoffNote Added: 0017660
2021-03-30 21:37Christian GrothoffPrioritynormal => high
2021-03-30 21:37Christian GrothoffTarget Versiongit (master) => 0.9
2021-03-30 21:37Christian GrothoffDescription Updated
2021-04-02 13:28Christian GrothoffNote Added: 0017671
2021-04-02 13:28Christian GrothoffFile Added: script-recreate-default-2.sh
2021-04-02 13:58Christian GrothoffNote Added: 0017672
2021-04-02 14:04Christian GrothoffStatusassigned => informing
2021-04-02 14:04Christian GrothoffResolutionopen => fixed
2021-04-02 14:04Christian GrothoffFixed in Version => 0.9
2021-04-02 14:04Christian GrothoffNote Added: 0017673
2021-07-30 11:57Christian GrothoffFixed in Version0.9 => 0.8.1
2021-07-30 11:59Christian GrothoffTarget Version0.9 => 0.8.1
2021-07-30 12:01Christian GrothoffFixed in Version0.8.1 => 0.8
2021-07-30 12:02Christian GrothoffTarget Version0.8.1 => 0.8
2021-08-24 14:23Christian GrothoffStatusinforming => closed
2021-09-02 16:22Christian Grothoff
2021-09-02 16:23Christian GrothoffNote Added: 0018354
2024-01-12 13:04Christian GrothoffCategorymerchant backend API (C) => mechant backend
2025-03-22 13:09Christian GrothoffCategorymechant backend => merchant backend