Skip to content

Conversation

@Daanvdplas
Copy link
Collaborator

@Daanvdplas Daanvdplas commented Dec 10, 2024

This PR introduces to output the events from calling a parachain next to the already outputted transaction hash. It is currently using cargo contract code which is not the cleanest way but it meant I didn't have to write new functions and tests. In the future when we want more say in how to parse and output the events this can be relooked at. My suggestion would be to move all the cargo contract code to the pop cli and make it suitable for calling chains and contracts.

Outputting events is also added to submitting extrinsics from call data. I have refactored the sign_and_submit_extrinsic in pop-parachains to be generic on the Payload. I think the code in the pop-cli regarding extrinsics with & without payload can be refactored in the future and make it more streamlined and prevent repetitive code.

AlexD10S and others added 30 commits September 5, 2024 14:09
Merged set_up_call_config and guide_user_to_call_contract into a single function. Also adds short symbols for arguments.
@Daanvdplas Daanvdplas force-pushed the feat/parachain_onboarding branch from 447e714 to ea32660 Compare December 10, 2024 08:47
* fix: add missing short arg option

* refactor: note that extrinsic wait includes finalization

* refactor: remove clones

* style: formatting

* refactor: make file prompt more generic

* refactor: add missing license headers

* style: formatting

* docs: comments

* docs: comments

* docs: comments

* refactor: reuse existing metadata

* refactor: minimise clones

* docs: comments

* refactor: naming

* docs: fix parameter doc comments

* refactor: address clippy warnings
@Daanvdplas Daanvdplas force-pushed the feat/parachain_onboarding branch from ea32660 to 751053a Compare December 10, 2024 10:28
@codecov
Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 27.50000% with 29 lines in your changes missing coverage. Please review.

Project coverage is 75.63%. Comparing base (e99f719) to head (9a35f88).
Report is 211 commits behind head on main.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/call/chain.rs 32.00% 11 Missing and 6 partials ⚠️
crates/pop-parachains/src/call/mod.rs 20.00% 11 Missing and 1 partial ⚠️
@@           Coverage Diff           @@
##             main     #372   +/-   ##
=======================================
  Coverage   75.62%   75.63%           
=======================================
  Files          62       62           
  Lines       12720    12728    +8     
  Branches    12720    12728    +8     
=======================================
+ Hits         9620     9627    +7     
+ Misses       1806     1804    -2     
- Partials     1294     1297    +3     
Files with missing lines Coverage Δ
crates/pop-common/src/lib.rs 73.91% <ø> (ø)
crates/pop-parachains/src/call/mod.rs 64.05% <20.00%> (+2.41%) ⬆️
crates/pop-cli/src/commands/call/chain.rs 76.84% <32.00%> (-0.49%) ⬇️

…in parachain as an alias (#373)

* refactor: rename parachain with chain in visible messages

* refactor: rename parachain with chain internal code

* chore: solve fmt after rebase

* refactor: small fix, use alias instead aliases

* refactor: rename CallParachain struct into Call
@Daanvdplas Daanvdplas requested a review from AlexD10S December 10, 2024 12:39
@Daanvdplas Daanvdplas force-pushed the feat/parachain_onboarding branch from fbc00b0 to 3a7062e Compare December 10, 2024 12:40
@Daanvdplas
Copy link
Collaborator Author

[sc-1508]

Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Great work, only two improvements before merge it.
We should improve the parsing to make it more readable for addresses.

Event(s):

Balances::Withdraw: { who: ((212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125)), amount: 14323809 }

Balances::Transfer: { from: ((212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125)), to: ((142, 175, 4, 21, 22, 135, 115, 99, 38, 201, 254, 161, 126, 37, 252, 82, 135, 97, 54, 147, 201, 18, 144, 156, 178, 38, 170, 71, 148, 242, 106, 72)), amount: 1000 }

Balances::Deposit: { who: ((212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125)), amount: 0 }

A great reference to check out is how cargo-contract handles it: https://github.com/use-ink/cargo-contract/blob/master/crates/extrinsics/src/events.rs#L277

Additionally, it’s challenging to test a successful case for the sign_and_submit_extrinsic function. However, if we split the event handling part into its own function, it would make it possible to test this logic separately.

Base automatically changed from feat-call-ui-extrinsics-limited to main December 10, 2024 17:28
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Great work! The events output looks amazing and is consistent with the pop call contract.

I really like the refactor you did for sign_and_submit_extrinsic_with_call_data. Just one small fix: adjust the output formatting in that specific scenario.

Copy link
Member

@al3mart al3mart left a comment

Choose a reason for hiding this comment

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

It is looking much better now. Great refactor!

@Daanvdplas Daanvdplas merged commit 51e786f into main Dec 12, 2024
19 of 20 checks passed
@Daanvdplas Daanvdplas deleted the feat/parachain_onboarding branch December 12, 2024 16:27
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.

5 participants