Skip to content

ontio/ontio-wasm-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ontio-wasm-build

Build Status

English | 中文

A wasm contract validation and optimization tool for Ontology. Before deploying the contract to the chain, this tool can parse and verify the binary code of wasm contract, clean up unused information in the contract to reduce the contract size and deployment cost.

validation and optimizations:

  • The contract has an exported entry function invoke, with empty parameters and return values;
  • Clean up functions,import and export entries not used in contracts;
  • Check floating point instructions in contracts;
  • Check that all imports are Ontology runtime API with correct signatures;
  • Check memory and table limits not exceeding the specified value to prevent malicious contract attacks;
  • Clean up zeros in data section;
  • Clean up custom section;
  • Check that the size of the optimized contract does not exceed the specified value;

Install

You can use one of the following method to install:

  1. download binary file from releases

  2. use cargo to install

cargo install --git=https://github.com/ontio/ontio-wasm-build
  1. install with source code
git clone https://github.com/ontio/ontio-wasm-build
cd ontio-wasm-build
cargo build --release

Usage

$ ontio-wasm-build --help
ontio-wasm-build 0.1.0

USAGE:
    ontio-wasm-build [FLAGS] <input> <output>

FLAGS:
    -h, --help           Prints help information
        --keep-custom    Keep custom section in output wasm file
    -V, --version        Prints version information

ARGS:
    <input>     Wasm file generated by rustc compiler
    <output>    Output wasm file name

inputparameter is used to specify the wasm contract file to be optimized, generated with ontology-wasm-cdt-cpp or ontology-wasm-cdt-rust

outputparameter is used to specify the optimized wasm contract file name

keep-custom is the wasm file used to set the output retained `custom_section', only for debugging purposes

License

This project is licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •