test: add vm_error to snapshot #6587
Draft
+44
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR does 2 things:
StacksTransactionReceipt::vm_error
to theExpectedTransactionOutput
ExpectedTransactionOutput::vm_error
for the snapshot appending a NON-CONSENSUS BREAKING info message. Basically we would like something like this:With the current solution, based on
serde
, we can only achieve this:Basically because they are json fields we are not allowed to add text outside the field.
Here I used a "static" approach so applying the trasformation directly to the
ExpectedTransactionOutput
definition, but we will have same result using the "dynamic" reduction approach done inside the test execution (because rely on serde/json).Alternative Approach
I also find a way to do what we want but requires to implement the
Debug
trait doing all the snaphoshot formatting "manually". Here a short example:This will produce the following snapshot:
So, for sure this is nice and give us the best flexibility (also for future formatting requirements), but we have to take into account for the whole struct formatting by ourselves.
What do you think?
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repo