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

Switch to manual parsing for validation #157

Merged
merged 22 commits into from
Jun 6, 2019
Merged

Conversation

JakeOShannessy
Copy link
Contributor

I'm only merging this into the main validation branch but I'm doing it as a PR for visibility. The custom parser works and is able to link into the kernel and pass a smoke test. I was able to reuse the instruction parser from parity-wasm by wrapping it in a not inelegant way. Be warned this is currently 2 styles of parser smashed together so make no sense to read. Now that I have a firm handle of what needs to be done I should be able to produce something a little more solid.

This doesn't actually successfully validate procedures given our spec, but it does validate them roughly, the logic just needs to be updated.

@JakeOShannessy
Copy link
Contributor Author

I'll merge once the tests pass.

@JakeOShannessy JakeOShannessy mentioned this pull request Jun 6, 2019
7 tasks
@JakeOShannessy
Copy link
Contributor Author

JakeOShannessy commented Jun 6, 2019

I've also update the nightly version. alloc, which we use has recently been stabilised (rust-lang/rfcs#2480). If we use the previous version of nightly it would mean getting an error (or using extern crate alloc and getting a warning, but since we're on nightly anyway we may as well use a version that works cleanly).

Edit: actually we do have to use it, this version just won't emit a warning anymore.

@JakeOShannessy JakeOShannessy merged commit 2f83b1c into validation Jun 6, 2019
@JakeOShannessy JakeOShannessy deleted the validation-manual branch June 6, 2019 09:37
Latrasis pushed a commit that referenced this pull request Jun 7, 2019
* Change nightly version.

The previous nightly version specified (nightly-2019-03-05) had an issue
where components where not supported on Windows. 2018 versions had an
issue with some wasm memory functions not being finalised
(see rust-lang/rust#56292). This could all be
wrong but I found this version worked for me where others didn't.

* Add batch equivalent to build.sh

* Update windows build command

* Rough validation testing

This tests the proofs-of-concept for the validation code. It is not
currently integrated into the test suites or CI.

* Fix contract name

* Add cap9-build to link in sycalls

* Validate syscalls.

* Functioning syscall linking and validation (albeit very messy)

* Change toolchain version

* Use cross platform CWD.

* Use no_std in native validator

* Clean up cap9-build logging

* Add toolchain to native-validator

* Move validation code into separate lib

* Switch to HTTP transport for tests

This is what I'd used previously and it had always worked well for me.

* Experiment with circleci

* Remove SolC

* Only build ewasm

* Change parity command

* Fix directory

* Build wasm-build 0.6.0

* Fix parity url

* Fix directory to run parity

* Fix location of cargo.lock

* Fix parity path

* Don't need to kill database

* Fix Cargo.lock path

* Remove reference to Cargo.lock, which is not commited

* Correct specification of dev dependencies

* Fix no_std build

* Fix std build

* Add get_code_size to the kernel

* Use custom parity node in CI

* Fix installation of parity

* circleci: install cmake

* circleci: use the right package manager

* circleci: needed privileges

* circleci: add more dependencies

* circleci: remove gflags

* circleci: try different gflags package name

* circleci: add perl and yasm

* circleci: see if we can use parity's image

* circleci: remove sudo

* circleci: remove install line

* circleci: try building parity's branch

* Copy example from parity's docker image

* circleci: actually clone parity

* circleci: switch to stable parity

* circleci: build syn first

* circleci: build syn from git

* circleci: dev build

* circleci: build 1 package at a time

* circleci: save cache after parity build

* Revert "circleci: save cache after parity build"

This reverts commit df48168.

* circleci: save cache after parity build

* circleci: checkout code

* circleci: restore cache

* circleci: cache parity builds

* circleci: version bump deps

* circleci: install parity stage

* circleci: don't update rust

* circleci: set default toolchain

* circleci: reorder rustup

* circleci: check for the existence of cargo

* circleci: only install not build then install

* circleci: install this package

* circleci: formatting

* Don't update rust

* circleci: cache rustup

* circleci: update PATH

* circleci: checkout code

* circleci: fix .profile

* circleci: force overwrite of parity node

* circleci: wrong line

* circleci: add log line

* circleci: more log lines

* circleci: fix cache path

* circleci: properly namespace directories

* circleci: fix yaml syntax error

* circleci: install nodejs

* circleci: add repo for nodejs

* circleci: add missing -y

* circleci: install newer version of node

* circleci: use .xz

* circleci: switch parity to master

* Build custom parity as part of ci (#152)

* circleci: add more dependencies

* circleci: remove gflags

* circleci: try different gflags package name

* circleci: add perl and yasm

* circleci: see if we can use parity's image

* circleci: remove sudo

* circleci: remove install line

* circleci: try building parity's branch

* Copy example from parity's docker image

* circleci: actually clone parity

* circleci: switch to stable parity

* circleci: build syn first

* circleci: build syn from git

* circleci: dev build

* circleci: build 1 package at a time

* circleci: save cache after parity build

* Revert "circleci: save cache after parity build"

This reverts commit df48168.

* circleci: save cache after parity build

* circleci: checkout code

* circleci: restore cache

* circleci: cache parity builds

* circleci: version bump deps

* circleci: install parity stage

* circleci: don't update rust

* circleci: set default toolchain

* circleci: reorder rustup

* circleci: check for the existence of cargo

* circleci: only install not build then install

* circleci: install this package

* circleci: formatting

* Don't update rust

* circleci: cache rustup

* circleci: update PATH

* circleci: checkout code

* circleci: fix .profile

* circleci: force overwrite of parity node

* circleci: wrong line

* circleci: add log line

* circleci: more log lines

* circleci: fix cache path

* circleci: properly namespace directories

* circleci: fix yaml syntax error

* circleci: install nodejs

* circleci: add repo for nodejs

* circleci: add missing -y

* circleci: install newer version of node

* circleci: use .xz

* circleci: switch parity to master

* validation: update whitelist and reorder to match parity.

* validation: add EXTCODECOPY and simple test

* Validation merge (#154)

* circleci: add more dependencies

* circleci: remove gflags

* circleci: try different gflags package name

* circleci: add perl and yasm

* circleci: see if we can use parity's image

* circleci: remove sudo

* circleci: remove install line

* circleci: try building parity's branch

* Copy example from parity's docker image

* circleci: actually clone parity

* circleci: switch to stable parity

* circleci: build syn first

* circleci: build syn from git

* circleci: dev build

* circleci: build 1 package at a time

* circleci: save cache after parity build

* Revert "circleci: save cache after parity build"

This reverts commit df48168.

* circleci: save cache after parity build

* circleci: checkout code

* circleci: restore cache

* circleci: cache parity builds

* circleci: version bump deps

* circleci: install parity stage

* circleci: don't update rust

* circleci: set default toolchain

* circleci: reorder rustup

* circleci: check for the existence of cargo

* circleci: only install not build then install

* circleci: install this package

* circleci: formatting

* Don't update rust

* circleci: cache rustup

* circleci: update PATH

* circleci: checkout code

* circleci: fix .profile

* circleci: force overwrite of parity node

* circleci: wrong line

* circleci: add log line

* circleci: more log lines

* circleci: fix cache path

* circleci: properly namespace directories

* circleci: fix yaml syntax error

* circleci: install nodejs

* circleci: add repo for nodejs

* circleci: add missing -y

* circleci: install newer version of node

* circleci: use .xz

* circleci: switch parity to master

* validation: update whitelist and reorder to match parity.

* validation: add EXTCODECOPY and simple test

* cap9-build: increase the amount of available memory in kernel

* kernel: link in basic validation code for testing

* example_contact: expand

* cap9-build: properly pass the number of memory pages

* kernel: LTO needs to be turned off for mem access bug workaround

* kernel: unlock more tests

* kernel: switch to git version of parity-wasm

* kernel: use wasm module type exposed by validator

* kernel: set number of memory pages to 3

* kernel: panic on inability to parse wasm

* kernel: test simple procedure contract

* Switch to manual parsing for validation (#157)

* wasm-parser: remove parity-wasm dependency

* wasm-parser: proof of basic idea

* wasm-parser: import instruction mappings from parity-wasm

* wasm-parser: build and link with kernel

* wasm-parser: fix parsing of import entries

* wasm-parser: add missing file

* kernel: add test script

* wasm-parser: minor cleanup

* circleci: don't force rebuild of parity-ethereum

* kernel: update tests to be more accurate

* kernel: update nightly version for alloc crate

* circleci: fix error with parity installation

* circleci: fix error in previous commit

* wasm-parser: reinclude alloc

* wasm-parser: merge Cursor and CodeCursor

* circleci: add example contract 2

* circleci: set-up environment for test

* circleci: fix example_contract_2 build

* wasm-parser: properly validate instructions in syscall

* wasm-parser: fix import cursor progression

* circleci: remove config step from parity

* circleci: clear cache

* remove and gitignore build files

* validation: rustfmt and add tests

* wasm-parse: refactor

* wasm-parser: docs

* validation: forbid indirect calls

* validation: correct invalidation of bad dcall

* wasm-parser: minor cleanup

* kernel: skip unimplemented test

* wasm-parser: check for varuint32 issues

* wasm-parser: additional comments

* whitespace
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

1 participant