Local Replica Weirdness with "Ping-Pong" Canisters

I’ve experimented with two canisters that just infinitely call themselves back and forth before with great success, not sure what happened, but now when using this setup my replica just explodes. It doesn’t appear the local replica is simulating consensus on inter-canister calls. I noticed the Time.now(); function doesn’t tick either during this, for lack of a better term, infinite callback loop.

Tried with versions:
7.0
7.1

1 Like

I figured it out, I had my awaits in the wrong places :eyes:

1 Like

Could you share your code? I’d like to learn! I’ve tried the ping-pong idea once in motoko, but failed to get it compiled because of circular dependency.

The trick is you need three files :grinning_face_with_smiling_eyes:

2 Likes

This is cute!

I think you could actually simplify the example further to avoid using raw principals. Might have a go later if you do not…

Yes you can! What I was originally doing was just passing the T.Game instead of that principal.

I mangled the codes pretty badly while I was attempting to debug - my first hunch was the local replica was acting directly on the Game reference. :joy:

1 Like