diff options
author | chriseth <chris@ethereum.org> | 2018-10-08 21:08:12 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-10-12 21:15:02 +0800 |
commit | 26c693aa920ec1ea41ef7994a3dc8bb45b78f866 (patch) | |
tree | aa95184ed3f52c80e216fc20706c22ddb71d6fc6 /docs | |
parent | 4d6d224cf83195db8dcea1f5015a68d1ce2dca0f (diff) | |
download | dexon-solidity-26c693aa920ec1ea41ef7994a3dc8bb45b78f866.tar.gz dexon-solidity-26c693aa920ec1ea41ef7994a3dc8bb45b78f866.tar.zst dexon-solidity-26c693aa920ec1ea41ef7994a3dc8bb45b78f866.zip |
Change library placeholder to `__$<hash>$__`.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/050-breaking-changes.rst | 6 | ||||
-rw-r--r-- | docs/using-the-compiler.rst | 11 |
2 files changed, 10 insertions, 7 deletions
diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst index 04121d00..7b227297 100644 --- a/docs/050-breaking-changes.rst +++ b/docs/050-breaking-changes.rst @@ -160,8 +160,10 @@ Command Line and JSON Interfaces * In unlinked binary hex files, library address placeholders are now the first 36 hex characters of the keccak256 hash of the fully qualified - library name, instead of just the fully qualified library name. - Binary files now also contain a list of mappings from these hex placeholders + library name, surrounded by ``$...$``. Previously, + just the fully qualified library name was used. + This recudes the chances of collisions, especially when long paths are used. + Binary files now also contain a list of mappings from these placeholders to the fully qualified names. Constructors diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index ac744d08..9ba6caa5 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -41,15 +41,16 @@ If there are multiple matches due to remappings, the one with the longest common For security reasons the compiler has restrictions what directories it can access. Paths (and their subdirectories) of source files specified on the commandline and paths defined by remappings are allowed for import statements, but everything else is rejected. Additional paths (and their subdirectories) can be allowed via the ``--allow-paths /sample/path,/another/sample/path`` switch. -If your contracts use :ref:`libraries <libraries>`, you will notice that the bytecode contains substrings of the form ``__53aea86b7d70b31448b230b20ae141a537e5__``. These are placeholders for the actual library addresses. -The placeholder is a 36 character prefix of the hex encoding of the keccak256 hash of the fully qualified library name. -The bytecode file will also contain lines of the form ``// <placeholder> -> <library name>`` at the end to help -identify which libraries the placeholders represent. +If your contracts use :ref:`libraries <libraries>`, you will notice that the bytecode contains substrings of the form ``__$53aea86b7d70b31448b230b20ae141a537$__``. These are placeholders for the actual library addresses. +The placeholder is a 34 character prefix of the hex encoding of the keccak256 hash of the fully qualified library name. +The bytecode file will also contain lines of the form ``// <placeholder> -> <fq library name>`` at the end to help +identify which libraries the placeholders represent. Note that the fully qualified library name +is the path of its source file and the library name separated by ``:``. You can use ``solc`` as a linker meaning that it will insert the library addresses for you at those points: Either add ``--libraries "file.sol:Math:0x1234567890123456789012345678901234567890 file.sol:Heap:0xabCD567890123456789012345678901234567890"`` to your command to provide an address for each library or store the string in a file (one library per line) and run ``solc`` using ``--libraries fileName``. -If ``solc`` is called with the option ``--link``, all input files are interpreted to be unlinked binaries (hex-encoded) in the ``__53aea86b7d70b31448b230b20ae141a537e5__``-format given above and are linked in-place (if the input is read from stdin, it is written to stdout). All options except ``--libraries`` are ignored (including ``-o``) in this case. +If ``solc`` is called with the option ``--link``, all input files are interpreted to be unlinked binaries (hex-encoded) in the ``__$53aea86b7d70b31448b230b20ae141a537$__``-format given above and are linked in-place (if the input is read from stdin, it is written to stdout). All options except ``--libraries`` are ignored (including ``-o``) in this case. If ``solc`` is called with the option ``--standard-json``, it will expect a JSON input (as explained below) on the standard input, and return a JSON output on the standard output. This is the recommended interface for more complex and especially automated uses. |