Skip to content

[#577] Treat `Address` as always implicit address

Konstantin Ivanov requested to merge martoon/#577-address-implicit into master

Description

Currently, it's hard to make the nettest interface truly typesafe (here I mean - checking that in transfers, parameter type, entrypoint name, and entrypoint argument do match) because of Address which refers to just "some address", we do not know what it refers to. This affects transfer, call, and transferMoney. E.g.

  • it is possible to transfer money to a contract that has no unit %default entrypoint;
  • in transfer/call argument type is not infered and usually has to be specified explicitly (and thus may be incorrect).

This MR modifies Address semantics to always refer to an implicit address, and for contract addresses, we now use only TAddress.

This improves the type safety of normal nettest operations at the cost of necessity to add type annotations when untyped part of the interface is used.

In theory, we can make the typecheking disable-able (e.g. if a special UncheckedAddress is used, then our new type-safety guarantees are not provided). This can be helpful in case someone is obliged to use untyped interface, or if his entrypoints cannot be expressed with our current entrypoints machinery. But I can't yet decide whether do we want to support those scenarios.

Related issue(s)

Resolves #577 (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 Konstantin Ivanov

Merge request reports