pub enum Event {
Show 18 variants
Custom {
sender: String,
raw: Vec<u8>,
},
Ready,
ShareSecrets {
sender: String,
shares: Vec<SecretShare>,
},
OperationTimeout {
addrs: Vec<String>,
},
Mask {
sender: String,
random_id: RandomId,
ciphertexts: Vec<Ciphertext>,
},
Lock {
sender: String,
random_id: RandomId,
ciphertexts_and_digests: Vec<(Ciphertext, SecretDigest)>,
},
RandomnessReady {
random_id: RandomId,
},
Sync {
new_players: Vec<PlayerJoin>,
new_servers: Vec<ServerJoin>,
transactor_addr: String,
access_version: u64,
},
ServerLeave {
server_addr: String,
transactor_addr: String,
},
Leave {
player_addr: String,
},
GameStart {
access_version: u64,
},
WaitingTimeout,
DrawRandomItems {
sender: String,
random_id: usize,
indexes: Vec<usize>,
},
DrawTimeout,
ActionTimeout {
player_addr: String,
},
AnswerDecision {
sender: String,
decision_id: DecisionId,
ciphertext: Ciphertext,
digest: SecretDigest,
},
SecretsReady {
random_ids: Vec<usize>,
},
Shutdown,
}Expand description
Game event structure
Variants§
Custom
Sent by player clients. Represent game specific events, the raw
parts is the serialized data from a custom game event which
satisfies CustomEvent.
Ready
A event sent by system, the first event sent by transactor when game is loaded.
Transactor shares its secert to specific player.
The secret_data is encrypted with the receiver’s public key.
OperationTimeout
Mask
Randomize items. This event is sent by transactors.
Lock
Lock items. This event is sent by transactors.
RandomnessReady
All randomness is prepared. This event is sent by transactor.
Sync
Sync with on-chain account. New players/servers will be added frist to game context and then to game handler (WASM). This event is sent by transactor based on the diff of the account states.
ServerLeave
A server left the game.
transactor_addr is the new current transactor address.
NOTE: This event must be handled idempotently.
Leave
Client left game This event is sent by transactor based on client’s connection status.
GameStart
Transactor uses this event as the start for each game.
The access_version can be used to filter out which players are included.
WaitingTimeout
Timeout when waiting for start
DrawRandomItems
Random drawer takes random items by indexes.
DrawTimeout
Timeout for drawing random items
ActionTimeout
Timeout when waiting for player’s action Sent by transactor.
AnswerDecision
Answer the decision question with encrypted ciphertext
SecretsReady
All required secrets are shared
Shutdown
Shutdown