Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

contracts: Rework contracts_call RPC #7468

Merged
2 commits merged into from
Oct 30, 2020
Merged

contracts: Rework contracts_call RPC #7468

2 commits merged into from
Oct 30, 2020

Conversation

athei
Copy link
Member

@athei athei commented Oct 30, 2020

This changes the contracts_call RPC so that more information is returned. The following changes are made:

  • gas_consumed is returned in any case and not only on success.
  • On error the DispatchError is returned instead of nothing. Can be used by the UI to pre-run a contract call and show the user what is going wrong.
  • A debug_message is introduced that can be used to return dynamic information. In the future, the plan is to use the field to allow outputting more precise error messages and to support println debugging. Those messages will only be collected when called by RPC and will introduce no overhead when executed as transaction. This is currently unused and will return an empty string.

This will need changes in polkadot.js API @jacogr

Also I needed to derive Deserialize for DispatchError because that is a requirement to use it in an RPC even though it is only used as a result.

@athei athei added A0-please_review Pull request needs code review. B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Oct 30, 2020
Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM

@athei
Copy link
Member Author

athei commented Oct 30, 2020

bot merge

@ghost
Copy link

ghost commented Oct 30, 2020

Trying merge.

@ghost ghost merged commit 3a0c6f2 into master Oct 30, 2020
@ghost ghost deleted the at-change-call-rpc branch October 30, 2020 14:39
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants