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

Cap-Build Preprocessor for Syscall Imports #150

Closed
Latrasis opened this issue May 26, 2019 · 3 comments
Closed

Cap-Build Preprocessor for Syscall Imports #150

Latrasis opened this issue May 26, 2019 · 3 comments
Assignees
Labels
A-code Area: Code T-ewasm Target system: Ethereum Wasm

Comments

@Latrasis
Copy link
Member

As described in #141, see comment we need a cap9-build lib utility that:

  • Decodes a .wasm module processed by wasm-build
  • Searches for:
(import "env" "cap9_syscall_low" (func $env.storage_write (type $t0)))
  • Replaces $cap9_syscall_low import declaration with a statically linked system-call with:
(func $cap9_syscall_low (type $t0) (param $p0 i32) (param $p1 i32) (param $p2 i32) (param $p3 i32) (result i32)
    call $env.gasleft
    call $env.sender
    get_local $p0
    get_local $p1
    get_local $p2
    get_local $p3
    call $env.dcall)

Lib

Library should be included in a separate cargo folder named: "cap9-build" and added as a dev-dependency in Cargo.toml. Use as a binary might not be necessary if integration tests allow using the lib as a dev-dependency.

Tests

Tests should be included:

  • For cap9-build tests in kernel-ewasm/cap9-build/tests/
  • For all other tests use cap9_build as a lib in kernel-ewasm/tests/**
@Latrasis Latrasis added A-code Area: Code T-ewasm Target system: Ethereum Wasm labels May 26, 2019
@JakeOShannessy
Copy link
Contributor

A quick note, "use a binary might not be necessary" if build.rs allows its use as a dev dependency. cap9-build is part of the workflow for creating procedures, not just tests (as with wasm-build). From the information in the pwasm tutorial it seems that build.rs doesn't support the necessary features for wasm-build (and therefore cap9-build) although I haven't investigated this thoroughly myself.

@Latrasis
Copy link
Member Author

Latrasis commented Jun 5, 2019

I was looking through how [ #link] attributes work, and I'm wondering if it's possible to statically import a wasm binary using the wasm_import_module attribute.

@Latrasis
Copy link
Member Author

@JakeOShannessy This looks like it's completed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code Area: Code T-ewasm Target system: Ethereum Wasm
Projects
None yet
Development

No branches or pull requests

2 participants