Skip to content

BlobMaster41/rust_runtime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust runtime for OP_NET VM

Compilation

cargo build --release -p example
wasm-opt -O2 -Oz ../target/wasm32-unknown-unknown/release/example.wasm -o ./rust.wasm

Testing

cp ./rust.wasm ../opnet-unit-test/bytecode/rust.wasm
node build/tests/rust.js 

Size

  • Compiled code from moto library: 23KB (23464B)
  • Unoptimized code from current Rust library: 31KB (31359B) - incomplete
  • Optimized code with wasm-opt: 22KB (21778B) - incomplete

Structure

  • ./src/ - Library providing the interface and helper functions for contract interaction
  • ./example/ - Sample smart contract, similar to contract used in unit tests

TODO

Buffer operations and manipulations

  • Investigate if it’s possible to directly map structs to memory
  • Write memory manipulation methods (readAddress, readUint32, etc.)
  • Create unit tests and check for memory leaks

Contract helpers

  • Coding methods like byte4, encodeSelector, hash, etc.
  • Decoding passed buffers (set_environment, execute, on_deploy) into correct structures

Smart contract and unit tests

  • Copy basic functionality from OP20 contract to examples, as needed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.8%
  • Rust 3.1%
  • HTML 0.1%