Skip to content

Cap-Build Preprocessor for Syscall Imports #150

@Latrasis

Description

@Latrasis

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

Metadata

Metadata

Labels

A-codeArea: CodeT-ewasmTarget system: Ethereum Wasm

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions