Skip to content

Add ability to "mock" jet returns for test and debugging purposes #23

@schoen

Description

@schoen

A developer at the hackathon asked for an ability to simulate success (or failure) of specific jets for debugging/testing purposes.

There are many places that this might be added, but right now the main place that people simulate executing Simplicity programs is when constructing transactions in hal-simplicity.

So for example, a developer would like to see what happens if a particular signature verification is considered to succeed (despite the fact that that developer doesn't possess the corresponding private key, and can't actually generate a valid signature on a proposed transaction, or can't actually generate a valid oracle signature for the transaction). The developer would like to see what will happen in the future if the signature presented is valid, and make sure that the rest of the logic performs as expected. This might entail annotating a particular jet (or a particular invocation of a jet) to hardcode a specific simulated return behavior, instead of running the jet logic as faithfully as possible, akin to "mocking" function calls in other tests.

This can also then be used in test suites for Simplicity or SimplicityHL programs, as developers can indicate the expected overall behavior of a program in the presence or absence of particular conditions (like timelock success or failure, or particular signature success or failure), and then run scripted tests to confirm that the program appears to behave as expected.

This isn't a substitute for eventual formal verification of the program's conformance to a specification, but is something developers will probably want to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions