From a3918c2341600997695573151f631a4d38b306b7 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 10 Dec 2018 16:26:05 +0100 Subject: ContribDoc: Link formatted instead of raw version of coding guidlines --- docs/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 43b2fd38..12dea7d1 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -61,7 +61,7 @@ New features and bugfixes should be added to the ``Changelog.md`` file: please follow the style of previous entries, when applicable. Finally, please make sure you respect the `coding style -`_ +`_ for this project. Also, even though we do CI testing, please test your code and ensure that it builds locally before submitting a pull request. -- cgit v1.2.3 From 6d82ad13386493b80f303eb7dcda07095a62e1e8 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 12 Sep 2018 14:35:41 +0200 Subject: Test updates for recent versions of aleth. --- docs/contributing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 12dea7d1..47d0d070 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -90,7 +90,7 @@ The option ``--no-smt`` disables the tests that require ``libz3`` and ``--no-ipc`` disables those that require ``aleth``. If you want to run the ipc tests (that test the semantics of the generated code), -you need to install `aleth `_ and run it in testing mode: ``aleth --test -d /tmp/testeth`` (make sure to rename it). +you need to install `aleth `_ and run it in testing mode: ``aleth --test -d /tmp/testeth`` (make sure to rename it). To run the actual tests, use: ``./scripts/soltest.sh --ipcpath /tmp/testeth/geth.ipc``. @@ -124,7 +124,7 @@ The CI runs additional tests (including ``solc-js`` and testing third party Soli You can not use some versions of ``aleth`` for testing. We suggest using the same version that the Solidity continuous integration tests use. - Currently the CI uses ``d661ac4fec0aeffbedcdc195f67f5ded0c798278`` of ``aleth``. + Currently the CI uses version ``1.5.0-alpha.7`` of ``aleth``. Writing and running syntax tests -------------------------------- -- cgit v1.2.3 From fe87cc7eb0508a7330b90c72f4dbc260948d6b43 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 11 Dec 2018 13:58:02 +0100 Subject: Improve explanation how to get abi output. --- docs/using-the-compiler.rst | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 9ba6caa5..016ea6e9 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -200,15 +200,27 @@ Input Description "MyLib": "0x123123..." } } - // The following can be used to select desired outputs. - // If this field is omitted, then the compiler loads and does type checking, but will not generate any outputs apart from errors. - // The first level key is the file name and the second is the contract name, where empty contract name refers to the file itself, - // while the star refers to all of the contracts. + // The following can be used to select desired outputs based + // on file and contract names. + // If this field is omitted, then the compiler loads and does type checking, + // but will not generate any outputs apart from errors. + // The first level key is the file name and the second level key is the contract name. + // An empty contract name is used for outputs that are not tied to a contract + // but to the whole source file like the AST. + // A star as contract name refers to all contracts in the file. + // Similarly, a star as a file name matches all files. + // To select all outputs the compiler can possibly generate, use + // "outputSelection: { "*": { "*": [ "*" ], "": [ "*" ] } }" + // but note that this might slow down the compilation process needlessly. // // The available output types are as follows: - // abi - ABI + // + // File level (needs empty string as contract name): // ast - AST of all source files // legacyAST - legacy AST of all source files + // + // Contract level (needs the contract name or "*"): + // abi - ABI // devdoc - Developer documentation (natspec) // userdoc - User documentation (natspec) // metadata - Metadata -- cgit v1.2.3 From 2f04633e272c0fb14d2fcf04270f6457f11c928b Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 11 Dec 2018 15:35:32 +0100 Subject: Explain source IDs. --- docs/miscellaneous.rst | 6 +++--- docs/using-the-compiler.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 017d5b81..5a6f3875 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -224,9 +224,9 @@ for displaying the current position in the source code inside a debugger or for breakpoint handling. Both kinds of source mappings use integer identifiers to refer to source files. -These are regular array indices into a list of source files usually called -``"sourceList"``, which is part of the combined-json and the output of -the json / npm compiler. +The identifier of a source file is stored in +``output['sources'][sourceName]['id']`` where ``output`` is the output of the +standard-json compiler interface parsed as JSON. .. note :: In the case of instructions that are not associated with any particular source file, diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 016ea6e9..4749ef1f 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -293,7 +293,7 @@ Output Description // This contains the file-level outputs. In can be limited/filtered by the outputSelection settings. sources: { "sourceFile.sol": { - // Identifier (used in source maps) + // Identifier of the source (used in source maps) id: 1, // The AST object ast: {}, -- cgit v1.2.3 From 774f7e612932d6300cf3d15d010fa312add744d8 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 12 Dec 2018 14:26:58 +0100 Subject: Remove payload FAQ item --- docs/frequently-asked-questions.rst | 6 ------ 1 file changed, 6 deletions(-) (limited to 'docs') diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index f3c5b1f7..e58db133 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -9,12 +9,6 @@ This list was originally compiled by `fivedogit `_. Basic Questions *************** -What is the transaction "payload"? -================================== - -This is just the bytecode "data" sent along with the request. - - Create a contract that can be killed and return funds ===================================================== -- cgit v1.2.3 From d03b52519adf31180261ee9edfe24a1c4fe71bb6 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 12 Dec 2018 14:57:47 +0100 Subject: Remove FAQ item that covers array literals --- docs/frequently-asked-questions.rst | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'docs') diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index f3c5b1f7..b0072348 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -45,31 +45,6 @@ Enums are not supported by the ABI, they are just supported by Solidity. You have to do the mapping yourself for now, we might provide some help later. -Can state variables be initialized in-line? -=========================================== - -Yes, this is possible for all types (even for structs). However, for arrays it -should be noted that you must declare them as static memory arrays. - -Examples:: - - pragma solidity >=0.4.0 <0.6.0; - - contract C { - struct S { - uint a; - uint b; - } - - S public x = S(1, 2); - string name = "Ada"; - string[4] adaArr = ["This", "is", "an", "array"]; - } - - contract D { - C c = new C(); - } - How do structs work? ==================== -- cgit v1.2.3 From c7e09658010b231f4743039c9f91892341a64e15 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Mon, 15 May 2017 07:45:26 -0300 Subject: Add NatSpec to Style-Guide related to #2270 --- docs/layout-of-source-files.rst | 2 +- docs/style-guide.rst | 61 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index ad84b200..fa36fc6a 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -267,7 +267,7 @@ Single-line comments (``//``) and multi-line comments (``/*...*/``) are possible (these are NEL, LS and PS), it will lead to a parser error. Additionally, there is another type of comment called a natspec comment, -for which the documentation is not yet written. They are written with a +which is detailed in the :ref:`style guide`. They are written with a triple slash (``///``) or a double asterisk block(``/** ... */``) and they should be used directly above function declarations or statements. You can use `Doxygen `_-style tags inside these comments to document diff --git a/docs/style-guide.rst b/docs/style-guide.rst index 68fee871..bf1be93e 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -1093,3 +1093,64 @@ General Recommendations ======================= TODO + +.. _natspec: + +******* +NatSpec +******* + +Solidity contracts can have a form of comments that are the basis of the +Ethereum Natural Language Specification Format. + +Add comments above functions or contracts following `doxygen `_ notation +of one or multiple lines starting with `///` or a +multiline comment starting with `/**` and ending with `*/`. + +For example, the contract from `a simple smart contract `_ with the comments +added looks like the one below:: + + pragma solidity >=0.4.0 <0.6.0; + + /// @author The Solidity Team + /// @title A simple storage example + contract SimpleStorage { + uint storedData; + + /// Store `x`. + /// @param x the new value to store + /// @dev stores the number in the state variable `storedData` + function set(uint x) public { + storedData = x; + } + + /// Return the stored value. + /// @dev retrieves the value of the state variable `storedData` + /// @return the stored value + function get() public view returns (uint) { + return storedData; + } + } + +Natspec uses doxygen style tags with some special meaning. +If no tag is used, then the comment applies to ``@notice``. +The ``@notice`` tag is the main NatSpec tag and its audience is +users of the contract who have never seen the source code, so it should make +as little assumptions about the inner details as possible. +All tags are optional. + ++-------------+-------------------------------------------+-------------------------------+ +| Tag | Description | Context | ++=============+===========================================+===============================+ +| ``@title`` | A title that describes the contract | contract, interface | ++-------------+-------------------------------------------+-------------------------------+ +| ``@author`` | The name of the author | contract, interface, function | ++-------------+-------------------------------------------+-------------------------------+ +| ``@notice`` | Explanation of functionality | contract, interface, function | ++-------------+-------------------------------------------+-------------------------------+ +| ``@dev`` | Any extra details | contract, interface, function | ++-------------+-------------------------------------------+-------------------------------+ +| ``@param`` | Parameter type followed by parameter name | function | ++-------------+-------------------------------------------+-------------------------------+ +| ``@return`` | The return value of a contract's function | function | ++-------------+-------------------------------------------+-------------------------------+ -- cgit v1.2.3 From a4da8c1ad83eddbf957d02ef44e6a5d4aad65904 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 12 Dec 2018 14:42:49 +0100 Subject: Remove FAQ item on killing contracts --- docs/frequently-asked-questions.rst | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'docs') diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index e58db133..a4ef3684 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -9,29 +9,6 @@ This list was originally compiled by `fivedogit `_. Basic Questions *************** -Create a contract that can be killed and return funds -===================================================== - -First, a word of warning: Killing contracts sounds like a good idea, because "cleaning up" -is always good, but as seen above, it does not really clean up. Furthermore, -if Ether is sent to removed contracts, the Ether will be forever lost. - -If you want to deactivate your contracts, it is preferable to **disable** them by changing some -internal state which causes all functions to throw. This will make it impossible -to use the contract and ether sent to the contract will be returned automatically. - -Now to answering the question: Inside a constructor, ``msg.sender`` is the -creator. Save it. Then ``selfdestruct(creator);`` to kill and return funds. - -`example `_ - -Note that if you ``import "mortal"`` at the top of your contracts and declare -``contract SomeContract is mortal { ...`` and compile with a compiler that already -has it (which includes `Remix `_), then -``kill()`` is taken care of for you. Once a contract is "mortal", then you can -``contractname.kill.sendTransaction({from:eth.coinbase})``, just the same as my -examples. - If I return an ``enum``, I only get integer values in web3.js. How to get the named values? =========================================================================================== -- cgit v1.2.3 From 02a8e5d4e999f0e3610e124c74b7b1492852fbe0 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 13 Dec 2018 12:07:32 +0100 Subject: Update to use memorydb for aleth. --- docs/contributing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 47d0d070..41573ea1 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -90,7 +90,7 @@ The option ``--no-smt`` disables the tests that require ``libz3`` and ``--no-ipc`` disables those that require ``aleth``. If you want to run the ipc tests (that test the semantics of the generated code), -you need to install `aleth `_ and run it in testing mode: ``aleth --test -d /tmp/testeth`` (make sure to rename it). +you need to install `aleth `_ and run it in testing mode: ``aleth --db memorydb --test -d /tmp/testeth``. To run the actual tests, use: ``./scripts/soltest.sh --ipcpath /tmp/testeth/geth.ipc``. @@ -122,7 +122,7 @@ The CI runs additional tests (including ``solc-js`` and testing third party Soli .. note :: - You can not use some versions of ``aleth`` for testing. We suggest using + Some versions of ``aleth`` can not be used for testing. We suggest using the same version that the Solidity continuous integration tests use. Currently the CI uses version ``1.5.0-alpha.7`` of ``aleth``. -- cgit v1.2.3 From 2e8114f3125b3d29cbeb03203fceebc77bc899cc Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 17 Dec 2018 13:30:06 +0100 Subject: Fix italics formatting issue --- docs/introduction-to-smart-contracts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 34ef012e..7daae06a 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -41,7 +41,7 @@ source code (e.g. `pragma once `_). A contract in the sense of Solidity is a collection of code (its *functions*) and data (its *state*) that resides at a specific address on the Ethereum blockchain. The line ``uint storedData;`` declares a state variable called ``storedData`` of -type ``uint`` (*u*nsigned *int*eger of *256* bits). You can think of it as a single slot +type ``uint`` (*u*\nsigned *int*\eger of *256* bits). You can think of it as a single slot in a database that can be queried and altered by calling functions of the code that manages the database. In the case of Ethereum, this is always the owning contract. And in this case, the functions ``set`` and ``get`` can be used to modify -- cgit v1.2.3 From 7b9fd4676db613a169f5e2ea105b8e02eaef9da6 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 12 Dec 2018 17:10:45 +0100 Subject: Add array item deletion idiosyncracy --- docs/types.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/types.rst b/docs/types.rst index f67a6d1a..b6003fd5 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -1189,7 +1189,14 @@ If ``a`` is an LValue (i.e. a variable or something that can be assigned to), th delete ------ -``delete a`` assigns the initial value for the type to ``a``. I.e. for integers it is equivalent to ``a = 0``, but it can also be used on arrays, where it assigns a dynamic array of length zero or a static array of the same length with all elements reset. For structs, it assigns a struct with all members reset. In other words, the value of ``a`` after ``delete a`` is the same as if ``a`` would be declared without assignment, with the following caveat: +``delete a`` assigns the initial value for the type to ``a``. I.e. for integers it is +equivalent to ``a = 0``, but it can also be used on arrays, where it assigns a dynamic +array of length zero or a static array of the same length with all elements set to their +initial value. ``delete a[x]`` deletes the item at index ``x`` of the array and leaves +all other elements and the length of the array untouched. This especially means that it leaves +a gap in the array. If you plan to remove items, a mapping is probably a better choice. + +For structs, it assigns a struct with all members reset. In other words, the value of ``a`` after ``delete a`` is the same as if ``a`` would be declared without assignment, with the following caveat: ``delete`` has no effect on mappings (as the keys of mappings may be arbitrary and are generally unknown). So if you delete a struct, it will reset all members that are not mappings and also recurse into the members unless they are mappings. However, individual keys and what they map to can be deleted: If ``a`` is a mapping, then ``delete a[x]`` will delete the value stored at ``x``. -- cgit v1.2.3 From 72c977608fea158adb0f1ff9f2354e78474d22e6 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Fri, 24 Aug 2018 14:25:50 +0200 Subject: Clean input and output function types Updates from review --- docs/types.rst | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/types.rst b/docs/types.rst index b6003fd5..dcd5f644 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -19,6 +19,7 @@ on its type. To handle any unexpected values, you should use the :ref:`revert fu tuple with a second `bool` value denoting success. .. index:: ! value type, ! type;value +.. _value-types: Value Types =========== @@ -728,6 +729,8 @@ Another example that uses external function types:: .. index:: ! type;reference, ! reference type, storage, memory, location, array, struct +.. _reference-types: + Reference Types =============== @@ -761,14 +764,17 @@ non-persistent area where function arguments are stored, and behaves mostly like depending on the kind of variable, function type, etc., but all complex types must now give an explicit data location. +.. _data-location-assignment: + +Data location and assignment behaviour +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Data locations are not only relevant for persistency of data, but also for the semantics of assignments: -assignments between storage and memory (or from calldata) always create an independent copy. -Assignments from memory to memory only create references. This means that changes to one memory variable -are also visible in all other memory variables that refer to the same data. -Assignments from storage to a local storage variables also only assign a reference. -In contrast, all other assignments to storage always copy. Examples for this case -are assignments to state variables or to members of local variables of storage struct type, even -if the local variable itself is just a reference. + +* Assignments between ``storage`` and ``memory`` (or from ``calldata``) always create an independent copy. +* Assignments from ``memory`` to ``memory`` only create references. This means that changes to one memory variable are also visible in all other memory variables that refer to the same data. +* Assignments from ``storage`` to a local storage variable also only assign a reference. +* All other assignments to ``storage`` always copy. Examples for this case are assignments to state variables or to members of local variables of storage struct type, even if the local variable itself is just a reference. :: @@ -1120,9 +1126,10 @@ assigning it to a local variable, as in ``campaigns[campaignID].amount = 0``. .. index:: !mapping +.. _mapping-types: -Mappings --------- +Mapping Types +============= You declare mapping types with the syntax ``mapping(_KeyType => _ValueType)``. The ``_KeyType`` can be any elementary type. This means it can be any of -- cgit v1.2.3 From 995840bfe08f307ec51174f294bef27abda7bfc6 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 17 Oct 2018 12:49:52 +0200 Subject: Updates arrays section to improve order and clarify concepts --- docs/types.rst | 62 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 25 deletions(-) (limited to 'docs') diff --git a/docs/types.rst b/docs/types.rst index dcd5f644..08fbd7b3 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -811,40 +811,50 @@ Data locations are not only relevant for persistency of data, but also for the s Arrays ------ -Arrays can have a compile-time fixed size or they can be dynamic. -The are few restrictions for the element, it can also be -another array, a mapping or a struct. The general restrictions for -types apply, though, in that mappings can only be used in storage -and publicly-visible functions need parameters that are :ref:`ABI types `. - -An array of fixed size ``k`` and element type ``T`` is written as ``T[k]``, -an array of dynamic size as ``T[]``. As an example, an array of 5 dynamic -arrays of ``uint`` is ``uint[][5]`` (note that the notation is reversed when -compared to some other languages). To access the second uint in the -third dynamic array, you use ``x[2][1]`` (indices are zero-based and -access works in the opposite way of the declaration, i.e. ``x[2]`` -shaves off one level in the type from the right). - -Accessing an array past its end causes a revert. If you want to add -new elements, you have to use ``.push()`` or increase the ``.length`` -member (see below). +Arrays can have a compile-time fixed size, or they can have a dynamic size. + +The type of an array of fixed size ``k`` and element type ``T`` is written as ``T[k]``, +and an array of dynamic size as ``T[]``. + +For example, an array of 5 dynamic arrays of ``uint`` is written as +``uint[][5]``. The notation is reversed compared to some other languages. In +Solidity, ``X[3]`` is always an array containing three elements of type ``X``, +even if ``X`` is itself an array. This is not the case in other languages such +as C. + +Indices are zero-based, and access is in the opposite direction of the +declaration. + +For example, if you have a variable ``uint[][5] x memory``, you access the +second ``uint`` in the third dynamic array using ``x[2][1]``, and to access the +third dynamic array, use ``x[2]``. Again, +if you have an array ``T[5] a`` for a type ``T`` that can also be an array, +then ``a[2]`` always has type ``T``. + +Array elements can be of any type, including mapping or struct. The general +restrictions for types apply, in that mappings can only be stored in the +``storage`` data location and publicly-visible functions need parameters that are :ref:`ABI types `. + +Accessing an array past its end causes a failing assertion. You can use the ``.push()`` method to append a new element at the end or assign to the ``.length`` :ref:`member ` to change the size (see below for caveats). +method or increase the ``.length`` :ref:`member ` to add elements. Variables of type ``bytes`` and ``string`` are special arrays. A ``bytes`` is similar to ``byte[]``, but it is packed tightly in calldata and memory. ``string`` is equal to ``bytes`` but does not allow length or index access. -So ``bytes`` should always be preferred over ``byte[]`` because it is cheaper. -As a rule of thumb, use ``bytes`` for arbitrary-length raw byte data and ``string`` -for arbitrary-length string (UTF-8) data. If you can limit the length to a certain -number of bytes, always use one of ``bytes1`` to ``bytes32`` because they are much cheaper. + +You should use ``bytes`` over ``byte[]`` because it is cheaper, since ``byte[]`` adds 31 padding bytes between the elements. As a general rule, +use ``bytes`` for arbitrary-length raw byte data and ``string`` for arbitrary-length +string (UTF-8) data. If you can limit the length to a certain number of bytes, +always use one of the value types ``bytes1`` to ``bytes32`` because they are much cheaper. .. note:: If you want to access the byte-representation of a string ``s``, use ``bytes(s).length`` / ``bytes(s)[7] = 'x';``. Keep in mind that you are accessing the low-level bytes of the UTF-8 representation, - and not the individual characters! + and not the individual characters. It is possible to mark arrays ``public`` and have Solidity create a :ref:`getter `. -The numeric index will become a required parameter for the getter. +The numeric index becomes a required parameter for the getter. .. index:: ! array;allocating, new @@ -918,8 +928,10 @@ complications because of how arrays are passed in the ABI. .. index:: ! array;length, length, push, pop, !array;push, !array;pop -Members -^^^^^^^ +.. _array-members: + +Array Members +^^^^^^^^^^^^^ **length**: Arrays have a ``length`` member that contains their number of elements. -- cgit v1.2.3 From 506642475892bd5b598c1c9c6498ff3efa1fa6cc Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 18 Dec 2018 16:19:50 +0100 Subject: Build in release mode. --- docs/contributing.rst | 4 ++-- docs/installing-solidity.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 41573ea1..85816766 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -83,8 +83,8 @@ internally. .. note :: - Those working in a Windows environment wanting to run the above basic sets without aleth or libz3 in Git Bash, you would have to do: ``./build/test/RelWithDebInfo/soltest.exe -- --no-ipc --no-smt``. - If you're running this in plain Command Prompt, use ``.\build\test\RelWithDebInfo\soltest.exe -- --no-ipc --no-smt``. + Those working in a Windows environment wanting to run the above basic sets without aleth or libz3 in Git Bash, you would have to do: ``./build/test/Release/soltest.exe -- --no-ipc --no-smt``. + If you're running this in plain Command Prompt, use ``.\build\test\Release\soltest.exe -- --no-ipc --no-smt``. The option ``--no-smt`` disables the tests that require ``libz3`` and ``--no-ipc`` disables those that require ``aleth``. diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index 2797d8b0..c475d427 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -296,13 +296,13 @@ And for Windows: This latter set of instructions should result in the creation of **solidity.sln** in that build directory. Double-clicking on that file should result in Visual Studio firing up. We suggest building -**RelWithDebugInfo** configuration, but all others work. +**Release** configuration, but all others work. Alternatively, you can build for Windows on the command-line, like so: .. code-block:: bash - cmake --build . --config RelWithDebInfo + cmake --build . --config Release CMake options ============= -- cgit v1.2.3 From 50101570ef1372394b60d0ce88f2d682eda53843 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 18 Dec 2018 17:53:58 +0100 Subject: Format "and" as instruction op code --- docs/assembly.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/assembly.rst b/docs/assembly.rst index 5bb9825a..b5206815 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -346,7 +346,7 @@ Literals You can use integer constants by typing them in decimal or hexadecimal notation and an appropriate ``PUSHi`` instruction will automatically be generated. The following creates code -to add 2 and 3 resulting in 5 and then computes the bitwise and with the string "abc". +to add 2 and 3 resulting in 5 and then computes the bitwise ``AND`` with the string "abc". The final value is assigned to a local variable called ``x``. Strings are stored left-aligned and cannot be longer than 32 bytes. -- cgit v1.2.3 From e9944206a5ee1b7d4f4230c3618df539dbc69438 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 18 Dec 2018 18:05:14 +0100 Subject: Rephrase opcode result returning description It was a bit between the lines that "pushing on the stack" is their means of returning a result. --- docs/assembly.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/assembly.rst b/docs/assembly.rst index b5206815..b2f150ca 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -159,8 +159,8 @@ following list can be used as a reference of its opcodes. If an opcode takes arguments (always from the top of the stack), they are given in parentheses. Note that the order of arguments can be seen to be reversed in non-functional style (explained below). -Opcodes marked with ``-`` do not push an item onto the stack, those marked with ``*`` are -special and all others push exactly one item onto the stack. +Opcodes marked with ``-`` do not push an item onto the stack (do not return a result), +those marked with ``*`` are special and all others push exactly one item onto the stack (their "return value"). Opcodes marked with ``F``, ``H``, ``B`` or ``C`` are present since Frontier, Homestead, Byzantium or Constantinople, respectively. Constantinople is still in planning and all instructions marked as such will result in an invalid instruction exception. -- cgit v1.2.3 From 36dc56fa7727d83e97ba09e512e749d227480367 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Tue, 18 Dec 2018 20:17:44 +0100 Subject: Doc: Fix typo "a messy" -> "a mess" --- docs/solidity-by-example.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst index d07452c5..0041e80c 100644 --- a/docs/solidity-by-example.rst +++ b/docs/solidity-by-example.rst @@ -743,7 +743,7 @@ In general, ECDSA signatures consist of two parameters, ``r`` and ``s``. Signatu Extracting the Signature Parameters ----------------------------------- -Signatures produced by web3.js are the concatenation of ``r``, ``s`` and ``v``, so the first step is to split these parameters apart. You can do this on the client-side, but doing it inside the smart contract means you only need to send one signature parameter rather than three. Splitting apart a byte array into component parts is a messy, so we use `inline assembly `_ to do the job in the ``splitSignature`` function (the third function in the full contract at the end of this section). +Signatures produced by web3.js are the concatenation of ``r``, ``s`` and ``v``, so the first step is to split these parameters apart. You can do this on the client-side, but doing it inside the smart contract means you only need to send one signature parameter rather than three. Splitting apart a byte array into component parts is a mess, so we use `inline assembly `_ to do the job in the ``splitSignature`` function (the third function in the full contract at the end of this section). Computing the Message Hash -------------------------- -- cgit v1.2.3 From af3e6db038c0ef2ce847537129e19deaec3c906a Mon Sep 17 00:00:00 2001 From: Zacharius Date: Tue, 18 Dec 2018 12:08:55 -0600 Subject: changed interface code example to illustrate working solidity version --- docs/contracts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/contracts.rst b/docs/contracts.rst index 98419430..682cb378 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -1408,7 +1408,7 @@ Interfaces are denoted by their own keyword: :: - pragma solidity >=0.4.11 <0.6.0; + pragma solidity >=0.5.0 <0.6.0; interface Token { enum TokenType { Fungible, NonFungible } -- cgit v1.2.3 From 8ce95312b6baee23f62824acbe66db628c4fd5a5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 19 Dec 2018 17:07:28 +0100 Subject: Update buglist. --- docs/bugs_by_version.json | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs') diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 658aab9c..438abbdd 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -616,5 +616,9 @@ "0.5.1": { "bugs": [], "released": "2018-12-03" + }, + "0.5.2": { + "bugs": [], + "released": "2018-12-19" } } \ No newline at end of file -- cgit v1.2.3