Skip to content

Commit

Permalink
docs/
Browse files Browse the repository at this point in the history
Enhancing all the .rst doc files by adding highlighting for the code snippets, including the following langs:
1. Solidity

2. bash

3. javascript

4. assembly
  • Loading branch information
iskanderandrews committed Jun 25, 2021
1 parent 4df5102 commit 8aac82b
Show file tree
Hide file tree
Showing 310 changed files with 5,550 additions and 1,749 deletions.
9 changes: 6 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ jobs:
command: apt -q update && apt install -y python3-pip
- run:
name: Install pylint
command: python3 -m pip install pylint z3-solver pygments-lexer-solidity
# also z3-solver to make sure pylint knows about this module, pygments-lexer-solidity for docs
command: python3 -m pip install pylint z3-solver pygments-lexer-solidity parsec tabulate
# also z3-solver, parsec and tabulate to make sure pylint knows about this module, pygments-lexer-solidity for docs
- run:
name: Linting Python Scripts
command: ./scripts/pylint_all.py
Expand Down Expand Up @@ -721,7 +721,10 @@ jobs:
TERM: xterm
# For Archlinux we do not have prebuilt docker images and we would need to build evmone from source,
# thus we forgo semantics tests to speed things up.
SOLTEST_FLAGS: --no-semantic-tests
# FIXME: Z3 4.8.11 prerelease is now in main Arch Linux repos but it makes some of our SMT
# tests hang. Disabling SMT tests until we get a proper release.
# See https://github.com/Z3Prover/z3/issues/5330 for more details.
SOLTEST_FLAGS: --no-semantic-tests --no-smt
steps:
- run:
name: Install runtime dependencies
Expand Down
2 changes: 2 additions & 0 deletions .circleci/osx_install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ set -eu

if [ ! -f /usr/local/lib/libz3.a ] # if this file does not exists (cache was not restored), rebuild dependencies
then
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
brew update
brew unlink python
brew install boost
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ prerelease.txt
/build*
emscripten_build/
docs/_build
docs/_static/robots.txt
__pycache__
docs/utils/*.pyc
/deps/downloads/
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include(EthPolicy)
eth_policy()

# project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.8.5")
set(PROJECT_VERSION "0.8.7")
# OSX target needed in order to support std::visit
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
Expand Down
44 changes: 41 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
### 0.8.5 (unreleased)
### 0.8.7 (unreleased)

Language Features:


Compiler Features:


Bugfixes:
* Code Generator: Fix internal compiler error when calling functions bound to calldata structs and arrays.
* Type Checker: Fix internal error and prevent static calls to unimplemented modifiers.


### 0.8.6 (2021-06-22)

Language Features:
* Yul: Special meaning of ``".metadata"`` data object in Yul object.


Bugfixes:
* Control Flow Graph: Fix incorrectly reported unreachable code.
* Solc-Js: When running ``solcjs`` without the ``--optimize`` flag, use ``settings.optimizer.enabled=false`` in Standard JSON instead of omitting the key.
* Standard JSON: Omitting ``settings.optimizer.enabled`` was not equivalent to setting it to ``false``. It meant disabling also the peephole optimizer and jumpdest remover which by default still run with ``enabled=false``.


### 0.8.5 (2021-06-10)

Language Features:
* Allowing conversion from ``bytes`` and ``bytes`` slices to ``bytes1``/.../``bytes32``.
* Yul: Add ``verbatim`` builtin function to inject arbitrary bytecode.


Compiler Features:
* Code Generator: Insert helper functions for panic codes instead of inlining unconditionally. This can reduce costs if many panics (checks) are inserted,
but can increase costs where few panics are used.
* Code Generator: Insert helper functions for panic codes instead of inlining unconditionally. This can reduce costs if many panics (checks) are inserted, but can increase costs where few panics are used.
* EVM: Set the default EVM version to "Berlin".
* SMTChecker: Function definitions can be annotated with the custom Natspec tag ``custom:smtchecker abstract-function-nondet`` to be abstracted by a nondeterministic value when called.
* Standard JSON / combined JSON: New artifact "functionDebugData" that contains bytecode offsets of entry points of functions and potentially more information in the future.
Expand All @@ -16,16 +40,30 @@ Compiler Features:

Bugfixes:
* AST: Do not output value of Yul literal if it is not a valid UTF-8 string.
* Code Generator: Fix internal error when function arrays are assigned to storage variables and the function types can be implicitly converted but are not identical.
* Code Generator: Fix internal error when super would have to skip an unimplemented function in the virtual resolution order.
* Control Flow Graph: Assume unimplemented modifiers use a placeholder.
* Control Flow Graph: Take internal calls to functions that always revert into account for reporting unused or unassigned variables.
* Function Call Graph: Fix internal error connected with circular constant references.
* Name Resolver: Do not issue shadowing warning if the shadowing name is not directly accessible.
* Natspec: Allow multiple ``@return`` tags on public state variable documentation.
* SMTChecker: Fix internal error on conversion from ``bytes`` to ``fixed bytes``.
* SMTChecker: Fix internal error on external calls from the constructor.
* SMTChecker: Fix internal error on struct constructor with fixed bytes member initialized with string literal.
* Source Locations: Properly set source location of scoped blocks.
* Standard JSON: Properly allow the ``inliner`` setting under ``settings.optimizer.details``.
* Type Checker: Fix internal compiler error related to having mapping types in constructor parameter for abstract contracts.
* Type Checker: Fix internal compiler error when attempting to use an invalid external function type on pre-byzantium EVMs.
* Type Checker: Fix internal compiler error when overriding receive ether function with one having different parameters during inheritance.
* Type Checker: Make errors about (nested) mapping type in event or error parameter into fatal type errors.
* Type Checker: Fix internal compiler error when overriding an implemented modifier with an unimplemented one.


AST Changes:
* Add member `hexValue` for Yul string and hex literals.



### 0.8.4 (2021-04-21)

Important Bugfixes:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![Gitter Chat](https://img.shields.io/badge/Gitter%20-chat-brightgreen?style=plastic&logo=gitter)](https://gitter.im/ethereum/solidity)
[![Solidity Forum](https://img.shields.io/badge/Solidity_Forum%20-discuss-brightgreen?style=plastic&logo=discourse)](https://forum.soliditylang.org/)
[![Twitter Follow](https://img.shields.io/twitter/follow/solidity_lang?style=plastic&logo=twitter)](https://twitter.com/solidity_lang)
[![Mastodon Follow](https://img.shields.io/mastodon/follow/000335908?domain=https%3A%2F%2Ffosstodon.org%2F&logo=mastodon&style=plastic)](https://fosstodon.org/@solidity)

You can talk to us on Gitter and Matrix, tweet at us on Twitter or create a new topic in the Solidity forum. Questions, feedback, and suggestions are welcome!

Expand Down
12 changes: 6 additions & 6 deletions docs/050-breaking-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ It is still possible to interface with contracts written for Solidity versions p
v0.5.0 (or the other way around) by defining interfaces for them.
Consider you have the following pre-0.5.0 contract already deployed:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.4.25;
Expand All @@ -308,7 +308,7 @@ Consider you have the following pre-0.5.0 contract already deployed:
This will no longer compile with Solidity v0.5.0. However, you can define a compatible interface for it:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.9.0;
Expand All @@ -326,7 +326,7 @@ the function will work with ``staticcall``.

Given the interface defined above, you can now easily use the already deployed pre-0.5.0 contract:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.9.0;
Expand All @@ -347,7 +347,7 @@ Similarly, pre-0.5.0 libraries can be used by defining the functions of the libr
supplying the address of the pre-0.5.0 library during linking (see :ref:`commandline-compiler` for how to use the
commandline compiler for linking):

::
.. code-block:: solidity
// This will not compile after 0.6.0
// SPDX-License-Identifier: GPL-3.0
Expand All @@ -372,7 +372,7 @@ v0.5.0 with some of the changes listed in this section.

Old version:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.4.25;
Expand Down Expand Up @@ -435,7 +435,7 @@ Old version:
New version:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.0;
Expand Down
8 changes: 4 additions & 4 deletions docs/abi-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Examples

Given the contract:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;
Expand Down Expand Up @@ -510,7 +510,7 @@ call.
As an example, let us consider the following contract whose ``transfer`` function always
reverts with a custom error of "insufficient balance":

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down Expand Up @@ -599,7 +599,7 @@ Errors look as follows:

For example,

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down Expand Up @@ -653,7 +653,7 @@ which is of array type and has the same structure as the top-level object except

As an example, the code

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >0.7.4 <0.9.0;
Expand Down
11 changes: 7 additions & 4 deletions docs/assembly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ load it into a ``bytes`` variable. This is not possible with "plain Solidity" an
idea is that reusable assembly libraries can enhance the Solidity language
without a compiler change.

.. code::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;
Expand All @@ -65,7 +65,7 @@ without a compiler change.
Inline assembly is also beneficial in cases where the optimizer fails to produce
efficient code, for example:

.. code::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;
Expand Down Expand Up @@ -141,7 +141,8 @@ Both expressions can also be assigned to.

Local Solidity variables are available for assignments, for example:

.. code::
.. code-block:: solidity
:force:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
Expand Down Expand Up @@ -216,7 +217,9 @@ starting from where this pointer points at and update it.
There is no guarantee that the memory has not been used before and thus
you cannot assume that its contents are zero bytes.
There is no built-in mechanism to release or free allocated memory.
Here is an assembly snippet you can use for allocating memory that follows the process outlined above::
Here is an assembly snippet you can use for allocating memory that follows the process outlined above

.. code-block:: yul
function allocate(length) -> pos {
pos := mload(0x40)
Expand Down
8 changes: 8 additions & 0 deletions docs/bugs_by_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -1543,5 +1543,13 @@
"0.8.4": {
"bugs": [],
"released": "2021-04-21"
},
"0.8.5": {
"bugs": [],
"released": "2021-06-10"
},
"0.8.6": {
"bugs": [],
"released": "2021-06-22"
}
}
8 changes: 4 additions & 4 deletions docs/common-patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract in order to become the "richest", inspired by
In the following contract, if you are no longer the richest,
you receive the funds of the person who is now the richest.

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down Expand Up @@ -63,7 +63,7 @@ you receive the funds of the person who is now the richest.
This is as opposed to the more intuitive sending pattern:

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down Expand Up @@ -129,7 +129,7 @@ functions and this is what this section is about.
The use of **function modifiers** makes these
restrictions highly readable.

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down Expand Up @@ -292,7 +292,7 @@ function finishes.
Starting with version 0.4.0, modifier code
will run even if the function explicitly returns.

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
def setup(sphinx):
thisdir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, thisdir + '/utils')
sphinx.add_lexer('Solidity', SolidityLexer())
sphinx.add_lexer('Yul', YulLexer())
sphinx.add_lexer('Solidity', SolidityLexer)
sphinx.add_lexer('Yul', YulLexer)

sphinx.add_stylesheet('css/custom.css')
sphinx.add_css_file('css/custom.css')

# -- General configuration ------------------------------------------------

Expand Down
16 changes: 12 additions & 4 deletions docs/contracts/abstract-contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Contracts may be marked as abstract even though all functions are implemented.

This can be done by using the ``abstract`` keyword as shown in the following example. Note that this contract needs to be
defined as abstract, because the function ``utterance()`` was defined, but no implementation was
provided (no implementation body ``{ }`` was given).::
provided (no implementation body ``{ }`` was given).

.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;
Expand All @@ -21,7 +23,9 @@ provided (no implementation body ``{ }`` was given).::
}
Such abstract contracts can not be instantiated directly. This is also true, if an abstract contract itself does implement
all defined functions. The usage of an abstract contract as a base class is shown in the following example::
all defined functions. The usage of an abstract contract as a base class is shown in the following example:

.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;
Expand All @@ -40,11 +44,15 @@ functions by overriding, it needs to be marked as abstract as well.
Note that a function without implementation is different from
a :ref:`Function Type <function_types>` even though their syntax looks very similar.

Example of function without implementation (a function declaration)::
Example of function without implementation (a function declaration):

.. code-block:: solidity
function foo(address) external returns (address);
Example of a declaration of a variable whose type is a function type::
Example of a declaration of a variable whose type is a function type:

.. code-block:: solidity
function(address) external returns (address) foo;
Expand Down
2 changes: 1 addition & 1 deletion docs/contracts/constant-state-variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ can sometimes be cheaper than immutable values.
Not all types for constants and immutables are implemented at this time. The only supported types are
:ref:`strings <strings>` (only for constants) and :ref:`value types <value-types>`.

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.4;
Expand Down
2 changes: 1 addition & 1 deletion docs/contracts/creating-contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If a contract wants to create another contract, the source code
(and the binary) of the created contract has to be known to the creator.
This means that cyclic creation dependencies are impossible.

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
Expand Down
4 changes: 2 additions & 2 deletions docs/contracts/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ which causes
all changes in the current call to be reverted and passes the error data back to the
caller.

::
.. code-block:: solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
Expand Down Expand Up @@ -79,4 +79,4 @@ of the built-in type ``Panic(uint256)``.
of inner calls is propagated back through the chain of external calls
by default. This means that an inner call
can "forge" revert data that looks like it could have come from the
contract that called it.
contract that called it.

0 comments on commit 8aac82b

Please sign in to comment.