darwinia-network / darwinia-messages-sol

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

gas/simple fee market #147

Closed hujw77 closed 2 years ago

hujw77 commented 2 years ago

Simply fee market logic

·----------------------------------------------------|---------------------------|----------------|-----------------------------· | Solc version: 0.8.11 · Optimizer enabled: true · Runs: 999999 · Block limit: 12450000 gas │ ·····················································|···························|················|······························ | Methods │ ·················|···································|·············|·············|················|···············|·············· | Contract · Method · Min · Max · Avg · # calls · eur (avg) │ ·················|···································|·············|·············|················|···············|·············· | InboundLane · receive_messages_proof · - · - · 121201 · 2 · - │ ·················|···································|·············|·············|················|···············|·············· | OutboundLane · receive_messages_delivery_proof · - · - · 110036 · 2 · - │ ·················|···································|·············|·············|················|···············|·············· | OutboundLane · send_message · - · - · 412714 · 2 · - │ ·················|···································|·············|·············|················|···············|··············


### SimpleFeeMarket gas used

yarn test test/test_normal_send_message_single_with_simple_fee_market.js

·-------------------------------------------------------|---------------------------|----------------|-----------------------------· | Solc version: 0.8.11 · Optimizer enabled: true · Runs: 999999 · Block limit: 12450000 gas │ ························································|···························|················|······························ | Methods │ ····················|···································|·············|·············|················|···············|·············· | Contract · Method · Min · Max · Avg · # calls · eur (avg) │ ····················|···································|·············|·············|················|···············|·············· | InboundLane · receive_messages_proof · - · - · 121201 · 2 · - │ ····················|···································|·············|·············|················|···············|·············· | OutboundLane · receive_messages_delivery_proof · - · - · 85393 · 2 · - │ ····················|···································|·············|·············|················|···············|·············· | OutboundLane · send_message · - · - · 228471 · 2 · - │ ····················|···································|·············|·············|················|···············|··············



### Gas comparing
`SimpleFeeMarket` reduce ~ 44% gas in `send_message`
`SimpleFeeMarket` reduce ~ 22% gas in `receive_messages_delivery_proof`
hackfisher commented 2 years ago

Any plans for beefy to support BLS, and the plan of Ethereum to support BLS precompile: https://eips.ethereum.org/EIPS/eip-2537

hujw77 commented 2 years ago

Any plans for beefy to support BLS, and the plan of Ethereum to support BLS precompile: https://eips.ethereum.org/EIPS/eip-2537

https://github.com/ethereum/go-ethereum/blob/a8040bc2c51605a4cca9e48cac83ff14928d50c2/core/vm/contracts.go#L97

Now, BLS precompile only for testing purposes.

hujw77 commented 2 years ago

Any plans for beefy to support BLS, and the plan of Ethereum to support BLS precompile: https://eips.ethereum.org/EIPS/eip-2537

https://github.com/ethereum/go-ethereum/blob/a8040bc2c51605a4cca9e48cac83ff14928d50c2/core/vm/contracts.go#L97

Now, BLS precompile only for testing purposes.

There is a roadmap and pr to track the plan https://github.com/ethereum/annotated-spec/blob/master/images/roadmap.jpeg https://github.com/ethereum/pm/issues/343