Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Treat output length as a maximum length for CALL operations #236

Merged
merged 4 commits into from
Nov 4, 2018

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Nov 3, 2018

PR description

For call-type operations when the output data is shorter than the specified output length, the extra unused memory should be left unchanged, not zeroed out. By chance Pantheon gets this right for the most common case when the output data is empty but not for other cases.

So fix the corner case in Memory so that it consistently zeros out all the memory in the range (which is the right behaviour for other operations like CODECOPY), then change AbstractCallOperation to explicitly treat output length as a maximum length.

New ethereum reference tests are being contributed to cover these cases: ethereum/tests#538

Issues with this behaviour were encountered on ropsten in block 1715984 and block 465128.

ajsutton and others added 4 commits November 3, 2018 19:56
…t's a 0 length BytesValues rather than 32 bytes of zeross.
… actual data to output is shorter than outputLength, do not zero out the tail end of the memory range.
Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

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

LGTM

@ajsutton ajsutton merged commit 41bce80 into PegaSysEng:master Nov 4, 2018
@ajsutton ajsutton deleted the precompile-max-length branch November 4, 2018 09:14
shemnon pushed a commit to shemnon/pantheon that referenced this pull request Nov 14, 2018
…ng#236)

* Fix corner case where Memory did not clear target destination if the new bytes to set was empty.

* Use BytesValue.EMPTY instead of Bytes32.EMPTY to make it clear that it's a 0 length BytesValues rather than 32 bytes of zeross.

* Treat outputLength for call operations as a maximum length - when the actual data to output is shorter than outputLength, do not zero out the tail end of the memory range.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants