Domain Specific Code Smells in Smart Contracts

05/04/2019
by   Jiachi Chen, et al.
0

Smart contracts are programs running on a blockchain. They are immutable to patch for bugs once deployed -- it is critical to ensure they are bug-free and well-designed before deploying. Code smells are symptoms in source code that possibly indicate deeper problems. The detection of code smells is a method to avoid potential bugs and improve the design of existing code. However, traditional code smell patterns are designed for centralized OO programs, e.g., Java or C++; while smart contracts are decentralized and contain numerous distinctive features, such as the gas system. To fill this gap, we collected smart-contract-related posts from Stack Exchange, as well as real-world smart contracts. We manually analyzed these posts and defined 20 kinds of code smells for smart contracts. We categorized these into security, architecture, and usability problems. To validate if practitioners consider these contract smells as harmful, we created an online survey and received 96 responses from 24 different countries. Feedback showed these code smells are harmful and removing them would improve quality and robustness of smart contracts. We manually identified our defined code smells in 587 contract accounts and publicly released our dataset. Finally, we summarized 5 impacts caused by contract code smells. These help developers better understand the symptoms of the smells and removal priority.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/06/2020

DEFECTCHECKER: Automated Smart Contract Defect Detection by Analyzing EVM Bytecode

Smart contracts are Turing-complete programs running on the blockchain. ...
research
09/04/2020

A Framework and DataSet for Bugs in Ethereum Smart Contracts

Ethereum is the largest blockchain platform that supports smart contract...
research
01/20/2020

Checking Smart Contracts with Structural Code Embedding

Smart contracts have been increasingly used together with blockchains to...
research
05/25/2023

Definition and Detection of Defects in NFT Smart Contracts

Recently, the birth of non-fungible tokens (NFTs) has attracted great at...
research
08/23/2021

Elysium: Automagically Healing Vulnerable Smart Contracts Using Context-Aware Patching

Smart contracts are programs that are deployed and executed on the block...
research
11/28/2021

Semantic Code Search for Smart Contracts

Semantic code search technology allows searching for existing code snipp...
research
03/10/2023

Watch the Gap: Making code more intelligible to users without sacrificing decentralization?

The potential for blockchain technology to eliminate the middleman and r...

Please sign up or login with your details

Forgot password? Click here to reset