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.
翻译:区块链应用正经历快速演进,这要求整合可升级的智能合约。软件模式已被提出以总结可升级智能合约的最佳实践。然而,关于这些可升级智能合约模式的比较研究仍属空白,尤其是在部署和执行相关的气体成本方面。本研究旨在深入分析两种流行的可升级智能合约模式——代理模式和钻石模式——的气体成本。代理模式利用一个指向逻辑合约的代理,而钻石模式使代理能够指向多个逻辑合约。我们针对这两种模式与传统不可升级智能合约的气体成本进行对比分析。基于此分析,我们以两种整合型区块链模式及相应决策模型的形式,提出理论贡献。通过上述工作,我们期望促进对可升级智能合约模式的更广泛理解。