Cointime

Download App
iOS & Android

zkSync Assists Gemholic with Smart Contract Issue, Ensures Safe Funds and Unfreezes Contract

Cointime Official

zkSync has given support to Gemholic, a multi-product platform that faced an issue with their smart contract on zkSync Era. 

Gemholic deployed their token contract and conducted a pre-sale launch on zkSync Era, but faced a problem due to the usage of the .transfer() function. The contracts were deployed on Era mainnet without prior testing on a testnet or local node, which could have identified the issue earlier.

"Funds are safe. We found an elegant solution how to unfreeze the contract.", zkSync stated in a tweet. The team said a solution to unfreeze the contract has been found, which will entail minimal changes to gas metering in the protocol but will allow for complete fund recovery. 

Smart contracts using transfer() or send() rely heavily on gas costs, as these functions forward a hardcoded amount of 2300 gas. However, this isn't guaranteed to work on Ethereum, since the fallback() function can consume more than 2300 gas, and opcode gas pricing may change in future Ethereum versions.

zkSync also highlights that zkSync Era is not EVM equivalent. zkSync Era's deliberate design choice to diverge from EVM equivalence results in dynamic gas metering, allowing some transactions to be 10x to 1000x cheaper than on other EVM rollups.

Read full thread:

@GemholicECO is a multi-product platform that recently deployed their token contract and performed a pre-sale launch on zkSync Era. After deployment they encountered an issue with their contract due to the usage of the .transfer() function.

Unfortunately, the contracts were deployed on Era mainnet without having been tried on the testnet or local node, which would have immediately caught the problem.

Any smart contract that uses transfer() or send() is taking a hard dependency on gas costs, because this functions forward a hardcoded amount of 2300 gas.

This is not guaranteed to work on Ethereum!

1) fallback() function can consume more than 2300 gas,

2) opcode gas pricing can change in future version of Ethereum, and your contract will break.

Developers have been warned about this 3 years ago:  Stop Using Solidity's transfer() Now

@zksync Era is not EVM equivalent. This is a deliberate design choice. Era has a diverging, dynamic gas metering, which allows some transaction types to be 10x to 1000x cheaper than on any other EVM rollup! 

At the current gas pricing levels of Era mainnet, ETH transfers will cost more than 2300 gas. Which is why any .transfer() call without explicit gas stipend will currently fail.

It was clear to us that this problem could arise, so we added a warning about .transfer() directly to the compiler:

We took one more extra step and checked the source code of dozens of popular crypto projects. We didn't find a single one not following the 3 year old warning of not using .transfer(). We concluded that the dev community has since long closed this issue.

However, the GemholicECO situation has demonstrated that this is not the case. We took their problem extremely seriously. We will always do our best to provide support and guidance to developers and communities building on @zksync.

In this case, we identified an elegant solution which can solve a broader class of gas-related problems. It will require minimal changes in the gas metering of the protocol, but will allow for full recovery of the funds. We will publish more details on it tomorrow.

zkEVMs are complex systems that are in the process of maturing. Even though zkSync Era is still in Alpha, we’ve already got a thriving ecosystem.

We’ve seen a tremendous spike in activity, the most any scaling solution has ever undergone in such a short period of time; it’s been two weeks since our launch and we've risen to the 4th highest TVL and 3rd highest usage of all L2s.

With this comes great responsibility and inevitably the occasional friction and today was one of these instances. When there are problems our team will continue to be on alert and be relentless in resolving issues.

Comments

All Comments

Recommended for you

  • Iranian Source: Breakthrough in Iran-US Negotiation Preparations Possible 'Tonight or Tomorrow'

    On April 23, an Iranian diplomatic source told RIA Novosti that preparations for negotiations between Iran and the United States in Pakistan may achieve a breakthrough 'tonight or tomorrow.' (Xinhua News Agency)

  • Anthropic's Secondary Market Valuation Reaches $1 Trillion, Surpassing OpenAI

    On April 23, Anthropic's valuation on private equity trading platforms like Forge Global has risen to around $1 trillion, surpassing OpenAI's $880 billion. It is reported that the valuation of this artificial intelligence startup has rapidly increased due to buyers competing to purchase the increasingly scarce secondary market shares of Anthropic. (Dongxin News Agency)

  • BTC Surpasses $78,000

    Market data shows that BTC has surpassed $78,000, currently priced at $78,000.81, with a 24-hour decline of 0.14%. The market is experiencing significant volatility, so please ensure proper risk management.

  • Bitmine Allegedly Acquires 100,000 ETH Worth $233.7 Million

    On April 23, according to monitoring by Lookonchain, three new addresses suspected to be associated with Tom Lee's Bitmine (0xB6a8...9c9E, 0xc2e0...2831, 0x4e5C...276c) received 100,000 ETH from BitGo, valued at $233.7 million.

  • Musk: AI Chip Shortage Expected in the Future

    On April 23, Tesla CEO Elon Musk stated during an earnings call that the company initiated the Terafab chip factory project due to an anticipated severe shortage of AI chips in the future. He remarked, "In terms of industry growth rates, logic chips, and even more so storage chips, we expect to encounter bottlenecks if we do not manufacture chips ourselves. This is the reason for the birth of Terafab." (Dongxin News Agency)

  • US Spot Bitcoin ETF Sees Net Inflow of $331.9 Million Yesterday

    On April 23, according to monitoring by Trader T, the US spot Bitcoin ETF experienced a net inflow of $331.9 million yesterday.

  • US Spot Ethereum ETF Sees Net Inflow of $96.43 Million Yesterday

    On April 23, according to monitoring by Trader T, the US spot Ethereum ETF saw a net inflow of $96.43 million yesterday.

  • U.S. State Department Urges American Citizens to Leave Iran Immediately

    On April 23, the Bureau of Consular Affairs of the U.S. State Department posted on social media that, given Iran's announcement of partial airspace reopening, American citizens in Iran should leave immediately. The post advised U.S. citizens to stay informed about the situation through local media and to consult commercial airlines for information on flights departing Iran. Additionally, U.S. citizens can also travel by land to Armenia, Azerbaijan, Turkey, and Turkmenistan, but should avoid areas along the Iran-Afghanistan, Iran-Iraq, or Iran-Pakistan borders.

  • Tesla: Increasing Investment in AI Computing Power and Advancing New Battery and Material Factories

    On April 23, Tesla's official blog announced that the company is increasing its investment in AI computing power to advance the construction of new battery and battery materials factories. This move is also aimed at further preparing for the production of the third-generation Megapack energy storage system, the Tesla autonomous electric vehicle Cybercab, and the Tesla electric truck Semi.

  • USA: Deploying the Strongest Military Force in History to the Middle East

    On April 23, local time April 22, the U.S. Central Command announced that since the U.S. military began its blockade operations in the waters related to the Strait of Hormuz on April 14, it has requested 31 vessels to turn around or return to port as part of the blockade. The U.S. Central Command also stated that the military is currently deploying the most comprehensive and powerful military force ever seen across the Middle East.