Blockchain applications are witnessing rapid evolution, necessitating the integration of upgradeable smart contracts. Software patterns have been proposed to summarize upgradeable smart contract best practices. However, research is missing on the comparison of these upgradeable smart contract patterns, especially regarding gas costs related to deployment and execution. This study aims to provide an in-depth analysis of gas costs associated with two prevalent upgradeable smart contract patterns: the Proxy and diamond patterns. The Proxy pattern utilizes a Proxy pointing to a logic contract, while the diamond pattern enables a Proxy to point to multiple logic contracts. We conduct a comparative analysis of gas costs for both patterns in contrast to a traditional non-upgradeable smart contract. We derive from this analysis a theoretical contribution in the form of two consolidated blockchain patterns and a corresponding decision model. By so doing we hope to contribute to the broader understanding of upgradeable smart contract patterns.
翻译:区块链应用正经历快速演进,亟需集成可升级智能合约。软件模式被提出以总结可升级智能合约的最佳实践。然而,针对这些可升级智能合约模式的比较研究尚属空白,尤其是在部署与执行相关的燃料成本方面。本研究旨在深入分析两种主流可升级智能合约模式——代理模式与钻石模式的燃料成本。代理模式利用指向单一逻辑合约的代理合约,而钻石模式则允许代理合约指向多个逻辑合约。我们通过对比两种模式与传统不可升级智能合约的燃料成本,进行系统性分析。基于此分析,我们提出了两项理论贡献:两类整合式区块链模式及相应的决策模型。期望通过本研究增进对可升级智能合约模式的全面理解。