aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/abi-spec.rst8
-rw-r--r--docs/assembly.rst5
-rw-r--r--docs/bugs_by_version.json4
-rw-r--r--docs/common-patterns.rst1
-rw-r--r--docs/contracts.rst61
-rw-r--r--docs/contributing.rst94
-rw-r--r--docs/grammar.txt2
-rw-r--r--docs/index.rst5
-rw-r--r--docs/installing-solidity.rst1
-rw-r--r--docs/introduction-to-smart-contracts.rst10
-rw-r--r--docs/miscellaneous.rst38
-rw-r--r--docs/solidity-by-example.rst6
-rw-r--r--docs/structure-of-a-contract.rst2
-rw-r--r--docs/style-guide.rst2
-rw-r--r--docs/types.rst4
-rw-r--r--docs/units-and-global-variables.rst6
16 files changed, 210 insertions, 39 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index 4a61d91f..98301fdc 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -54,11 +54,11 @@ The following elementary types exist:
- ``ufixed<M>x<N>``: unsigned variant of ``fixed<M>x<N>``.
-- ``fixed``, ``ufixed``: synonyms for ``fixed128x19``, ``ufixed128x19`` respectively. For computing the function selector, ``fixed128x19`` and ``ufixed128x19`` have to be used.
+- ``fixed``, ``ufixed``: synonyms for ``fixed128x18``, ``ufixed128x18`` respectively. For computing the function selector, ``fixed128x18`` and ``ufixed128x18`` have to be used.
- ``bytes<M>``: binary type of ``M`` bytes, ``0 < M <= 32``.
-- ``function``: an address (20 bytes) folled by a function selector (4 bytes). Encoded identical to ``bytes24``.
+- ``function``: an address (20 bytes) followed by a function selector (4 bytes). Encoded identical to ``bytes24``.
The following (fixed-size) array type exists:
@@ -164,9 +164,9 @@ on the type of ``X`` being
- ``int<M>``: ``enc(X)`` is the big-endian two's complement encoding of ``X``, padded on the higher-order (left) side with ``0xff`` for negative ``X`` and with zero bytes for positive ``X`` such that the length is 32 bytes.
- ``bool``: as in the ``uint8`` case, where ``1`` is used for ``true`` and ``0`` for ``false``
- ``fixed<M>x<N>``: ``enc(X)`` is ``enc(X * 10**N)`` where ``X * 10**N`` is interpreted as a ``int256``.
-- ``fixed``: as in the ``fixed128x19`` case
+- ``fixed``: as in the ``fixed128x18`` case
- ``ufixed<M>x<N>``: ``enc(X)`` is ``enc(X * 10**N)`` where ``X * 10**N`` is interpreted as a ``uint256``.
-- ``ufixed``: as in the ``ufixed128x19`` case
+- ``ufixed``: as in the ``ufixed128x18`` case
- ``bytes<M>``: ``enc(X)`` is the sequence of bytes in ``X`` padded with trailing zero-bytes to a length of 32 bytes.
Note that for any ``X``, ``len(enc(X))`` is a multiple of 32.
diff --git a/docs/assembly.rst b/docs/assembly.rst
index cf9bf840..705cd1b8 100644
--- a/docs/assembly.rst
+++ b/docs/assembly.rst
@@ -647,6 +647,11 @@ Solidity manages memory in a very simple way: There is a "free memory pointer"
at position ``0x40`` in memory. If you want to allocate memory, just use the memory
from that point on and update the pointer accordingly.
+The first 64 bytes of memory can be used as "scratch space" for short-term
+allocation. The 32 bytes after the free memory pointer (i.e. starting at ``0x60``)
+is meant to be zero permanently and is used as the initial value for
+empty dynamic memory arrays.
+
Elements in memory arrays in Solidity always occupy multiples of 32 bytes (yes, this is
even true for ``byte[]``, but not for ``bytes`` and ``string``). Multi-dimensional memory
arrays are pointers to memory arrays. The length of a dynamic array is stored at the
diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json
index 5a4c9e29..4c976a32 100644
--- a/docs/bugs_by_version.json
+++ b/docs/bugs_by_version.json
@@ -418,6 +418,10 @@
"bugs": [],
"released": "2018-02-14"
},
+ "0.4.21": {
+ "bugs": [],
+ "released": "2018-03-07"
+ },
"0.4.3": {
"bugs": [
"ZeroFunctionSelector",
diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst
index 7e09f534..c62b5aca 100644
--- a/docs/common-patterns.rst
+++ b/docs/common-patterns.rst
@@ -194,6 +194,7 @@ restrictions highly readable.
function forceOwnerChange(address _newOwner)
public
+ payable
costs(200 ether)
{
owner = _newOwner;
diff --git a/docs/contracts.rst b/docs/contracts.rst
index e61667dd..f8a44fb3 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -40,7 +40,7 @@ This means that cyclic creation dependencies are impossible.
::
- pragma solidity ^0.4.16;
+ pragma solidity >0.4.21;
contract OwnedToken {
// TokenCreator is a contract type that is defined below.
@@ -52,7 +52,7 @@ This means that cyclic creation dependencies are impossible.
// This is the constructor which registers the
// creator and the assigned name.
- function OwnedToken(bytes32 _name) public {
+ constructor(bytes32 _name) public {
// State variables are accessed via their name
// and not via e.g. this.owner. This also applies
// to functions and especially in the constructors,
@@ -472,8 +472,15 @@ The following statements are considered modifying the state:
.. note::
Getter methods are marked ``view``.
+.. note::
+ If invalid explicit type conversions are used, state modifications are possible
+ even though a ``view`` function was called.
+ You can switch the compiler to use ``STATICCALL`` when calling such functions and thus
+ prevent modifications to the state on the level of the EVM by adding
+ ``pragma experimental "v0.5.0";``
+
.. warning::
- Before version 0.4.17 the compiler didn't enforce that ``view`` is not modifying the state.
+ The compiler does not enforce yet that a ``view`` method is not modifying state. It raises a warning though.
.. index:: ! pure function, function;pure
@@ -502,6 +509,18 @@ In addition to the list of state modifying statements explained above, the follo
}
}
+.. note::
+ If invalid explicit type conversions are used, state modifications are possible
+ even though a ``pure`` function was called.
+ You can switch the compiler to use ``STATICCALL`` when calling such functions and thus
+ prevent modifications to the state on the level of the EVM by adding
+ ``pragma experimental "v0.5.0";``
+
+.. warning::
+ It is not possible to prevent functions from reading the state at the level
+ of the EVM, it is only possible to prevent them from writing to the state
+ (i.e. only ``view`` can be enforced at the EVM level, ``pure`` can not).
+
.. warning::
Before version 0.4.17 the compiler didn't enforce that ``pure`` is not reading the state.
@@ -660,7 +679,7 @@ candidate, resolution fails.
}
}
-Calling ``f(50)`` would create a type error since ``250`` can be implicitly converted both to ``uint8``
+Calling ``f(50)`` would create a type error since ``50`` can be implicitly converted both to ``uint8``
and ``uint256`` types. On another hand ``f(256)`` would resolve to ``f(uint256)`` overload as ``256`` cannot be implicitly
converted to ``uint8``.
@@ -784,7 +803,7 @@ as topics. The event call above can be performed in the same way as
}
where the long hexadecimal number is equal to
-``keccak256("Deposit(address,hash256,uint256)")``, the signature of the event.
+``keccak256("Deposit(address,bytes32,uint256)")``, the signature of the event.
Additional Resources for Understanding Events
==============================================
@@ -957,8 +976,31 @@ virtual method lookup.
Constructors
============
-A constructor is an optional function with the same name as the contract which is executed upon contract creation.
-Constructor functions can be either ``public`` or ``internal``.
+A constructor is an optional function declared with the ``constructor`` keyword which is executed upon contract creation.
+Constructor functions can be either ``public`` or ``internal``. If there is no constructor, the contract will assume the
+default constructor: ``contructor() public {}``.
+
+
+::
+
+ pragma solidity >0.4.21;
+
+ contract A {
+ uint public a;
+
+ constructor(uint _a) internal {
+ a = _a;
+ }
+ }
+
+ contract B is A(1) {
+ constructor() public {}
+ }
+
+A constructor set as ``internal`` causes the contract to be marked as :ref:`abstract <abstract-contract>`.
+
+.. note ::
+ Prior to version 0.4.22, constructors were defined as functions with the same name as the contract. This syntax is now deprecated.
::
@@ -976,7 +1018,6 @@ Constructor functions can be either ``public`` or ``internal``.
function B() public {}
}
-A constructor set as ``internal`` causes the contract to be marked as :ref:`abstract <abstract-contract>`.
.. index:: ! base;constructor
@@ -990,11 +1031,11 @@ the base constructors. This can be done in two ways::
contract Base {
uint x;
- function Base(uint _x) public { x = _x; }
+ constructor(uint _x) public { x = _x; }
}
contract Derived is Base(7) {
- function Derived(uint _y) Base(_y * _y) public {
+ constructor(uint _y) Base(_y * _y) public {
}
}
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 8c190a26..7c199d53 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -69,21 +69,107 @@ Solidity includes different types of tests. They are included in the application
called ``soltest``. Some of them require the ``cpp-ethereum`` client in testing mode,
some others require ``libz3`` to be installed.
-To disable the z3 tests, use ``./build/test/soltest -- --no-smt`` and
-to run a subset of the tests that do not require ``cpp-ethereum``, use ``./build/test/soltest -- --no-ipc``.
+``soltest`` reads test contracts that are annotated with expected results
+stored in ``./test/libsolidity/syntaxTests``. In order for soltest to find these
+tests the root test directory has to be specified using the ``--testpath`` command
+line option, e.g. ``./build/test/soltest -- --testpath ./test``.
+
+To disable the z3 tests, use ``./build/test/soltest -- --no-smt --testpath ./test`` and
+to run a subset of the tests that do not require ``cpp-ethereum``, use
+``./build/test/soltest -- --no-ipc --testpath ./test``.
For all other tests, you need to install `cpp-ethereum <https://github.com/ethereum/cpp-ethereum/releases/download/solidityTester/eth>`_ and run it in testing mode: ``eth --test -d /tmp/testeth``.
-Then you run the actual tests: ``./build/test/soltest -- --ipcpath /tmp/testeth/geth.ipc``.
+Then you run the actual tests: ``./build/test/soltest -- --ipcpath /tmp/testeth/geth.ipc --testpath ./test``.
To run a subset of tests, filters can be used:
-``soltest -t TestSuite/TestName -- --ipcpath /tmp/testeth/geth.ipc``, where ``TestName`` can be a wildcard ``*``.
+``soltest -t TestSuite/TestName -- --ipcpath /tmp/testeth/geth.ipc --testpath ./test``,
+where ``TestName`` can be a wildcard ``*``.
Alternatively, there is a testing script at ``scripts/test.sh`` which executes all tests and runs
``cpp-ethereum`` automatically if it is in the path (but does not download it).
Travis CI even runs some additional tests (including ``solc-js`` and testing third party Solidity frameworks) that require compiling the Emscripten target.
+Writing and running syntax tests
+--------------------------------
+
+As mentioned above, syntax tests are stored in individual contracts. These files must contain annotations, stating the expected result(s) of the respective test.
+The test suite will compile and check them against the given expectations.
+
+Example: ``./test/libsolidity/syntaxTests/double_stateVariable_declaration.sol``
+
+::
+
+ contract test {
+ uint256 variable;
+ uint128 variable;
+ }
+ // ----
+ // DeclarationError: Identifier already declared.
+
+A syntax test must contain at least the contract under test itself, followed by the seperator ``----``. The additional comments above are used to describe the
+expected compiler errors or warnings. This section can be empty in case that the contract should compile without any errors or warnings.
+
+In the above example, the state variable ``variable`` was declared twice, which is not allowed. This will result in a ``DeclarationError`` stating that the identifer was already declared.
+
+The tool that is being used for those tests is called ``isoltest`` and can be found under ``./test/tools/``. It is an interactive tool which allows
+editing of failing contracts using your prefered text editor. Let's try to break this test by removing the second declaration of ``variable``:
+
+::
+
+ contract test {
+ uint256 variable;
+ }
+ // ----
+ // DeclarationError: Identifier already declared.
+
+Running ``./test/isoltest`` again will result in a test failure:
+
+::
+
+ syntaxTests/double_stateVariable_declaration.sol: FAIL
+ Contract:
+ contract test {
+ uint256 variable;
+ }
+
+ Expected result:
+ DeclarationError: Identifier already declared.
+ Obtained result:
+ Success
+
+
+which prints the expected result next to the obtained result, but also provides a way to change edit / update / skip the current contract or to even quit.
+``isoltest`` offers several options for failing tests:
+
+- edit: ``isoltest`` will try to open the editor that was specified before using ``isoltest --editor /path/to/editor``. If no path was set, this will result in a runtime error. In case an editor was specified, this will open it such that the contract can be adjusted.
+- update: Updates the contract under test. This will either remove the annotation which contains the exception not met or will add missing expectations. The test will then be run again.
+- skip: Skips the execution of this particular test.
+- quit: Quits ``isoltest``.
+
+Automatically updating the test above will change it to
+
+::
+
+ contract test {
+ uint256 variable;
+ }
+ // ----
+
+and re-run the test. It will now pass again:
+
+::
+
+ Re-running test case...
+ syntaxTests/double_stateVariable_declaration.sol: OK
+
+
+.. note::
+
+ Please choose a name for the contract file, that is self-explainatory in the sense of what is been tested, e.g. ``double_variable_declaration.sol``.
+ Do not put more than one contract into a single file. ``isoltest`` is currently not able to recognize them individually.
+
Whiskers
========
diff --git a/docs/grammar.txt b/docs/grammar.txt
index a5c2acf3..b4ca5ca9 100644
--- a/docs/grammar.txt
+++ b/docs/grammar.txt
@@ -19,7 +19,7 @@ InheritanceSpecifier = UserDefinedTypeName ( '(' Expression ( ',' Expression )*
StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' | 'constant' )? Identifier ('=' Expression)? ';'
UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';'
StructDefinition = 'struct' Identifier '{'
- ( VariableDeclaration ';' (VariableDeclaration ';')* )? '}'
+ ( VariableDeclaration ';' (VariableDeclaration ';')* ) '}'
ModifierDefinition = 'modifier' Identifier ParameterList? Block
ModifierInvocation = Identifier ( '(' ExpressionList? ')' )?
diff --git a/docs/index.rst b/docs/index.rst
index 184d0e69..80b0d6e7 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -19,7 +19,9 @@ crowdfunding, blind auctions, multi-signature wallets and more.
.. note::
The best way to try out Solidity right now is using
`Remix <https://remix.ethereum.org/>`_
- (it can take a while to load, please be patient).
+ (it can take a while to load, please be patient). Remix is a web browser
+ based IDE that allows you to write Solidity smart contracts, then deploy
+ and run the smart contracts.
.. warning::
Since software is written by humans, it can have bugs. Thus, also
@@ -37,6 +39,7 @@ This documentation is translated into several languages by community volunteers,
* `Simplified Chinese <http://solidity-cn.readthedocs.io>`_ (in progress)
* `Spanish <https://solidity-es.readthedocs.io>`_
* `Russian <https://github.com/ethereum/wiki/wiki/%5BRussian%5D-%D0%A0%D1%83%D0%BA%D0%BE%D0%B2%D0%BE%D0%B4%D1%81%D1%82%D0%B2%D0%BE-%D0%BF%D0%BE-Solidity>`_ (rather outdated)
+* `Korean <http://solidity-kr.readthedocs.io>`_ (in progress)
Useful links
diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst
index e26870f0..6726ded9 100644
--- a/docs/installing-solidity.rst
+++ b/docs/installing-solidity.rst
@@ -122,7 +122,6 @@ We will re-add the pre-built bottles soon.
brew upgrade
brew tap ethereum/ethereum
brew install solidity
- brew linkapps solidity
If you need a specific version of Solidity you can install a
Homebrew formula directly from Github.
diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst
index 11e07292..84b1fff8 100644
--- a/docs/introduction-to-smart-contracts.rst
+++ b/docs/introduction-to-smart-contracts.rst
@@ -80,7 +80,7 @@ registering with username and password - all you need is an Ethereum keypair.
::
- pragma solidity ^0.4.20; // should actually be 0.4.21
+ pragma solidity ^0.4.21;
contract Coin {
// The keyword "public" makes those variables
@@ -326,7 +326,13 @@ EVM bytecode and executed. The output of this execution is
permanently stored as the code of the contract.
This means that in order to create a contract, you do not
send the actual code of the contract, but in fact code that
-returns that code.
+returns that code when executed.
+
+.. note::
+ While a contract is being created, its code is still empty.
+ Because of that, you should not call back into the
+ contract under construction until its constructor has
+ finished executing.
.. index:: ! gas, ! gas price
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 7d3d058b..20400aa2 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -64,12 +64,15 @@ The position of ``data[4][9].b`` is at ``keccak256(uint256(9) . keccak256(uint25
Layout in Memory
****************
-Solidity reserves three 256-bit slots:
+Solidity reserves four 32 byte slots:
-- 0 - 64: scratch space for hashing methods
-- 64 - 96: currently allocated memory size (aka. free memory pointer)
+- ``0x00`` - ``0x3f``: scratch space for hashing methods
+- ``0x40`` - ``0x5f``: currently allocated memory size (aka. free memory pointer)
+- ``0x60`` - ``0x7f``: zero slot
-Scratch space can be used between statements (ie. within inline assembly).
+Scratch space can be used between statements (ie. within inline assembly). The zero slot
+is used as initial value for dynamic memory arrays and should never be written to
+(the free memory pointer points to ``0x80`` initially).
Solidity always places new objects at the free memory pointer and memory is never freed (this might change in the future).
@@ -192,6 +195,11 @@ 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.
+.. note ::
+ In the case of instructions that are not associated with any particular source file,
+ the source mapping assigns an integer identifier of ``-1``. This may happen for
+ bytecode sections stemming from compiler-generated inline assembly statements.
+
The source mappings inside the AST use the following
notation:
@@ -309,7 +317,7 @@ The following is the order of precedence for operators, listed in order of evalu
Global Variables
================
-- ``block.blockhash(uint blockNumber) returns (bytes32)``: hash of the given block - only works for 256 most recent blocks
+- ``block.blockhash(uint blockNumber) returns (bytes32)``: hash of the given block - only works for 256 most recent, excluding current, blocks - deprecated in version 0.4.22 and replaced by ``blockhash(uint blockNumber)``.
- ``block.coinbase`` (``address``): current block miner's address
- ``block.difficulty`` (``uint``): current block difficulty
- ``block.gaslimit`` (``uint``): current block gaslimit
@@ -326,6 +334,7 @@ Global Variables
- ``assert(bool condition)``: abort execution and revert state changes if condition is ``false`` (use for internal error)
- ``require(bool condition)``: abort execution and revert state changes if condition is ``false`` (use for malformed input or error in external component)
- ``revert()``: abort execution and revert state changes
+- ``blockhash(uint blockNumber) returns (bytes32)``: hash of the given block - only works for 256 most recent blocks
- ``keccak256(...) returns (bytes32)``: compute the Ethereum-SHA-3 (Keccak-256) hash of the :ref:`(tightly packed) arguments <abi_packed_mode>`
- ``sha3(...) returns (bytes32)``: an alias to ``keccak256``
- ``sha256(...) returns (bytes32)``: compute the SHA-256 hash of the :ref:`(tightly packed) arguments <abi_packed_mode>`
@@ -336,11 +345,28 @@ Global Variables
- ``this`` (current contract's type): the current contract, explicitly convertible to ``address``
- ``super``: the contract one level higher in the inheritance hierarchy
- ``selfdestruct(address recipient)``: destroy the current contract, sending its funds to the given address
-- ``suicide(address recipient)``: an alias to ``selfdestruct``
+- ``suicide(address recipient)``: a deprecated alias to ``selfdestruct``
- ``<address>.balance`` (``uint256``): balance of the :ref:`address` in Wei
- ``<address>.send(uint256 amount) returns (bool)``: send given amount of Wei to :ref:`address`, returns ``false`` on failure
- ``<address>.transfer(uint256 amount)``: send given amount of Wei to :ref:`address`, throws on failure
+.. note::
+ Do not rely on ``block.timestamp``, ``now`` and ``blockhash`` as a source of randomness,
+ unless you know what you are doing.
+
+ Both the timestamp and the block hash can be influenced by miners to some degree.
+ Bad actors in the mining community can for example run a casino payout function on a chosen hash
+ and just retry a different hash if they did not receive any money.
+
+ The current block timestamp must be strictly larger than the timestamp of the last block,
+ but the only guarantee is that it will be somewhere between the timestamps of two
+ consecutive blocks in the canonical chain.
+
+.. note::
+ The block hashes are not available for all blocks for scalability reasons.
+ You can only access the hashes of the most recent 256 blocks, all other
+ values will be zero.
+
.. index:: visibility, public, private, external, internal
Function Visibility Specifiers
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 57556fa5..27fefd49 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -219,7 +219,7 @@ activate themselves.
::
- pragma solidity ^0.4.20; // should actually be 0.4.21
+ pragma solidity ^0.4.21;
contract SimpleAuction {
// Parameters of the auction. Times are either
@@ -376,7 +376,7 @@ high or low invalid bids.
::
- pragma solidity ^0.4.20; // should actually be 0.4.21
+ pragma solidity ^0.4.21;
contract BlindAuction {
struct Bid {
@@ -529,7 +529,7 @@ Safe Remote Purchase
::
- pragma solidity ^0.4.20; // should actually be 0.4.21
+ pragma solidity ^0.4.21;
contract Purchase {
uint public value;
diff --git a/docs/structure-of-a-contract.rst b/docs/structure-of-a-contract.rst
index 4a0873df..df40b1d0 100644
--- a/docs/structure-of-a-contract.rst
+++ b/docs/structure-of-a-contract.rst
@@ -86,7 +86,7 @@ Events are convenience interfaces with the EVM logging facilities.
::
- pragma solidity ^0.4.20; // should actually be 0.4.21
+ pragma solidity ^0.4.21;
contract SimpleAuction {
event HighestBidIncreased(address bidder, uint amount); // Event
diff --git a/docs/style-guide.rst b/docs/style-guide.rst
index 2261746f..ee1ea4bd 100644
--- a/docs/style-guide.rst
+++ b/docs/style-guide.rst
@@ -904,7 +904,7 @@ Constants
=========
Constants should be named with all capital letters with underscores separating
-words. Examples: ``MAX_BLOCKS``, `TOKEN_NAME`, ``TOKEN_TICKER``, ``CONTRACT_VERSION``.
+words. Examples: ``MAX_BLOCKS``, ``TOKEN_NAME``, ``TOKEN_TICKER``, ``CONTRACT_VERSION``.
Modifier Names
diff --git a/docs/types.rst b/docs/types.rst
index 3611bc3e..5de6d07e 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -81,7 +81,7 @@ Fixed Point Numbers
``fixed`` / ``ufixed``: Signed and unsigned fixed point number of various sizes. Keywords ``ufixedMxN`` and ``fixedMxN``, where ``M`` represents the number of bits taken by
the type and ``N`` represents how many decimal points are available. ``M`` must be divisible by 8 and goes from 8 to 256 bits. ``N`` must be between 0 and 80, inclusive.
-``ufixed`` and ``fixed`` are aliases for ``ufixed128x19`` and ``fixed128x19``, respectively.
+``ufixed`` and ``fixed`` are aliases for ``ufixed128x18`` and ``fixed128x18``, respectively.
Operators:
@@ -470,7 +470,7 @@ Example that shows how to use internal function types::
Another example that uses external function types::
- pragma solidity ^0.4.20; // should actually be 0.4.21
+ pragma solidity ^0.4.21;
contract Oracle {
struct Request {
diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst
index 1b58b1e8..2571f20a 100644
--- a/docs/units-and-global-variables.rst
+++ b/docs/units-and-global-variables.rst
@@ -52,7 +52,7 @@ namespace and are mainly used to provide information about the blockchain.
Block and Transaction Properties
--------------------------------
-- ``block.blockhash(uint blockNumber) returns (bytes32)``: hash of the given block - only works for 256 most recent blocks excluding current
+- ``block.blockhash(uint blockNumber) returns (bytes32)``: hash of the given block - only works for 256 most recent, excluding current, blocks - deprecated in version 0.4.22 and replaced by ``blockhash(uint blockNumber)``.
- ``block.coinbase`` (``address``): current block miner's address
- ``block.difficulty`` (``uint``): current block difficulty
- ``block.gaslimit`` (``uint``): current block gaslimit
@@ -74,7 +74,7 @@ Block and Transaction Properties
This includes calls to library functions.
.. note::
- Do not rely on ``block.timestamp``, ``now`` and ``block.blockhash`` as a source of randomness,
+ Do not rely on ``block.timestamp``, ``now`` and ``blockhash`` as a source of randomness,
unless you know what you are doing.
Both the timestamp and the block hash can be influenced by miners to some degree.
@@ -183,7 +183,7 @@ Contract Related
destroy the current contract, sending its funds to the given :ref:`address`
``suicide(address recipient)``:
- alias to ``selfdestruct``
+ deprecated alias to ``selfdestruct``
Furthermore, all functions of the current contract are callable directly including the current function.