kirancodes.me
To Proof Maintenance & Beyond!

Recasting Type Hints from WebAssembly Contracts

Kunsong Zhao, Zihao Li, Weimin Chen, Xiapu Luo, Ting Chen, Guozhu Meng, Yajin Zhou

Abstract

WebAssembly has become the preferred smart contract format for various blockchain platforms due to its high portability and near-native execution speed. To effectively understand WebAssembly contracts, it is crucial to recover high-level type signatures because of the limited type information that WebAssembly provides. However, existing studies on type inference for smart contracts primarily center around Ethereum Virtual Machine bytecode, which is not applicable to WebAssembly owing to their differing targets and runtime semantics. This paper introduces WasmHint , a novel solution that leverages deep learning inference to automatically recover high-level parameter and return types from WebAssembly contracts. More specifically, WasmHint constructs a w CFG representation to clarify dependencies within WebAssembly code and simulates its execution to capture type-related operational information. By learning comprehensive code semantics, it infers parameter and return types, with a semantic corrector designed to enhance information coordination. We conduct experiments on a newly constructed dataset containing 77,208 WebAssembly contract functions. The results demonstrate that WasmHint achieves inference accuracies of 80.0% for parameter types and 95.8% for return types, with average improvements of 86.6% and 34.0% over the baseline methods, respectively.

BibTeX
@article{Zhao-al:FSE25,
  author    = {Kunsong Zhao and
               Zihao Li and
               Weimin Chen and
               Xiapu Luo and
               Ting Chen and
               Guozhu Meng and
               Yajin Zhou},
  title     = {Recasting Type Hints from {WebAssembly} Contracts},
  journal   = {{PACMSE}},
  volume    = {2},
  number    = {{FSE}},
  pages     = {2665--2688},
  year      = {2025},
}

Related papers