Table of Contents
Fetching ...

Metamorphic Testing for Smart Contract Validation:A Case Study of Ethereum-Based Crowdfunding Contracts

Irving Jared Villanueva, Madhusudan Srinivasan, Faqeer Ur Rehman

TL;DR

The paper tackles the oracle problem in smart contract testing by applying metamorphic testing (MT) to an Ethereum-based crowdfunding contract. It designs 17 metamorphic relations (MRs), establishes a source/follow-up test workflow, and evaluates MR effectiveness through mutation testing with the Vertigo tool, achieving a 25.65% overall mutant-detection rate and up to 89% mutant-killing for the strongest MRs. Key findings show that MR1 (state transitions) and MR2 (donation consistency) are the most effective, while several edge-case MR(s) provide modest coverage, underscoring the need for a diverse MR portfolio. The study demonstrates MT as a practical, scalable approach to improving smart contract reliability and motivates automation and extension to broader contract families to strengthen blockchain trust and security.

Abstract

Blockchain smart contracts play a crucial role in automating and securing agreements in diverse domains such as finance, healthcare, and supply chains. Despite their critical applications, testing these contracts often receives less attention than their development, leaving significant risks due to the immutability of smart contracts post-deployment. A key challenge in the testing of smart contracts is the oracle problem, where the exact expected outcomes are not well defined, complicating systematic testing efforts. Metamorphic Testing (MT) addresses the oracle problem by using Metamorphic Relations (MRs) to validate smart contracts. MRs define how output should change relative to specific input modifications, determining whether the tests pass or fail. In this work, we apply MT to test an Ethereum-based crowdfunding smart contract, focusing on core functionalities such as state transitions and donation tracking. We identify a set of MRs tailored for smart contract testing and generate test cases for these MRs. To assess the effectiveness of this approach, we use the Vertigo mutation testing tool to create faulty versions of the smart contract. The experimental results show that our MRs detected 25.65% of the total mutants generated, with the most effective MRs achieving a mutant-killing rate of 89%. These results highlight the utility of MT to ensure the reliability and quality of blockchain-based smart contracts.

Metamorphic Testing for Smart Contract Validation:A Case Study of Ethereum-Based Crowdfunding Contracts

TL;DR

The paper tackles the oracle problem in smart contract testing by applying metamorphic testing (MT) to an Ethereum-based crowdfunding contract. It designs 17 metamorphic relations (MRs), establishes a source/follow-up test workflow, and evaluates MR effectiveness through mutation testing with the Vertigo tool, achieving a 25.65% overall mutant-detection rate and up to 89% mutant-killing for the strongest MRs. Key findings show that MR1 (state transitions) and MR2 (donation consistency) are the most effective, while several edge-case MR(s) provide modest coverage, underscoring the need for a diverse MR portfolio. The study demonstrates MT as a practical, scalable approach to improving smart contract reliability and motivates automation and extension to broader contract families to strengthen blockchain trust and security.

Abstract

Blockchain smart contracts play a crucial role in automating and securing agreements in diverse domains such as finance, healthcare, and supply chains. Despite their critical applications, testing these contracts often receives less attention than their development, leaving significant risks due to the immutability of smart contracts post-deployment. A key challenge in the testing of smart contracts is the oracle problem, where the exact expected outcomes are not well defined, complicating systematic testing efforts. Metamorphic Testing (MT) addresses the oracle problem by using Metamorphic Relations (MRs) to validate smart contracts. MRs define how output should change relative to specific input modifications, determining whether the tests pass or fail. In this work, we apply MT to test an Ethereum-based crowdfunding smart contract, focusing on core functionalities such as state transitions and donation tracking. We identify a set of MRs tailored for smart contract testing and generate test cases for these MRs. To assess the effectiveness of this approach, we use the Vertigo mutation testing tool to create faulty versions of the smart contract. The experimental results show that our MRs detected 25.65% of the total mutants generated, with the most effective MRs achieving a mutant-killing rate of 89%. These results highlight the utility of MT to ensure the reliability and quality of blockchain-based smart contracts.
Paper Structure (15 sections, 1 figure, 2 tables)

This paper contains 15 sections, 1 figure, 2 tables.

Figures (1)

  • Figure 2: Fault detection rate of MRs for Ethereum Crowdfunding Contract Program