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

Support actor init args in mo_idl/idl_to_mo.ml #2120

Open
ggreif opened this issue Nov 17, 2020 · 2 comments · May be fixed by #2132
Open

Support actor init args in mo_idl/idl_to_mo.ml #2120

ggreif opened this issue Nov 17, 2020 · 2 comments · May be fixed by #2132
Assignees
Labels
Bug Something isn't working idl Candid or serialisation P1 high priority, resolve before the next milestone

Comments

@ggreif
Copy link
Contributor

ggreif commented Nov 17, 2020

Currently there is an assertion failure in

Fatal error: exception "Assert_failure mo_idl/idl_to_mo.ml:105:9"
Raised at file "mo_idl/idl_to_mo.ml", line 105, characters 9-21

when compiling .did files with services that take init arguments.

One such example is
https://github.com/dfinity-lab/dfinity/pull/6864/files#diff-47dc8fc25392fec08b3f4d2b12e98c0f6284b751ce0ceed8c450a7055bf23e11R40

For now we have a workaround to exclude those args from the .did: https://github.com/dfinity-lab/dfinity/pull/6864/commits/69a813a913299668368e4b35cc3d6073de648795

Please note, that this issue can be split, to

  • first be able to send messages to existing services (that came into existence with init args)
  • second, instantiating such services.

Clearly, the first part is sufficient to deal with the problem described above, and as such has priority.

@ggreif ggreif added the Bug Something isn't working label Nov 17, 2020
@nomeata
Copy link
Collaborator

nomeata commented Nov 17, 2020

Re “first be able to send messages to existing services (that came into existence with init args)”:

This is related to the discusion at #1549, and I think the conclusion (or at least one possible stance) was that by the time the .did file reaches the above code, it describes an installed service, not a canister class , and therefore there should not be any init parameters in that file.

The other stance is that that this is too pedantic and the parameters could just be ignored.

In any case it should be handled more gracefully.

@chenyan-dfinity chenyan-dfinity linked a pull request Nov 19, 2020 that will close this issue
@chenyan-dfinity
Copy link
Contributor

first be able to send messages to existing services (that came into existence with init args)
second, instantiating such services.

So the intended use case is the first one? Then I would say the workaround (removing the init arguments from did file) is the expected fix, because the running/instantiated canister is always a service, not a service constructor. I didn't see the Motoko code in the PR, are we using import "ic:/canister:" to import the service?

For the second case, I created #2132 as a first step. We also need a new URI for actor class, e.g. import "class:proposals.did", and this needs to be a local did file, as the did file from the canister is not an actor class.

@rossberg rossberg added idl Candid or serialisation P1 high priority, resolve before the next milestone labels Dec 1, 2020
@rossberg rossberg mentioned this issue Feb 2, 2021
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working idl Candid or serialisation P1 high priority, resolve before the next milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants