rbolog
June 6, 2021, 11:19am
1
Hi,
I have the following snippet
shared(msg) actor class Organisations() {
let canisterOwner = msg.caller;
public shared(caller) func debugIdentity() : async Text {
let result = "Caller : " # Principal.toText(caller.caller) # " canister Owner: " # Principal.toText(canisterOwner) # " Caller hash : " # Nat32.toText(Principal.hash(caller.caller)) # " Canister Owner hash : " # Nat32.toText(Principal.hash(canisterOwner)) ;
return result;
};
};
I deploy using default identity dfx --identity default deploy
And call it as dfx --identity default canister call organisations debugIdentity
I expect to get the same identity between canister owner and function caller. But there are different.
(
āCaller : gwa27-fxplx-wxche-go5up-irof3-bpuxh-4wzon-tdkb7-disam-ehhrw-tqe canister Owner: rwlgt-iiaaa-aaaaa-aaaaa-cai Caller hash : 897691542 Canister Owner hash : 2375444897ā,
)
if I am using command: dfx identity get-principal
I got the caller id gwa27-fxplx-wxche-go5up-irof3-bpuxh-4wzon-tdkb7-disam-ehhrw-tqe
I am using dfx 0.7.1
I could not find my mistake.
Thanks for adviceās
1 Like
Hey, Iām not sure if dfx --identity default deploy
stops the proxying through the wallet canister. Iām not on a machine right now but maybe you can check the dfx deploy --help
command to see if thereās a flag for it?
This is for reference:
Hey guys, dfx 0.7.1 is now promoted to the latest release. There is a breaking change you should be aware of detailed here:
To summarize, in previous releases, dfx canister call would proxy all calls via the cycle wallet by default. This is no longer the case.
If a user expects the dfx canister call to proxy via the wallet, the user will have to do dfx canister --wallet=<id> call now; this primarily impacts canisters that maintain an internal ACL based on the canister initializer. For exampleā¦
3 Likes
Use some permutation of --no-wallet. Dfx routes requests through a wallet canister unless you use this and things get wonky.
1 Like
Hi,
Yes, thanks with following command dfx canister --wallet=$(dfx identity get-wallet) call organisations debugIdentity
I got the same id.
1 Like
Hi,
I tried your proposition using command dfx canister --no-wallet call organisations debugIdentity
but I still have different idās.
Thanks