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

fix(xcm): use single encoding for XCM messages #2278

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Conversation

peterwht
Copy link
Contributor

@peterwht peterwht commented Aug 27, 2024

Summary

Closes #_

  • [y] y/n | Does it introduce breaking changes? -> kinda, see notes below.
  • [y] y/n | Is it dependant on the specific version of cargo-contract or pallet-contracts?

A later release of pallet-contracts changes the expected XCM message format for xcm_execute and xcm_send from requiring a double encoded message to a single encoded message.

Compatible with pallet-contracts on polkadot-v1.11.0 and greater.

Description

ink!'s XCM support was originally merged on polkadot-v1.10.0, where XCM used execute_blob and send_blob. These accepted an encoded XCM message, which required that ink! double encode XCM messages.

However, in this commit Revert execute_blob and send_blob (#4266) , execute_blob was replaced by execute which accepts a VersionedXcm<RuntimeCall> message. This requires that ink! single encodes the XCM message.
Screenshot 2024-08-27 at 3 59 26 PM

XCM support in ink! has not had an official release, and remained in the master branch only. Additionally, since the initial support, pallet-contracts has stabilized the XCM host fns.

Checklist before requesting a review

  • My code follows the style guidelines of this project
  • I have added an entry to CHANGELOG.md
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works ->
  • Any dependent changes have been merged and published in downstream modules

@peterwht peterwht requested a review from pgherveou August 27, 2024 22:09
Copy link
Contributor

@pgherveou pgherveou left a comment

Choose a reason for hiding this comment

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

Make sense I think if the tests are passing with a runtime that has the changed mentioned here, then it should be good to merge

Copy link

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

The CI failing here /~https://github.com/use-ink/ink/actions/runs/10586570908/job/29335623282?pr=2278 I think is the same problem we have building the docker image in cargo-contract: /~https://github.com/use-ink/cargo-contract/actions/runs/10556354226/job/29241730113

The nightly Rust version nightly-2024-02-08 is currently hardcoded for linting in the rust-toolchain.toml file. Does it needs to be updated?

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.53%. Comparing base (5ec034c) to head (3661ed1).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2278   +/-   ##
=======================================
  Coverage   60.53%   60.53%           
=======================================
  Files         141      141           
  Lines        5739     5739           
  Branches     2374     2374           
=======================================
  Hits         3474     3474           
  Misses       2265     2265           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Nov 6, 2024

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the integration-tests/* contracts from this branch with cargo-contract and comparing them to ink! master:

Contract Upstream Size (kB) PR Size (kB) Diff (kB) Diff (%) Change
call-builder-return-value 8.924 8.924 0 0
e2e-runtime-only-backend 1.925 1.925 0 0
lang-err/call-builder-delegate 2.612 2.612 0 0
lang-err/call-builder 5.66 5.66 0 0
lang-err/constructors-return-value 2.011 2.011 0 0
lang-err/contract-ref 5.087 5.087 0 0
lang-err/integration-flipper 1.91 1.91 0 0
mother 12.375 12.375 0 0
sr25519-verification 1.082 1.082 0 0
call-runtime 1.881 1.881 0 0
combined-extension 2.017 2.017 0 0
conditional-compilation 1.46 1.46 0 0
contract-storage 7.459 7.459 0 0
contract-terminate 1.314 1.314 0 0
contract-transfer 1.52 1.52 0 0
contract-xcm 19.504 18.805 -0.699 -3.58388 📉
cross-contract-calls 7.471 7.471 0 0
cross-contract-calls/other-contract 1.591 1.591 0 0
custom-allocator 7.831 7.831 0 0
custom-environment 2.062 2.062 0 0
dns 7.142 7.142 0 0
e2e-call-runtime 1.182 1.182 0 0
erc1155 14.294 14.294 0 0
erc20 6.993 6.993 0 0
erc721 9.742 9.742 0 0
events 4.955 4.955 0 0
flipper 1.701 1.701 0 0
incrementer 1.538 1.538 0 0
lazyvec 4.664 4.664 0 0
mapping 8.008 8.008 0 0
multi-contract-caller 6.42 6.42 0 0
multi-contract-caller/accumulator 1.363 1.363 0 0
multi-contract-caller/adder 1.733 1.733 0 0
multi-contract-caller/subber 1.751 1.751 0 0
multisig 20.804 20.804 0 0
payment-channel 5.72 5.72 0 0
psp22-extension 6.907 6.907 0 0
rand-extension 2.957 2.957 0 0
runtime-call-contract 1.592 1.592 0 0
static-buffer 2.602 2.602 0 0
trait-dyn-cross-contract-calls 2.808 2.808 0 0
trait-dyn-cross-contract-calls/contracts/incrementer 1.571 1.571 0 0
trait-erc20 7.286 7.286 0 0
trait-flipper 1.46 1.46 0 0
trait-incrementer 1.63 1.63 0 0
upgradeable-contracts/delegator 3.869 3.869 0 0
upgradeable-contracts/delegator/delegatee 1.652 1.652 0 0
upgradeable-contracts/delegator/delegatee2 1.652 1.652 0 0
upgradeable-contracts/set-code-hash-migration 1.74 1.74 0 0
upgradeable-contracts/set-code-hash-migration/migration 1.302 1.302 0 0
upgradeable-contracts/set-code-hash-migration/updated-incrementer 1.93 1.93 0 0
upgradeable-contracts/set-code-hash 1.74 1.74 0 0
upgradeable-contracts/set-code-hash/updated-incrementer 1.717 1.717 0 0
wildcard-selector 2.779 2.779 0 0

Link to the run | Last update: Wed Nov 6 14:45:42 CET 2024

@cmichi cmichi merged commit 09c41ce into master Nov 6, 2024
35 checks passed
@cmichi cmichi deleted the peter/fix-xcm-encoding branch November 6, 2024 13:45
@cmichi cmichi mentioned this pull request Nov 28, 2024
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.

4 participants