11 research outputs found
Short Paper: Blockcheck the Typechain
Recent efforts have sought to design new smart contract programming languages that make writing blockchain programs safer. But programs on the blockchain are beholden only to the safety properties enforced by the blockchain itself: even the strictest language-only properties can be rendered moot on a language-oblivious blockchain due to inter-contract interactions. Consequently, while safer languages are a necessity, fully realizing their benefits necessitates a language-aware redesign of the blockchain itself. To this end, we propose that the blockchain be viewed as a typechain: a chain of typed programs-not arbitrary blocks-that are included iff they typecheck against the existing chain. Reaching consensus, or blockchecking, validates typechecking in a byzantine fault-tolerant manner. Safety properties traditionally enforced by a runtime are instead enforced by a type system with the aim of statically capturing smart contract correctness. To provide a robust level of safety, we contend that a typechain must minimally guarantee (1) asset linearity and liveness, (2) physical resource availability, including CPU and memory, (3) exceptionless execution, or no early termination, (4) protocol conformance, or adherence to some state machine, and (5) inter-contract safety, including reentrancy safety. Despite their exacting nature, typechains are extensible, allowing for rich libraries that extend the set of verified properties. We expand on typechain properties and present examples of real-world bugs they prevent
solc-verify: A Modular Verifier for Solidity Smart Contracts
We present solc-verify, a source-level verification tool for Ethereum smart
contracts. Solc-verify takes smart contracts written in Solidity and discharges
verification conditions using modular program analysis and SMT solvers. Built
on top of the Solidity compiler, solc-verify reasons at the level of the
contract source code, as opposed to the more common approaches that operate at
the level of Ethereum bytecode. This enables solc-verify to effectively reason
about high-level contract properties while modeling low-level language
semantics precisely. The contract properties, such as contract invariants, loop
invariants, and function pre- and post-conditions, can be provided as
annotations in the code by the developer. This enables automated, yet
user-friendly formal verification for smart contracts. We demonstrate
solc-verify by examining real-world examples where our tool can effectively
find bugs and prove correctness of non-trivial properties with minimal user
effort.Comment: Authors' manuscript. Published in S. Chakraborty and J. A. Navas
(Eds.): VSTTE 2019, LNCS 12031, 2020. The final publication is available at
Springer via https://doi.org/10.1007/978-3-030-41600-3_1
Flint for safer smart contracts
The Ethereum blockchain platform supports the execution of decentralised applications or smart contracts. These typically hold and transfer digital currency to other parties on the platform; however, they have been subject to numerous attacks due to the unintentional introduction of bugs. Over a billion dollars worth of currency has been stolen since its release in July 2015. As smart contracts cannot be updated after deployment, it is imperative that the programming language supports the development of robust contracts. We propose Flint, a new statically-typed programming language specifically designed for writing robust smart contracts. Flint's features enforce the writing of safe and predictable code. To encourage good practices, we introduce protection blocks. Protection blocks restrict who can run code and when (using typestate) it can be executed. To prevent vulnerabilities relating to the unintentional loss of currency, Flint Asset traits provide safe atomic operations, ensuring the state of contracts is always consistent. Writes to state are restricted, simplifying reasoning about smart contracts
SMT-Friendly Formalization of the Solidity Memory Model
Solidity is the dominant programming language for Ethereum smart contracts.
This paper presents a high-level formalization of the Solidity language with a
focus on the memory model. The presented formalization covers all features of
the language related to managing state and memory. In addition, the
formalization we provide is effective: all but few features can be encoded in
the quantifier-free fragment of standard SMT theories. This enables precise and
efficient reasoning about the state of smart contracts written in Solidity. The
formalization is implemented in the solc-verify verifier and we provide an
extensive set of tests that covers the breadth of the required semantics. We
also provide an evaluation on the test set that validates the semantics and
shows the novelty of the approach compared to other Solidity-level contract
analysis tools.Comment: Authors' manuscript. Published in P. M\"uller (Ed.): ESOP 2020, LNCS
12075, 2020. The final publication is available at Springer via
https://doi.org/10.1007/978-3-030-44914-8_