mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
docs/
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
This commit is contained in:
@@ -56,7 +56,7 @@ to call back into A before this interaction is completed. To give an example,
|
||||
the following code contains a bug (it is just a snippet and not a
|
||||
complete contract):
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
@@ -80,7 +80,7 @@ basically retrieve all the Ether in the contract. In particular, the
|
||||
following contract will allow an attacker to refund multiple times
|
||||
as it uses ``call`` which forwards all remaining gas by default:
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.2 <0.9.0;
|
||||
@@ -100,7 +100,7 @@ as it uses ``call`` which forwards all remaining gas by default:
|
||||
To avoid re-entrancy, you can use the Checks-Effects-Interactions pattern as
|
||||
outlined further below:
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
@@ -198,7 +198,7 @@ tx.origin
|
||||
|
||||
Never use tx.origin for authorization. Let's say you have a wallet contract like this:
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
@@ -218,7 +218,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
|
||||
|
||||
Now someone tricks you into sending Ether to the address of this attack wallet:
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
@@ -251,7 +251,7 @@ They resemble integers when the values are small, but cannot represent arbitrari
|
||||
The following code causes an overflow because the result of the addition is too large
|
||||
to be stored in the type ``uint8``:
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
uint8 x = 255;
|
||||
uint8 y = 1;
|
||||
@@ -289,7 +289,7 @@ field of a ``struct`` that is the base type of a dynamic storage array. The
|
||||
``mapping`` is also ignored in assignments of structs or arrays containing a
|
||||
``mapping``.
|
||||
|
||||
::
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
|
||||
Reference in New Issue
Block a user