separate out a new "Design Criteria" section from "Formal Specification"

This commit is contained in:
Li Xuanji 2018-09-24 16:38:16 -04:00 committed by chriseth
parent 3eb5ecdf58
commit 26d36e1faa

View File

@ -102,18 +102,19 @@ them.
|:ref:`struct<structs>` |``tuple`` | |:ref:`struct<structs>` |``tuple`` |
+-------------------------------+-----------------------------------------------------------------------------+ +-------------------------------+-----------------------------------------------------------------------------+
Formal Specification of the Encoding Design Criteria for the Encoding
==================================== ================================
We will now formally specify the encoding, such that it will have the following The encoding is designed to have the following properties, which are especially useful if some arguments are nested arrays:
properties, which are especially useful if some arguments are nested arrays:
Properties:
1. The number of reads necessary to access a value is at most the depth of the value inside the argument array structure, i.e. four reads are needed to retrieve ``a_i[k][l][r]``. In a previous version of the ABI, the number of reads scaled linearly with the total number of dynamic parameters in the worst case. 1. The number of reads necessary to access a value is at most the depth of the value inside the argument array structure, i.e. four reads are needed to retrieve ``a_i[k][l][r]``. In a previous version of the ABI, the number of reads scaled linearly with the total number of dynamic parameters in the worst case.
2. The data of a variable or array element is not interleaved with other data and it is relocatable, i.e. it only uses relative "addresses" 2. The data of a variable or array element is not interleaved with other data and it is relocatable, i.e. it only uses relative "addresses"
Formal Specification of the Encoding
====================================
We distinguish static and dynamic types. Static types are encoded in-place and dynamic types are encoded at a separately allocated location after the current block. We distinguish static and dynamic types. Static types are encoded in-place and dynamic types are encoded at a separately allocated location after the current block.
**Definition:** The following types are called "dynamic": **Definition:** The following types are called "dynamic":