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

Reduce accepted error codes on mirror node contracts/call #1276

Closed
17 tasks done
Nana-EC opened this issue May 18, 2023 · 1 comment · Fixed by #1746
Closed
17 tasks done

Reduce accepted error codes on mirror node contracts/call #1276

Nana-EC opened this issue May 18, 2023 · 1 comment · Fixed by #1746
Assignees
Labels
enhancement New feature or request P2
Milestone

Comments

@Nana-EC
Copy link
Collaborator

Nana-EC commented May 18, 2023

Problem

Currently the relay will accept error code in acceptedErrorStatusesResponsePerRequestPathMap[MirrorNodeClient.CONTRACT_CALL_ENDPOINT] and not throw an error.
This may be problematic as it would return a 0x value instead of throwing to clients.

Solution

Verify that 0x is not an appropriate value to return on any of these codes.
Assuming so reduce the array of codes to an empty array []

In this way all error from the mirror node would result in errors to the user.

Also remove the 0x return in callMirrorNode() if not applicable

Endpoints to refactor:

  • GET_ACCOUNTS_BY_ID_ENDPOINT
  • GET_BALANCE_ENDPOINT
  • GET_BLOCK_ENDPOINT
  • GET_BLOCKS_ENDPOINT
  • GET_CONTRACT_ENDPOINT
  • GET_CONTRACT_RESULTS_BY_ADDRESS_ENDPOINT
  • GET_CONTRACT_RESULTS_DETAILS_BY_CONTRACT_ID_ENDPOINT
  • GET_CONTRACT_RESULT_ENDPOINT
  • GET_CONTRACT_RESULT_LOGS_ENDPOINT
  • GET_CONTRACT_RESULT_LOGS_BY_ADDRESS_ENDPOINT
  • GET_CONTRACT_RESULTS_ENDPOINT
  • GET_NETWORK_EXCHANGERATE_ENDPOINT
  • GET_NETWORK_FEES_ENDPOINT
  • GET_TOKENS_ENDPOINT
  • GET_TRANSACTIONS_ENDPOINT
  • CONTRACT_CALL_ENDPOINT
  • GET_STATE_ENDPOINT

Alternatives

No response

@Nana-EC Nana-EC added enhancement New feature or request P2 labels May 18, 2023
@Nana-EC Nana-EC added this to the 0.25.0 milestone May 18, 2023
@Nana-EC Nana-EC modified the milestones: 0.25.0, 0.26.0 Jun 9, 2023
@AlfredoG87 AlfredoG87 self-assigned this Jun 15, 2023
@AlfredoG87
Copy link
Collaborator

@Nana-EC, taking a further look at this, my take is that the mirrorNode Client is the one that is returning null whenever it gets any acceptedErrorCodes from the mirror node, and is up to the implementation of the methods using the mirrorNode client what to do with the null value.

In some, is part of the logic, and in some they do return an exception, and in some as you noted, it might end-up returning 0x.

My suggestion is to always return the corresponding error from the mirrorNodeClient and instead of the methods using the mirror node handling the null as they need, they handle the exception, but in some cases they will not return that exception to the user since is part of a path flow of the logic, to verify for the existence or the absentee of something. so for example if we return a 404 exception instead of null in those cases, the call to the mirror node will have to be wrapped in a try catch block and depending on wether it goes to the catch, do one or the other actions...

I am not sure how much we want to use try catch as part of the flow of code, thus making this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants