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

Add tests for malformed init code #92

Merged
merged 13 commits into from
Oct 25, 2018
Merged

Conversation

lrettig
Copy link
Member

@lrettig lrettig commented Oct 7, 2018

Checks 1. that CREATE returns 1 (failure), 2. that result (created
contract address) is empty

Test for ewasm/hera#436

@lrettig lrettig changed the title Add test for missing main in init code Add test for start section in init code Oct 7, 2018
@lrettig lrettig changed the title Add test for start section in init code Add test for start section in init code (WIP) Oct 8, 2018
@lrettig lrettig changed the title Add test for start section in init code (WIP) Add test for malformed init code (WIP) Oct 8, 2018
balance: '99916113919'
# newly-created contract
# expect code to be empty since create should fail
# 6295ee1b4f6dd65047762f924ecd367c17eabf8f:
Copy link
Member

Choose a reason for hiding this comment

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

you could uncomment this and add "shouldnotexist": "1"

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Do you know if there's a way to make sure that no new contracts get created?

@lrettig
Copy link
Member Author

lrettig commented Oct 8, 2018

@axic take a look at

, is this what you had in mind for this test? Note that it produces the following when I run it for some reason: Error in parsing WASM binary: 'Section extends beyond end of input'

@lrettig lrettig changed the title Add test for malformed init code (WIP) Add tests for malformed init code Oct 9, 2018
@lrettig
Copy link
Member Author

lrettig commented Oct 9, 2018

This is done, it contains all of the missing tests that @axic marked "testnet critical" here. Note that a couple of these tests don't pass against the hera branch I've been using for testing (https://github.com/ewasm/hera/tree/verifycontract):

  • initMalformedBytecodeInvalidMain
  • initMalformedBytecodeInvalidMainFromTx

These tests are failing (with binaryen) due to ewasm/hera#442 (and with wabt due to ewasm/hera#441).

Copy link
Member

@hugo-dc hugo-dc left a comment

Choose a reason for hiding this comment

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

It looks good to me, still pending to take a decision about the current tests which are failing due to pending issues in binaryen/wabt

@lrettig
Copy link
Member Author

lrettig commented Oct 19, 2018

Thanks @hugo-dc!. Agree, @axic any thoughts? This is waiting on ewasm/hera#441 and ewasm/hera#442.

@axic
Copy link
Member

axic commented Oct 23, 2018

@lrettig @hugo-dc is it in any way possible to split this PR and merge those which pass with Hera already?

@lrettig
Copy link
Member Author

lrettig commented Oct 25, 2018

@axic I split out the failing tests into #96

CREATE should fail if the init code contains a 'start' section.

Checks 1. that CREATE returns 1 (failure), 2. that result (created
contract address) is empty
Tests that a contract is not created from a tx when the bytecode
contains a (start) section.
Try to create a contract from a transaction where the init code is
missing a main section
CREATE with init code that contains no main
Tests init code with missing memory export on create
Same as last test, but from tx rather than from create
Test for malformed bytecode (has start section) in code returned from
init code, rather than in init code itself
Same as previous test, but tests bytecode returned from tx
@lrettig
Copy link
Member Author

lrettig commented Oct 25, 2018

Rebased onto Hugo's latest changes. It looks like Hugo renamed a test to storedMalformedBytecodeHasStartFromTx which conflicted with a new one I wrote. They are basically identical, the only difference is that the contract I stored was minimal, with less bytecode. I accepted Hugo's version and just copied over a few helpful comments from mine.

@hugo-dc @axic this is ready for one final review and then merging.

@axic axic merged commit a859f75 into ewasm:wasm-tests Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants