mouseless-eth / rusty-sando

Implementation of a competitive v2/v3 multi-meat MEV sandwich bot written using Rust and Huff.
MIT License
767 stars 256 forks source link

Optimize FrontRun [ENHANCEMENT] #48

Closed praveenbm5 closed 1 year ago

praveenbm5 commented 1 year ago

The FrontRun Tx using Sando.huff in this repo consumes around 103k gas.

And the state of the art bots use around 86k gas. 17% less.

Ex. https://etherscan.io/tx/0xeeb288abdd22e1f2c26f3f46eef0ca769afb78910a248d3ae9de965f02cdb103

Link to the deployed contract and disassembled byte code used by them - https://library.dedaub.com/ethereum/address/0x6b75d8af000000e20b7a7ddf000ba900b4009a80/disassembled

How do we compare and port the optimizations used in this contrat into sando.huff?

This issue is meant to host the discussion around the optimizations used by sando.huff and other searcher contracts.

mouseless-eth commented 1 year ago

The FrontRun Tx using Sando.huff in this repo consumes around 103k gas.

And the state of the art bots use around 86k gas. 17% less.

Ex. https://etherscan.io/tx/0xeeb288abdd22e1f2c26f3f46eef0ca769afb78910a248d3ae9de965f02cdb103

Link to the deployed contract and disassembled byte code used by them - https://library.dedaub.com/ethereum/address/0x6b75d8af000000e20b7a7ddf000ba900b4009a80/disassembled

How do we compare and port the optimizations used in this contrat into sando.huff?

This issue is meant to host the discussion around the optimizations used by sando.huff and other searcher contracts.

How are you measuring the gas used on the sando contract? Earlier this year it was very close to the top bots (couple tens to hundred gas off). Can you share the code used to test gasused? are you accounting for token dust/access list?

The tx that u reference uses a token that isn't used in the tests... gas used is different per erc20 token...