circle-free / optimistic-roll-in

Layer-Agnostic Optimistic Roll-Ins For Isolated-State-Transitions - A Proof of Concept
MIT License
1 stars 1 forks source link

optimistic-roll-in

4-Minute Pitch

Optimistic Roll-Ins in 4 Minutes

Status

Just a Proof Of Concept, with Smart Contracts and JS Client. Only "happy path" tested. No security review. Feedback welcome and wanted.

Brief

If your contract(s) has any functionality that results in isolated state changes for individual accounts (which means you could rewrite certain function to take in the user's state, and some arguments, and result in a new state, via a pure function) then this library should allow your users to perform Optimistic Roll Ins. Effectively, your users can assert their intent to the chain, by providing their current state, the call data they would have sent to the chain normally, and their expected new state, and optimistically update their state, without wasting any gas actually performing the on-chain verifications and logic. They can perform as many of these state transitions as they want, one at a time, or even cheeper in batch (allowing for offline play and syncing afterwards), and any other users can validate their proposed state changes after the fact, and prove if anyone committed fraud. Users can enter and exit this "optimistic" state at will (some conditions) so that they can perform non-optimistic transitions that are the result on non-pure functions in your contract.

Things to note:

Examples and more coming soon. Feel free to reach out with questions.