Recasting Type Hints from WebAssembly Contracts

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

Research output: Chapter in book / Conference proceedingConference article published in proceeding or bookAcademic researchpeer-review

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 wCFG 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.
Original languageEnglish
Title of host publicationProceedings of the ACM International Conference on the Foundations of Software Engineering
Pages2665 - 2688
Publication statusPublished - 19 Jun 2025

Fingerprint

Dive into the research topics of 'Recasting Type Hints from WebAssembly Contracts'. Together they form a unique fingerprint.

Cite this