peeramid-labs / contracts

Rankify smart contracts
https://rankify.it
5 stars 2 forks source link

GM SLA Contract Specifications #25

Open peersky opened 8 months ago

peersky commented 8 months ago

SLA contract is an act between game master and game users, stored on-chain. It allows game master backend servers to take decisions on how to serve each particular game

peersky commented 4 months ago

Using EigenLayer AVS seems to make sense: https://docs.eigenlayer.xyz/eigenlayer/avs-guides/avs-developer-guide

examples: 1. https://github.com/Layr-Labs/hello-world-avs/blob/84ae1974c212c193a3992467f7d431bad39f74a3/contracts/src/HelloWorldServiceManager.sol

2. https://github.com/Layr-Labs/incredible-squaring-avs/blob/8bd0ac663dcc2289cad02af4a7f0002ea07bc1d8/contracts/src/IncredibleSquaringTaskManager.sol#L102

This implies:

  1. Creating a task requires to have at least on on chain event
  2. Responding to task requires interface to have at least one on chain event

In case of our SLA we would need:

  1. Post on Chain GameMaster & Participant signature agreeing to serve game of a particular player for a particular contract. Consists of

From now on player may send anything to the game master via encrypted channel. (Further nonce-based KDF may be implied, out of scope of this work for now)

  1. Now player may join the game. He uses Game Master provided signature during step 1 to prove that he has GM behind him and hence will be able to participate

  2. Game process: Whenever even on-chain that contains message signed by a shared GM key they must respond within SLA timeout (defined in step 1) with a transaction that executes actions on behalf of the player on target contract.

If they fail, slashing occurs.

There might be legitimate cases when game master does not want to retranslate player intentions, in case for example if content is not validated against the SLA agreement. I.e. it might break terms of conduct. In such case:

Each transaction game master does it acts as bundler which is pulling payments from players wallet paymasters.

It serves player until player has at least 1/2 of his initial stake available.

peersky commented 4 months ago

EL AVS has limitations today that we won't be able to run it cheaply on L2s. We might want to provision architecture to well fit it, however not implement the real AVS at the initial stages and just go with simple substitute.