AlacrisIO / meta

Internal management of Legicash/Legilogic/Alacris
0 stars 0 forks source link

Allow JS client to start protocol part-way through, given captured state #74

Open jeapostrophe opened 5 years ago

jeapostrophe commented 5 years ago

A simple way to do this is to change ctc.send( ...., () => ctc.recv( .... , (res) => ....); ); into ctc.sendrecv( ...., (res) => ....); where the contract object will look and see if the message has already been sent and if so, not try to send it. This means that "starting" part-way really means starting from the beginning again and seeing that the things you meant to do have already happened.

This way all of the complexity of this is in the standard library. The interact function would need to track the previous results and re-play them.

fare commented 5 years ago

This is a necessity for any JS client worth its salt. My manual demo does it—modulo the fact that it trusts the browser's LocalStorage, which unhappily is not trustworthy and should be replaced by a better library at some point.

Options for persistence notably include none, local storage, remote storage on private servers, remote storage on the blockchain itself (encrypted).

fare commented 5 years ago

That's the kind of infrastructure I was working on for many years at ITA (then, to a point, Google).