Skip to content

[#501] Check necessity in initial `cast` automatically

Description

Problem: We tend to insert CAST automatically at the beginning of each Lorentz contract to avoid problems with annotation in contract code. However, this may increase origination operation size significantly since CAST call includes both storage and parameter types. Despite the presence of this CAST call is configurable, in most cases, no one cares about tuning this up. Would be nice to handle this automatically.

Solution: Verify the contract typechecks without CAST. If it doesn't, only then insert CAST.

Similar treatment applied to compileLorentzView. To facilitate that, typeVerifyView is added to Morley.Michelson.TypeCheck.

Related issue(s)

Resolves #501 (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)

Edited by Nikolay Yakimov

Merge request reports

Loading