diff --git a/.readthedocs.yml b/.readthedocs.yml index c0c139b7e8..bb81012240 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,9 +1,9 @@ version: 2 build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.11" + python: "3.13" sphinx: builder: html diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e477cf3a8..44ef6dbcdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.13.0) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The path to the cmake directory") list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR}) @@ -21,7 +23,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.8.31") +set(PROJECT_VERSION "0.8.36") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst index 43839ec54f..a106b268e1 100644 --- a/docs/050-breaking-changes.rst +++ b/docs/050-breaking-changes.rst @@ -2,11 +2,19 @@ Solidity v0.5.0の破壊的変更点 ***************************** +<<<<<<< HEAD .. This section highlights the main breaking changes introduced in Solidity version 0.5.0, along with the reasoning behind the changes and how to update affected code. .. For the full list check `the release changelog `_. このセクションでは、Solidityバージョン0.5.0で導入された主な変更点と、変更の理由、影響を受けるコードの更新方法について説明します。 完全なリストは `リリースのチェンジログ `_ を参照してください。 +======= +This section highlights the main breaking changes introduced in Solidity +version 0.5.0, along with the reasoning behind the changes and how to update +affected code. +For the full list check +`the release changelog `_. +>>>>>>> english/develop .. note:: .. Contracts compiled with Solidity v0.5.0 can still interface with contracts diff --git a/docs/060-breaking-changes.rst b/docs/060-breaking-changes.rst index 505c2a7506..d6b1b34344 100644 --- a/docs/060-breaking-changes.rst +++ b/docs/060-breaking-changes.rst @@ -2,8 +2,16 @@ Solidity v0.6.0の破壊的変更点 ***************************** +<<<<<<< HEAD .. This section highlights the main breaking changes introduced in Solidity version 0.6.0, along with the reasoning behind the changes and how to update affected code. .. For the full list check `the release changelog `_. +======= +This section highlights the main breaking changes introduced in Solidity +version 0.6.0, along with the reasoning behind the changes and how to update +affected code. +For the full list check +`the release changelog `_. +>>>>>>> english/develop このセクションでは、Solidityバージョン0.6.0で導入された主な変更点と、変更の理由、影響を受けるコードの更新方法について説明します。 完全なリストは `リリースチェンジログ `_ を参照してください。 @@ -156,8 +164,17 @@ Solidity v0.6.0の破壊的変更点 * YulとInline Assemblyには、現在の関数を終了させる ``leave`` という新しい文があります。 * ``address`` から ``address payable`` への変換は ``payable(x)`` を介して可能になりました。 +<<<<<<< HEAD インターフェースの変更点 ======================== +======= +The compiler now appends the `IPFS `_ hash of the metadata file to the end of the bytecode by default +(for details, see documentation on :doc:`contract metadata `). Before 0.6.0, the compiler appended the +`Swarm `_ hash by default, and in order to still support this behavior, +the new command-line option ``--metadata-hash`` was introduced. It allows you to select the hash to be produced and +appended, by passing either ``ipfs`` or ``swarm`` as value to the ``--metadata-hash`` command-line option. +Passing the value ``none`` completely removes the hash. +>>>>>>> english/develop .. This section lists changes that are unrelated to the language itself, but that have an effect on the interfaces of the compiler. .. These may change the way how you use the compiler on the command-line, how you use its programmable interface, or how you analyze the output produced by it. diff --git a/docs/070-breaking-changes.rst b/docs/070-breaking-changes.rst index b0edee43ad..8a8662a7a8 100644 --- a/docs/070-breaking-changes.rst +++ b/docs/070-breaking-changes.rst @@ -2,11 +2,19 @@ Solidity v0.7.0の破壊的変更点 ***************************** +<<<<<<< HEAD .. This section highlights the main breaking changes introduced in Solidity version 0.7.0, along with the reasoning behind the changes and how to update affected code. .. For the full list check `the release changelog `_. このセクションでは、Solidityバージョン0.7.0で導入された主な変更点と、変更の理由、影響を受けるコードの更新方法について説明します。 完全なリストは `リリースチェンジログ `_ を参照してください。 +======= +This section highlights the main breaking changes introduced in Solidity +version 0.7.0, along with the reasoning behind the changes and how to update +affected code. +For the full list check +`the release changelog `_. +>>>>>>> english/develop .. Silent Changes of the Semantics diff --git a/docs/080-breaking-changes.rst b/docs/080-breaking-changes.rst index 2f9758e951..b1f5fc0baa 100644 --- a/docs/080-breaking-changes.rst +++ b/docs/080-breaking-changes.rst @@ -2,8 +2,15 @@ Solidity v0.8.0の破壊的変更点 ***************************** +<<<<<<< HEAD このセクションでは、Solidityのバージョン0.8.0で導入された主な変更点を紹介します。 完全なリストは `リリースチェンジログ `_ を参照してください。 +======= +This section highlights the main breaking changes introduced in Solidity +version 0.8.0. +For the full list check +`the release changelog `_. +>>>>>>> english/develop .. Silent Changes of the Semantics diff --git a/docs/_static/css/custom-dark.css b/docs/_static/css/custom-dark.css index 044a8f800d..1294a6f648 100644 --- a/docs/_static/css/custom-dark.css +++ b/docs/_static/css/custom-dark.css @@ -590,6 +590,6 @@ stroke: white; } -:root[style*=dark] .a4 .sig-name { +:root[style*=dark] .sig-name { background-color: transparent !important; } diff --git a/docs/_static/js/constants.js b/docs/_static/js/constants.js index 67fa16cdb0..c88d259b02 100644 --- a/docs/_static/js/constants.js +++ b/docs/_static/js/constants.js @@ -26,12 +26,12 @@ const CONTRIBUTE_PATH = `/en/latest/contributing.html`; const ABOUT_PATH = `${SOLIDITY_HOME_URL}/about`; const FORUM_URL = "https://forum.soliditylang.org/"; const NAV_LINKS = [ - { name: "Blog", href: BLOG_URL }, - { name: "Documentation", href: DOCS_URL }, - { name: "Use cases", href: USE_CASES_PATH }, - { name: "Contribute", href: CONTRIBUTE_PATH }, - { name: "About", href: ABOUT_PATH }, - { name: "Forum", href: FORUM_URL }, + { name: window.NAV_LINKS.blog, href: BLOG_URL }, + { name: window.NAV_LINKS.documentation, href: DOCS_URL }, + { name: window.NAV_LINKS.use_cases, href: USE_CASES_PATH }, + { name: window.NAV_LINKS.contribute, href: CONTRIBUTE_PATH }, + { name: window.NAV_LINKS.about, href: ABOUT_PATH }, + { name: window.NAV_LINKS.forum, href: FORUM_URL }, ]; const MOBILE_MENU_TOGGLE_CLASS = "shift"; diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 65c4e461cd..1b559d8e08 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -1,5 +1,19 @@ {% extends "!layout.html" %} +{% block scripts %} + + {{ super() }} +{% endblock %} + {% block menu %} {{ super() }}
    diff --git a/docs/assembly.rst b/docs/assembly.rst index c626010fd8..4bfafe8f4a 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -57,6 +57,7 @@ Solidityのインラインアセンブリに使用される言語は :ref:`Yul < pragma solidity >=0.4.16 <0.9.0; library GetCode { + // This will report a warning - `at` will be promoted to reserved keyword function at(address addr) public view returns (bytes memory code) { assembly { // コードのサイズを取得します。これはアセンブリが必要です。 @@ -469,12 +470,18 @@ Solidityの複数のバージョンで互換性のあるライブラリを開発 ... } +<<<<<<< HEAD .. Note that we will disallow the annotation via comment in a future breaking release; so, if you are not concerned with backward-compatibility with older compiler versions, prefer using the dialect string. なお、コメントによるアノテーションは、将来のブレーキングリリースで禁止する予定です。 したがって、古いコンパイラのバージョンとの後方互換性にこだわらない場合は、方言文字列を使用することをお勧めします。 .. TODO: +======= +.. warning:: + The ``memory-safe-assembly`` special comment is deprecated and scheduled for removal. + In new code targeting recent compilers, use the assembly block annotation. +>>>>>>> english/develop Advanced Safe Use of Memory --------------------------- diff --git a/docs/bugs.json b/docs/bugs.json index 8005246690..5f8d1a1627 100644 --- a/docs/bugs.json +++ b/docs/bugs.json @@ -1,4 +1,28 @@ [ + { + "uid": "SOL-2026-1", + "name": "TransientStorageClearingHelperCollision", + "summary": "Clearing both storage and transient storage variables in the same contract may result in only one of these locations being cleared.", + "description": "The IR-based code generator provides a set of Yul helper functions for basic operations, such as clearing, copying, encoding or type conversions. Not all functions are used by every contract. The codegen appends them to the generated sources individually, only when an operation that would invoke one of them is encountered. Utility functions are often specialized for different types and locations. Since Yul does not support generic functions, specialization is done by generating multiple versions of the same function, with the information distinguishing the variants embedded in their names. However, if not all the necessary bits of distinguishing information are properly accounted for, two helpers may end up with the same name, causing a collision. In this situation the codegen includes only one of them, with calls to both variants invoking it. This happened with the ``set_to_zero`` helper used when an area of transient or persistent storage needs to be cleared. The helper name was missing the location information, which resulted in a collision between the persistent and transient storage variants for the same type. This meant that contracts clearing both locations would actually clear only one, leaving the other untouched. Which location ended up being cleared depended on the order in which the code generator processed the input. The necessary condition to trigger the bug was the use of ``delete`` operator on a transient storage variable. This was due to value types being the only types supported in transient storage and ``delete`` being the only operation invoking the helper allowed on such types. The other necessary condition was clearing of persistent storage and in this case the range of affected operations was wider: operator ``delete``, array ``pop()`` or assignment that resulted in a longer array being overwritten with a shorter one. The cleared variable itself also did not necessarily have to be of the same type. It was enough that a matching value type was nested in it. It also did not always have to be the exact same value type - clearing operations on reference types are usually performed at slot granularity, treating every slot as ``uint256`` rather than clearing every value packed into it individually. To trigger the bug both operations had to be present within the same piece of bytecode. Independent contracts, not related through inheritance, would not affect each other this way. The presence of one operation only in creation code and the other only in deployed code would not trigger the bug either.", + "link": "https://blog.soliditylang.org/2026/02/18/transient-storage-clearing-helper-collision-bug/", + "introduced": "0.8.28", + "fixed": "0.8.34", + "severity": "high", + "conditions": { + "viaIR": true, + "evmVersion": ">=cancun" + } + }, + { + "uid": "SOL-2025-1", + "name": "LostStorageArrayWriteOnSlotOverflow", + "summary": "Operations that involve clearing or copying from arrays that straddle the end of storage could result in silent data retention.", + "description": "Solidity makes it possible to define variables that extend past the last (2**256-th) slot of storage, which results in wrap-around back to slot zero. Since EVM uses 256-bit integer arithmetic, most operations on such variables just work. The only situation which requires special attention is iteration against absolute slot addresses: the invariant that the last slot belonging to a variable has the highest address does not hold. When implemented incorrectly, a loop over an array will immediately terminate if the container spans the end of storage - due to the initial position already being greater than the end position. This affected storage array clearing loops generated by both evmasm and IR pipelines. Additionally, (only in the evmasm pipeline) copying operations whose source was an array straddling the end of storage were also affected. At the language level, the buggy code would be generated for array assignment, array initialization, delete operator, .pop() and .push(). Note that a clearing loop is inserted by the compiler not only for invocations of the delete operator, but also to zero storage when overwriting a longer array with a shorter one, popping an element or even pushing an empty element to a dynamic array. Since clearing is a separate loop, it is possible for the bug to only affect it and not the copy operation it follows (which is always the case in the IR pipeline). The bug is extremely unlikely to be triggered accidentally due to the probabilistic impossibility of a short dynamic array being allocated right at the storage boundary. On the other hand, scenarios in which a user may place a static array there intentionally do not seem realistic and are limited to unusual layouts, in which a contract does not place any storage variables at slot zero (otherwise they would overlap the array).", + "link": "https://blog.soliditylang.org/2025/12/18/lost-storage-array-write-on-slot-overflow-bug/", + "introduced": "0.1.0", + "fixed": "0.8.32", + "severity": "low" + }, { "uid": "SOL-2023-3", "name": "VerbatimInvalidDeduplication", diff --git a/docs/bugs.rst b/docs/bugs.rst index 93fb1a80db..cd04371b9c 100644 --- a/docs/bugs.rst +++ b/docs/bugs.rst @@ -6,6 +6,7 @@ 既知のバグのリスト ################## +<<<<<<< HEAD .. Below, you can find a JSON-formatted list of some of the known security-relevant bugs in the .. Solidity compiler. The file itself is hosted in the `GitHub repository .. `_. @@ -15,6 +16,17 @@ 以下に、Solidityコンパイラのセキュリティ関連の既知のバグをJSON形式でリストアップしています。 このファイルは `GitHubリポジトリ `_ にあります。 このリストはバージョン0.3.0までさかのぼりますが、それ以前のバージョンにしか存在しないことがわかっているバグはリストに含まれていません。 +======= +Below, you can find a JSON-formatted list of some of the known security-relevant bugs in the +Solidity compiler. The file itself is hosted in the `GitHub repository +`_. +The list stretches back as far as version 0.3.0, bugs known to be present only +in versions preceding that are not listed. + +There is another file called `bugs_by_version.json +`_, +which can be used to check which bugs affect a specific version of the compiler. +>>>>>>> english/develop .. There is another file called `bugs_by_version.json .. `_, diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index 1a210b885c..d7e28ab784 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -1,6 +1,7 @@ { "0.1.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -23,6 +24,7 @@ }, "0.1.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -45,6 +47,7 @@ }, "0.1.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -67,6 +70,7 @@ }, "0.1.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -89,6 +93,7 @@ }, "0.1.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -112,6 +117,7 @@ }, "0.1.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -135,6 +141,7 @@ }, "0.1.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -160,6 +167,7 @@ }, "0.1.7": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -185,6 +193,7 @@ }, "0.2.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -211,6 +220,7 @@ }, "0.2.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -237,6 +247,7 @@ }, "0.2.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -263,6 +274,7 @@ }, "0.3.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -291,6 +303,7 @@ }, "0.3.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -318,6 +331,7 @@ }, "0.3.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -345,6 +359,7 @@ }, "0.3.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -371,6 +386,7 @@ }, "0.3.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -397,6 +413,7 @@ }, "0.3.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -423,6 +440,7 @@ }, "0.3.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -447,6 +465,7 @@ }, "0.4.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -471,6 +490,7 @@ }, "0.4.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -495,6 +515,7 @@ }, "0.4.10": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -518,6 +539,7 @@ }, "0.4.11": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -540,6 +562,7 @@ }, "0.4.12": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -561,6 +584,7 @@ }, "0.4.13": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -582,6 +606,7 @@ }, "0.4.14": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -602,6 +627,7 @@ }, "0.4.15": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -621,6 +647,7 @@ }, "0.4.16": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -643,6 +670,7 @@ }, "0.4.17": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -666,6 +694,7 @@ }, "0.4.18": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -688,6 +717,7 @@ }, "0.4.19": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -711,6 +741,7 @@ }, "0.4.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -734,6 +765,7 @@ }, "0.4.20": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -757,6 +789,7 @@ }, "0.4.21": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -780,6 +813,7 @@ }, "0.4.22": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -803,6 +837,7 @@ }, "0.4.23": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -825,6 +860,7 @@ }, "0.4.24": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -847,6 +883,7 @@ }, "0.4.25": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -867,6 +904,7 @@ }, "0.4.26": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -884,6 +922,7 @@ }, "0.4.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -906,6 +945,7 @@ }, "0.4.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -927,6 +967,7 @@ }, "0.4.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -951,6 +992,7 @@ }, "0.4.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -974,6 +1016,7 @@ }, "0.4.7": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -997,6 +1040,7 @@ }, "0.4.8": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -1020,6 +1064,7 @@ }, "0.4.9": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "KeccakCaching", "EmptyByteArrayCopy", @@ -1043,6 +1088,7 @@ }, "0.5.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1063,6 +1109,7 @@ }, "0.5.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1083,6 +1130,7 @@ }, "0.5.10": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1101,6 +1149,7 @@ }, "0.5.11": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1118,6 +1167,7 @@ }, "0.5.12": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1135,6 +1185,7 @@ }, "0.5.13": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1152,6 +1203,7 @@ }, "0.5.14": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1171,6 +1223,7 @@ }, "0.5.15": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1189,6 +1242,7 @@ }, "0.5.16": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1206,6 +1260,7 @@ }, "0.5.17": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1222,6 +1277,7 @@ }, "0.5.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1242,6 +1298,7 @@ }, "0.5.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1262,6 +1319,7 @@ }, "0.5.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1282,6 +1340,7 @@ }, "0.5.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1304,6 +1363,7 @@ }, "0.5.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1326,6 +1386,7 @@ }, "0.5.7": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "DirtyBytesArrayToStorage", "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", @@ -1346,6 +1407,7 @@ }, "0.5.8": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1367,6 +1429,7 @@ }, "0.5.9": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1387,6 +1450,7 @@ }, "0.6.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1405,6 +1469,7 @@ }, "0.6.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", "NestedCalldataArrayAbiReencodingSizeValidation", @@ -1422,6 +1487,7 @@ }, "0.6.10": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1438,6 +1504,7 @@ }, "0.6.11": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1454,6 +1521,7 @@ }, "0.6.12": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1470,6 +1538,7 @@ }, "0.6.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", @@ -1488,6 +1557,7 @@ }, "0.6.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", @@ -1506,6 +1576,7 @@ }, "0.6.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", @@ -1524,6 +1595,7 @@ }, "0.6.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", @@ -1542,6 +1614,7 @@ }, "0.6.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", "DirtyBytesArrayToStorage", @@ -1559,6 +1632,7 @@ }, "0.6.7": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1577,6 +1651,7 @@ }, "0.6.8": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1592,6 +1667,7 @@ }, "0.6.9": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1609,6 +1685,7 @@ }, "0.7.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1625,6 +1702,7 @@ }, "0.7.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1642,6 +1720,7 @@ }, "0.7.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1658,6 +1737,7 @@ }, "0.7.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1673,6 +1753,7 @@ }, "0.7.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1687,6 +1768,7 @@ }, "0.7.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1701,6 +1783,7 @@ }, "0.7.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1715,6 +1798,7 @@ }, "0.8.0": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1729,6 +1813,7 @@ }, "0.8.1": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1743,6 +1828,7 @@ }, "0.8.10": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1755,6 +1841,7 @@ }, "0.8.11": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1768,6 +1855,7 @@ }, "0.8.12": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1781,6 +1869,7 @@ }, "0.8.13": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1795,6 +1884,7 @@ }, "0.8.14": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1807,6 +1897,7 @@ }, "0.8.15": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1817,6 +1908,7 @@ }, "0.8.16": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1826,6 +1918,7 @@ }, "0.8.17": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess" @@ -1834,6 +1927,7 @@ }, "0.8.18": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess" @@ -1842,6 +1936,7 @@ }, "0.8.19": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess" @@ -1850,6 +1945,7 @@ }, "0.8.2": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1864,6 +1960,7 @@ }, "0.8.20": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess" @@ -1872,46 +1969,65 @@ }, "0.8.21": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication" ], "released": "2023-07-19" }, "0.8.22": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication" ], "released": "2023-10-25" }, "0.8.23": { - "bugs": [], + "bugs": [ + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2023-11-08" }, "0.8.24": { - "bugs": [], + "bugs": [ + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2024-01-25" }, "0.8.25": { - "bugs": [], + "bugs": [ + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2024-03-14" }, "0.8.26": { - "bugs": [], + "bugs": [ + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2024-05-21" }, "0.8.27": { - "bugs": [], + "bugs": [ + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2024-09-04" }, "0.8.28": { - "bugs": [], + "bugs": [ + "TransientStorageClearingHelperCollision", + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2024-10-09" }, "0.8.29": { - "bugs": [], + "bugs": [ + "TransientStorageClearingHelperCollision", + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2025-03-12" }, "0.8.3": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1924,11 +2040,42 @@ "released": "2021-03-23" }, "0.8.30": { - "bugs": [], + "bugs": [ + "TransientStorageClearingHelperCollision", + "LostStorageArrayWriteOnSlotOverflow" + ], "released": "2025-05-07" }, + "0.8.31": { + "bugs": [ + "TransientStorageClearingHelperCollision", + "LostStorageArrayWriteOnSlotOverflow" + ], + "released": "2025-12-03" + }, + "0.8.32": { + "bugs": [ + "TransientStorageClearingHelperCollision" + ], + "released": "2025-12-18" + }, + "0.8.33": { + "bugs": [ + "TransientStorageClearingHelperCollision" + ], + "released": "2025-12-18" + }, + "0.8.34": { + "bugs": [], + "released": "2026-02-18" + }, + "0.8.35": { + "bugs": [], + "released": "2026-04-29" + }, "0.8.4": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", "AbiReencodingHeadOverflowWithStaticArrayCleanup", @@ -1941,6 +2088,7 @@ }, "0.8.5": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1954,6 +2102,7 @@ }, "0.8.6": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1967,6 +2116,7 @@ }, "0.8.7": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1980,6 +2130,7 @@ }, "0.8.8": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", @@ -1994,6 +2145,7 @@ }, "0.8.9": { "bugs": [ + "LostStorageArrayWriteOnSlotOverflow", "VerbatimInvalidDeduplication", "FullInlinerNonExpressionSplitArgumentEvaluationOrder", "MissingSideEffectsOnSelectorAccess", diff --git a/docs/cheatsheet.rst b/docs/cheatsheet.rst index 53f1dd7e81..d1404b01c7 100644 --- a/docs/cheatsheet.rst +++ b/docs/cheatsheet.rst @@ -52,6 +52,7 @@ ABIのエンコード関数とデコード関数 ``address`` のメンバー ====================== +<<<<<<< HEAD .. TODO: - ``
    .balance`` (``uint256``): :ref:`address` の残高(Wei) @@ -62,6 +63,20 @@ ABIのエンコード関数とデコード関数 - ``
    .staticcall(bytes memory) returns (bool, bytes memory)``: issue low-level ``STATICCALL`` with the given payload, returns success condition and return data - ``
    .send(uint256 amount) returns (bool)``: 指定した量のWeiを :ref:`address` に送り、失敗したら ``false`` を返します。 - ``
    .transfer(uint256 amount)``: 指定した量のWeiを :ref:`address` に送り、失敗したらリバートします。 +======= +- ``
    .balance`` (``uint256``): balance of the :ref:`address` in Wei +- ``
    .code`` (``bytes memory``): code at the :ref:`address` (can be empty) +- ``
    .codehash`` (``bytes32``): the codehash of the :ref:`address` +- ``
    .call(bytes memory) returns (bool, bytes memory)``: issue low-level ``CALL`` with the given payload, + returns success condition and return data +- ``
    .delegatecall(bytes memory) returns (bool, bytes memory)``: issue low-level ``DELEGATECALL`` with the given payload, + returns success condition and return data +- ``
    .staticcall(bytes memory) returns (bool, bytes memory)``: issue low-level ``STATICCALL`` with the given payload, + returns success condition and return data +- ``
    .send(uint256 amount) returns (bool)``: send given amount of Wei to :ref:`address`, + returns ``false`` on failure (deprecated) +- ``
    .transfer(uint256 amount)``: send given amount of Wei to :ref:`address`, throws on failure (deprecated) +>>>>>>> english/develop .. index:: blockhash, blobhash, block, block;basefee, block;blobbasefee, block;chainid, block;coinbase, block;difficulty, block;gaslimit, block;number, block;prevrandao, block;timestamp .. index:: gasleft, msg;data, msg;sender, msg;sig, msg;value, tx;gasprice, tx;origin @@ -127,11 +142,12 @@ ABIのエンコード関数とデコード関数 - ``revert(string memory message)``: 実行を中止し、説明文字列を提供してステートの変化をリバートします。 -.. index:: cryptography, keccak256, sha256, ripemd160, ecrecover, addmod, mulmod +.. index:: cryptography, keccak256, sha256, ripemd160, ecrecover, addmod, mulmod, erc7201 数学的関数と暗号学的関数 ======================== +<<<<<<< HEAD - ``keccak256(bytes memory) returns (bytes32)``: 入力のKeccak-256ハッシュを計算します。 - ``sha256(bytes memory) returns (bytes32)``: 入力のSHA-256ハッシュを計算します。 @@ -143,6 +159,19 @@ ABIのエンコード関数とデコード関数 - ``addmod(uint x, uint y, uint k) returns (uint)``: 任意の精度で加算が実行され、 ``2**256`` で切り捨てられない ``(x + y) % k`` を計算します。バージョン0.5.0から ``k != 0`` であることをアサートします。 - ``mulmod(uint x, uint y, uint k) returns (uint)``: 任意の精度で乗算が実行され、 ``2**256`` で切り捨てられない ``(x * y) % k`` を計算します。バージョン0.5.0から ``k != 0`` であることをアサートします。 +======= +- ``keccak256(bytes memory) returns (bytes32)``: compute the Keccak-256 hash of the input +- ``sha256(bytes memory) returns (bytes32)``: compute the SHA-256 hash of the input +- ``ripemd160(bytes memory) returns (bytes20)``: compute the RIPEMD-160 hash of the input +- ``ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address)``: recover address associated with + the public key from elliptic curve signature, return zero on error +- ``addmod(uint x, uint y, uint k) returns (uint)``: compute ``(x + y) % k`` where the addition is performed with + arbitrary precision and does not wrap around at ``2**256``. Assert that ``k != 0`` starting from version 0.5.0. +- ``mulmod(uint x, uint y, uint k) returns (uint)``: compute ``(x * y) % k`` where the multiplication is performed + with arbitrary precision and does not wrap around at ``2**256``. Assert that ``k != 0`` starting from version 0.5.0. +- ``erc7201(string memory id) returns (uint)``: compute the base slot of an ``erc7201`` storage namespace. + Can be used in compile time context. +>>>>>>> english/develop .. index:: this, super, selfdestruct diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 9bd657ee24..ed6be8b2da 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -52,7 +52,8 @@ uint amount = pendingWithdrawals[msg.sender]; // Reentrancy攻撃を防ぐため、送金前にpendingしている返金の額をゼロにすることを忘れないでください pendingWithdrawals[msg.sender] = 0; - payable(msg.sender).transfer(amount); + (bool success, ) = payable(msg.sender).call{value: amount}(""); + require(success); } } @@ -79,8 +80,14 @@ function becomeRichest() public payable { if (msg.value <= mostSent) revert NotEnoughEther(); +<<<<<<< HEAD // この行は問題を引き起こす可能性があります(以下で説明します)。 richest.transfer(msg.value); +======= + // This line can cause problems (explained below). + (bool success, ) = richest.call{value: msg.value}(""); + require(success); +>>>>>>> english/develop richest = payable(msg.sender); mostSent = msg.value; } @@ -192,8 +199,10 @@ revert NotEnoughEther(); _; - if (msg.value > amount) - payable(msg.sender).transfer(msg.value - amount); + if (msg.value > amount) { + (bool success, ) = payable(msg.sender).call{value: msg.value - amount}(""); + require(success); + } } function forceOwnerChange(address newOwner) diff --git a/docs/conf.py b/docs/conf.py index 96d534cc5e..68b52706d8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -92,13 +92,15 @@ def get_github_username_repo(url): # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx_a4doc', + 'sphinx_syntax', 'html_extra_template_renderer', 'remix_code_links', 'sphinx.ext.imgconverter', ] -a4_base_path = os.path.dirname(__file__) + '/grammar' +syntax_base_path = 'grammar' +# generate link anchors compatible with Sphinx-A4Doc’s naming +syntax_a4doc_compat_links = True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -124,10 +126,12 @@ def get_github_username_repo(url): with open('../CMakeLists.txt', 'r', encoding='utf8') as f: version = re.search('PROJECT_VERSION "([^"]+)"', f.read()).group(1) # The full version, including alpha/beta/rc tags. -if not os.path.isfile('../prerelease.txt') or os.path.getsize('../prerelease.txt') == 0: +if os.path.isfile('../prerelease.txt') and os.path.getsize('../prerelease.txt') == 0: release = version +elif os.path.isfile('../prerelease.txt'): + with open('../prerelease.txt', 'r', encoding='utf8') as prerelease_file: + release = version + '-' + prerelease_file.read() else: - # This is a prerelease version release = version + '-develop' # The language for content autogenerated by Sphinx. Refer to documentation @@ -170,6 +174,10 @@ def get_github_username_repo(url): # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False +suppress_warnings = [ + # Suppress sphinx-syntax warnings, in particular `diagram descriptions can't have custom resolver_data` + 'sphinx_syntax', +] # -- Options for HTML output ---------------------------------------------- @@ -182,7 +190,8 @@ def get_github_username_repo(url): # documentation. html_theme_options = { 'logo_only': True, - 'display_version': True, + 'version_selector': True, + 'language_selector': True, } # Add any paths that contain custom themes here, relative to this directory. diff --git a/docs/contracts/custom-storage-layout.rst b/docs/contracts/custom-storage-layout.rst index 89890dadb2..55b9540260 100644 --- a/docs/contracts/custom-storage-layout.rst +++ b/docs/contracts/custom-storage-layout.rst @@ -23,8 +23,16 @@ .. As the above example shows, the specifier uses the ``layout at `` syntax and is located in the header of a contract definition. +<<<<<<< HEAD 上の例に示されているように、この指定子は ``layout at `` という構文を使用し、 コントラクト定義のヘッダー部分に記述されます。 +======= +The layout specifier can be placed either before or after the inheritance specifier, and can appear at most once. +The ``base-slot-expression`` must be an :ref:`integer literal` expression +that can be evaluated at compilation time and yields a value in the range of ``uint256``. +The use of constants initialized using such expressions and +the :ref:`built-in function erc7201` is also allowed. +>>>>>>> english/develop .. The layout specifier can be placed either before or after the inheritance specifier, and can appear at most once. .. The ``base-slot-expression`` must be an :ref:`integer literal` expression that can be evaluated at compilation time and yields a value in the range of ``uint256``. diff --git a/docs/contracts/functions.rst b/docs/contracts/functions.rst index bd13e14c26..af192ac131 100644 --- a/docs/contracts/functions.rst +++ b/docs/contracts/functions.rst @@ -430,6 +430,7 @@ receive Ether関数もpayable fallback関数も存在しない場合、コント - Etherの送信 .. warning:: +<<<<<<< HEAD .. When Ether is sent directly to a contract (without a function call, i.e. sender uses ``send`` or ``transfer``) but the receiving contract does not define a receive Ether function or a payable fallback function, an exception will be thrown, sending back the Ether (this was different before Solidity v0.4.0). .. If you want your contract to receive Ether, you have to implement a receive Ether function (using payable fallback functions for receiving Ether is not recommended, since the fallback is invoked and would not fail for interface confusions on the part of the sender). @@ -450,6 +451,20 @@ receive Ether関数もpayable fallback関数も存在しない場合、コント .. than the sum of some manual accounting implemented in a .. contract (i.e. having a counter updated in the receive Ether function). +======= + ``send()`` and ``transfer()`` are deprecated and scheduled for removal. + See the section on :ref:`send ` and :ref:`transfer ` for more information. + +.. warning:: + When Ether is sent directly to a contract (without a function call, i.e. sender uses ``send`` or ``transfer``) + but the receiving contract does not define a receive Ether function or a payable fallback function, + an exception will be thrown, sending back the Ether (this was different + before Solidity v0.4.0). If you want your contract to receive Ether, + you have to implement a receive Ether function (using payable fallback functions for receiving Ether is + not recommended, since the fallback is invoked and would not fail for interface confusions + on the part of the sender). + +>>>>>>> english/develop .. warning:: Etherを受け取る関数を持たないコントラクトは、 *coinbaseトランザクション* (別名: *minerブロックリワード* )の受信者として、または ``selfdestruct`` の宛先としてEtherを受け取ることができます。 @@ -581,8 +596,14 @@ fallback関数 // その上で ``send`` を呼び出すには ``address payable`` 型に変換する必要があります。 address payable testPayable = payable(address(test)); +<<<<<<< HEAD // 誰かがそのコントラクトにEtherを送ると、送金は失敗します。 // つまり、ここではfalseが返されます。 +======= + // If someone sends Ether to that contract, + // the transfer will fail, i.e. this returns false here. + // This will report a warning (deprecation) +>>>>>>> english/develop return testPayable.send(2 ether); } diff --git a/docs/contracts/inheritance.rst b/docs/contracts/inheritance.rst index 6eb7833059..2aec1623ee 100644 --- a/docs/contracts/inheritance.rst +++ b/docs/contracts/inheritance.rst @@ -402,8 +402,13 @@ Solidityは、ポリモーフィズムを含む多重継承をサポートして .. _modifier-overriding: +<<<<<<< HEAD モディファイアのオーバーライド ============================== +======= +Modifier Overriding (deprecated) +================================ +>>>>>>> english/develop .. Function modifiers can override each other. This works in the same way as .. :ref:`function overriding ` (except that there is no overloading for modifiers). The @@ -421,6 +426,7 @@ Solidityは、ポリモーフィズムを含む多重継承をサポートして contract Base { + // This will report a warning (deprecation) modifier foo() virtual {_;} } @@ -441,11 +447,13 @@ Solidityは、ポリモーフィズムを含む多重継承をサポートして contract Base1 { + // This will report a warning (deprecation) modifier foo() virtual {_;} } contract Base2 { + // This will report a warning (deprecation) modifier foo() virtual {_;} } @@ -454,6 +462,13 @@ Solidityは、ポリモーフィズムを含む多重継承をサポートして modifier foo() override(Base1, Base2) {_;} } +<<<<<<< HEAD +======= +.. warning:: + ``virtual`` modifiers are deprecated and scheduled for removal. + + +>>>>>>> english/develop .. index:: ! constructor .. _constructor: diff --git a/docs/contributing.rst b/docs/contributing.rst index b265a76663..1cdcc29e97 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -7,7 +7,21 @@ Solidityに貢献するための選択肢はたくさんあります。 特に、以下の領域でのサポートに感謝します。 +<<<<<<< HEAD * イシューの報告。 +======= +* Reporting issues. +* Fixing and responding to `Solidity's GitHub issues + `_, especially those tagged as + `"good first issue" `_ which are + meant as introductory issues for external contributors. +* Improving the documentation. +* `Translating `_ the documentation into more languages. +* Responding to questions from other users on `StackExchange + `_ and the `Solidity Gitter Chat + `_. +* Getting involved in the language design process by proposing language changes or new features in the `Solidity forum `_ and providing feedback. +>>>>>>> english/develop * `SolidityのGitHubイシュー `_ (特に「 `good first issue `_ 」タグの付いた、外部の貢献者のための入門的なイシュー)の修正と対応。 @@ -22,10 +36,22 @@ Solidityに貢献するための選択肢はたくさんあります。 .. To get started, you can try :ref:`building-from-source` in order to familiarize yourself with the components of Solidity and the build process. .. Also, it may be useful to become well-versed at writing smart-contracts in Solidity. +<<<<<<< HEAD まずは :ref:`building-from-source` を使って、Solidityのコンポーネントやビルドプロセスに慣れてみてください。 また、Solidityでのスマートコントラクトの書き方を熟知することも有効でしょう。 .. Please note that this project is released with a `Contributor Code of Conduct `_. By participating in this project — in the issues, pull requests, or Gitter channels — you agree to abide by its terms. +======= +New topics can be freely added to the `agenda `_ +and will be scheduled for discussion on the nearest call. + +How to Report Issues +==================== + +To report an issue, please use the +`GitHub issues tracker `_. When +reporting issues, please mention the following details: +>>>>>>> english/develop このプロジェクトは `Contributor Code of Conduct `_ 付きで公開されていることにご注意ください。 イシュー、プルリクエスト、Gitterチャンネルなど、このプロジェクトに参加することで、その条件を守ることに同意したことになります。 @@ -51,6 +77,7 @@ Solidityに貢献するための選択肢はたくさんあります。 問題を報告するには、 `GitHubイシュートラッカー `_ を利用してください。 報告の際には、以下の内容をお知らせください。 +<<<<<<< HEAD * Solidityのバージョン。 * ソースコード(必要に応じて)。 * オペレーティングシステム。 @@ -58,15 +85,50 @@ Solidityに貢献するための選択肢はたくさんあります。 * 実際の挙動と期待される挙動の比較。 .. Reducing the source code that caused the issue to a bare minimum is always very helpful and sometimes even clarifies a misunderstanding. +======= +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. + +We highly recommend going through our `review checklist `_ before submitting the pull request. +We thoroughly review every PR and will help you get it right, but there are many common problems that can be easily avoided, making the review much smoother. +>>>>>>> english/develop イシューの原因となったソースコードを最小限に減らすことは、常に非常に役に立ち、時には誤解を解くことにもなります。 +<<<<<<< HEAD .. For technical discussions about language design, a post in the `Solidity forum `_ is the correct place (see :ref:`solidity_language_design`). +======= +AI-Assisted Contributions +========================= + +We do not ban the use of AI tools, but we hold all contributions to the same high standard +regardless of how they are produced, and we require full transparency about their use. + +Submitting AI-generated code means you have reviewed it, understand it, can explain it, and have +tested it as thoroughly as if you had written it by hand. + +If you used AI tools to generate code, tests, or documentation in any part of your contribution, +disclosure in the pull request is mandatory. +If we determine that a PR contains undisclosed AI-generated content, we may close it. + + +Running the Compiler Tests +========================== +>>>>>>> english/develop 言語設計に関する技術的な議論については、 `Solidity forum `_ への投稿が正しい場所です( :ref:`solidity_language_design` を参照してください)。 +<<<<<<< HEAD プルリクエストのワークフロー ============================ +======= +For running all compiler tests you may want to optionally install a few +dependencies (`evmone `_, +`z3 `_, `Eldarica `_, +`cvc5 `). +>>>>>>> english/develop .. In order to contribute, please fork off of the ``develop`` branch and make your changes there. .. Your commit messages should detail *why* you made your change in addition to *what* you did (unless it is a tiny change). @@ -82,7 +144,12 @@ Solidityに貢献するための選択肢はたくさんあります。 .. Additionally, if you are writing a new feature, please ensure you add appropriate test cases under ``test/`` (see below). +<<<<<<< HEAD また、新機能を書いている場合は、 ``test/`` の下に適切なテストケースを追加してください(下記を参照してください)。 +======= +The test system automatically tries to discover the location of +the `evmone `_ for running the semantic tests. +>>>>>>> english/develop .. However, if you are making a larger change, please consult with the `Solidity Development Gitter channel `_ (different from the one mentioned above — this one is focused on compiler and language development instead of language usage) first. @@ -387,8 +454,15 @@ CIは、Emscriptenターゲットのコンパイルを必要とする追加の コマンドラインテスト -------------------- +<<<<<<< HEAD .. Our suite of end-to-end command-line tests checks the behaviour of the compiler binary as a whole in various scenarios. .. These tests are located in `test/cmdlineTests/ `_, one per subdirectory, and can be executed using the ``cmdlineTests.sh`` script. +======= +Our suite of end-to-end command-line tests checks the behaviour of the compiler binary as a whole +in various scenarios. +These tests are located in `test/cmdlineTests/ `_, +one per subdirectory, and can be executed using the ``cmdlineTests.sh`` script. +>>>>>>> english/develop エンドツーエンドのコマンドラインテストスイートは、様々なシナリオにおけるコンパイラバイナリ全体の動作をチェックします。 これらのテストは `test/cmdlineTests/ `_ にサブディレクトリごとに1つずつあり、 ``cmdlineTests.sh`` スクリプトを使って実行できます。 @@ -760,13 +834,25 @@ Solidityの言語設計 言語設計のプロセスに積極的に参加し、Solidityの将来に関するアイデアを共有するには、 `Solidityフォーラム `_ に参加してください。 +<<<<<<< HEAD .. The Solidity forum serves as the place to propose and discuss new language features and their implementation in the early stages of ideation or modifications of existing features. +======= +As soon as proposals get more tangible, their +implementation will also be discussed in the `Solidity GitHub repository `_ +in the form of issues. +>>>>>>> english/develop Solidityフォーラムは、新しい言語機能やその実装のアイデアの初期段階や、既存の機能の修正を提案し、議論する場として機能しています。 .. As soon as proposals get more tangible, their implementation will also be discussed in the `Solidity GitHub repository `_ in the form of issues. +<<<<<<< HEAD 提案が具体的になれば、その実現に向けて `SolidityのGitHubリポジトリ `_ でもイシューという形で議論されます。 +======= +If you want to know where the team is standing in terms of implementing new features, you can follow the implementation status in the `Solidity GitHub project `_. +Issues in the design backlog need further specification and will either be discussed in a language design call or in a regular team call. You can +see the upcoming changes for the next breaking release by changing from the default branch (`develop`) to the `breaking branch `_. +>>>>>>> english/develop .. In addition to the forum and issue discussions, we regularly host language design discussion calls in which selected topics, issues or feature implementations are debated in detail. .. The invitation to those calls is shared via the forum. diff --git a/docs/control-structures.rst b/docs/control-structures.rst index ba9e0faefe..d98bf12df7 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -787,14 +787,21 @@ You can optionally provide a message string or a custom error to ``require``, bu :force: // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.5.0 <0.9.0; + pragma solidity >=0.6.2 <0.9.0; contract Sharer { function sendHalf(address payable addr) public payable returns (uint balance) { require(msg.value % 2 == 0, "Even value required."); uint balanceBeforeTransfer = address(this).balance; +<<<<<<< HEAD addr.transfer(msg.value / 2); // transferに失敗すると例外がスローされ、ここにコールバックすることはできないので、半分のEtherを送金せず保持する方法はないはずです。 +======= + (bool success, ) = addr.call{value: msg.value / 2}(""); + require(success); + // Since require will stop execution and revert if success is false, + // there should be no way for us to still have half of the Ether. +>>>>>>> english/develop assert(address(this).balance == balanceBeforeTransfer - msg.value / 2); return address(this).balance; } @@ -878,7 +885,8 @@ You can optionally provide a message string or a custom error to ``require``, bu if (msg.sender != owner) revert Unauthorized(); - payable(msg.sender).transfer(address(this).balance); + (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); + require(success); } } @@ -1031,9 +1039,20 @@ Solidityでは、エラーの種類に応じて様々な種類のキャッチブ .. The caller always retains at least 1/64th of the gas in a call and thus even if the called contract goes out of gas, the caller still has some gas left. .. note:: +<<<<<<< HEAD 失敗したコールの原因はさまざまです。 エラーメッセージが呼び出されたコントラクトから直接来ていると思わないでください。 エラーはコールチェーンのより深いところで発生し、呼び出されたコントラクトがそれをフォワードしただけかもしれません。 また、意図的なエラー状態ではなく、ガス欠状態が原因である可能性もあります。 コール側は常に1/64以上のガスを保持しているため、コールされたコントラクトがガス欠になっても、コール側にはガスが残っています。 +======= + The reason behind a failed call can be manifold. Do not assume that + the error message is coming directly from the called contract: + The error might have happened deeper down in the call chain and the + called contract just forwarded it. Also, it could be due to an + out-of-gas situation and not a deliberate error condition: + The caller always retains at least 1/64th of the gas in a call and thus + even if the called contract goes out of gas, the caller still + has some gas left. +>>>>>>> english/develop diff --git a/docs/examples/blind-auction.rst b/docs/examples/blind-auction.rst index 698f9e6676..d002241378 100644 --- a/docs/examples/blind-auction.rst +++ b/docs/examples/blind-auction.rst @@ -94,14 +94,27 @@ function withdraw() external returns (bool) { uint amount = pendingReturns[msg.sender]; if (amount > 0) { +<<<<<<< HEAD // 受信者は `send` が戻る前に、受信コールの一部としてこの関数を再び呼び出すことができるので、これをゼロに設定することが重要です。 +======= + // It is important to set this to zero because the recipient + // can call this function again as part of the receiving call + // before `call` returns. +>>>>>>> english/develop pendingReturns[msg.sender] = 0; // msg.sender is not of type `address payable` and must be // explicitly converted using `payable(msg.sender)` in order +<<<<<<< HEAD // use the member function `send()`. if (!payable(msg.sender).send(amount)) { // ここでコールを投げる必要はなく、ただリセットすれば良いです。 +======= + // use the member function `call()`. + (bool success, ) = payable(msg.sender).call{value: amount}(""); + if (!success) { + // No need to call throw here, just reset the amount owing +>>>>>>> english/develop pendingReturns[msg.sender] = amount; return false; } @@ -128,8 +141,14 @@ ended = true; emit AuctionEnded(highestBidder, highestBid); +<<<<<<< HEAD // 3. インタラクション beneficiary.transfer(highestBid); +======= + // 3. Interaction + (bool success, ) = beneficiary.call{value: highestBid}(""); + require(success); +>>>>>>> english/develop } } @@ -262,18 +281,27 @@ Ethereumでは価値の移転はブラインドできないため、誰でも価 // 送信者が同じデポジットを再クレームできないようにします。 bidToCheck.blindedBid = bytes32(0); } - payable(msg.sender).transfer(refund); + (bool success, ) = payable(msg.sender).call{value: refund}(""); + require(success); } /// オーバーな入札を引き出す。 function withdraw() external { uint amount = pendingReturns[msg.sender]; if (amount > 0) { +<<<<<<< HEAD // これをゼロに設定することが重要です。 // なぜなら、受信者は `transfer` が戻る前にリシーブしているコールの一部としてこの関数を再び呼び出すことができるからです(前で述べた 条件 -> エフェクト -> インタラクション に関する記述を参照してください)。 +======= + // It is important to set this to zero because the recipient + // can call this function again as part of the receiving call + // before `call` returns (see the remark above about + // conditions -> effects -> interaction). +>>>>>>> english/develop pendingReturns[msg.sender] = 0; - payable(msg.sender).transfer(amount); + (bool success, ) = payable(msg.sender).call{value: amount}(""); + require(success); } } @@ -285,7 +313,8 @@ Ethereumでは価値の移転はブラインドできないため、誰でも価 if (ended) revert AuctionEndAlreadyCalled(); emit AuctionEnded(highestBidder, highestBid); ended = true; - beneficiary.transfer(highestBid); + (bool success, ) = beneficiary.call{value: highestBid}(""); + require(success); } // これは「内部」関数であり、コントラクト自身(または派生コントラクト)からしか呼び出すことができないことを意味します。 diff --git a/docs/examples/micropayment.rst b/docs/examples/micropayment.rst index deccbd854f..d9fdf680da 100644 --- a/docs/examples/micropayment.rst +++ b/docs/examples/micropayment.rst @@ -156,7 +156,8 @@ web3.jsが生成する署名は、 ``r`` 、 ``s`` 、 ``v`` を連結したも // this recreates the message that was signed on the client bytes32 message = prefixed(keccak256(abi.encodePacked(msg.sender, amount, nonce, this))); require(recoverSigner(message, signature) == owner); - payable(msg.sender).transfer(amount); + (bool success, ) = payable(msg.sender).call{value: amount}(""); + require(success); } /// freeze the contract and reclaim the leftover funds. @@ -166,7 +167,8 @@ web3.jsが生成する署名は、 ``r`` 、 ``s`` 、 ``v`` を連結したも { require(msg.sender == owner); freeze(); - payable(msg.sender).transfer(address(this).balance); + (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); + require(success); } /// signature methods. @@ -362,9 +364,11 @@ Solidityの関数 ``isValidSignature`` と ``recoverSigner`` は、前のセク require(msg.sender == recipient); require(isValidSignature(amount, signature)); - recipient.transfer(amount); freeze(); - sender.transfer(address(this).balance); + (bool success, ) = recipient.call{value: amount}(""); + require(success); + (success, ) = sender.call{value: address(this).balance}(""); + require(success); } /// 送信者はいつでも有効期限を延長できます。 @@ -385,7 +389,8 @@ Solidityの関数 ``isValidSignature`` と ``recoverSigner`` は、前のセク { require(block.timestamp >= expiration); freeze(); - sender.transfer(address(this).balance); + (bool success, ) = sender.call{value: address(this).balance}(""); + require(success); } function isValidSignature(uint256 amount, bytes memory signature) diff --git a/docs/examples/safe-remote.rst b/docs/examples/safe-remote.rst index 97d186524a..6a8eb71ad0 100644 --- a/docs/examples/safe-remote.rst +++ b/docs/examples/safe-remote.rst @@ -87,9 +87,18 @@ { emit Aborted(); state = State.Inactive; +<<<<<<< HEAD // ここではtransferを直接使っています。 // この関数の最後のコールであり、すでに状態を変更しているため、reentrancy-safeになっています。 seller.transfer(address(this).balance); +======= + // We use call here directly. It is + // reentrancy-safe, because it is the + // last call in this function and we + // already changed the state. + (bool success, ) = seller.call{value: address(this).balance}(""); + require(success); +>>>>>>> english/develop } /// 買い手として購入を確認します。 @@ -114,11 +123,18 @@ inState(State.Locked) { emit ItemReceived(); +<<<<<<< HEAD // 最初に状態を変更することが重要です。 // そうしないと、以下の `send` を使用して呼び出されたコントラクトが、ここで再び呼び出される可能性があるからです。 +======= + // It is important to change the state first because + // otherwise, the contracts called using `call` below + // can call in again here. +>>>>>>> english/develop state = State.Release; - buyer.transfer(value); + (bool success, ) = buyer.call{value: value}(""); + require(success); } /// この機能は、売り手に返金する、つまり売り手のロックされた資金を払い戻すものです。 @@ -128,13 +144,19 @@ inState(State.Release) { emit SellerRefunded(); +<<<<<<< HEAD // otherwise, the contracts called using `send` below +======= + // It is important to change the state first because + // otherwise, the contracts called using `call` below +>>>>>>> english/develop // can call in again here. // 最初に状態を変更することが重要です。 // そうしないと、以下の `send` を使用して呼び出されたコントラクトが、ここで再び呼び出される可能性があるからです。 state = State.Inactive; - seller.transfer(3 * value); + (bool success, ) = seller.call{value: 3 * value}(""); + require(success); } } diff --git a/docs/grammar.rst b/docs/grammar.rst index 4dcb3eedcb..bbb48d9f84 100644 --- a/docs/grammar.rst +++ b/docs/grammar.rst @@ -2,13 +2,13 @@ 言語の文法 ********** -.. a4:autogrammar:: SolidityParser - :only-reachable-from: SolidityParser.sourceUnit +.. syntax:autogrammar:: SolidityParser.g4 + :root-rule: SolidityParser.sourceUnit :undocumented: :cc-to-dash: -.. a4:autogrammar:: SolidityLexer - :only-reachable-from: SolidityParser.sourceUnit +.. syntax:autogrammar:: SolidityLexer.g4 + :root-rule: SolidityParser.sourceUnit :fragments: :cc-to-dash: diff --git a/docs/grammar/SolidityLexer.g4 b/docs/grammar/SolidityLexer.g4 index 716de30422..04e1c300a4 100644 --- a/docs/grammar/SolidityLexer.g4 +++ b/docs/grammar/SolidityLexer.g4 @@ -297,7 +297,7 @@ YulHex: 'hex'; YulEVMBuiltin: 'stop' | 'add' | 'sub' | 'mul' | 'div' | 'sdiv' | 'mod' | 'smod' | 'exp' | 'not' | 'lt' | 'gt' | 'slt' | 'sgt' | 'eq' | 'iszero' | 'and' | 'or' | 'xor' | 'byte' - | 'shl' | 'shr' | 'sar' | 'addmod' | 'mulmod' | 'signextend' | 'keccak256' + | 'shl' | 'shr' | 'sar' | 'clz' | 'addmod' | 'mulmod' | 'signextend' | 'keccak256' | 'pop' | 'mload' | 'mstore' | 'mstore8' | 'sload' | 'sstore' | 'tload' | 'tstore'| 'msize' | 'gas' | 'address' | 'balance' | 'selfbalance' | 'caller' | 'callvalue' | 'calldataload' | 'calldatasize' | 'calldatacopy' | 'extcodesize' | 'extcodecopy' | 'returndatasize' diff --git a/docs/index.rst b/docs/index.rst index 8125bd3b28..54a4cf583f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,10 +12,18 @@ Solidityは、静的型付け、継承、ライブラリ、複雑なユーザー Solidityでは、投票、クラウドファンディング、ブラインドオークション、マルチシグネチャウォレットなどの用途に応じたコントラクトを作成できます。 +<<<<<<< HEAD コントラクトをデプロイする際には、Solidityの最新のリリースバージョンを使用すべきです。 例外的なケースを除いて、最新バージョンには `セキュリティフィックス `_ が施されています。 さらに、破壊的な変更や新機能も定期的に導入されています。 私たちは現在、 `この速いペースでの変更を示すため `_ に、0.y.zというバージョン番号を使用しています。 +======= +When deploying contracts, you should use the latest released version of Solidity. +Apart from exceptional cases, only the latest version receives +`security fixes `_. +Furthermore, breaking changes, as well as new features, are introduced regularly. +We currently use a 0.y.z version number `to indicate this fast pace of change `_. +>>>>>>> english/develop .. warning:: diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index 872d8ad97d..5baea27550 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -12,9 +12,18 @@ Solidityコンパイラのインストール .. In addition, patch-level releases with major release 0 (i.e. 0.x.y) will not contain breaking changes. .. That means code that compiles with version 0.x.y can be expected to compile with 0.x.z where z > y. +<<<<<<< HEAD Solidityのバージョンは `セマンティックバージョニング `_ に従っています。 さらに、メジャーリリース0(つまり0.x.y)のパッチレベルのリリースには、破壊的な変更が含まれません。 つまり、バージョン0.x.yでコンパイルされたコードは、0.x.z(z > y)でコンパイルされることが期待できます。 +======= +In addition to releases, we provide **prereleases** and **nightly development builds** to make it +easy for developers to try out upcoming features and provide early feedback. +Note that such builds contain bleeding-edge code from the development branch and are not guaranteed +to be of the same quality as full releases. +Despite our best efforts, they might contain undocumented and/or broken changes that will not +become a part of an actual release. They are not meant for production use. +>>>>>>> english/develop .. In addition to releases, we provide **nightly development builds** to make it easy for developers to try out upcoming features and provide early feedback. .. Note, however, that while the nightly builds are usually very stable, they contain bleeding-edge code from the development branch and are not guaranteed to be always working. @@ -39,9 +48,16 @@ Remix *小規模なコントラクトやSolidityを短期間で習得するにはRemixをお勧めします。* +<<<<<<< HEAD `Remixにオンラインでアクセスする `_ 場合、何もインストールする必要はありません。 インターネットに接続せずに使用したい場合は、https://github.com/ethereum/remix-live/tree/gh-pages#readme に行き、そのページの指示に従ってください。 Remixは、複数のSolidityバージョンをインストールせずにnightlyビルドをテストするのに便利なオプションでもあります。 +======= +`Access Remix online `_, you do not need to install anything. +If you want to use it without connection to the Internet, download Remix Desktop from `the releases page `_. +Remix is also a convenient option for testing nightly builds +without installing multiple Solidity versions. +>>>>>>> english/develop このページの他のオプションでは、お使いのコンピュータにコマンドラインのSolidityコンパイラソフトウェアをインストールする方法について説明しています。 大規模なコントラクトに取り組む場合や、より多くのコンパイルオプションを必要とする場合は、コマンドラインコンパイラを選択してください。 @@ -51,10 +67,19 @@ Remixは、複数のSolidityバージョンをインストールせずにnightly npm / Node.js ============= +<<<<<<< HEAD ``solcjs`` プログラムは、Solidityのコンパイラである ``solcjs`` をインストールするための便利でポータブルな方法として使用します。 また、 ``solcjs`` プログラムは、このページの下の方で説明されているコンパイラへのアクセス方法よりも機能が少なくなっています。 :ref:`commandline-compiler` のドキュメントでは、フル機能のコンパイラである ``solc`` を使用していることを前提としています。 ``solcjs`` の使い方は、独自の `リポジトリ `_ の中で説明されています。 +======= +Use ``npm`` for a convenient and portable way to install ``solcjs``, a Solidity compiler. The +``solcjs`` program has fewer features than the ways to access the compiler described +further down this page. The +:ref:`commandline-compiler` documentation assumes you are using +the full-featured compiler, ``solc``. The usage of ``solcjs`` is documented inside its own +`repository `_. +>>>>>>> english/develop 注: ``solc-js`` プロジェクトは、Emscriptenを使用してC++ ``solc`` から派生しており、両者は同じコンパイラのソースコードを使用しています。 ``solc-js`` はJavaScriptプロジェクト(Remixなど)で直接使用できます。 @@ -73,24 +98,35 @@ npm / Node.js Docker ====== +<<<<<<< HEAD SolidityのビルドのDockerイメージは、 ``ethereum`` オーガナイゼーションの ``solc`` イメージを使って利用できます。 最新のリリースバージョンには ``stable`` タグを、 ``develop`` ブランチの不安定な可能性のある変更には ``nightly`` タグを使用してください。 +======= +Docker images of Solidity builds are available using the `solc `_ image from the argotorg organization on ghcr.io. +Use the ``stable`` tag for the latest released version, and ``nightly`` for potentially unstable changes in the ``develop`` branch. +>>>>>>> english/develop Dockerイメージはコンパイラ実行ファイルを実行するので、すべてのコンパイラ引数を渡すことができます。 例えば、以下のコマンドは、ステーブル版の ``solc`` イメージ(まだ持っていない場合)を取り出し、 ``--help`` 引数を渡して新しいコンテナで実行します。 .. code-block:: bash - docker run ethereum/solc:stable --help + docker run ghcr.io/argotorg/solc:stable --help .. note:: .. Specific compiler versions are supported as the Docker image tag such as ``ethereum/solc:0.8.23``. .. We will be passing the ``stable`` tag here instead of specific version tag to ensure that users get .. the latest version by default and avoid the issue of an out-of-date version. +<<<<<<< HEAD 特定のコンパイラバージョンは ``ethereum/solc:0.8.23`` のように Docker イメージのタグとして指定できます。 ここでは特定のバージョンタグの代わりに ``stable`` タグを使用することで、 ユーザーがデフォルトで最新バージョンを取得できるようにし、古いバージョンによる問題を回避します。 +======= + Specific compiler versions are supported as the Docker image tag such as ``ghcr.io/argotorg/solc:0.8.23``. + We will be passing the ``stable`` tag here instead of specific version tag to ensure that users get + the latest version by default and avoid the issue of an out-of-date version. +>>>>>>> english/develop ホストマシンでSolidityのファイルをコンパイルするためにDockerイメージを使用するには、入出力用のローカルフォルダーをマウントし、コンパイルするコントラクトを指定します。 例えば、以下のようになります: @@ -99,7 +135,7 @@ Dockerイメージはコンパイラ実行ファイルを実行するので、 docker run \ --volume "/tmp/some/local/path/:/sources/" \ - ethereum/solc:stable \ + ghcr.io/argotorg/solc:stable \ /sources/Contract.sol \ --abi \ --bin \ @@ -110,40 +146,57 @@ Dockerイメージはコンパイラ実行ファイルを実行するので、 .. code-block:: bash - docker run ethereum/solc:stable --standard-json < input.json > output.json + docker run ghcr.io/argotorg/solc:stable --standard-json < input.json > output.json Linuxパッケージ =============== +<<<<<<< HEAD `solidity/releases `_ ではSolidityのバイナリパッケージが用意されています。 また、Ubuntu用のPPAも用意しているので、以下のコマンドで最新のステーブル版を入手できます。 +======= +We provide :ref:`standalone binaries ` of the compiler that should run on most +distributions without any additional installation steps. -.. code-block:: bash +Ubuntu packages for versions up to 0.8.30 are available in the +`ethereum/ethereum PPA `_. +However, we have discontinued this distribution method and future versions will not be added there. +>>>>>>> english/develop + +Some Linux distributions provide their own packages. +These packages are not directly maintained by us but usually kept up-to-date by the respective +package maintainers. - sudo add-apt-repository ppa:ethereum/ethereum - sudo apt-get update - sudo apt-get install solc +Unofficial, community-maintained scripts for building and installing the compiler are also +available for some distributions: +<<<<<<< HEAD nightlyバージョンは、以下のコマンドでインストールできます。 +======= +- Arch Linux / (AUR): +>>>>>>> english/develop -.. code-block:: bash + - `solidity `_ (builds from source), + - `solidity-bin `_ (uses our standalone binaries). - sudo add-apt-repository ppa:ethereum/ethereum - sudo add-apt-repository ppa:ethereum/ethereum-dev - sudo apt-get update - sudo apt-get install solc +- Nix: +<<<<<<< HEAD さらに、一部のLinuxディストリビューションでは、独自のパッケージが提供されています。 これらのパッケージは私たちが直接メンテナンスしているわけではありませんが、基本的にそれぞれのパッケージメンテナによって最新に保たれています。 例えば、Arch Linuxでは、最新の開発版のパッケージがAURパッケージとして用意されています。 `solidity `_ と `solidity-bin `_ です。 +======= + - `solc.nix `_ (builds from source). +>>>>>>> english/develop .. note:: `AUR `_ パッケージはユーザーが作成したコンテンツであり、非公式パッケージです。 使用する際には注意してください。 +<<<<<<< HEAD .. There is also a `snap package `_, however, it is **currently unmaintained**. .. It is installable in all the `supported Linux distros `_. .. To install the latest stable version of solc: @@ -151,6 +204,15 @@ nightlyバージョンは、以下のコマンドでインストールできま `snapパッケージ `_ もありますが、 **現在メンテナンスされていません** 。 `サポートされているLinuxディストリビューション `_ すべてでインストール可能です。 最新の安定版のsolcをインストールするには: +======= + Please be aware that these scripts are produced and maintained by users and not vetted in any + way by the distro maintainers. + Exercise caution when using them. + +There is also a `snap package `_, however, it is **currently unmaintained**. +It is installable in all the `supported Linux distros `_. To +install the latest stable version of solc: +>>>>>>> english/develop .. code-block:: bash @@ -203,8 +265,15 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom # eg. Install 0.4.8 brew install solidity.rb +<<<<<<< HEAD 静的バイナリ ============ +======= +.. _static-binaries: + +Static Binaries +=============== +>>>>>>> english/develop `solc-bin`_ では、サポートしているすべてのプラットフォーム用の過去および現在のコンパイラバージョンの静的ビルドを含むリポジトリを管理しています。 ここにはnightlyビルドも置かれています。 @@ -245,6 +314,7 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom これは次のことを意味します。 +<<<<<<< HEAD - 同じディレクトリに `solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js `_ という名前でバイナリが置かれています。 このファイルはシンボリックリンクになっている可能性があるので、git を使ってダウンロードしていない場合やファイルシステムがシンボリックリンクをサポートしていない場合は、自分で解決する必要があります。 - このバイナリは https://binaries.soliditylang.org/emscripten-wasm32/solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js にもミラーされています。この場合、git は必要ありません。シンボリックリンクは透過的に解決され、ファイルのコピーを提供するか HTTP リダイレクトを返します。 @@ -255,11 +325,29 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom - keccak256ハッシュを ``0x300330ecd127756b824aa13e843cb1f43c473cb22eaf3750d5fb9c99279af8c3`` と比較することで、バイナリの完全性を確認できます。ハッシュは、 `sha3sum`_ が提供する ``keccak256sum`` ユーティリティーを使ってコマンドラインで計算するか、JavaScriptで `keccak256() function from ethereumjs-util`_ を使って計算できます。 - また、sha256ハッシュを ``0x2b55ed5fec4d9625b6c7b3ab1abd2b7fb7dd2a9c68543bf0323db2c7e2d55af2`` と比較することで、バイナリの完全性を確認できます。 +======= +- You can find the binary in the same directory under the name + `solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js `_. + Note that the file might be a symlink, and you will need to resolve it yourself if you are not using + git to download it or your file system does not support symlinks. +- The binary is also mirrored at https://binaries.soliditylang.org/emscripten-wasm32/solc-emscripten-wasm32-v0.7.4+commit.3f05b770.js. + In this case git is not necessary and symlinks are resolved transparently, either by serving a copy + of the file or returning a HTTP redirect. +- The file is also available on IPFS at `QmTLs5MuLEWXQkths41HiACoXDiH8zxyqBHGFDRSzVE5CS`_. + Please, be aware that the order of items in the ``urls`` array is not predetermined or guaranteed and users should not rely on it. +- You can verify the integrity of the binary by comparing its keccak256 hash to + ``0x300330ecd127756b824aa13e843cb1f43c473cb22eaf3750d5fb9c99279af8c3``. The hash can be computed + on the command-line using ``keccak256sum`` utility provided by `sha3sum`_ or `keccak256() function + from ethereumjs-util`_ in JavaScript. +- You can also verify the integrity of the binary by comparing its sha256 hash to + ``0x2b55ed5fec4d9625b6c7b3ab1abd2b7fb7dd2a9c68543bf0323db2c7e2d55af2``. +>>>>>>> english/develop .. warning:: 強い後方互換性の要求により、リポジトリにはいくつかのレガシー要素が含まれていますが、新しいツールを書く際にはそれらを使用しないようにしてください。 +<<<<<<< HEAD - 最高のパフォーマンスを求めるのであれば、 ``bin/`` ではなく ``emscripten-wasm32/`` ( ``emscripten-asmjs/`` へのフォールバック機能あり)を使用してください。バージョン0.6.1まではasm.jsのバイナリのみを提供していました。 0.6.2からは、パフォーマンスが大幅に向上した `WebAssembly builds`_ に切り替えました。古いバージョンを wasm 用に作り直しましたが、オリジナルの asm.js ファイルは ``bin/`` に残っています。 新しいファイルは、名前の衝突を避けるために別のディレクトリに置く必要がありました。 - wasmとasm.jsのどちらのバイナリをダウンロードしているかを確認したい場合は、 ``bin/`` と ``wasm/`` ディレクトリではなく、 ``emscripten-asmjs/`` と ``emscripten-wasm32/`` を使用してください。 @@ -275,10 +363,39 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom 使用している場合は、ドロップインで置き換え可能な https://binaries.soliditylang.org に切り替えてください。 これにより、基盤となるホスティングの変更を透明性のある方法で行い、混乱を最小限に抑えることができます。 私たちがコントロールできない ``ethereum.github.io`` ドメインとは異なり、 ``binaries.soliditylang.org`` は長期的に機能し、同じURL構造を維持することが保証されています。 +======= + - Use ``emscripten-wasm32/`` (with a fallback to ``emscripten-asmjs/``) instead of ``bin/`` if + you want the best performance. Until version 0.6.1 we only provided asm.js binaries. + Starting with 0.6.2 we switched to `WebAssembly builds`_ with much better performance. We have + rebuilt the older versions for wasm but the original asm.js files remain in ``bin/``. + The new ones had to be placed in a separate directory to avoid name clashes. + - Use ``emscripten-asmjs/`` and ``emscripten-wasm32/`` instead of ``bin/`` and ``wasm/`` directories + if you want to be sure whether you are downloading a wasm or an asm.js binary. + - Use ``list.json`` instead of ``list.js`` and ``list.txt``. The JSON list format contains all + the information from the old ones and more. + +.. warning:: + - The solc-bin.ethereum.org domain is no longer supported. Going forward, + we recommend any tools which are still using it as the source of Solidity binaries + to switch to binaries.soliditylang.org. + +.. warning:: + + The binaries are also available at https://argotorg.github.io/solc-bin/ but this page + stopped being updated just after the release of version 0.7.2, will not receive any new releases + or nightly builds for any platform and does not serve the new directory structure, including + non-emscripten builds. + + If you are using it, please switch to https://binaries.soliditylang.org, which is a drop-in + replacement. This allows us to make changes to the underlying hosting in a transparent way and + minimize disruption. Unlike the ``argotorg.github.io`` domain, which we do not have any control + over, ``binaries.soliditylang.org`` is guaranteed to work and maintain the same URL structure + in the long-term. +>>>>>>> english/develop .. _IPFS: https://ipfs.io -.. _solc-bin: https://github.com/ethereum/solc-bin/ -.. _Solidity release page on GitHub: https://github.com/ethereum/solidity/releases +.. _solc-bin: https://github.com/argotorg/solc-bin/ +.. _Solidity release page on GitHub: https://github.com/argotorg/solidity/releases .. _sha3sum: https://github.com/maandree/sha3sum .. _keccak256() function from ethereumjs-util: https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/modules/_hash_.md#const-keccak256 .. _WebAssembly builds: https://emscripten.org/docs/compiling/WebAssembly.html @@ -292,6 +409,7 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom 前提知識 - 全オペレーティングシステム共通 ----------------------------------------- +<<<<<<< HEAD 以下は、Solidityのすべてのビルドに依存しています。 +----------------------------------------------------------+-------------------------------------------------------+ @@ -305,6 +423,23 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom +----------------------------------------------------------+-------------------------------------------------------+ | `z3`_ (バージョン4.8.16+, オプション) | SMTチェッカーと併用する場合。 | +----------------------------------------------------------+-------------------------------------------------------+ +======= +.. Note: This has to be kept in sync with `scripts/ci/install_and_check_minimum_requirements.sh`. + ++-----------------------------------+-------------------------------------------------------+ +| Software | Notes | ++===================================+=======================================================+ +| `CMake`_ (version 3.21.3+ on | Cross-platform build file generator. | +| Windows, 3.13+ otherwise) | | ++-----------------------------------+-------------------------------------------------------+ +| `Boost`_ (version 1.77+ on | C++ libraries. | +| Windows, 1.83+ otherwise) | | ++-----------------------------------+-------------------------------------------------------+ +| `Git`_ | Command-line tool for retrieving source code. | ++-----------------------------------+-------------------------------------------------------+ +| `z3`_ (version 4.8.16+, Optional) | For use with SMT checker. | ++-----------------------------------+-------------------------------------------------------+ +>>>>>>> english/develop .. _Git: https://git-scm.com/download .. _Boost: https://www.boost.org @@ -328,11 +463,23 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom ただし、この場合、SMT テストをスキップするために ``scripts/tests.sh`` に ``--no-smt`` オプションを渡すことを忘れないでください。 .. note:: +<<<<<<< HEAD .. By default the build is performed in *pedantic mode*, which enables extra warnings and tells the compiler to treat all warnings as errors. .. This forces developers to fix warnings as they arise, so they do not accumulate "to be fixed later". .. If you are only interested in creating a release build and do not intend to modify the source code to deal with such warnings, you can pass ``-DPEDANTIC=OFF`` option to CMake to disable this mode. .. Doing this is not recommended for general use but may be necessary when using a toolchain we are not testing with or trying to build an older version with newer tools. .. If you encounter such warnings, please consider `reporting them `_. +======= + By default the build is performed in *pedantic mode*, which enables extra warnings and tells the + compiler to treat all warnings as errors. + This forces developers to fix warnings as they arise, so they do not accumulate "to be fixed later". + If you are only interested in creating a release build and do not intend to modify the source code + to deal with such warnings, you can pass ``-DPEDANTIC=OFF`` option to CMake to disable this mode. + Doing this is not recommended for general use but may be necessary when using a toolchain we are + not testing with or trying to build an older version with newer tools. + If you encounter such warnings, please consider + `reporting them `_. +>>>>>>> english/develop デフォルトでは、ビルドは *pedantic mode* で実行され、余分な警告を有効にし、すべての警告をエラーとして扱うようにコンパイラに指示します。 これにより、開発者は警告が発生したときに修正することを余儀なくされ、「後で修正する」ことが蓄積されることがありません。 @@ -343,7 +490,15 @@ Solidityの特定のバージョンが必要な場合は、Githubから直接Hom 最小コンパイラバージョン ^^^^^^^^^^^^^^^^^^^^^^^^ +<<<<<<< HEAD 以下のC++コンパイラとその最小バージョンでSolidityのコードベースを構築できます。 +======= +.. Note: Minimum versions for GCC and Clang are based on availability in Ubuntu 24.04. + +- `GCC `_, version 13.3+ +- `Clang `_, version 18.1.3+ +- `MSVC `_, version 2019+ +>>>>>>> english/develop - `GCC `_ 、バージョン11以上 - `Clang `_ 、バージョン14以上 @@ -408,7 +563,7 @@ Visual Studio 2019は、IDEと必要なコンパイラとライブラリの両 .. code-block:: bash - git clone --recursive https://github.com/ethereum/solidity.git + git clone --recursive https://github.com/argotorg/solidity.git cd solidity もしSolidityの開発に協力したいのであれば、Solidityをフォークして、自分の個人的なフォークをセカンドリモートとして追加してください。 @@ -422,7 +577,7 @@ Visual Studio 2019は、IDEと必要なコンパイラとライブラリの両 この方法では、プレリリースビルドの結果、そのようなコンパイラで生成された各バイトコードにフラグが設定されるなどの問題が発生します。 リリースされたSolidityコンパイラを再構築したい場合は、GitHubのリリースページにあるソースtarballを使用してください。 - https://github.com/ethereum/solidity/releases/download/v0.X.Y/solidity_0.X.Y.tar.gz + https://github.com/argotorg/solidity/releases/download/v0.X.Y/solidity_0.X.Y.tar.gz (GitHubで提供されている「ソースコード」ではありません)。 @@ -496,29 +651,52 @@ Solidity はオプションで SMT ソルバー( ``z3``、 ``cvc5``、 ``Eldar Solidityバージョンの文字列は、4つの部分で構成されています。 +<<<<<<< HEAD - バージョン番号 - プレリリースのタグ。通常は ``develop.YYYY.MM.DD`` または ``nightly.YYYY.MM.DD`` に設定されています。 - コミット。フォーマットは ``commit.GITHASH`` です。 - プラットフォーム。任意の数の項目を持ち、プラットフォームとコンパイラに関する詳細を含むます。 +======= +- the version number +- pre-release tag, usually set to ``develop.YYYY.MM.DD``, ``pre.N`` or ``nightly.YYYY.MM.DD`` +- commit in the format of ``commit.GITHASH`` +- platform, which has an arbitrary number of items, containing details about the platform and compiler +>>>>>>> english/develop ローカルに変更があった場合、そのコミットは ``.mod`` でポストフィックスされます。 これらのパーツはSemVerの要求に応じて組み合わせられます。 SolidityのプレリリースタグはSemVerのプレリリースに相当し、Solidityのコミットとプラットフォームを組み合わせてSemverのビルドメタデータを構成します。 +<<<<<<< HEAD リリース例: ``0.4.8+commit.60cc1668.Emscripten.clang``。 プレリリースの例: ``0.4.9-nightly.2017.1.17+commit.6ecb4aa3.Emscripten.clang``。 +======= +Examples: + +- release: ``0.4.8+commit.60cc1668.Emscripten.clang`` +- pre-release: ``0.4.9-pre.3+commit.fb60450bc.Emscripten.clang`` +- nightly build: ``0.4.9-nightly.2017.1.17+commit.6ecb4aa3.Emscripten.clang`` +>>>>>>> english/develop バージョニングについての重要な情報 ================================== +<<<<<<< HEAD リリースが行われた後、パッチレベルの変更のみが続くと想定されるため、パッチのバージョンレベルをバンプさせています。 変更がマージされたときには、SemVerと変更の重要度に応じてバージョンを上げる必要があります。 最後に、リリースは常に現在のnightlyビルドのバージョンで作成されますが、 ``prerelease`` 指定子はありません。 +======= +After a release is made, the patch version level is bumped, because we assume that only +patch level changes follow. When changes are merged, the version should be bumped according +to SemVer and the severity of the change. Finally, a release is always made with the version +of the current build, but without the ``prerelease`` specifier. +>>>>>>> english/develop 例: +<<<<<<< HEAD 1. 0.4.0のリリースを行います。 2. nightlyビルドのバージョンが今後0.4.1になります。 3. 非破壊的な変更があった場合 --> バージョンの変更なし。 @@ -526,3 +704,12 @@ SolidityのプレリリースタグはSemVerのプレリリースに相当し、 5. 0.5.0のリリースを行います。 この動作は :ref:`version pragma ` と相性が良いです。 +======= +1. The 0.4.0 release is made. +2. Nightly builds and preerelases have a version of 0.4.1 from now on. +3. Non-breaking changes are introduced --> no change in version. +4. A breaking change is introduced --> version is bumped to 0.5.0. +5. The 0.5.0 release is made. + +This behavior works well with the :ref:`version pragma `. +>>>>>>> english/develop diff --git a/docs/internals/optimizer.rst b/docs/internals/optimizer.rst index 7bc2078d1a..c5994e0d5a 100644 --- a/docs/internals/optimizer.rst +++ b/docs/internals/optimizer.rst @@ -11,7 +11,12 @@ .. - Optimizing transformations on the Yul IR code. .. - Optimizations at the opcode level. +<<<<<<< HEAD Solidity コンパイラは、以下の3つの異なるレベルで最適化を行います(実行順): +======= +The opcode-based optimizer applies a set of `simplification rules `_ +to opcodes. It also combines equal code sets and removes unused code. +>>>>>>> english/develop - Solidity コードを直接解析して行うコード生成時の最適化 - Yul 中間表現(IR)に対する変換ベースの最適化 diff --git a/docs/internals/variable_cleanup.rst b/docs/internals/variable_cleanup.rst index 7bc59bc3f7..2144bdb770 100644 --- a/docs/internals/variable_cleanup.rst +++ b/docs/internals/variable_cleanup.rst @@ -103,7 +103,7 @@ Positive 0000...0000 0000 0001 0000...0000 0000 0010 .... - 0000...0000 1111 1111 + 0000...0000 0111 1111 .. The compiler will ``signextend`` the sign bit, which is 1 for negative and 0 for positive values, overwriting the higher bits: diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index 18946a86b5..84203f9d3d 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -76,6 +76,7 @@ ABIコーダーpragma ``pragma abicoder v1`` または ``pragma abicoder v2`` を使用すると、ABIエンコーダおよびデコーダの2つの実装を選択できます。 +<<<<<<< HEAD .. Apart from supporting more types, it involves more extensive validation and safety checks, which may result in higher gas costs, but also heightened security. .. It is considered non-experimental as of Solidity 0.6.0 and it is enabled by default starting with Solidity 0.8.0. .. The old ABI coder can still be selected using ``pragma abicoder v1;``. @@ -90,6 +91,26 @@ Solidity 0.6.0の時点では非実験的とみなされ、Solidity 0.8.0から 逆は、 ``abicoder v2`` ではないコントラクトが、新しいエンコーダでのみサポートされている型のデコードを必要とするような呼び出しを行わない限り可能です。 コンパイラはこれを検知してエラーを出します。 コントラクトで ``abicoder v2`` を有効にするだけで、このエラーは解消されます。 +======= +The new ABI coder (v2) is able to encode and decode arbitrarily nested +arrays and structs. Apart from supporting more types, it involves more extensive +validation and safety checks, which may result in higher gas costs, but also heightened +security. +It is considered non-experimental as of Solidity 0.6.0 and it is enabled by default starting +with Solidity 0.8.0. The old ABI coder can still be selected using ``pragma abicoder v1;``. + +.. warning:: + The ABI coder v1 is deprecated and scheduled for removal. + Use ABI coder v2 instead. + +The set of types supported by the new encoder is a strict superset of +the ones supported by the old one. Contracts that use it can interact with ones +that do not without limitations. The reverse is possible only as long as the +non-``abicoder v2`` contract does not try to make calls that would require +decoding types only supported by the new encoder. The compiler can detect this +and will issue an error. Simply enabling ``abicoder v2`` for your contract is +enough to make the error go away. +>>>>>>> english/develop .. note:: @@ -124,6 +145,7 @@ ABIコーダーv2は実験的なものではなくなったので、Solidity 0.7 SMTChecker ~~~~~~~~~~ +<<<<<<< HEAD このコンポーネントは、Solidityコンパイラのビルド時に有効にする必要があるため、すべてのSolidityバイナリで利用できるわけではありません。 :ref:`build instructions` では、このオプションを有効にする方法を説明しています。 ほとんどのバージョンのUbuntu PPAリリースでは有効になっていますが、Dockerイメージ、Windowsバイナリ、静的ビルドのLinuxバイナリでは有効になっていません。 @@ -132,6 +154,19 @@ SMTソルバーがローカルにインストールされていて、ブラウ ``pragma experimental SMTChecker;`` を使用する場合は、SMTソルバーへの問い合わせによって得られる追加の :ref:`safety warnings` を取得します。 このコンポーネントは、Solidity言語のすべての機能をサポートしておらず、多くの警告を出力する可能性があります。 サポートされていない機能が報告された場合、解析が完全にはうまくいかない可能性があります。 +======= +If you use ``pragma experimental SMTChecker;``, then you get additional +:ref:`safety warnings` which are obtained by querying an +SMT solver. +The component does not yet support all features of the Solidity language and +likely outputs many warnings. In case it reports unsupported features, the +analysis may not be fully sound. +>>>>>>> english/develop + +.. note:: + + The ``SMTChecker`` pragma is deprecated and will be removed. + To enable SMTChecker, simply select :ref:`select an engine` when invoking the compiler. .. index:: source file, ! import, module, source unit diff --git a/docs/metadata.rst b/docs/metadata.rst index 453e8d8858..10eaddb7e9 100644 --- a/docs/metadata.rst +++ b/docs/metadata.rst @@ -155,6 +155,7 @@ IPFSの場合、 ``ipfs add`` が返すCIDに含まれるハッシュ(ファ "myDirectory/myFile.sol": { // 必須: ソースファイルのkeccak256ハッシュ "keccak256": "0x123...", +<<<<<<< HEAD // オプション: ソースファイルに与えられるSPDXライセンス識別子 "license": "MIT", // 必須(「content」が使用されていない場合、下記参照): ソースファイルへのソートされたURL。 @@ -166,6 +167,141 @@ IPFSの場合、 ``ipfs add`` が返すCIDに含まれるハッシュ(ファ "version": 1 } +======= + // Required for Solidity: Version of the compiler + "version": "0.8.2+commit.661d1103" + }, + // Required: Source code language, basically selects a "sub-version" + // of the specification + "language": "Solidity", + // Required: Generated information about the contract. + "output": { + // Required: ABI definition of the contract. See "Contract ABI Specification" + "abi": [/* ... */], + // Required: NatSpec developer documentation of the contract. See https://docs.soliditylang.org/en/latest/natspec-format.html for details. + "devdoc": { + // Contents of the @author NatSpec field of the contract + "author": "John Doe", + // Contents of the @dev NatSpec field of the contract + "details": "Interface of the ERC20 standard as defined in the EIP. See https://eips.ethereum.org/EIPS/eip-20 for details", + "errors": { + "MintToZeroAddress()" : { + "details": "Cannot mint to zero address" + } + }, + "events": { + "Transfer(address,address,uint256)": { + "details": "Emitted when `value` tokens are moved from one account (`from`) toanother (`to`).", + "params": { + "from": "The sender address", + "to": "The receiver address", + "value": "The token amount" + } + } + }, + "kind": "dev", + "methods": { + "transfer(address,uint256)": { + // Contents of the @dev NatSpec field of the method + "details": "Returns a boolean value indicating whether the operation succeeded. Must be called by the token holder address", + // Contents of the @param NatSpec fields of the method + "params": { + "_value": "The amount tokens to be transferred", + "_to": "The receiver address" + }, + // Contents of the @return NatSpec field. + "returns": { + // Return var name (here "success") if exists. "_0" as key if return var is unnamed + "success": "a boolean value indicating whether the operation succeeded" + } + } + }, + "stateVariables": { + "owner": { + // Contents of the @dev NatSpec field of the state variable + "details": "Must be set during contract creation. Can then only be changed by the owner" + } + }, + // Contents of the @title NatSpec field of the contract + "title": "MyERC20: an example ERC20", + "version": 1 // NatSpec version + }, + // Required: NatSpec user documentation of the contract. See "NatSpec Format" + "userdoc": { + "errors": { + "ApprovalCallerNotOwnerNorApproved()": [ + { + "notice": "The caller must own the token or be an approved operator." + } + ] + }, + "events": { + "Transfer(address,address,uint256)": { + "notice": "`_value` tokens have been moved from `from` to `to`" + } + }, + "kind": "user", + "methods": { + "transfer(address,uint256)": { + "notice": "Transfers `_value` tokens to address `_to`" + } + }, + "version": 1 // NatSpec version + } + }, + // Required: Compiler settings. + // Reflects the settings in the JSON input during compilation, except: + // - Different format: "libraries" field + // - Added field in metadata.settings: "compilationTarget" + // - Not in metadata.settings: "stopAfter", "debug.debugInfo", "outputSelection" + // See the standard JSON input's "settings" field docs for the rest. + "settings": { + // Required for Solidity: File path and the name of the contract or library this + // metadata is created for. This field is not present in the standard JSON input settings. + "compilationTarget": { + "myDirectory/myFile.sol": "MyContract" + }, + // Optional (false if omitted): Indicates whether experimental mode has been enabled. + // Always matches the value of the `experimental` flag in CBOR metadata. + // Note that experimental mode being enabled does not necessarily mean that any + // experimental features were actually used, or if they were, that those features + // affected the bytecode. + "experimental": true, + // Required for Solidity: Addresses for libraries used. + // Note that metadata has a different format for "libraries" field than the standard JSON input. + // metadata format = { "MyLib.sol:MyLib": "0x123123..." } + // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } } + "libraries": { + "MyLib.sol:MyLib": "0x123123..." + }, + // ... + // ... + // ... + // The rest of the fields and their defaults same as in std JSON input. + }, + // Required: Compilation source files/source units, keys are file paths + "sources": { + "settable": { + // Required (unless "url" is used): literal contents of the source file + "content": "contract settable is owned { uint256 private x = 0; function set(uint256 _x) public { if (msg.sender == owner) x = _x; } }", + // Required: keccak256 hash of the source file + "keccak256": "0x234..." + }, + "myDirectory/myFile.sol": { + // Required: keccak256 hash of the source file + "keccak256": "0x123...", + // Optional: SPDX license identifier as given in the source file + "license": "MIT", + // Required (unless "content" is used, see above): Sorted URL(s) + // to the source file, protocol is more or less arbitrary, but an + // IPFS URL is recommended + "urls": [ "bzz-raw://7d7a...", "dweb:/ipfs/QmN..." ] + } + }, + // Required: The version of the metadata format + "version": 1 + } +>>>>>>> english/develop .. warning:: @@ -194,12 +330,22 @@ IPFSの場合、 ``ipfs add`` が返すCIDに含まれるハッシュ(ファ .. code-block:: javascript { + // Present if "bytecodeHash" was "ipfs" in compiler settings "ipfs": "", +<<<<<<< HEAD // コンパイラの設定で "bytecodeHash" が "ipfs" ではなく "bzzr1" だった場合 +======= + // Present if "bytecodeHash" was "bzzr1" in compiler settings +>>>>>>> english/develop "bzzr1": "", // 以前のバージョンでは "bzzr1" の代わりに "bzzr0" を使用していた "bzzr0": "", +<<<<<<< HEAD // コード生成に影響を与える実験的機能が使用されている場合 +======= + // Present if experimental mode has been enabled either via "--experimental" flag or + // "settings.experimental" option in Standard JSON +>>>>>>> english/develop "experimental": true, "solc": "" } diff --git a/docs/path-resolution.rst b/docs/path-resolution.rst index e8bd0743dd..9829b486dd 100644 --- a/docs/path-resolution.rst +++ b/docs/path-resolution.rst @@ -35,6 +35,7 @@ .. An import callback is free to interpret source unit names in an arbitrary way, not just as paths. .. If there is no callback available when one is needed or if it fails to locate the source code, compilation fails. +<<<<<<< HEAD VFSには、コンパイラーが入力として受け取ったファイルのみが最初に入力されます。 使用するコンパイラの種類によって異なる *インポートコールバック* を使用して、コンパイル中に追加のファイルを読み込むことができます(後述)。 コンパイラは、VFS内のインポートパスに一致するソースユニット名が見つからない場合、コールバックを起動し、その名前で配置されるソースコードを取得する役割を果たします。 @@ -61,6 +62,18 @@ VFSには、コンパイラーが入力として受け取ったファイルの .. For portability it is recommended to avoid using import paths that will work correctly only with a specific import callback or only on one platform. .. For example you should always use forward slashes since they work as path separators also on platforms that support backslashes. +======= +By default, the command-line compiler provides the *Host Filesystem Loader* - a rudimentary callback +that interprets a source unit name as a path in the local filesystem. +This callback can be disabled using the ``--no-import-callback`` command-line option. +The `JavaScript interface `_ does not provide any by default, +but one can be provided by the user. +This mechanism can be used to obtain source code from locations other than the local filesystem +(which may not even be accessible, e.g. when the compiler is running in a browser). +For example the `Remix IDE `_ provides a versatile callback that +lets you `import files from HTTP, IPFS and Swarm URLs or refer directly to packages in NPM registry +`_. +>>>>>>> english/develop .. note:: @@ -104,7 +117,14 @@ VFSの初期コンテンツは、コンパイラの起動方法によって異 #. **Standard JSON** +<<<<<<< HEAD :ref:`Standard JSON ` APIを使用する場合( `JavaScriptインターフェース `_ または ``--standard-json`` コマンドラインオプションを使用)、すべてのソースファイルのコンテンツなどを含むJSONフォーマットの入力を提供します。 +======= + When using the :ref:`Standard JSON ` API (via either the `JavaScript interface + `_ or the ``--standard-json`` command-line option) + you provide input in JSON format, containing, among other things, the content of all your source + files: +>>>>>>> english/develop .. code-block:: json @@ -807,9 +827,17 @@ CLI Path NormalizationとStripping .. - source unit names are not normalized so ``a/b=c`` will not match ``a//b`` either. +<<<<<<< HEAD .. - Parts of file and directory names can match as well. .. ``/newProject/con:/new=old`` will match ``/newProject/contract.sol`` and remap it to .. ``oldProject/contract.sol``. +======= + - If multiple remappings match the same source unit name, the one with the longest matching context is chosen. + - If contexts are identical, the one with the longest matching prefix is chosen. + - If contexts and prefixes are identical, the one specified last wins. + - Remappings do not work on other remappings. For example ``a=b b=c c=d`` will not result in ``a`` + being remapped to ``d``. +>>>>>>> english/develop #. **リマッピングは、インポートパスとソースユニット名の間の変換にのみ影響します。** diff --git a/docs/requirements.txt b/docs/requirements.txt index f4c1aae617..8f5f27ffff 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,12 +2,11 @@ # which could result in it being installed anyway and the style (especially bullet points) being broken. # See https://github.com/readthedocs/sphinx_rtd_theme/issues/1115 # theme >=3.0.0 removes the display_version option in favor of version_selector and language_selector -sphinx_rtd_theme>=0.5.2, <3.0.0 +# Use rtd theme version that supports sphinx>=8.0 +sphinx_rtd_theme>=3.0.0 pygments-lexer-solidity>=0.7.0 -sphinx-a4doc>=1.6.0; python_version < '3.13' -# todo remove this once there is a version > 1.6.0 -sphinx-a4doc @ git+https://github.com/taminomara/sphinx-a4doc@f63d3b2; python_version >= '3.13' +sphinx-syntax>=1.0.1 -# Sphinx 2.1.0 is the oldest version that accepts a lexer class in add_lexer() -sphinx>=2.1.0, <9.0 +# Sphinx version constraints for sphinx-syntax compatibility +sphinx>=8.0.0, <9.0.0 diff --git a/docs/resources.rst b/docs/resources.rst index 3a19f36b33..89ec6ccfdc 100644 --- a/docs/resources.rst +++ b/docs/resources.rst @@ -8,8 +8,8 @@ * `Ethereum.org Developers page `_ * `Ethereum StackExchange `_ * `Solidity website `_ -* `Solidity changelog `_ -* `Solidity codebase on GitHub `_ +* `Solidity changelog `_ +* `Solidity codebase on GitHub `_ * `Solidity language users chat `_ * `Solidity compiler developers chat `_ * `awesome-solidity `_ @@ -102,6 +102,9 @@ * Visual Studio Code (VS Code) + * `Aderyn Visual Studio Code extension `_ + Solidity Smart contract analyzer designed to help find vulnerabilities. It supports projects built with Hardhat, Foundry, or any custom framework. + * `Ethereum Remix Visual Studio Code extension `_ VS Code用のEthereum Remix拡張パック。 💡 Note: As per the official repository, this extension has been removed from the VSCODE marketplace and will be replaced by a dedicated stand-alone desktop application. @@ -137,7 +140,7 @@ Solidityのツール 与えられたABI JSONからSolidityインターフェースソースを生成するツール。 * `Aderyn `_ - Rust-based solidity smart contract static analyzer designed to help find vulnerabilities in Solidity code bases. + Command Line Tool that helps find vulnerabilities in Solidity smart contracts. It supports projects built with Hardhat, Foundry, or any custom framework. * `Doxity `_ Solidityのためのドキュメントジェネレーター。 @@ -181,6 +184,9 @@ Solidityのツール .. * `sol2uml `_ .. Unified Modeling Language (UML) class diagram generator for Solidity contracts. +* `Slippy `_ + A simple and powerful linter for Solidity. + * `sol2uml `_ Solidityコントラクト用のUnified Modeling Language (UML)クラスのダイアグラムジェネレーター。 diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 5b80f89056..2b24323588 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -66,15 +66,26 @@ Reentrancy mapping(address => uint) shares; /// シェアを引き出す function withdraw() public { + // This will report a warning (deprecation) if (payable(msg.sender).send(shares[msg.sender])) shares[msg.sender] = 0; } } +<<<<<<< HEAD この問題は、 ``send`` にガス制限があるため、それほど深刻ではありませんが、それでも脆弱性があります。 Etherの送金には常にコードの実行が含まれるため、受信者は ``withdraw`` にコールバックするコントラクトになる可能性があります。 これにより、複数回の払い戻しが可能となり、基本的にはコントラクト内のすべてのEtherを回収できます。 特に、以下のコントラクトは、デフォルトで残りのガスをすべて送金する ``call`` を使用しているため、攻撃者は複数回返金できます。 +======= +The problem is not too serious here because of the limited gas as part of ``send``, +but it still exposes a weakness: +Ether transfer can always include code execution, +so the recipient could be a contract that calls back into ``withdraw``. +This would let it get multiple refunds and, 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 does not limit the amount of gas that is forwarded by default: +>>>>>>> english/develop .. code-block:: solidity @@ -98,7 +109,7 @@ Re-entrancyを避けるために、以下のようなChecks-Effects-Interactions .. code-block:: solidity // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.9.0; + pragma solidity >=0.6.2 <0.9.0; contract Fund { /// @dev Etherシェアのマッピング @@ -107,7 +118,8 @@ Re-entrancyを避けるために、以下のようなChecks-Effects-Interactions function withdraw() public { uint share = shares[msg.sender]; shares[msg.sender] = 0; - payable(msg.sender).transfer(share); + (bool success, ) = payable(msg.sender).call{value: share}(""); + require(success); } } @@ -143,8 +155,18 @@ Reentrancyは、Ether送金だけでなく、別のコントラクトでのあ それでも、そのような関数はオンチェーン操作の一部として他のコントラクトから呼び出され、それらを引き伸ばすことができます。 このようなケースについては、コントラクトのドキュメントで明示してください。 +<<<<<<< HEAD Etherの送受信 ============= +======= +- There is a way to forward more gas to the receiving contract using ``addr.call{value: x}("")``. + This is essentially the same as ``addr.transfer(x)``, only that it forwards all remaining gas, + subject to additional limits imposed by some EVM versions (such as the `63/64th rule `_ + introduced by ``tangerineWhistle``), and opens up the ability for the recipient to perform more expensive actions + (and it returns a failure code instead of automatically propagating the error). + This might include calling back into the sending contract or other state changes you might not have thought of. + So it allows for great flexibility for honest users but also for malicious actors. +>>>>>>> english/develop .. - Neither contracts nor "externally-owned accounts" are currently able to prevent that someone sends them Ether. .. Contracts can react on and reject a regular transfer, but there are ways to move Ether without creating a message call. @@ -293,6 +315,7 @@ tx.origin function transferTo(address payable dest, uint amount) public { // バグはここにあります。tx.originの代わりにmsg.senderを使用する必要があります。 require(tx.origin == owner); + // This will report a warning (deprecation) dest.transfer(amount); } } diff --git a/docs/smtchecker.rst b/docs/smtchecker.rst index 7896110826..a8f3b5f298 100644 --- a/docs/smtchecker.rst +++ b/docs/smtchecker.rst @@ -323,6 +323,7 @@ SMTCheckerはSolidity >=0.8.7ではデフォルトでアンダーフローとオ スマートコントラクトにおける一般的なプロパティの種類は、コントラクトの状態に関わるプロパティです。 このようなプロパティについてアサーションを失敗させるには、複数のトランザクションが必要になる場合があります。 +<<<<<<< HEAD .. As an example, consider a 2D grid where both axis have coordinates in the range (-2^128, 2^128 - 1). .. Let us place a robot at position (0, 0). The robot can only move diagonally, one step at a time, .. and cannot move outside the grid. The robot's state machine can be represented by the smart contract @@ -332,6 +333,12 @@ SMTCheckerはSolidity >=0.8.7ではデフォルトでアンダーフローとオ ここで、ロボットを(0, 0)の位置に置きます。 ロボットは対角線上に1歩ずつしか移動できず、グリッドの外には出られません。 このロボットのステートマシンは、以下のスマートコントラクトで表すことができます。 +======= +As an example, consider a 2D grid where both axis have coordinates in the range (-2^127, 2^127 - 1). +Let us place a robot at position (0, 0). The robot can only move diagonally, one step at a time, +and cannot move outside the grid. The robot's state machine can be represented by the smart contract +below. +>>>>>>> english/develop .. code-block:: solidity @@ -1073,6 +1080,15 @@ SMTソルバーを主とし、 `Spacer `_ をHorn これをコンパイラの `コールバックメカニズム `_ と併用することで、システム内の任意のソルバーバイナリを採用して、クエリの結果をコンパイラに同期して返すことができます。 これは、どのソルバーを呼び出すかによって、BMCとCHCの両方で使用できます。 +<<<<<<< HEAD +======= +- ``cvc5`` is used via its binary which must be installed in the system. Only BMC uses ``cvc5``. +- ``eld`` is used via its binary which must be installed in the system. Only CHC uses ``eld``, and only if ``z3`` is not enabled. +- ``smtlib2`` outputs SMT/Horn queries in the `smtlib2 `_ format. + These can be used together with the compiler's `callback mechanism `_ so that + any solver binary from the system can be employed to synchronously return the results of the queries to the compiler. + This can be used by both BMC and CHC depending on which solvers are called. +>>>>>>> english/develop - ``z3`` is available statically in ``soljson.js`` (from Solidity 0.6.9), that is, the JavaScript binary of the compiler. Otherwise it is used via its binary which must be installed in the system. .. note:: diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 273d661188..0d43488307 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -655,7 +655,7 @@ Solidityでは、構造体の形で新しい型を定義する方法を提供し .. code-block:: solidity // SPDX-License-Identifier: GPL-3.0 - pragma solidity >=0.6.0 <0.9.0; + pragma solidity >=0.6.2 <0.9.0; // 2つのフィールドを持つ新しい型を定義します。 // 構造体をコントラクトの外部で宣言すると、複数のコントラクトで共有できるようになります。 @@ -701,8 +701,8 @@ Solidityでは、構造体の形で新しい型を定義する方法を提供し return false; uint amount = c.amount; c.amount = 0; - c.beneficiary.transfer(amount); - return true; + (bool success, ) = c.beneficiary.call{value: amount}(""); + return success; } } diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index e431164b67..fcea719ca3 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -252,17 +252,27 @@ Solidityでは、除算はゼロに向かって丸められます。 全メンバーのアドレスの早見表は、 :ref:`address_related` を参照してください。 +<<<<<<< HEAD * ``balance`` と ``transfer`` プロパティ ``balance`` を使ってアドレスの残高を照会したり、 ``transfer`` 関数を使って支払先のアドレスにイーサ(wei単位)を送信したりすることが可能です。 +======= +.. _balance-transfer-address-members: -.. code-block:: solidity - :force: +* ``balance`` and ``transfer`` + + It is possible to query the balance of an address using the property ``balance`` + and to send Ether (in units of wei) to a payable address using the ``transfer`` function: +>>>>>>> english/develop + + .. code-block:: solidity + :force: - address payable x = payable(0x123); - address myAddress = address(this); - if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10); + address payable x = payable(0x123); + address myAddress = address(this); + if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10); +<<<<<<< HEAD ``transfer`` 関数は、現在のコントラクトの残高が十分でない場合や、Ether送金が受信アカウントで拒否された場合に失敗します。 ``transfer`` 関数は失敗するとリバートします。 @@ -277,11 +287,58 @@ Solidityでは、除算はゼロに向かって丸められます。 実行に失敗した場合、現在のコントラクトは例外的に停止しませんが、 ``send`` は ``false`` を返します。 .. warning:: +======= + The ``transfer`` function fails if the balance of the current contract is not large enough + or if the Ether transfer is rejected by the receiving account. The ``transfer`` function + reverts on failure. + + .. note:: + If ``x`` is a contract address, its code (more specifically: its :ref:`receive-ether-function`, if present, or otherwise its :ref:`fallback-function`, if present) will be executed together with the ``transfer`` call (this is a feature of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted and the current contract will stop with an exception. + + .. warning:: + ``transfer`` is deprecated and scheduled for removal. + Simple ether transfers can still be performed using the :ref:`call function ` + with with an optionally provided maximum amount of gas and empty payload, i.e., ``call{value: }("")``. + By default this forwards all the remaining gas, subject to additional limits imposed by some EVM versions + (such as the `63/64th rule `_ introduced by ``tangerineWhistle``). + As with any external call, the ``gas`` call option can be used to set a lower limit. + + While it is possible to recreate the functionality by explicitly setting the limit to the value of the stipend (2300 gas), + this value no longer holds its original meaning due to changing opcode costs. + It is recommended to use different means to protect against reentrancy. + +.. _send-address-member: + +* ``send`` + + ``send`` is the low-level counterpart of ``transfer``. If the execution fails, the current contract will not stop with an exception, but ``send`` will return ``false``. + + .. warning:: + There are some dangers in using ``send``: The transfer fails if the call stack depth is at 1024 + (this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order + to make safe Ether transfers, always check the return value of ``send``, use ``transfer`` or even better: + use a pattern where the recipient withdraws the Ether. + + .. warning:: + ``send`` is deprecated and scheduled for removal. + Simple ether transfers can still be performed using the :ref:`call function ` + with with an optionally provided maximum amount of gas and empty payload, i.e., ``call{value: }("")``. + By default this forwards all the remaining gas, subject to additional limits imposed by some EVM versions + (such as the `63/64th rule `_ introduced by ``tangerineWhistle``). + As with any external call, the ``gas`` call option can be used to set a lower limit. + + While it is possible to recreate the functionality by explicitly setting the limit to the value of the stipend (2300 gas), + this value no longer holds its original meaning due to changing opcode costs. + It is recommended to use different means to protect against reentrancy. + +.. _address_call_functions: +>>>>>>> english/develop ``send`` の使用にはいくつかの危険性があります。 コールスタックの深さが1024の場合(これは常に呼び出し側で強制できます)、送金は失敗し、また、受信者がガス欠になった場合も失敗します。 したがって、安全なEther送金を行うためには、 ``send`` の戻り値を常にチェックするか、 ``transfer`` を使用するか、あるいはさらに良い方法として、受信者がEtherを引き出すパターンを使用してください。 +<<<<<<< HEAD * ``call``, ``delegatecall``, ``staticcall`` ABIに準拠していないコントラクトとのインターフェースや、エンコーディングをより直接的に制御するために、関数 ``call`` 、 ``delegatecall`` 、 ``staticcall`` が用意されています。 @@ -289,13 +346,26 @@ ABIに準拠していないコントラクトとのインターフェースや 関数 ``abi.encode``、 ``abi.encodePacked``、 ``abi.encodeWithSelector``、 ``abi.encodeWithSignature`` は、構造化データのエンコードに使用できます。 例: - -.. code-block:: solidity - - bytes memory payload = abi.encodeWithSignature("register(string)", "MyName"); - (bool success, bytes memory returnData) = address(nameReg).call(payload); - require(success); - +======= + In order to interface with contracts that do not adhere to the ABI, + or to get more direct control over the encoding, + the functions ``call``, ``delegatecall`` and ``staticcall`` are provided. + They all take a single ``bytes memory`` parameter and + return the success condition (as a ``bool``) and the returned data + (``bytes memory``). + The functions ``abi.encode``, ``abi.encodePacked``, ``abi.encodeWithSelector`` + and ``abi.encodeWithSignature`` can be used to encode structured data. + + Example: +>>>>>>> english/develop + + .. code-block:: solidity + + bytes memory payload = abi.encodeWithSignature("register(string)", "MyName"); + (bool success, bytes memory returnData) = address(nameReg).call(payload); + require(success); + +<<<<<<< HEAD .. warning:: これらの関数はすべて低レベルの関数であり、注意して使用する必要があります。 @@ -308,24 +378,49 @@ ABIに準拠していないコントラクトとのインターフェースや これらのエッジケースはバージョン0.5.0で削除されました。 ``gas`` モディファイアで供給ガスを調整することが可能です。 +======= + .. warning:: + All these functions are low-level functions and should be used with care. + Specifically, any unknown contract might be malicious and if you call it, you + hand over control to that contract which could in turn call back into + your contract, so be prepared for changes to your state variables + when the call returns. The regular way to interact with other contracts + is to call a function on a contract object (``x.f()``). -.. code-block:: solidity + .. note:: + Previous versions of Solidity allowed these functions to receive + arbitrary arguments and would also handle a first argument of type + ``bytes4`` differently. These edge cases were removed in version 0.5.0. + + It is possible to adjust the supplied gas with the ``gas`` modifier: +>>>>>>> english/develop + + .. code-block:: solidity - address(nameReg).call{gas: 1000000}(abi.encodeWithSignature("register(string)", "MyName")); + address(nameReg).call{gas: 1000000}(abi.encodeWithSignature("register(string)", "MyName")); +<<<<<<< HEAD 同様に、送金するEtherの値も制御できます。 +======= + Similarly, the supplied Ether value can be controlled too: +>>>>>>> english/develop -.. code-block:: solidity + .. code-block:: solidity - address(nameReg).call{value: 1 ether}(abi.encodeWithSignature("register(string)", "MyName")); + address(nameReg).call{value: 1 ether}(abi.encodeWithSignature("register(string)", "MyName")); +<<<<<<< HEAD 最後に、これらのモディファイアは組み合わせることができます。 その順番は問題ではありません。 +======= + Lastly, these modifiers can be combined. Their order does not matter: +>>>>>>> english/develop -.. code-block:: solidity + .. code-block:: solidity - address(nameReg).call{gas: 1000000, value: 1 ether}(abi.encodeWithSignature("register(string)", "MyName")); + address(nameReg).call{gas: 1000000, value: 1 ether}(abi.encodeWithSignature("register(string)", "MyName")); +<<<<<<< HEAD 同様の方法で、関数 ``delegatecall`` を使用できます。 違いは、与えられたアドレスのコードのみが使用され、他のすべての側面(ストレージ、残高、...)は、現在のコントラクトから取得されます。 ``delegatecall`` の目的は、別のコントラクトに保存されているライブラリコードを使用することです。 @@ -344,10 +439,29 @@ Byzantiumから ``staticcall`` も使えるようになりました。 ``gas`` オプションは3つの方式すべてで利用できますが、 ``value`` オプションは ``call`` でのみ利用できます。 .. note:: +======= + In a similar way, the function ``delegatecall`` can be used: the difference is that only the code of the given address is used, all other aspects (storage, balance, ...) are taken from the current contract. The purpose of ``delegatecall`` is to use library code which is stored in another contract. The user has to ensure that the layout of storage in both contracts is suitable for delegatecall to be used. + + .. note:: + Prior to homestead, only a limited variant called ``callcode`` was available that did not provide access to the original ``msg.sender`` and ``msg.value`` values. This function was removed in version 0.5.0. + + Since byzantium ``staticcall`` can be used as well. This is basically the same as ``call``, but will revert if the called function modifies the state in any way. + + All three functions ``call``, ``delegatecall`` and ``staticcall`` are very low-level functions and should only be used as a *last resort* as they break the type-safety of Solidity. + + The ``gas`` option is available on all three methods, while the ``value`` option is only available + on ``call``. + + .. note:: + It is best to avoid relying on hardcoded gas values in your smart contract code, + regardless of whether state is read from or written to, as this can have many pitfalls. + Also, access to gas might change in the future. +>>>>>>> english/develop スマートコントラクトのコードでは、状態の読み書きにかかわらず、ハードコードされたガスの値に依存することは、多くの落とし穴があるので避けたほうがよいでしょう。 また、ガスへのアクセスが将来変わる可能性もあります。 +<<<<<<< HEAD * ``code`` と ``codehash`` .. You can query the deployed code for any smart contract. @@ -378,6 +492,22 @@ Byzantiumから ``staticcall`` も使えるようになりました。 .. note:: すべてのコントラクトは ``address`` 型に変換できるので、 ``address(this).balance`` を使って現在のコントラクトの残高を照会することが可能です。 +======= + You can query the deployed code for any smart contract. Use ``.code`` to get the EVM bytecode as a + ``bytes memory``, which might be empty. Use ``.codehash`` to get the Keccak-256 hash of that code + (as a ``bytes32``). Note that ``addr.codehash`` is cheaper than using ``keccak256(addr.code)``. + + .. warning:: + The output of ``addr.codehash`` may be ``0`` if the account associated with ``addr`` is empty or non-existent + (i.e., it has no code, zero balance, and zero nonce as defined by `EIP-161 `_). + If the account has no code but a non-zero balance or nonce, then ``addr.codehash`` will output the Keccak-256 hash of empty data + (i.e., ``keccak256("")`` which is equal to ``c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470``), as defined by + `EIP-1052 `_. + + .. note:: + All contracts can be converted to ``address`` type, so it is possible to query the balance of the + current contract using ``address(this).balance``. +>>>>>>> english/develop .. index:: ! contract type, ! type; contract diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index b9252402e4..45f5e57fd5 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -242,7 +242,7 @@ stringのメンバー ``revert(string memory reason)`` 実行を中止し、状態変化をリバートするために、説明用の文字列を提供します。 -.. index:: keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, +.. index:: keccak256, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, erc7201, .. _mathematical-and-cryptographic-functions: @@ -331,12 +331,24 @@ stringのメンバー この問題を回避するには、実際のコントラクトで使用する前に、まず各コントラクトにWei(例: 1)を送信することです。 これは、メインネットやテストネットでは問題になりません。 +``erc7201(string memory id) returns (uint)`` + compute the base slot of a storage namespace of a given ``id`` according to the ``erc7201`` formula defined by `ERC-7201 `_. + The formula is equivalent to ``keccak256(keccak256(id) - 1) & ~0xff``. + The builtin accepts arbitrary strings, including ones containing whitespace. + The function can be used in compile-time context. + .. index:: balance, codehash, send, transfer, call, callcode, delegatecall, staticcall .. _address_related: +<<<<<<< HEAD アドレス型のメンバー -------------------- +======= +Members of Address Types +------------------------ +These members are explained in more detail in the section on :ref:`members of address `. +>>>>>>> english/develop ``
    .balance`` (``uint256``) :ref:`address` のWei残高 @@ -355,7 +367,12 @@ stringのメンバー 指定された量のWeiを :ref:`address` に送り、失敗すると ``false`` を返します。 2300ガスのみ使用可能(調整不可)。 +.. warning:: + ``send()`` and ``transfer()`` are deprecated and scheduled for removal. + See the section on :ref:`send ` and :ref:`transfer ` for more information. + ``
    .call(bytes memory) returns (bool, bytes memory)`` +<<<<<<< HEAD 与えたペイロードで低レベルの ``CALL`` を発行し、成功条件とリターンデータを返します。 利用可能なすべてのガスを送金できる(調整可能)。 @@ -366,6 +383,18 @@ stringのメンバー ``
    .staticcall(bytes memory) returns (bool, bytes memory)`` 与えたペイロードで低レベルの ``STATICCALL`` を発行し、成功条件とリターンデータを返します。 利用可能なすべてのガスを送金できる(調整可能)。 +======= + issue low-level ``CALL`` with the given payload, returns success condition and return data, + forwards all available gas (subject to additional limits imposed by some EVM versions), adjustable + +``
    .delegatecall(bytes memory) returns (bool, bytes memory)`` + issue low-level ``DELEGATECALL`` with the given payload, returns success condition and return data, + forwards all available gas (subject to additional limits imposed by some EVM versions), adjustable + +``
    .staticcall(bytes memory) returns (bool, bytes memory)`` + issue low-level ``STATICCALL`` with the given payload, returns success condition and return data, + forwards all available gas (subject to additional limits imposed by some EVM versions), adjustable +>>>>>>> english/develop 詳しくは、 :ref:`address` の項を参照してください。 @@ -560,4 +589,16 @@ stringのメンバー ``define``, ``final``, ``implements``, ``in``, ``inline``, ``let``, ``macro``, ``match``, ``mutable``, ``null``, ``of``, ``partial``, ``promise``, ``reference``, ``relocatable``, ``sealed``, ``sizeof``, ``static``, ``supports``, ``switch``, ``typedef``, ``typeof``, +<<<<<<< HEAD ``var`` 。 +======= +``var``. + +.. note:: + The following identifiers will become keywords in the future and will no longer be usable as names: + ``at``, ``error``, ``layout``, ``leave``, ``super``, ``transient``, ``this``. + + There are also names which will be considered Yul reserved identifiers in the future: + ``basefee``, ``blobbasefee``, ``blobhash``, ``clz``, ``memoryguard``, ``mcopy``, ``prevrandao``, ``tload``, ``tstore``. + +>>>>>>> english/develop diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 4e58d083f2..d767730663 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -285,6 +285,7 @@ EVMのバージョンをターゲットに設定 - ``push0`` の導入により、コードサイズが小さくなり、ガスが節約できるようになりました( `EIP-3855 `_ を参照)。 - ``cancun`` +<<<<<<< HEAD .. - The block's blob base fee (`EIP-7516 `_ and `EIP-4844 `_) can be accessed via the global ``block.blobbasefee`` or ``blobbasefee()`` in inline assembly. .. - Introduces ``blobhash()`` in inline assembly and a corresponding global function to retrieve versioned hashes of blobs associated with the transaction (see `EIP-4844 `_). @@ -304,6 +305,15 @@ EVMのバージョンをターゲットに設定 - ``osaka`` (**experimental**) - このバージョンから、EOF への実験的なコンパイルが可能になりました( `EIP-7692 `_ 参照)。 +======= + - The block's blob base fee (`EIP-7516 `_ and `EIP-4844 `_) can be accessed via the global ``block.blobbasefee`` or ``blobbasefee()`` in inline assembly. + - Introduces ``blobhash()`` in inline assembly and a corresponding global function to retrieve versioned hashes of blobs associated with the transaction (see `EIP-4844 `_). + - Opcode ``mcopy`` is available in assembly (see `EIP-5656 `_). + - Opcodes ``tstore`` and ``tload`` are available in assembly (see `EIP-1153 `_). +- ``prague`` +- ``osaka`` (**default**) + - ``clz`` builtin function is available in inline assembly. (`EIP-7939 `_) +>>>>>>> english/develop .. index:: ! standard JSON, ! --standard-json .. _compiler-api: @@ -408,7 +418,15 @@ Solidityコンパイラとのインターフェースとして、特に複雑な "stopAfter": "parsing", // オプション: List of remappings "remappings": [ ":g=/dir" ], +<<<<<<< HEAD // オプション: Optimizer settings +======= + // Optional: Experimental mode toggle (Default: false) + // Makes it possible to use experimental features (but does not enable any such feature by itself). + // The use of this mode is recorded in contract metadata. + "experimental": true, + // Optional: Optimizer settings +>>>>>>> english/develop "optimizer": { // Turn on the optimizer. Optional. Default: false. // NOTE: The state of the optimizer is fully determined by the 'details' dict and this setting @@ -476,27 +494,33 @@ Solidityコンパイラとのインターフェースとして、特に複雑な // In particular if the whole value consists only of the delimiter, both sequences are empty. // Note that there are several hard-coded steps that always run, even when both sequences are empty. // For more information see "The Optimizer > Selecting Optimizations". - "optimizerSteps": "dhfoDgvulfnTUtnIf..." + "optimizerSteps": "dfDvulfnTUtnIf..." } } }, // Version of the EVM to compile for (optional). // Affects type checking and code generation. Can be homestead, // tangerineWhistle, spuriousDragon, byzantium, constantinople, - // petersburg, istanbul, berlin, london, paris, shanghai, cancun, prague (default) or osaka (experimental). - "evmVersion": "prague", - // EVM Object Format version to compile for (optional, experimental). - // Currently the only valid value is 1. If not specified, legacy non-EOF bytecode will be generated. - "eofVersion": null, + // petersburg, istanbul, berlin, london, paris, shanghai, cancun, + // prague, osaka (default), or @future (experimental). + "evmVersion": "osaka", // Optional: Change compilation pipeline to go through the Yul intermediate representation. // This is false by default. "viaIR": true, +<<<<<<< HEAD // オプション: Debugging settings +======= + // Optional: Turn on SSA CFG-based code generation via the IR (experimental). + // Implies viaIR: true. This is false by default. + "viaSSACFG": false, + // Optional: Debugging settings +>>>>>>> english/develop "debug": { // How to treat revert (and require) reason strings. Settings are // "default", "strip", "debug" and "verboseDebug". // "default" does not inject compiler-generated revert strings and keeps user-supplied ones. - // "strip" removes all revert strings (if possible, i.e. if literals are used) keeping side-effects + // "strip" removes all revert strings (if possible, i.e. if literals are used) keeping side-effects. + // NOTE: "strip" does not remove custom errors. // "debug" injects strings for compiler-generated internal reverts, implemented for ABI encoders V1 and V2 for now. // "verboseDebug" even appends further information to user-supplied revert strings (not yet implemented) "revertStrings": "default", @@ -509,8 +533,11 @@ Solidityコンパイラとのインターフェースとして、特に複雑な // - `` is the index of the first byte after that location. // - `snippet`: A single-line code snippet from the location indicated by `@src`. // The snippet is quoted and follows the corresponding `@src` annotation. - // - `*`: Wildcard value that can be used to request everything. - "debugInfo": ["location", "snippet"] + // - `ast-id`: Annotations of the form `@ast-id ` over elements that can be mapped back to a definition in the original Solidity file. + // `` is a node ID in the Solidity AST ('ast' output). + // - `ethdebug`: Ethdebug annotations (experimental). Automatically enabled when any ethdebug output is requested. + // - `*`: Wildcard value that can be used to request all non-experimental components. + "debugInfo": ["location", "snippet", "ast-id", "ethdebug"] }, // メタデータの設定(オプション) "metadata": { @@ -561,13 +588,15 @@ Solidityコンパイラとのインターフェースとして、特に複雑な // userdoc - User documentation (natspec) // metadata - Metadata // ir - Yul intermediate representation of the code before optimization - // irAst - AST of Yul intermediate representation of the code before optimization + // irAst - AST of Yul intermediate representation of the code before optimization (experimental) // irOptimized - Intermediate representation after optimization - // irOptimizedAst - AST of intermediate representation after optimization - // storageLayout - Slots, offsets and types of the contract's state variables in storage. - // transientStorageLayout - Slots, offsets and types of the contract's state variables in transient storage. + // irOptimizedAst - AST of intermediate representation after optimization (experimental) + // storageLayout - Slots, offsets and types of the contract's state variables in storage + // transientStorageLayout - Slots, offsets and types of the contract's state variables in transient storage // evm.assembly - New assembly format // evm.legacyAssembly - Old-style assembly format in JSON + // evm.bytecode.ethdebug - Debug information in ethdebug format (ethdebug/format/program schema for creation bytecode). Can only be requested when compiling via IR. (experimental) + // evm.deployedBytecode.ethdebug - Debug information in ethdebug format (ethdebug/format/program schema for deployed bytecode). Can only be requested when compiling via IR. (experimental) // evm.bytecode.functionDebugData - Debugging information at function level // evm.bytecode.object - Bytecode object // evm.bytecode.opcodes - Opcodes list @@ -578,6 +607,11 @@ Solidityコンパイラとのインターフェースとして、特に複雑な // evm.deployedBytecode.immutableReferences - Map from AST ids to bytecode ranges that reference immutables // evm.methodIdentifiers - The list of function hashes // evm.gasEstimates - Function gas estimates + // yulCFGJson - Control Flow Graph (CFG) of the Single Static Assignment (SSA) form of the contract (experimental) + // + // Global level (needs "*" as file name and "*" as contract name): + // ethdebug.resources - Global ethdebug output (ethdebug/format/info/resources schema) containing source list and compiler info (experimental) + // ethdebug.compilation - Global ethdebug compilation output (the 'compilation' key from ethdebug/format/info/resources schema) (experimental) // // Note that using `evm`, `evm.bytecode`, etc. will select every // target part of that output. Additionally, `*` can be used as a wildcard to request everything. @@ -729,6 +763,8 @@ Solidityコンパイラとのインターフェースとして、特に複雑な "legacyAssembly": {}, // Bytecode and related details. "bytecode": { + // Ethdebug output (experimental) + "ethdebug": {/* ... */}, // Debugging data at the level of functions. "functionDebugData": { // Now follows a set of functions including compiler-internal and @@ -771,6 +807,8 @@ Solidityコンパイラとのインターフェースとして、特に複雑な } }, "deployedBytecode": { + // Ethdebug output (experimental) + "ethdebug": {/* ... */}, /* ..., */ // The same layout as above. "immutableReferences": { // There are two references to the immutable with AST ID 3, both 32 bytes long. One is @@ -795,10 +833,19 @@ Solidityコンパイラとのインターフェースとして、特に複雑な "internal": { "heavyLifting()": "infinite" } - } + }, + // Yul CFG representation of the SSA form (experimental) + "yulCFGJson": {/* ... */} } } } + }, + // Global Ethdebug output (experimental) + "ethdebug": { + // Requested via ethdebug.resources output selection + "resources": {/* ... */}, + // Requested via ethdebug.compilation output selection + "compilation": {/* ... */} } } @@ -807,6 +854,7 @@ Solidityコンパイラとのインターフェースとして、特に複雑な .. 1. ``JSONError``: JSON input doesn't conform to the required format, e.g. input is not a JSON object, the language is not supported, etc. +<<<<<<< HEAD 1. ``JSONError``: JSON入力が要求されたフォーマットに適合していません。 例: 入力がJSONオブジェクトでない、言語がサポートされていない、など。 @@ -867,3 +915,74 @@ Solidityコンパイラとのインターフェースとして、特に複雑な 15. ``Info``: コンパイラが、ユーザーが役に立つかもしれないと考えている情報です。 しかし、危険ではないので、必ず対処する必要はありません。 +======= +1. ``JSONError``: JSON input doesn't conform to the required format, e.g. input is not a JSON object, the language is not supported, etc. +2. ``IOError``: IO and import processing errors, such as unresolvable URL or hash mismatch in supplied sources. +3. ``ParserError``: Source code doesn't conform to the language rules. +4. ``DocstringParsingError``: The NatSpec tags in the comment block cannot be parsed. +5. ``SyntaxError``: Syntactical error, such as ``continue`` is used outside of a ``for`` loop. +6. ``DeclarationError``: Invalid, unresolvable or clashing identifier names. e.g. ``Identifier not found`` +7. ``TypeError``: Error within the type system, such as invalid type conversions, invalid assignments, etc. +8. ``UnimplementedFeatureError``: Feature is not supported by the compiler, but is expected to be supported in future versions. +9. ``InternalCompilerError``: Internal bug triggered in the compiler - this should be reported as an issue. +10. ``Exception``: Unknown failure during compilation - this should be reported as an issue. +11. ``CompilerError``: Invalid use of the compiler stack - this should be reported as an issue. +12. ``FatalError``: Fatal error not processed correctly - this should be reported as an issue. +13. ``YulException``: Error during Yul code generation - this should be reported as an issue. +14. ``Warning``: A warning, which didn't stop the compilation, but should be addressed if possible. +15. ``Info``: Information that the compiler thinks the user might find useful, but is not dangerous and does not necessarily need to be addressed. + +.. index:: ! Experimental mode, ! --experimental +.. _experimental-mode: + +Experimental Mode +***************** + +Some language and compiler features included in stable releases are not themselves considered stable. +They are sparsely documented, if at all, often not adequately tested, and thus not yet intended for production use. +In many cases it is possible to develop a big feature incrementally, with each iteration being already stable. +Sometimes, however, it is preferable to start with a prototype and stabilize it over multiple releases, while receiving feedback from users. +To prevent accidental use, such features can be only accessed by enabling the experimental mode. + +There are no backwards compatibility guarantees for experimental features. +They are subject to change in breaking ways in non-breaking releases of the compiler. +Only major changes affecting them are recorded in the changelog. + +To enable the experimental mode, use the ``--experimental`` flag on the command line, +or the analogous ``settings.experimental`` boolean setting in the Standard JSON input. + +Note that the use of this mode is recorded in the metadata: + +- ``experimental`` flag in CBOR metadata is set to ``true``, +- ``settings.experimental`` in JSON metadata is set to ``true``, + +.. note:: + Prior to version 0.8.35, most of the experimental features were usable without any extra safeguards. + Some were gated behind ``pragma experimental``, but this was not done consistently. + The information about them was also only recorded in CBOR metadata and even then not always. + The main goal of the experimental mode is to systematize this and make users fully aware when relying on features which are unfinished or not production-ready. + +The table below details all currently available experimental features. + ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| Feature | ID | Affects bytecode | Flag/pragma | ++=======================+==========================+==================+=========================================================================================================================================+ +| AST import | ``ast-import`` | yes | ``--import-ast`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| LSP | ``lsp`` | no | ``--lsp`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| EVM Assembly import | ``evmasm-import`` | yes | ``--import-asm-json`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| Generic Solidity | ``generic-solidity`` | yes | ``pragma experimental solidity`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| IR AST | ``ir-ast`` | no | ``--ir-ast-json``, ``--ir-optimized-ast-json`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| Non-mainnet EVMs | ``evm`` | yes | ``--evm-version `` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| Ethdebug | ``ethdebug`` | no | ``--ethdebug-resources``, ``--ethdebug-compilation``, ``--ethdebug-program``, ``--ethdebug-program-runtime``, ``--debug-info ethdebug`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| | | no | ``--yul-cfg-json`` | +| SSA CFG + ``ssa-cfg`` +------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| | | yes | ``--via-ssa-cfg`` | ++-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +>>>>>>> english/develop diff --git a/docs/yul.rst b/docs/yul.rst index a0d176da1c..0f94e73475 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -668,14 +668,21 @@ Yulのデフォルトの方言は、現在選択されているEVMのバージ このドキュメントは、Ethereum Virtual Machineの完全な説明を目的としていません。 正確なセマンティクスに興味がある場合は、別のドキュメントを参照してください。 +<<<<<<< HEAD ``-`` と書かれたオペコードは結果を返さず、その他のオペコードは正確に1つの値を返します。 ``F`` 、 ``H`` 、 ``B`` 、 ``C`` 、 ``I`` 、 ``L`` 、 ``P`` 、 ``N`` とマークされたオペコードは、それぞれFrontier、Homestead、Byzantium、Constantinople、Istanbul、London、Parisから存在しています。 +======= +Opcodes marked with ``-`` do not return a result and all others return exactly one value. +Opcodes marked with ``F``, ``H``, ``B``, ``C``, ``I``, ``L``, ``P``, ``N`` and ``O`` are present since +Frontier, Homestead, Byzantium, Constantinople, Istanbul, London, Paris, Cancun or Osaka respectively. +>>>>>>> english/develop 以下において、 ``mem[a...b)`` はメモリ上の位置 ``a`` から ``b`` 未満までのバイト列を表し、 ``storage[p]`` はスロット ``p`` におけるストレージの内容を、同様に ``transientStorage[p]`` はスロット ``p`` におけるトランジェントストレージの内容を表します。 Yulはローカル変数やコントロールフローを管理しているため、これらの機能を阻害するオペコードは使用できません。 これには、 ``dup`` 、 ``swap`` 命令のほか、 ``jump`` 命令、ラベル、 ``push`` 命令などが含まれます。 +<<<<<<< HEAD +-------------------------+-----+-----+--------------------------------------------------------------------------+ | 命令 | | | 説明 | +=========================+=====+=====+==========================================================================+ @@ -860,6 +867,194 @@ Yulはローカル変数やコントロールフローを管理しているた +-------------------------+-----+-----+--------------------------------------------------------------------------+ | gaslimit() | | F | 現在のブロックのブロックガスリミット。 | +-------------------------+-----+-----+--------------------------------------------------------------------------+ +======= ++-------------------------+-----+---+-----------------------------------------------------------------+ +| Instruction | | | Explanation | ++=========================+=====+===+=================================================================+ +| stop() | `-` | F | stop execution, identical to return(0, 0) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| add(x, y) | | F | x + y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| sub(x, y) | | F | x - y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mul(x, y) | | F | x * y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| div(x, y) | | F | x / y or 0 if y == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| sdiv(x, y) | | F | x / y, for signed numbers in two's complement, 0 if y == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mod(x, y) | | F | x % y, 0 if y == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| smod(x, y) | | F | x % y, for signed numbers in two's complement, 0 if y == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| exp(x, y) | | F | x to the power of y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| not(x) | | F | bitwise "not" of x (every bit of x is negated) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| lt(x, y) | | F | 1 if x < y, 0 otherwise | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| gt(x, y) | | F | 1 if x > y, 0 otherwise | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| slt(x, y) | | F | 1 if x < y, 0 otherwise, for signed numbers in two's complement | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| sgt(x, y) | | F | 1 if x > y, 0 otherwise, for signed numbers in two's complement | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| eq(x, y) | | F | 1 if x == y, 0 otherwise | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| iszero(x) | | F | 1 if x == 0, 0 otherwise | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| and(x, y) | | F | bitwise "and" of x and y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| or(x, y) | | F | bitwise "or" of x and y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| xor(x, y) | | F | bitwise "xor" of x and y | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| byte(n, x) | | F | nth byte of x, where the most significant byte is the 0th byte | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| shl(x, y) | | C | logical shift left y by x bits | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| shr(x, y) | | C | logical shift right y by x bits | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| sar(x, y) | | C | signed arithmetic shift right y by x bits | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| clz(x) | | O | number of leading zero bits of x, 256 if x == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| addmod(x, y, m) | | F | (x + y) % m with arbitrary precision arithmetic, 0 if m == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mulmod(x, y, m) | | F | (x * y) % m with arbitrary precision arithmetic, 0 if m == 0 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| signextend(i, x) | | F | sign extend from (i*8+7)th bit counting from least significant | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| keccak256(p, n) | | F | keccak(mem[p...(p+n))) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| pop(x) | `-` | F | discard value x | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mload(p) | | F | mem[p...(p+32)) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mstore(p, v) | `-` | F | mem[p...(p+32)) := v | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mstore8(p, v) | `-` | F | mem[p] := v & 0xff (only modifies a single byte) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| sload(p) | | F | storage[p] | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| sstore(p, v) | `-` | F | storage[p] := v | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| tload(p) | | N | transientStorage[p] | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| tstore(p, v) | `-` | N | transientStorage[p] := v | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| msize() | | F | size of memory, i.e. largest accessed memory index | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| gas() | | F | gas still available to execution | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| address() | | F | address of the current contract / execution context | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| balance(a) | | F | wei balance at address a | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| selfbalance() | | I | equivalent to balance(address()), but cheaper | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| caller() | | F | call sender (excluding ``delegatecall``) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| callvalue() | | F | wei sent together with the current call | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| calldataload(p) | | F | call data starting from position p (32 bytes) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| calldatasize() | | F | size of call data in bytes | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| calldatacopy(t, f, s) | `-` | F | copy s bytes from calldata at position f to mem at position t | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| codesize() | | F | size of the code of the current contract / execution context | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| codecopy(t, f, s) | `-` | F | copy s bytes from code at position f to mem at position t | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| extcodesize(a) | | F | size of the code at address a | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| extcodecopy(a, t, f, s) | `-` | F | like codecopy(t, f, s) but take code at address a | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| returndatasize() | | B | size of the last returndata | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| returndatacopy(t, f, s) | `-` | B | copy s bytes from returndata at position f to mem at position t | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| mcopy(t, f, s) | `-` | N | copy s bytes from mem at position f to mem at position t | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| extcodehash(a) | | C | code hash of address a | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| create(v, p, n) | | F | create new contract with code mem[p...(p+n)) and send v wei | +| | | | and return the new address; returns 0 on error | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| create2(v, p, n, s) | | C | create new contract with code mem[p...(p+n)) at address | +| | | | keccak256(0xff . this . s . keccak256(mem[p...(p+n))) | +| | | | and send v wei and return the new address, where ``0xff`` is a | +| | | | 1 byte value, ``this`` is the current contract's address | +| | | | as a 20 byte value and ``s`` is a big-endian 256-bit value; | +| | | | returns 0 on error | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| call(g, a, v, in, | | F | call contract at address a with input mem[in...(in+insize)) | +| insize, out, outsize) | | | providing g gas and v wei and output area | +| | | | mem[out...(out+outsize)) returning 0 on error (eg. out of gas) | +| | | | and 1 on success | +| | | | :ref:`See more ` | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| callcode(g, a, v, in, | | F | identical to ``call`` but only use the code from a and stay | +| insize, out, outsize) | | | in the context of the current contract otherwise | +| | | | :ref:`See more ` | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| delegatecall(g, a, in, | | H | identical to ``callcode`` but also keep ``caller`` | +| insize, out, outsize) | | | and ``callvalue`` | +| | | | :ref:`See more ` | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| staticcall(g, a, in, | | B | identical to ``call(g, a, 0, in, insize, out, outsize)`` but do | +| insize, out, outsize) | | | not allow state modifications | +| | | | :ref:`See more ` | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| return(p, s) | `-` | F | end execution, return data mem[p...(p+s)) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| revert(p, s) | `-` | B | end execution, revert state changes, return data mem[p...(p+s)) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| selfdestruct(a) | `-` | F | end execution, destroy current contract and send funds to a | +| | | | (deprecated) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| invalid() | `-` | F | end execution with invalid instruction | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| log0(p, s) | `-` | F | log data mem[p...(p+s)) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| log1(p, s, t1) | `-` | F | log data mem[p...(p+s)) with topic t1 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| log2(p, s, t1, t2) | `-` | F | log data mem[p...(p+s)) with topics t1, t2 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| log3(p, s, t1, t2, t3) | `-` | F | log data mem[p...(p+s)) with topics t1, t2, t3 | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| log4(p, s, t1, t2, t3, | `-` | F | log data mem[p...(p+s)) with topics t1, t2, t3, t4 | +| t4) | | | | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| chainid() | | I | ID of the executing chain (EIP-1344) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| basefee() | | L | current block's base fee (EIP-3198 and EIP-1559) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| blobbasefee() | | N | current block's blob base fee (EIP-7516 and EIP-4844) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| origin() | | F | transaction sender | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| gasprice() | | F | gas price of the transaction | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| blockhash(b) | | F | hash of block nr b - only for last 256 blocks excluding current | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| blobhash(i) | | N | versioned hash of transaction's i-th blob, 0 if blob does not | +| | | | exist | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| coinbase() | | F | current mining beneficiary | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| timestamp() | | F | timestamp of the current block in seconds since the epoch | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| number() | | F | current block number | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| difficulty() | | F | difficulty of the current block (see note below) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| prevrandao() | | P | randomness provided by the beacon chain (see note below) | ++-------------------------+-----+---+-----------------------------------------------------------------+ +| gaslimit() | | F | block gas limit of the current block | ++-------------------------+-----+---+-----------------------------------------------------------------+ +>>>>>>> english/develop .. _yul-call-return-area: