Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bytecode object in docs #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions docs/source/package-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ within the dependency tree the value is constructed as follows.

----

The *Bytecode* Object
~~~~~~~~~~~~~~~~~~~~~
The *UnlinkedBytecode* Object
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A bytecode object has the following key/value pairs.
An unlinked bytecode object, representing a |ContractType|, has the following key/value pairs.

Bytecode: ``bytecode``
^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -420,14 +420,13 @@ hexadecimal representation of the bytecode.
:Type: String
:Format: ``0x`` prefixed hexadecimal.


Link References: ``link_references``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``link_references`` field defines the locations in the corresponding
bytecode which require |linking|.
bytecode which require |linking|. If bytecode contains no link references, this field should be an empty array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/should/must/


:Required: No
:Required: Yes
:Type: Array
:Format: All values **must** be valid :ref:`Link Reference objects <link-reference-object>`.
See also below.
Expand All @@ -440,17 +439,45 @@ any of the link references intersect.

Intersection is defined as two link references which overlap.

----

The *LinkedBytecode* Object
~~~~~~~~~~~~~~~~~~~~~~~~~~~

A linked bytecode object, representing a deployed |ContractInstance|, has the following key/value pairs.

Link Dependencies: ``link_dependencies``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``link_dependencies`` defines the |LinkValues| that have been used
to link the corresponding bytecode.

:Required: No
:Required: Yes
:Type: Array
:Format: All values **must** be valid :ref:`Link Value objects <link-value-object>`.
See also below.

Bytecode: ``bytecode``
^^^^^^^^^^^^^^^^^^^^^^

The ``bytecode`` field is a string containing the ``0x`` prefixed
hexadecimal representation of the bytecode.

:Required: Only if a |LinkValue| differs from its corresponding |ContractType|.
:Type: String
:Format: ``0x`` prefixed hexadecimal.

Link References: ``link_references``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``link_references`` field defines the locations in the corresponding
bytecode which require |linking|.

:Required: Only if a |LinkValue| differs from its corresponding |ContractType|.
:Type: Array
:Format: All values **must** be valid :ref:`Link Reference objects <link-reference-object>`.
See also below.

**Format**

Validation of this field includes the following:
Expand All @@ -459,8 +486,8 @@ Validation of this field includes the following:
``offsets``.

- Each :ref:`link value object <link-value-object>` **must** have a
corresponding :ref:`link reference object <link-reference-object>` under
the ``link_references`` field.
corresponding :ref:`link reference object <link-reference-object>` in its
corresponding |ContractType| or in the ``link_references`` field.

- The length of the resolved ``value`` **must** be equal to the
``length`` of the corresponding |LinkReference|.
Expand Down Expand Up @@ -561,7 +588,7 @@ The ``deployment_bytecode`` field defines the bytecode for this |ContractType|.

:Required: No
:Type: Object
:Format: **must** conform to `the Bytecode Object`_ format.
:Format: **must** conform to `the UnlinkedBytecode Object`_ format.


Runtime Bytecode: ``runtime_bytecode``
Expand All @@ -572,7 +599,7 @@ runtime portion of |Bytecode| for this |ContractType|.

:Required: No
:Type: Object
:Format: **must** conform to `the Bytecode Object`_ format.
:Format: **must** conform to `the UnlinkedBytecode Object`_ format.

ABI: ``abi``
^^^^^^^^^^^^
Expand Down Expand Up @@ -685,7 +712,7 @@ the ``runtime_bytecode`` from the |ContractType| for this |ContractInstance|.

:Required: No
:Type: Object
:Format: **must** conform to `the Bytecode Object`_ format.
:Format: **must** conform to `the LinkedBytecode Object`_ format.

Every entry in the ``link_references`` for this bytecode **must** have a
corresponding entry in the ``link_dependencies`` section.
Expand Down