Skip to content
New issue

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

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

Already on GitHub? # to your account

EEI: create should clear the return data buffer on success #104

Merged
merged 1 commit into from
Jan 22, 2018

Conversation

axic
Copy link
Member

@axic axic commented Jan 21, 2018

No description provided.

@axic
Copy link
Member Author

axic commented Jan 21, 2018

@lrettig @jwasinger @hugo-dc having a test case for this would be nice:

  • do a call which fills the return buffer
  • do a successful create
  • ensure returndatasize equals to 0

A few more combinations :)

@jwasinger
Copy link
Contributor

jwasinger commented Jan 21, 2018

ensure returndatasize equals to 0

@axic I'm assuming that you mean to inspect the returndatabuffer to ensure it was zeroed out. Otherwise the proposed test case is just testing the behavior of the environment which is already covered by existing state tests.

so the test case would look like this:

   do CALL which fills returndata buffer....
   let l = length(RETURNDATASIZE)
   do CREATE which zeroes returndata buffer....
   assert(mem[returnBuffer:returnBuffer+l] == '0x00000....')

**EDIT** ah maybe I misunderstand how the `returndatabuffer` works.   It is not automatically filled with return data.  It is just the location where return data goes after calling `returndatacopy`

@axic
Copy link
Member Author

axic commented Jan 21, 2018

Actually the only thing which matters is that returndatasize returns 0, because returndatacopy will throw if someone tries to read more than what's inside (= returndatasize).

Note: I am talking here about getReturnDataSize and returnDataCopy, in all these tests resultOffset and resultLength should both be zero as they are obsolete and to be removed soon. See ewasm/design#70

@jwasinger
Copy link
Contributor

I really would like to have a strong argument for why we can't run state tests transcompiled to eWASM to address cases like this...

I'm not opposed to writing test cases but I feel like we are re-inventing the wheel here

@axic axic requested a review from chfast January 21, 2018 22:15
@axic axic merged commit 72e5ad4 into master Jan 22, 2018
@axic axic deleted the create-returndata branch January 22, 2018 16:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants