Typing Fallback Functions: A Semantic Approach to Type Safe Smart Contracts

📅 2025-12-04
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
To address the type-safety challenge posed by statically untypable constructs—such as fallback functions—in smart contracts, this paper proposes a semantics-based type-safety methodology. It formally endows such constructs with operational semantics imbued with type meaning, constructs a coinductively defined semantic type interpretation, and—novelty—the first integration of up-to techniques into a Proof-Carrying Code (PCC) framework to generate compact, tamper-proof type-safety certificates and enable efficient verification. Implemented for the TINYSOL language, the approach successfully verifies canonical fallback pointer patterns and enforces critical safety properties, including non-interference. Moreover, the framework is extensible to other security properties, such as information-flow control. This work establishes the first theoretically sound and practically verifiable foundation for typed smart contracts in blockchain environments, balancing expressive power with mechanized verifiability.

Technology Category

Application Category

📝 Abstract
This paper develops semantic typing in a smart-contract setting to ensure type safety of code that uses statically untypable language constructs, such as the fallback function. The idea is that the creator of a contract on the blockchain equips code containing such constructs with a formal proof of its type safety, given in terms of the semantics of types. Then, a user of the contract only needs to check the validity of the provided `proof certificate' of type safety. This is a form of proof-carrying code, which naturally fits with the immutable nature of the blockchain environment. As a concrete application of our approach, we focus on ensuring information flow control and non-interference for the language TINYSOL, a distilled version of the Solidity language, through security types. We provide the semantics of types in terms of a typed operational semantics of TINYSOL, and a way for expressing the proofs of safety as coinductively-defined typing interpretations and for representing them compactly via up-to techniques, similar to those used for bisimilarity. We also show how our machinery can be used to type the typical pointer-to-implementation pattern based on the fallback function. However, our main contribution is not the safety theorem per se (and so security properties different from non-interference can be considered as well), but rather the presentation of the theoretical developments necessary to make this approach work in a blockchain/smart-contract setting.
Problem

Research questions and friction points this paper is trying to address.

Ensures type safety for untypable smart contract constructs
Provides formal proofs for blockchain contract security verification
Applies semantic typing to enforce information flow control
Innovation

Methods, ideas, or system contributions that make the work stand out.

Semantic typing ensures type safety for untypable constructs
Proof-carrying code with certificates for blockchain immutability
Coinductive typing interpretations with up-to techniques for proofs