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

(Regression) EVMC fails to validate contract via Sentinel #551

Open
jwasinger opened this issue Oct 21, 2019 · 6 comments
Open

(Regression) EVMC fails to validate contract via Sentinel #551

jwasinger opened this issue Oct 21, 2019 · 6 comments

Comments

@jwasinger
Copy link
Contributor

Using the genesis provided here (which is the same as the ewasm testnet genesis for milestone 1), a transaction containing this wast fails to deploy:

(module
  (import "ethereum" "storageStore" (func $storageStore (param i32 i32)))
  (memory 1)
  (data (i32.const 0)  "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ;; Path                                                                                  
  (data (i32.const 32) "\cd\ab\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ;; Value                                                                                 
  (export "memory" (memory 0))
  (export "main" (func $main))
  (func $main

  )
)

The only output I get from Hera is:
"Sentinel has failed on contract. It is invalid."

Maybe this is intended (and the contract is in some way malformed according to wasm-chisel's validation specs), however it is completely opaque what the underlying reason for the failure is.

@chfast
Copy link
Collaborator

chfast commented Oct 23, 2019

Can this be reproduces with testeth or any other tool? Can you add this as a JSON test to ewasm/tests?

@jwasinger
Copy link
Contributor Author

I'm not sure. I don't think it can be tested for unless we want to write unit test cases for hard-coded sentinel contract bytecodes....

If we had more detailed output from the sentinel contract, it would make solving issues like this a lot easier.

@jwasinger
Copy link
Contributor Author

jwasinger commented Nov 4, 2019

I built a new version of the sentinel contract from source and tried to test a simple contract deployment. This bug persists.

My rustc version:

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.38.0-nightly (4bb6b4a5e 2019-07-11)

How to reproduce locally (note: the wasm in this example is different than in the issue description. but they are both bare-bones simple and trigger the same bug):
https://github.com/jwasinger/ewasm-dev-env/tree/post-milestone-1

@jwasinger
Copy link
Contributor Author

jwasinger commented Nov 5, 2019

Executing message in Hera
Metering (input 120 bytes)...
Executing message in Hera
Executing with wabt...
Module failed to load.
Metering done (output 0 bytes, used 9223372036854775807 gas) with code=1
Sentinel has failed on contract. It is invalid.

It looks like the sentinel itself fails to load with whatever version of wabt is shipped with hera at current master branch.

@axic
Copy link
Member

axic commented Nov 6, 2019

It seems that an old version of llvm always included a linker custom section and the milestone1 version of sentinel was probably compiled like that. Source: WebAssembly/wabt#842

Manually dropping all custom sections with chisel's repack feature makes it to work with wabt – at least confirmed with wasm2wat, which decodes without issues.

@jwasinger
Copy link
Contributor Author

Executing message in Hera
Metering (input 120 bytes)...
Executing message in Hera
Executing with wabt...
wabt (execute): invalid section size: extends past end
Module failed to load.
Metering done (output 0 bytes, used 9223372036854775807 gas) with code=1
Sentinel has failed on contract. It is invalid.

^ I get this after updating all components, using a freshly built and chiseled sentinel contract.

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