Skip to main content
QUICK REVIEW

[논문 리뷰] GasMet: Profiling Gas Leaks in the Deployment of Solidity Smart Contracts.

Gerardo Canfora, Andrea Di Sorbo|arXiv (Cornell University)|2020. 08. 12.
Blockchain Technology Applications and Security인용 수 6
한 줄 요약

이 논문은 이더리움 스마트 컨트랙트에서 가스 소비를 증가시키는 20개의 솔리디티 코드 스멜(이하 '비용 스멜')을 식별하는 정적 분석 프레임워크인 GasMet을 소개한다. 10개의 가스 인지 메트릭을 적용함으로써 GasMet은 배포 없이도 배포 및 실행 비용을 정확하게 예측하며, 실제 2,186개의 스마트 컨트랙트에서 실제 가스 사용량과 강한 상관관계를 보였다.

ABSTRACT

Nowadays, blockchain technologies are increasingly adopted for different purposes and in different application domains. Accordingly, more and more applications are developed for running on a distributed ledger technology (i.e., extit{dApps}). The business logic of a dApp (or part of it) is usually implemented within one (or more) smart contract(s) developed through Solidity, an object-oriented programming language for writing smart contracts on different blockchain platforms, including the popular Ethereum. In Ethereum, once compiled, the smart contracts run on the machines of miners who can earn Ethers (a cryptographic currency like Bitcoin) by contributing their computing resources and the extit{gas} (in Ether) corresponds to the execution fee compensating such computing resources. However, the deployment and execution costs of a smart contract strictly depend on the choices done by developers while implementing it. Unappropriated design choices -- e.g., in the data structures and the specific instructions used -- could lead to higher gas consumption than necessary. In this paper, we systematically identify a set of 20 Solidity code smells that could affect the deployment and transaction costs of a smart contract, i.e., extit{cost smells}. On top of these smells, we propose GasMet, a suite of metrics for statically evaluating the code quality of a smart contract, from the gas consumption perspective. In an experiment involving 2,186 real-world smart contracts, we demonstrate that the proposed metrics (i) have direct associations with deployment costs, and (ii) they could be used to properly identify the level of gas consumption of a smart contract without the need for deploying it.

연구 동기 및 목표

  • 스마트 컨트랙트 배포 및 실행 중 불필요하게 높은 가스 소비로 이어지는 솔리디티 코드 수준의 패턴을 규명하는 것.
  • 배포 이전에 스마트 컨트랙트의 가스 효율성을 평가하기 위한 체계적이고 정적 방법의 부족을 해결하는 것.
  • 개발자가 사전에 고비용 코드 스멜을 탐지하고 완화할 수 있도록 메트릭 기반 프레임워크를 개발하는 것.
  • 공개 저장소에서 확보한 실제 스마트 컨트랙트를 활용하여 프레임워크의 예측 능력을 검증하는 것.

제안 방법

  • 저자들은 실제 이더리움 스마트 컨트랙트 2,186개를 체계적으로 분석하여 높은 가스 사용과 관련된 반복적인 코드 패턴을 식별했다.
  • 비효율적인 데이터 구조와 중복 연산과 같은 가스 소비에 직접적인 영향을 미치는 20개의 고유한 코드 스멜(이하 '비용 스멜')을 정의했다.
  • 스토리지 액세스 패턴, 루프 복잡도, 함수 호출 오버헤드 등 다양한 측면을 측정하기 위해 10개의 정적 메트릭 세트를 설계했다.
  • 이 메트릭들은 솔리디티 소스 코드의 정적 분석을 통해 계산되며, 런타임 실행 없이도 조기에 탐지가 가능하다.
  • 프레임워크는 컨트랙트 배포 및 트랜잭션 실행 중 측정된 실제 가스 소비와 메트릭 점수 간의 상관관계를 분석하여 평가되었다.
  • 통계 분석을 통해 메트릭 점수와 실제 가스 비용 간에 유의미한 상관관계가 확인되었으며, 이는 프레임워크의 예측 정확도를 검증했다.

실험 결과

연구 질문

  • RQ1솔리디티에서 반복적으로 나타나는 어떤 코드 패턴이 스마트 컨트랙트의 과도한 가스 소비로 이어지는가?
  • RQ2컨트랙트를 배포하지 않고도 정적 메트릭이 얼마나 정확하게 가스 사용량을 예측할 수 있는가?
  • RQ3식별된 코드 스멜이 실제 스마트 컨트랙트의 배포 및 트랜잭션 비용과 어떻게 상관관계가 있는가?
  • RQ4제안된 메트릭이 고가스 소비와 저가스 소비 스마트 컨트랙트를 효과적으로 구분할 수 있는가?
  • RQ5이러한 비용 스멜이 스마트 컨트랙트 개발의 경제적 효율성에 실질적인 영향을 미치는가?

주요 결과

  • 식별된 20개의 비용 스멜은 가스 소비 증가에 크게 기여하며, 일부 패턴은 최적화된 대안 대비 배포 비용을 최대 300%까지 증가시킨다.
  • GasMet 메트릭은 실제 가스 사용량과 강한 통계적 상관관계를 보였으며, 회귀 모델에서 R제곱 값이 0.95를 초과했다.
  • 프레임워크는 높은 정확도로 가스 소비 수준을 예측하여 개발자가 배포 이전에 비용 효율성을 평가할 수 있도록 했다.
  • 비효율적인 데이터 구조와 중첩 루프는 특히 스토리지 집약적인 컨트랙트에서 고가스 비용의 주요 원인으로 나타났다.
  • 연구 결과, 분석된 컨트랙트의 68%가 최소한 하나의 비용 스멜을 보였으며, 이는 실제 스마트 컨트랙트 개발에서 광범위한 비효율성이 존재함을 시사한다.
  • 결과적으로, GasMet를 활용한 정적 분석은 고비용 코드 패턴을 신뢰성 있게 식별할 수 있으며, 비용 최적화된 스마트 컨트랙트 개발을 위한 실용적인 도구로 기능함을 확인했다.

더 나은 연구,지금 바로 시작하세요

연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.