Skip to content

Draft: [#653] Expose more Morley error information in Cleveland

At this point, this is more of an RFC. The catch here is that this creates a bit of a disparity between on-network and emulated tests -- we can make more statements about emulated tests at this point. On the other hand, this isn't actually new. But I could add a couple more error handlers to morley-client.

The point of the exercise is to be able to rewrite morley tests to use Cleveland's interface, instead of the soon-to-be-deprecated Test.Cleveland.Michelson.Unit.

Description

Problem: Cleveland strips a bit of information from the emulator errors, and there aren't corresponding Cleveland errors defined, so testing for those ends up being unnecessarily awkward.

Solution: First of all, a bit of refactoring of TransferFailure is in order: since each alternative includes an Address, we can factor it out by declaring TransferFailureReason as the sum type, and making TransferFailure a product type (actually a record). This simplifies a few things.

Then add a couple errors to TransferFailureReason:

  • MutezArithError
  • GasExhaustion

These both are specifically interpreter errors that were missing.

Then extend FailedWith with Maybe InstrCallStack to attach source location when available.

Finally, we shouldn't differentiate between different ShiftArithErrorType, since the RPC doesn't actually care whether LSL or LSR instruction fails, it's script_overflow either way (this should probably be a separate commit, but untangling it from the rest seems to be more trouble than it's worth)

Related issue(s)

Related to #653 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Merge request reports