darwinia-network / docs

The official Darwinia network docs.
https://docs.darwinia.network/
2 stars 1 forks source link

Gas estimation differences compared to Ethereum #23

Closed hujw77 closed 4 months ago

hujw77 commented 5 months ago

TX hash:

Yeah this definitely could be due to gas estimation differences on Pangolin. Do you have any documentation on that? Or just documentation differences between Pangolin and ethereum? I couldn't find anything on your website on the topic We've resolved both of those bugs. Let me know if you run into either of them again. We'd still like to see documentation on differences between your networks and Ethereum if you have any available -- From Sphinx Ryan Pate

AurevoirXavier commented 5 months ago

Darwinia doesn't include the lasted update. We adjusted gas price on Pangolin last week.

hujw77 commented 5 months ago

https://github.com/sphinx-labs/sphinx/commit/72f363e9d8764435f3811c5ae23db6be16dba5d8

hujw77 commented 5 months ago

Darwinia doesn't include the lasted update. We adjusted gas limit on Pangolin last week.

I don't get the point, How to adjust gas price?

hujw77 commented 5 months ago

Ryan Pate, [2024/4/10 10:19] So, for your context, our system calculates the gas required for each transaction, and that gas value is part of the deployment info that you sign for the deployment. A deployment may fail if the gas value is too low for a given transaction. This system works very well for networks that have EVM-equivalent opcode gas costs. However, sometimes networks will have opcode cost differences that can result in our gas estimation logic yielding incorrect estimates. This appears to be the case with Pangolin and is what caused your deployment to fail

Ryan Pate, [2024/4/10 10:19] I have implemented a fix on our end that resolves this issue by always using close to the maximum block gas limit for this gas value. We’ve implemented this solution on other networks and it works well, so I expect it to work for you. You can continue deploying on Pangolin and expect your deployments to be completed correctly. There is nothing you need to do. However, the downside of the solution I implemented is that it makes deployments take longer on the network. So, you may notice some larger deployments take longer now than before.

Ryan Pate, [2024/4/10 10:19] If you want to, your team could investigate how gas usage differs on Pangolin vs Ethereum and resolve any differences so that gas usage on the network is equivalent to Ethereum mainnet. That would allow me to remove the fix, making deployments on Pangolin faster. However, to reiterate, this is not required for you to continue deploying on the network.

AurevoirXavier commented 5 months ago

I don't get the point, How to adjust gas price?

https://github.com/darwinia-network/darwinia/pull/1463

boundless-forest commented 5 months ago

Yeah this definitely could be due to gas estimation differences on Pangolin.

That's the root cause of this issue. Darwinia chains, the same as Moonbeam, based on the Polkadot relaychain + parachain model, have to consider the proof_size into account when calculating the gas value. This leads to an inconsistent gas result compared to the Ethereum in some cases, where gas value is only depends on the opcode cost.

boundless-forest commented 5 months ago

I think I have explained the reason for this. Close it.