Closed haerdib closed 2 years ago
@darkfriend77 did I get that correct with the queue_game extrinsic of layer one that triggers a new game?
@haerdib after at least 2 players used gameRegistry.queue(), the gameregistry will start to create games and add them into the game queue. queue_game, is only internally executed by the on_initialize which is getting matches from the matchmaker and creates game.
Testing the game is pretty simple.
Launch ajuna-node (branch: https://github.com/ajuna-network/ajuna-node/tree/ajuna-network)
Queue Alice, gameRegistry.queue()
Queue Bob, gameRegistry.queue()
After that, a queue should exist with one game_id
At this point L1 is waiting on Ajuna TEE to acknowledge a game .... once TEE has created the game it should call.
After acknowledging the queue should be empty again and the game in the registry should have changed it's state from waiting to accept.
once the Ajuna TEE reads that the game is accepted it can set the game engine on running
Here's a proposed sequence diagram:
I hope this makes somewhat sense. If you detect an issue, please let me know immediately.
With https://github.com/ajuna-network/worker/commit/00f336e6832c63586443bdb63b9f17b8b57b996f we have successfully demonstrated the creation of a new game. So I'm closing this issue for now.
In a next step, for every new imported and validated parentchain block we query the queued game state of the node
GameQueues
. If games are found, we create anack_game
extrinsic with all game hashes, including our tee_id (extrinsic signature should probably contain all information already), and send it to the node. The next validateer importing thisack_game
extrinsic will check the following:If everything passed, the validateer will create the game, include it in the sidechain block, that will be broadcasted to its peers. The peers will import sidechain block and include the new game in their registry. Only then, they will import the parentchain block containing the
ack_extrinsic
, which will not be executed, as the game has been registered already.Tasks:
ack_game
extrinsic including all game hashes, sign it, and send it to the node. #7get state
call into sgx-runtime) #11new_game
. #9