darwinia-network / darwinia-messages-sol

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

BEEFY light client and fee market gas opt #149

Closed hujw77 closed 2 years ago

hujw77 commented 2 years ago

BEEFY light client

Before

  1. https://dashboard.tenderly.co/tx/bsc-testnet/0x4ccac6351eccb0af91488d48ff6ba3a01d46d8ee20f960054cbdb1dc557322bc/gas-usage Gas Used: 174,298
  2. https://dashboard.tenderly.co/tx/bsc-testnet/0x4c0ad9109fa2d53008f56c71f394142d81c3a569896d3f25f7622b78a58ed061/gas-usage Gas Used: 435,729 Total: 610027

After

  1. https://testnet.bscscan.com/tx/0x0526129878a7ca4ef5163ce879eb1c2dd607445875ae668dfe6f68b2486deaee Gas Used: 106,333
  2. https://testnet.bscscan.com/tx/0x130a39500642f67c7b77b70206c066366cfef402876abac38da0cd6d02376531 Gas Used: 278,450 Total: 384,783

Diff

Gas: -225244 ~37%

Simple Fee Market

Message layer

Issues

Fix #133 Fix #144 Related #147

hujw77 commented 2 years ago

@HackFisher @xiaoch05 Any more suggestions for gas saving ?

hujw77 commented 2 years ago

Set threhold to 22, and MIN_SUPPORT to 28 ether (120000000/2**22 = 28.6)

  1. https://dashboard.tenderly.co/tx/bsc-testnet/0x2cbeb1ca819bc3dbb80bb318bed1f74b91d94b604f625163916c602bdef78aec/gas-usage

  2. https://dashboard.tenderly.co/tx/bsc-testnet/0xc1e2858eb79929b1806987e0cb6c068e335e58533f16340d7c98d8ed54a3aa68/gas-usage

Diff

Gas Used: -122058 ~20%