celestia-node icon indicating copy to clipboard operation
celestia-node copied to clipboard

fix:(api/fraud): `fraud.Get` returns potentially confusing error message

Open distractedm1nd opened this issue 9 months ago • 0 comments

From a user:

in this endpoint https://node-rpc-docs.celestia.org/?version=v0.13.5#fraud.Get What should be Proof Type? I tried to use type shown in the docs but that is throwing error. datastore: key not found.

This makes sense to us, because we know there is no fraud available in the store so ofc it says key not found. But this is not very intuitive.

I suggest either:

  • returning an empty array when this error is encountered (haha)
  • returning an error that is user friendly, i.e. NoFraudAvailable = "no fraud proofs were found"

I am more for option one because in my mind, it is not semantically an error. For the same reasoning that I used with blob.GetAll. But I won't block if others prefer version two.

This also signifies we should write an example for how to interact with fraud proofs over the API. I have opened an issue to add an example, showing that Subscribe makes the most sense here unless you want to poll with Get.

distractedm1nd avatar May 16 '24 15:05 distractedm1nd