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

Add functions to decode reject reason in contract client #199

Merged
merged 12 commits into from
Jul 12, 2024

Conversation

DOBEN
Copy link
Member

@DOBEN DOBEN commented Jul 8, 2024

Purpose

Add methods to the ContractClient to decode the reject reason for a failed transaction during dry-run.
Related Concordium/concordium-dapp-examples#87

Changes

  • Update the ContractClient to optionally keep track of the associated schema of the contract.
  • Update the create method to the ContractClient to look up the embedded schema from the chain.
  • Add the new_with_schema method to the ContractClient to create a ContractClient with a given schema.
  • Add dry_run_update_with_reject_reason_info and dry_run_update_raw_with_reject_reason_info methods to the ContractClient. They are like the dry_run_update and dry_run_update_raw methods but in case of a reject, decode the reject reason into a human-readable error.
  • Add decode_concordium_std_error and decode_smart_contract_revert functions to facilitate reject reason decoding of failed transactions.

@DOBEN DOBEN force-pushed the add-functions-to-decode-reject-reason branch from e60eb7a to 5044321 Compare July 8, 2024 10:37
@DOBEN DOBEN force-pushed the add-functions-to-decode-reject-reason branch from ac14d56 to e5ea591 Compare July 8, 2024 12:05
@DOBEN DOBEN requested review from soerenbf and limemloh July 8, 2024 13:52
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
@DOBEN DOBEN requested review from soerenbf and limemloh July 9, 2024 16:32
src/contract_client.rs Show resolved Hide resolved
src/contract_client.rs Show resolved Hide resolved
@DOBEN DOBEN force-pushed the add-functions-to-decode-reject-reason branch 3 times, most recently from f2614f1 to 2d808e6 Compare July 11, 2024 13:40
@DOBEN DOBEN force-pushed the add-functions-to-decode-reject-reason branch from 2d808e6 to 82b7644 Compare July 11, 2024 13:56
Copy link
Contributor

@soerenbf soerenbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice write-up of the error decoding rationale 😄

I still have one suggestion originating from @limemloh as seen below:

Otherwise I think it looks good 👍

src/contract_client.rs Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
src/contract_client.rs Outdated Show resolved Hide resolved
@DOBEN DOBEN merged commit f18fffc into main Jul 12, 2024
4 checks passed
@DOBEN DOBEN deleted the add-functions-to-decode-reject-reason branch July 12, 2024 14:02
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.

3 participants