Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulator: Property checks #2117

Closed
5 tasks
ValarDragon opened this issue Jul 18, 2022 · 0 comments
Closed
5 tasks

Simulator: Property checks #2117

ValarDragon opened this issue Jul 18, 2022 · 0 comments
Assignees
Milestone

Comments

@ValarDragon
Copy link
Member

Background

This issue discusses implementation details for "Property Checks", a suggested abstraction over the legacy SDK invariants.

The goal of a property check is to be able to verify properties of the state machine, during these complex simulation runs. There are a couple dimensions the property checks should abstract over:

  • "Memoryless" (AKA legacy invariants) - Just look at the current state, and run some consistency checks. If consistency check fails, error. E.g. "No account has a negative balance"
  • Memoried - The checker can maintain state from its prior invokations. (So it can tell that a quantity that is only increasing, is in fact only increasing)

Triggers:

  • We want to be able to trigger an event before and after certain message types are executed
    • In a first pass, we maybe just architect around before/after an action, and pass the message blob through. TBD
  • Trigger an event after any action
  • Trigger an event at beginning and end block.

Suggested Design

I suggest a "pub sub" model of for the property checks. We have the simualtor "publish" events to an "event bus" struct. We have the simulator take in property checks, that each register "subscriptions". The simualtor handles putting those subscriptions onto the "event bus" struct as well.

To be honest, I think this is the correct answer for hooks should be designed everywhere in the SDK, and I suggest we use this as a demo to showcase a much cleaner way to rewrite hooks.

Acceptance Criteria

  • Property check written into new simulator
  • Property check written for CFMM k only increasing between swaps & join pools. (And handling exit pools)
  • Property check from legacy invariant
    • We will want to amend to give more fine-grained subscription control as well, but can be later.
  • Actions trigger pre and post events
@p0mvn p0mvn added this to the Simulator milestone Jul 19, 2022
@ValarDragon ValarDragon mentioned this issue Jul 20, 2022
20 tasks
@czarcas7ic czarcas7ic mentioned this issue Jul 21, 2022
10 tasks
@ValarDragon ValarDragon self-assigned this Aug 8, 2022
@czarcas7ic czarcas7ic self-assigned this Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants