From 1ff00488bb6102a39b2ef902622255e4997dd20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 14 Nov 2020 00:50:19 +0100 Subject: [PATCH] docs: Add information about metadata difference resulting from manual linking --- docs/contracts/libraries.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/contracts/libraries.rst b/docs/contracts/libraries.rst index 035bb36e1..6da52776a 100644 --- a/docs/contracts/libraries.rst +++ b/docs/contracts/libraries.rst @@ -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: