Zilliqa / scilla-compiler

Compile Scilla to LLVM-IR
GNU General Public License v3.0
7 stars 4 forks source link

Add support for remote state reads #61

Closed vaivaswatha closed 3 years ago

vaivaswatha commented 3 years ago

https://github.com/Zilliqa/scilla/pull/967

vaivaswatha commented 3 years ago

See commit message: https://github.com/Zilliqa/scilla-compiler/commit/b8b97d32a05b78676a4962a0f5b02b9c92041785.

In addition to explicit remote state load and map get, code must be generated for dynamic type checking. This involves:

  1. During deployment, any Address typed fields in contract parameters must be scanned and ensured that each field specified exists.
  2. During transition execution, any Address typed transition parameter must be first scanned and each field specified must exist.
vaivaswatha commented 3 years ago

See commit message: b8b97d3.

In addition to explicit remote state load and map get, code must be generated for dynamic type checking. This involves:

  1. During deployment, any Address typed fields in contract parameters must be scanned and ensured that each field specified exists.
  2. During transition execution, any Address typed transition parameter must be first scanned and each field specified must exist.

Quoting @jjcnn 's response to this on slack:

Not quite: It's any address in a contract/transition parameter, even if it's buried in a map or an ADT value. In the interpreter the work is done by assert_literal_type: >https://github.com/Zilliqa/scilla/blob/994b231fd1a4be37639a9ac86194296e6022946f/src/base/TypeUtil.ml#L672 It's called from init_contract (for deployment) and check_message_entries (for transition invocation) in Eval.ml.

vaivaswatha commented 3 years ago

After a discussion with Jacob:

vaivaswatha commented 3 years ago

Implemented with #64, #65, #66. Closing.