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 decode command for event, message and constructor data decoding #481

Merged
merged 22 commits into from
Apr 12, 2022

Conversation

agryaznov
Copy link
Contributor

@agryaznov agryaznov commented Mar 29, 2022

As a response to user feature request (e.g. like in this StackExchange question):

  1. New command added which allows to decode data from contract events and messages
  2. Corresponding encoded values printing added to debug log (where there was lack of such)

src/cmd/extrinsics/decode.rs Outdated Show resolved Hide resolved
src/cmd/extrinsics/decode.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@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.

Looks good, just a couple of nitpicks, and also we need to add constructor decoding

src/cmd/decode.rs Outdated Show resolved Hide resolved
src/cmd/decode.rs Outdated Show resolved Hide resolved
src/cmd/decode.rs Outdated Show resolved Hide resolved
Co-authored-by: Andrew Jones <ascjones@gmail.com>
src/cmd/decode.rs Outdated Show resolved Hide resolved
src/cmd/decode.rs Outdated Show resolved Hide resolved
src/cmd/decode.rs Outdated Show resolved Hide resolved
@agryaznov agryaznov changed the title Add decode command for event and message data decoding Add decode command for event, message and constructor data decoding Apr 8, 2022
@agryaznov agryaznov requested a review from ascjones April 8, 2022 11:08
Copy link
Collaborator

@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

Comment on lines 75 to 79
fn cargo_contract(path: &Path) -> assert_cmd::Command {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.current_dir(path).arg("contract");
cmd
}
Copy link
Contributor

@athei athei Apr 12, 2022

Choose a reason for hiding this comment

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

I think you need to compile cargo contract here. So you essentially want to run cargo run --release -- <args> here. You can get the correct directory where to run it by reading CARGO_MANIFEST_PATH env var.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems that assert_cmd assumes it is an integration test (therefore the binary would already have been built).

I've moved this test to integration test to see if it works now.

@agryaznov agryaznov requested a review from a team as a code owner April 12, 2022 08:34
@ascjones ascjones merged commit bce9301 into master Apr 12, 2022
@ascjones ascjones deleted the ag-decode-cmd branch April 12, 2022 10:43
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