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

Fix SimpleAdderVM test cases after #17 #19

Merged
merged 3 commits into from
Apr 6, 2018

Conversation

juztamau5
Copy link
Contributor

@juztamau5 juztamau5 commented Apr 5, 2018

Apparently, in #17 the state was change from 4 registers to 3 registers, and the omitted register was added as a runStep() parameter. This updates the test cases to reflect this.

In addition, test case program "instructions" were fixed to be of type bytes32 instead of byte, as single-byte values were being assigned to the MSB, yielding registers encoded in big-endian format. (See description of third commit.)

After these changes, running truffle test produces:

Contract: SimpleAdderVM
    ✓ should merklize state
    ✓ should run a step
    ✓ should run steps

Output was:

1) Contract: SimpleAdderVM should merklize state:
     AssertionError: expected '0xce14df43546288f0a098d4057077c167f41c3cbcd4011965d53430d2e99d3dfb' to equal '0x235bae0e9307973e69b4c4da79fa631652c75cc382c9d097ff28dfcd702e8e25'
Output was:

2) Contract: SimpleAdderVM should run a step:
     Error: Invalid number of arguments to Solidity function
Output was:

3) Contract: SimpleAdderVM should run steps:

      AssertionError: expected [ Array(2) ] to deeply equal [ Array(2) ]
      + expected - actual

       [
         [
      -    "0x4000000000000000000000000000000000000000000000000000000000000000"
      -    "0xa000000000000000000000000000000000000000000000000000000000000000"
      +    "0x0000000000000000000000000000000000000000000000000000000000000004"
      +    "0x0000000000000000000000000000000000000000000000000000000000000004"
      +    "0x0000000000000000000000000000000000000000000000000000000000000006"
           "0x0000000000000000000000000000000000000000000000000000000000000005"
         ]
      -  "0xe72f7cc82a531b841eeb3b3a0ae1be6dad22bdec19b87a38f535df65c0ed4b06"
      +  "0x00b6b0f456d4b05f44bd2f7ad745e2350d8dfd0bd68cdda97c011e988ca58998"
       ]
@hswick
Copy link
Contributor

hswick commented Apr 6, 2018

Ah good catch! Thanks for the PR!

@hswick hswick merged commit ed02a06 into TrueBitFoundation:master Apr 6, 2018
@juztamau5
Copy link
Contributor Author

happy to help :)

@juztamau5 juztamau5 deleted the pr-17-fixes branch April 7, 2018 22:01
@juztamau5 juztamau5 restored the pr-17-fixes branch May 22, 2018 18:43
@juztamau5 juztamau5 deleted the pr-17-fixes branch May 22, 2018 18:45
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.

None yet

2 participants