Developers Forum for XinFin XDC Network

Omkar Mestry
Omkar Mestry

Posted on

EVM Compatible XDC Network’s Upgraded Security and Memory features on Apothem Platform.

EVM Compatible XDC Network’s Upgraded Security and Memory features on Apothem Platform.

Upgrading the feasibility of XinFin(XDC) network which covers Security issues and Memory leak issues.

Introduction to XDC Network and Apothem Network.

The XDC Network is a global, open-source, delegated proof of stake consensus network (XDPoS), which enables hybrid relay bridges, instant block finality and interoperability with ISO 20022 financial messaging standards. The network’s hybrid (private/public) architecture is designed to support institutional use in trade finance and asset tokenization. Featuring interoperable smart contracts, 2,000 transactions per-second, and Ethereum Virtual Machine compatibility, the XDC Network provides a scalable infrastructure for enterprises and independent community contributors.

Apothem Network (Testnet) is the network used by smart contract developers to test smart contracts and protocol upgrades before deployment to the mainnet. Any upgrade to the XinFin XDC Network blockchain is first implemented on the Apothem Test Network, a simulation of the XinFin XDC Network, giving developers and other community members a chance to test the system before real assets are involved.

Now Let’s discuss what issues the team has fixed, which will be on the Apothem Network.

https://github.com/XinFinOrg/XDPoSChain/pull/200
https://github.com/XinFinOrg/XDPoSChain/pull/212

internal/ethapi: EstimateGas and Call handle revert error

Mentioned first issue was, XDC blockchain didn’t show the revert error before sending the tx with no one wallet/interface(metamask, XDCpay, Remix…). There is no way to see the error before sending the transaction.

In the current version XDPoSChain, it always returns the message: “gas required exceeds allowance or always failing transaction”. If solidity contract function reverts when metamask or other client calls method eth.estimateGas. Therefore, neither the user nor the wallet programme can predict when a revert will occur or get a revert message when one does. This is the main problem in the complaint by xcantera. The latest Pull Request parses and returns the revert message/reason for both of eth.call and eth.estimateGas. This PR is tested on a private network and now it will be tested on Apothem testnet.

test with apothem RPC

Code:

https://explorer.apothem.network/address/xdc41cfa4c7c764c39237a765788eb0596c4b7a05ba#readContract

Request:

curl -X POST -H “Content-Type: application/json” https://rpc.apothem.network -d ‘

{

“jsonrpc”:”2.0",

“method”:”eth_estimateGas”,

“params”:[

{

“from”:”0xD4CE02705041F04135f1949Bc835c1Fe0885513c”,

“to”:”0x41cfa4c7c764c39237a765788eb0596c4b7a05ba”,

“data”: “0x55241077000000000000000000000000000000000000000000000000000000000000000a”,

“value”:”0x0"

}

],

“id”:1

}’

Response

{

“jsonrpc”: “2.0”,

“id”: 1,

“error”: {

“code”: -32000,

“message”: “gas required exceeds allowance or always failing transaction”

}

}
Enter fullscreen mode Exit fullscreen mode

Now, Users can see that this fix will be live on the XDC Apothem Network first.

Merged link: https://github.com/XinFinOrg/XDPoSChain/pull/200

Fixed memory leak when sending tx, vote, block etc to peers.
A memory leak reduces the performance of the peer by reducing the amount of available memory. Eventually, in the worst case, too much of the available memory may become allocated and all or part of the system or device stops working correctly, the application fails, or the system slows down vastly due to thrashing.

The memory leak issue is based on original v1/eth code that has been Merged and it will be live on XDC Apothem Network with the Latest Merge.

Both the issues will be live on XDC Apothem Network in the first week of January 2023.

Discuss any technical developments on the XDC Network Technical forum XDC.Dev

Discussion (0)