Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More informative error messages for invalid txids #6359

Merged
merged 6 commits into from
Jul 29, 2024

Conversation

achamayou
Copy link
Member

@achamayou achamayou commented Jul 12, 2024

Before:

curl -k
https://127.0.0.1:8000/node/tx?transaction_id=0.0
{"error":{"code":"InternalError","message":"Error code: InternalError"}}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=1.1
{"status":"Invalid","transaction_id":"1.1"}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=1.0
{"error":{"code":"InternalError","message":"Error code: InternalError"}}

$ curl -k https://127.0.0.1:8000/app/tx?transaction_id=0.1
{"status":"Invalid","transaction_id":"0.1"}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=2.0
{"error":{"code":"InternalError","message":"Error code: InternalError"}}

After:

curl -k https://127.0.0.1:8000/app/tx?transaction_id=0.0
{"error":{"code":"InvalidQueryParameterValue","message":"The value '0.0' passed as query parameter 'transaction_id' could not be converted to a valid Transaction ID."}}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=1.1
{"status":"Invalid","transaction_id":"1.1"}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=1.0
{"error":{"code":"InvalidQueryParameterValue","message":"The value '1.0' passed as query parameter 'transaction_id' could not be converted to a valid Transaction ID."}}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=0.1
{"error":{"code":"InvalidQueryParameterValue","message":"The value '0.1' passed as query parameter 'transaction_id' could not be converted to a valid Transaction ID."}}

curl -k https://127.0.0.1:8000/app/tx?transaction_id=2.0
{"error":{"code":"InvalidQueryParameterValue","message":"The value '2.0' passed as query parameter 'transaction_id' could not be converted to a valid Transaction ID."}}

@achamayou
Copy link
Member Author

achamayou commented Jul 12, 2024

I wonder if it is worth preserving "Invalid" for 0.1 and 1.1, i.e. you can always ask about the first transaction, even for views that we never use. Edit: I think we should do that in fact, there may be users who have a flow similar to what the historical test did and depend on this.

include/ccf/tx_id.h Outdated Show resolved Hide resolved
include/ccf/tx_id.h Outdated Show resolved Hide resolved
include/ccf/tx_id.h Outdated Show resolved Hide resolved
@lemmy
Copy link
Contributor

lemmy commented Jul 26, 2024

@marina-p fuzzed CCF with https://github.com/microsoft/restler-fuzzer and found the following:

FuzzLean found 1 bug: 

2024-07-18 10:00:07.393: Sending: 'GET /app/log/public/historical/range?from_seqno=1&to_seqno=0963012895303452&id=1 HTTP/1.1\r\nAccept: application/json\r\nHost: 20.14.79.29\r\nContent-Length: 0\r\nUser-Agent: restler/9.2.4\r\nx-restler-sequence-id: 902dc766-095a-4b18-a5f5-09356ac1b102\r\n\r\n'

2024-07-18 10:00:07.477: Received: 'HTTP/1.1 500 INTERNAL_SERVER_ERROR\r\ncontent-length: 75\r\ncontent-type: application/json\r\n\r\n{"error":{"code":"InternalError","message":"Unable to retrieve Tx status"}}'

@achamayou
Copy link
Member Author

@lemmy as @eddyashton pointed out (and resolved in #6401), I was confused, and despite superficial similarity this is actually a different issue with the logging app itself.

@achamayou achamayou marked this pull request as ready for review July 29, 2024 09:12
@achamayou achamayou requested a review from a team July 29, 2024 09:12
CHANGELOG.md Outdated Show resolved Hide resolved
@achamayou achamayou enabled auto-merge July 29, 2024 09:13
@achamayou achamayou added this pull request to the merge queue Jul 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 29, 2024
@maxtropets maxtropets added this pull request to the merge queue Jul 29, 2024
Merged via the queue into microsoft:main with commit b1673da Jul 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants