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: motoko canisters can import other canisters with service constructor #3138

Merged
merged 6 commits into from
May 25, 2023

Conversation

lwshang
Copy link
Contributor

@lwshang lwshang commented May 24, 2023

Description

Fixes SDK-1084

How Has This Been Tested?

The onchain part of the deps e2e test

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@lwshang lwshang marked this pull request as ready for review May 24, 2023 23:23
@lwshang lwshang requested a review from a team as a code owner May 24, 2023 23:23
@chenyan-dfinity
Copy link
Collaborator

Related PR on the Motoko side: dfinity/motoko#3990

@lwshang lwshang enabled auto-merge (squash) May 25, 2023 14:10
@lwshang lwshang disabled auto-merge May 25, 2023 14:11
@lwshang lwshang enabled auto-merge (squash) May 25, 2023 14:46
@lwshang lwshang merged commit f181986 into master May 25, 2023
@lwshang lwshang deleted the lwshang/candid_processing branch May 25, 2023 15:26
mergify bot pushed a commit to dfinity/motoko that referenced this pull request Jun 22, 2023
…ng the service arguments. (#4041)

Allow canister imports of service constructors, silently ignoring the service arguments. 

A hack that fixes #3990 (for some definition of fix) and duplicate #2319.

Really, dfx should be feeding the idl of the instantiated service, not service constructor, to dependent canisters, but until it's fixed to do so (and it hasn't been forever now), this is a reasonable and simple workaround, avoiding the error-prone and kludgy workaround of rewriting candid files described, for instance, here:

https://dfinityorg.notion.site/ckBTC-example-Encode-Hackathon-0aaf6292e3404dabb49df5d1b5abc797#08a7469beaf14d6ba35e8827e363e160

and also used here:

https://github.com/letmejustputthishere/ckbtc-payments

via npm scripting hacks (!).

Also see here for the pain this caused:

https://forum.dfinity.org/t/confusing-type-error-when-crossing-canisters-expression-of-type-mytype-cannot-produce-expected-type-mytype-1/20636

UPDATE: I turned the previous error into a warning to nag us to fix dfx.


UPDATE: Potentially obviated by dfinity/sdk#3138, which teaches dfx to strip the service argument.

UPDATE: @chenyan-dfinity thinks we should still merge for other scenarios (old dfx, new compiler, I guess).
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