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

feat: allow controllers to call __motoko_stable_var_info query endpoint #4103

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

ggreif
Copy link
Contributor

@ggreif ggreif commented Jul 5, 2023

This was originally spec-ed, but there was no possibility to implement it (a canister couldn't get its own controller list).
In the meantime canisters can get their controller list (via query), but a query cannot call another query 🫤.

So we had to wait until the ic0.is_controller syscall became available. Now it is there and the implementation is easy.

(It was technically possible to call it before, but it invariably trapped.)

@ggreif ggreif self-assigned this Jul 5, 2023
@ggreif ggreif marked this pull request as ready for review July 5, 2023 18:12
@ggreif ggreif requested a review from crusso July 5, 2023 18:12
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

Comparing from 5334f9b to 716fedb:
In terms of gas, no changes are observed in 4 tests.
In terms of size, 4 tests regressed and the mean change is +0.0%.

@ggreif ggreif force-pushed the gabor/controller-footprint branch from 7f07d08 to edb8e6c Compare July 6, 2023 07:06
@ggreif ggreif requested a review from luc-blaeser July 6, 2023 08:33
@@ -438,8 +438,9 @@ and export_footprint self_id expr =
([ letD (var v typ) (
funcE v (Shared Query) Promises [bind1] [] [ret_typ] (
(asyncE T.Fut bind2
(blockE [expD (assertE (primE (I.RelPrim (caller, Operator.EqOp))
[primE I.ICCallerPrim []; selfRefE caller]));
(blockE [expD (assertE (orE (primE (I.RelPrim (caller, Operator.EqOp))
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be cheaper to call ICCallerPrim just once, but don't think it matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not overly concerned :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now #4108!

@crusso
Copy link
Contributor

crusso commented Jul 6, 2023

I guess we could now provide a helper in ExperimentalInternetComputer to call this on another canister than self, but not urgent.

@ggreif ggreif added the automerge-squash When ready, merge (using squash) label Jul 6, 2023
@ggreif ggreif added the opportunity More optimisation opportunities inside label Jul 6, 2023
@mergify mergify bot merged commit 1a7fdce into master Jul 6, 2023
7 of 8 checks passed
@mergify mergify bot removed the automerge-squash When ready, merge (using squash) label Jul 6, 2023
@mergify mergify bot deleted the gabor/controller-footprint branch July 6, 2023 11:55
ggreif added a commit that referenced this pull request Jul 6, 2023
@ggreif ggreif removed the opportunity More optimisation opportunities inside label Jul 6, 2023
mergify bot pushed a commit that referenced this pull request Jul 6, 2023
reacting to the #4103 (comment)

Turns out that the backend generates quite some code to build the caller principal, so we do it only once now.
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.

2 participants