Fix --dry-run error deserialization and report error details#534
Merged
Fix --dry-run error deserialization and report error details#534
--dry-run error deserialization and report error details#534Conversation
ascjones
commented
May 5, 2022
|
|
||
| type ContractExecResult = pallet_contracts_primitives::ContractExecResult<Balance>; | ||
| type ContractExecResult = | ||
| ContractResult<result::Result<ExecReturnValue, RuntimeDispatchError>, Balance>; |
Collaborator
Author
There was a problem hiding this comment.
This is the crux of the change, it is using the subxt generated RuntimeDispatchError instead of the default sp_runtime::DispatchError. This means it is using the same DispatchError type as would be returned in case of an error on calling the extrinsic.
| #[subxt::subxt( | ||
| runtime_metadata_path = "src/cmd/extrinsics/runtime_api/contracts_runtime.scale" | ||
| runtime_metadata_path = "src/cmd/extrinsics/runtime_api/contracts_runtime.scale", | ||
| derive_for_type(type = "sp_runtime::DispatchError", derive = "::serde::Deserialize"), |
Collaborator
Author
There was a problem hiding this comment.
Adding these derives to these generated types is necessary so that they can be used to deserialize the RPC --dry-run error responses.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #533.
This now parameterizes the RPC results with the generated
DispatchErrortype fromsubxtso the types line up with the latest contracts node for deserializataion.This also allows us to retrieve the
DispatchErrordetails from the metadata so we can map to a user friendly error: