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

Rust-generated contract causes consensus failure #6

Closed
jakelang opened this issue Nov 30, 2018 · 8 comments
Closed

Rust-generated contract causes consensus failure #6

jakelang opened this issue Nov 30, 2018 · 8 comments
Assignees

Comments

@jakelang
Copy link
Member

Repro

  1. Open ewasm studio and submit a create transaction with valid wast code (destination empty)
    ewasm-studio will send a notification saying that the program terminated, and will then prompt the user to sign the TX via metamask. It will send the TX as usual and yield the receipt. Wagon will then fail to sync.

TX fields

Wei: 100000000000000000
Code: https://pastebin.com/yPQGkDPp

Message

ExitStatus: Program terminated with exit(1)

@jakelang jakelang changed the title Contract creation gives error message before prompting transaction signature Rust-generated contract causes consensus failure Nov 30, 2018
@jakelang
Copy link
Member Author

Update: this belongs in a different repo. Thought this was an ewasm-studio bug at first but actually it is worse.

@axic axic transferred this issue from ewasm/ewasm-studio Dec 3, 2018
@hugo-dc
Copy link
Member

hugo-dc commented Dec 5, 2018

I reproduced this problem following the steps described above.
This transaction was produced: http://ewasm.ethereum.org/explorer/tx/0x8293c7f2e0c01ff88ac4c6364b93da11230398966ae17d67a4318d536cea686c

It is deploying a contract with empty bytecode: http://ewasm.ethereum.org/explorer/account/0x807A7C82D2800a78B2F3b180F1D85a1e77E18E82

If you convert the Data in the transaction to wast you see something like this:

(module
  (type $t0 (func (param i32 i32)))
  (type $t1 (func))
  (import "ethereum" "finish" (func $ethereum.finish (type $t0)))
  (func $main (export "main") (type $t1)
    (call $ethereum.finish
      (i32.const 0)
      (i32.const 0)))
  (memory $memory (export "memory") 100))

This is the code which causes a difference between hera en wagon. I'm not sure why this test case is not failing for wagon: https://github.com/ewasm/tests/blob/wasm-tests/src/GeneralStateTestsFiller/stEWASMTests/createFromTransactionReturnZeroBytesFiller.yml#L38-L48

@hugo-dc
Copy link
Member

hugo-dc commented Dec 5, 2018

The test case is passing when I run it with go-ethereum+wagon, however there is something that chaught my attention: gasUsed: 0x0

$ ./evm --json statetest /home/hugo/workspace/tests/GeneralStateTests/stEWASMTests/createFromTransactionReturnZeroBytes.json 
{"output":"","gasUsed":"0x0","time":2433380}
{"stateRoot": "d14d4ecbf1dfc0d5d5d20b3e9889479a70345baa31296da6ed06ade886b6e4c2"}
[
  {
    "name": "createFromTransactionReturnZeroBytes",
    "pass": true,
    "fork": "Byzantium"
  }
]

@gballet gballet self-assigned this Dec 5, 2018
@gballet
Copy link
Member

gballet commented Dec 5, 2018

@jakelang @hugo-dc I was able to full-synch to block 145093 which is further than 139871 (the one hugo mentions). Could you please give more details on the issue?

@jakelang
Copy link
Member Author

jakelang commented Dec 5, 2018

@gballet i don't have much more info but here's a log from the same thing happening at block 110066.

Chain config: {ChainID: 66 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: <nil> Engine: ethash}

Number: 110066
Hash: 0xefeb899654f9b784c2d01d6bd577a94f6012b24da15390c442560b7026d7d8fc
    &{[] 1 70260 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [] [220 142 116 30 27 212 254 26 215 116 74 224 11 233 53 153 211 171 160 138 126 0 134 122 61 56 77 236 15 65 169 131] [54 214 77 94 2 178 30 150 11 10 127 31 34 55 194 222 44 233 7 31] 70260}


Error: invalid gas used (remote: 76064 local: 70260)
##############################

@gballet
Copy link
Member

gballet commented Dec 5, 2018

@jakelang I re-synced and didn't have the issue. Could you please make sure that you have the latest version of wagon ? My last fix got merged today.

@gballet
Copy link
Member

gballet commented Dec 5, 2018

This is a block that got mined with wagon on a full sync: http://ewasm.ethereum.org/explorer/account/0x9AfA52330797885BC7f6Df7b7d87835995d0f4f1 so either I'm mining the wrong chain, or your config is somewhat wrong. Any suggestion?

@gballet
Copy link
Member

gballet commented Dec 7, 2018

@hugo-dc has identified the issue, the metering command line is wrong. I'm closing this issue, and will update the README.

@gballet gballet closed this as completed Dec 7, 2018
chfast pushed a commit that referenced this issue Dec 14, 2018
* added tests for new abi encoding features (#4)

* added tests from bytes32[][] and string[]

* added offset to other types

* formatting

* Abi/dynamic types (#5)

* Revert "Abi/dynamic types (#5)" (#6)

This reverts commit dabca31.

* Abi/dynamic types (#7)

* some cleanup

* Apply suggestions from code review

apply suggestions

Co-Authored-By: vedhavyas <[email protected]>

* added better formatting (#8)

* review chnages

* better comments
chfast pushed a commit that referenced this issue Apr 29, 2021
* internal/build: implement signify's signing func
* Add signify to the ci utility
* fix output file format
* Add unit test for signify
* holiman's + travis' feedback
* internal/build: verify signify's output
* crypto: move signify to common dir
* use go-minisign to verify binaries
* more holiman feedback
* crypto, ci: support minisign output
* only accept one-line trusted comments
* configurable untrusted comments
* code cleanup in tests
* revert to use ed25519 from the stdlib
* bug: fix for empty untrusted comments
* write timestamp as comment if trusted comment isn't present
* rename line checker to commentHasManyLines
* crypto: added signify fuzzer (#6)
* crypto: added signify fuzzer
* stuff
* crypto: updated signify fuzzer to fuzz comments
* crypto: repro signify crashes
* rebased fuzzer on build-signify branch
* hide fuzzer behind gofuzz build flag
* extract key data inside a single function
* don't treat \r as a newline
* travis: fix signing command line
* do not use an external binary in tests
* crypto: move signify to crypto/signify
* travis: fix formatting issue
* ci: fix linter build after package move

Co-authored-by: Marius van der Wijden <[email protected]>
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

No branches or pull requests

3 participants