firoorg / firo

The privacy-focused cryptocurrency
https://firo.org
MIT License
720 stars 354 forks source link

curl method "spendspark" returns server error 500 #1308

Closed RESTfulRaccoon closed 1 year ago

RESTfulRaccoon commented 1 year ago

Describe the issue

curl -v --user $USER:$PASS --data-binary '{"jsonrpc":"1.0", "id":"something", "method": "spendspark", "params": ["{\"$ADDR\":{\"amount\":1, \"memo\":\"\", \"subtractFee\": false}}"] }' -H 'content-type: text/plain;' http://127.0.0.1:8382/

Returns:

HTTP/1.1 500 Internal Server Error Content-Type: application/json Date: Mon, 14 Aug 2023 20:33:19 GMT Content-Length: 105

./firo-cli "{\"$ADDR\":{\"amount\":1, \"memo\":\"\", \"subtractFee\": false}}"

work as expected, no wallet encryption

Other curl methods such as: "getnewsparkaddress" and "getinfo" and "getsparkbalance" work as expected

Local setup

Manjaro - Linux 6.4 Firo 14.12.04

Any extra information that might be useful in the debugging process.

Using an invalid address causes the same error No relevant logs available

RESTfulRaccoon commented 1 year ago

Error acts as if perams is empty "perams": [""] returns same error

RESTfulRaccoon commented 1 year ago

method mintspark returns same error seems anything requiring parameters returns the error

{"result":null,"error":{"code":-1,"message":"JSON value is not an object as expected"},"id":"something"}

justanwar commented 1 year ago

Please try with latest commit from spark branch (daemon only, Qt does not have Spark UI.) Let me know if you need the binaries.

RESTfulRaccoon commented 1 year ago

spendspark_3

same error, but to be honest I'm not the best with git so could be on my end.

mobias17 commented 1 year ago

It seems to be the parser and not an server issue.

image

Three examples: spendspark to a single address - success spendspark to signle address - fail. Note the [ and ] as only difference to before. spendspark to multiple address - success | lining up the params without squared brackets

I agree that one example in the help is with square brackets. So question to Project is whether it is a documentation issue or parser issue.

@RESTfulRaccoon would you mind to run a retest without square brackets and confirm observation?

here the param templates :

spendspark "{\"ADDRESS1\":{\"amount\":1,\"memo\":\"\", \"subtractFee\": false}}" spendspark ["{\"ADDRESS1\":{\"amount\":1,\"memo\":\"\", \"subtractFee\": false}}"] spendspark "{\"ADDRESS1\":{\"amount\":1, \"memo\":\"test_memo\", \"subtractFee\": false},\"ADDRESS2\":{\"amount\":1, \"subtractFee\": false}}"

RESTfulRaccoon commented 1 year ago

brackets.png

brackets_2.png

backslash.png

backslash_2.png

mobias17 commented 1 year ago

apologies. I checked the code and now below the curl commands:

amend username, address and port accordingly. single: curl -v --user MYUSERNAME --data-binary '{"jsonrpc": "1.0", "id":"something", "method": "spendspark", "params": [{"ADDRESS1":{"amount":0.01, "subtractFee": false}}] }' -H 'content-type: text/plain;' http://127.0.0.1:PORT/

multiple: curl -v --user MYUSERNAME --data-binary '{"jsonrpc": "1.0", "id":"something", "method": "spendspark", "params": [{"ADDRESS1":{"amount":0.01, "subtractFee": false},"ADDRESS2":{"amount":0.01, "subtractFee": false}}] }' -H 'content-type: text/plain;' http://127.0.0.1:PORT/

proof:

image

single - returns 200 image

multiple - return 200 image

root cause

seems to be rather a documentation issue to me, than a functional one. Valid though.

levonpetrosyan93 commented 1 year ago

Fixed with 881ff260d3b459d8b2e6eaa5c089eec35c385d47 , Feel free to reopen, in case issue again happens.

justanwar commented 1 year ago

Please reply to this post with a mainnet Firo address for the bug bounty payout. Use a new address that has never been used before. Make sure to anonymize after receiving!

RESTfulRaccoon commented 1 year ago

a3BacgFxzAgkG1dSBYLyi5r3s5rbU3nXVi

justanwar commented 1 year ago

TXID: 0c73d47b082b69d584c2719951eea64b859f432ac92a35d711bb96503afc64e2

Bounty paid: Type: UI Amount: 5 Firo