docs: Add information about metadata difference resulting from manual linking

This commit is contained in:
Kamil Śliwak 2020-11-14 00:50:19 +01:00
parent aba04c7afa
commit 1ff00488bb

View File

@ -196,10 +196,14 @@ manually by replacing all those 40 symbols by the hex
encoding of the address of the library contract.
.. note::
You should ask the compiler to link the libraries at the time
a contract is compiled by either using
the ``--libraries`` option of ``solc`` or the ``libraries`` key if you use
the standard-JSON interface to the compiler.
Manually linking libraries on the generated bytecode is discouraged because it does not update
contract metadata. Since metadata contains a list of libraries specified at the time of
compilation and bytecode contains a metadata hash, you will get different binaries, depending
on when linking is performed.
You should ask the compiler to link the libraries at the time a contract is compiled by either
using the ``--libraries`` option of ``solc`` or the ``libraries`` key if you use the
standard-JSON interface to the compiler.
In comparison to contracts, libraries are restricted in the following ways: