Skip to content

How to test internals of a contract other than writing explicit end-to-end full transactions #129

Description

@schoen

Describe the feature

Right now when we have a contract with various internal functions, Simplex tests basically synthesize calls to those specific functions by selecting them through the witness, the main mechanism being if_test_this_function(). I think this is a little cumbersome and hard to read, and I just had an AI complain about "how do I test my individual contract functions individually, as opposed to indirectly via transactions that happen to use them?" and my answer was basically "you can make a witness parameter and then use if_test_this_function(). Neither the AI nor I found this very aesthetically satisfying.

Is there a possibility of standardizing this more so that one would need less boilerplate in order to cause calls to individual contract functions as part of tests? I understand that it's tricky to literally call into the middle of the program because every real on-chain transaction only ever enters via main() with some witness, but maybe Simplex could help synthesize some of the boilerplate so that there could be some form of test that at least looks and feels more like calling individual SimplicityHL functions?

I'm sure this will look a little nicer when we have an if statement, but I do wonder if Simplex could literally write some form of the test/foo_test.simf functions for us, in a way that would make it appear that we could directly test inputs and output behaviors of functions other than main().

Metadata

Metadata

Assignees

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