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

  • BTC breaks through $69,000

     the market shows BTC breaking through $69,000, currently at $69,021.49, with a 24-hour increase of 1.15%. The market is highly volatile, please manage your risk accordingly.

  • Spanish Foreign Minister: Not worried about any consequences of refusing US access to military bases

     on March 3 local time, Spanish Foreign Minister Alvarez defended the Spanish government's refusal to provide the Rota and Moron military bases to the United States for participation in attacks on Iran. Alvarez stated that the operation initiated by the United States and Israel is not supported by the United Nations and is not part of the bilateral agreements allowing the use of the aforementioned Spanish sovereign military bases. Alvarez also said that the Spanish government is not concerned that this stance will have any consequences. Alvarez stated: "The position of the Spanish government represents the will of the vast majority of the Spanish people as well as the vast majority of people worldwide, which is to defend the UN Charter, respect international law, and believe that cooperation is always more powerful than confrontation."

  • Spot gold plunges nearly $100 in the short term.

     spot gold plunged nearly 100 dollars in a short time, spot gold fell below 5170 dollars/ounce, with a daily decline of 2.94%. 

  • BTC falls below $67,000

    the market shows BTC fell below $67,000, currently at $66,996.93, with a 24-hour increase of 1.18%. The market is highly volatile, please manage your risk accordingly.

  • ETH breaks $2,000

    the market shows ETH breaking through $2000, currently at $2001.64, with a 24-hour increase of 2.89%. The market is highly volatile, please manage your risks accordingly.

  • The US spot Bitcoin ETF saw a net inflow of $962.48 million yesterday.

    according to Trader T's monitoring, the US spot Bitcoin ETF had a net inflow of 962.48 million USD yesterday.

  • BTC falls below $66,000

     the market shows BTC fell below 66,000 USD, currently at 65,986.66 USD, with a 24-hour decline of 1.31%. The market is highly volatile, please manage your risks accordingly.

  • BTC falls below $66,000

     the market shows BTC fell below $66,000, currently at $65,973.16, a 24-hour drop of 2.66%. The market is highly volatile, please manage your risks accordingly.

  • ETH breaks $2,000

    market shows ETH breaking through $2000, currently at $2000.29, with a 24-hour increase of 3.73%. The market is volatile, please manage your risk accordingly.

  • The United States uses Anthropic's artificial intelligence technology in its airstrikes in the Middle East.

     United States used Anthropic's artificial intelligence technology in airstrikes in the Middle East, and just hours before the attack, Trump had just issued a ban against Anthropic.