flashbots / web3-flashbots

Web3.py plugin for using Flashbots' bundle APIs
https://pypi.org/project/flashbots/
MIT License
405 stars 213 forks source link

Fix callBundle: 400 unable to decode txs issue #70

Closed kavimaluskam closed 1 year ago

kavimaluskam commented 1 year ago

Why?

I tried to simulate my bundle against historical blocks to backtest, and I keep receiving 400 Bad Request - decode txs issue. Example like:

flashbot.simulate(
        [
            web3.eth.get_transaction(historical_tx.hash),
            ...
        ],
        # hisotrical transaction's block information
        historical_tx.block - 1 ,
        historical_tx.block - 1,
        historical_tx.block_timestamp
)

What?

When I submit the callBundle request to some public builders I have a more detailed error message: cannot unmarshal hex string without 0x prefix into Go struct field CallBundleArgs.txs

It should be call_bundle_munger using some expired hexing handling.

How?

Updated to self.to_hex() to handle the transactions bundle bytes hexing.