darwinia-network / darwinia-messages-sol

Darwinia cross-chain messages gateway and protocol for EVM developers 💌
MIT License
29 stars 8 forks source link

Max gas limit #189

Closed wuminzhe closed 2 years ago

hackfisher commented 2 years ago

I think we can not limit only by gas_limit here, the gas fee equals gas_limit * gas_price should not larger than 100 CRAB (current settings), 1 CRAB equals 118 ether on Smart chain, and 1 9 nano on Crab substrate chain, notorious different decimal we all know.

For here, since we do not know the gas_price when block will be included, we can not infer the exact gas_limit then.

This limit can be documented for gas senders to note, can not be hard coded in SDK IMO.

I'm not sure it is a sample here or part of SDK.

hackfisher commented 2 years ago

@hujw77 What's the maximum block gas limit then?

hujw77 commented 2 years ago

@hujw77 What's the maximum block gas limit then?

https://github.com/darwinia-network/darwinia/blob/03c86e1132dce1f6de08decfde2f8a536dd65e79/runtime/crab/src/pallets/evm_.rs#L167

hackfisher commented 2 years ago

@hujw77 What's the maximum block gas limit then?

https://github.com/darwinia-network/darwinia/blob/03c86e1132dce1f6de08decfde2f8a536dd65e79/runtime/crab/src/pallets/evm_.rs#L167

1000000000000 * 2 / 40000 = 50, 000, 000

I think the limitations in message_transact is too generous, or the gas_price is too low currently.

Let's use 50, 000, 000 as the limitation first, maybe in the runtime we should use gas_limit for settings, instead of native tokens.