Skip to content
Tom Larkworthy edited this page Jan 22, 2014 · 12 revisions

Sends an item from user account to another, with the following features:

  • either user can abort
  • no deadlocks exists, even if one player goes offline
  • formally verified, items can never be created nor destroyed

source hsm

Design Sketch

the ordered stages of a successful transfer is is:

  • IDLE: both players start in the idle state
  • TX: A states they want to send their item to B
  • RX: B states they want to receive the item from A
  • ACK_RX: A acknowledges B
  • ACK_TX: B acknowledges A
  • Boom, commit inventory updates

Send item interaction diagram

However, we allow either user to rollback the transition before the ACK_TX.

The complete deadlock free with rollback:-

send_item.hsm

Client examples

Client side code for executing a transaction is in the unit tests

Clone this wiki locally