aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-09-01 19:37:40 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-16 19:31:12 +0800
commitc5063d315583270e88a01a0a82a84a68190f6ba1 (patch)
treeba738fb253932ad7cb81bae6d27352aa06de4c7f /docs
parent70d70e78160069d28a6b4931c995d0b24c2b09d5 (diff)
downloaddexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.tar
dexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.tar.gz
dexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.tar.bz2
dexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.tar.lz
dexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.tar.xz
dexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.tar.zst
dexon-solidity-c5063d315583270e88a01a0a82a84a68190f6ba1.zip
Use "tuple" for struct types in ABI JSON.
Only use tuple as a type in the ABI (and remove all "anonymous struct" references too)
Diffstat (limited to 'docs')
-rw-r--r--docs/abi-spec.rst30
1 files changed, 15 insertions, 15 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index 6df9f1d5..f4822be7 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -68,13 +68,12 @@ The following non-fixed-size types exist:
- ``<type>[]``: a variable-length array of the given fixed-length type.
-Types can be combined to anonymous structs by enclosing a finite non-negative number
+Types can be combined to a tuple by enclosing a finite non-negative number
of them inside parentheses, separated by commas:
-- ``(T1,T2,...,Tn)``: anonymous struct (ordered tuple) consisting of the types ``T1``, ..., ``Tn``, ``n >= 0``
-
-It is possible to form structs of structs, arrays of structs and so on.
+- ``(T1,T2,...,Tn)``: tuple consisting of the types ``T1``, ..., ``Tn``, ``n >= 0``
+It is possible to form tuples of tuples, arrays of tuples and so on.
Formal Specification of the Encoding
====================================
@@ -133,7 +132,7 @@ on the type of ``X`` being
``enc(X) = enc((X[0], ..., X[k-1]))``
- i.e. it is encoded as if it were an anonymous struct with ``k`` elements
+ i.e. it is encoded as if it were a tuple with ``k`` elements
of the same type.
- ``T[]`` where ``X`` has ``k`` elements (``k`` is assumed to be of type ``uint256``):
@@ -176,7 +175,7 @@ and the return values ``v_1, ..., v_k`` of ``f`` are encoded as
``enc((v_1, ..., v_k))``
-i.e. the values are combined into an anonymous struct and encoded.
+i.e. the values are combined into a tuple and encoded.
Examples
========
@@ -357,16 +356,17 @@ would result in the JSON:
"outputs": []
}]
-Use of Structs in Types
------------------------
+Handling tuple types
+--------------------
-If structs are part of the type, we still want to know the name of the components. Because of that,
+If tuples are part of the type, we still want to know the name of the components. Because of that,
the json structure gets arbitrarily nested in the following way:
An object with members ``name``, ``type`` and potentially ``components`` describes a typed variable.
-The canonical type is determined until a struct type is reached and the string description up
-to that point is stored in ``type``, i.e. it will be a sequence of ``[]`` and ``[k]`` with
-integers ``k``. The components of the struct are then stored in the member ``components``,
+The canonical type is determined until a tuple type is reached and the string description up
+to that point is stored in ``type`` prefix with the word ``tuple``, i.e. it will be ``tuple`` followed by
+a sequence of ``[]`` and ``[k]`` with
+integers ``k``. The components of the tuple are then stored in the member ``components``,
which is of array type and has the same structure as the top-level object except that
``indexed`` is not allowed there.
@@ -391,7 +391,7 @@ would result in the JSON:
"inputs": [
{
"name": "s",
- "type": "",
+ "type": "tuple",
"components": [
{
"name": "a",
@@ -403,7 +403,7 @@ would result in the JSON:
},
{
"name": "c",
- "type": "[]",
+ "type": "tuple[]",
"components": [
{
"name": "x",
@@ -419,7 +419,7 @@ would result in the JSON:
},
{
"name": "t",
- "type": "",
+ "type": "tuple",
"components": [
{
"name": "x",