flashbots / ethers-provider-flashbots-bundle

Flashbots provider for ethers.js
543 stars 212 forks source link

Sending a legacy transaction in a bundle without chainId reverts #90

Closed miguelmtzinf closed 1 year ago

miguelmtzinf commented 1 year ago

Running the demo throws an error due to the inclusion of the legacy transaction with no chainId in the bundle.

Error:

Error: bad response (status=400, headers={"date":"Thu, 12 Jan 2023 22:38:57 GMT","content-type":"application/json","content-length":"32","connection":"close","x-amzn-requestid":"f3d78faf-0680-4d62-a6dc-1d43c49a43ea","x-amz-apigw-id":"eprQSFsOiYcFU2Q=","vary":"Origin","x-amzn-trace-id":"Root=1-63c08c01-4a1a1d4a0b7622d73999eba4;Sampled=0"}, body="{\"error\":\"unable to decode txs\"}", requestBody="{\"method\":\"eth_callBundle\",\"params\":[{\"txs\":[\"0xf864108502cb41780082520894a68e2f643e0fa7062a78dfb6c629577ae21ad82980801ba08b6a75eb729581b3994056336d505bd631b482fec4d51816db0caa07dc798831a0747ebc76784017d3e5a08fa1c84f1e3a75511d9987989740fdde9bb16891aab7\",\"0x02f86a051184b2d05e0084e6372b6c82520894a68e2f643e0fa7062a78dfb6c629577ae21ad8298080c001a04c0e0ce0de3b83428ed848b1e9f507a9acf2ed9c9d0ca09a46d38958b64b7ef7a06b008a96a90da85d60257da0f289443eb3c0785f6dde52fe488eab14f11af76e\"],\"blockNumber\":\"0x7ea9e3\",\"stateBlockNumber\":\"latest\"}],\"id\":43,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://relay-goerli.flashbots.net/", code=SERVER_ERROR, version=web/5.7.1)

Legacy transaction creation: https://github.com/flashbots/ethers-provider-flashbots-bundle/blob/acdc7e8a49623c54ec01218413563b74b349bab8/src/demo.ts#L53-L59

juroberttyb commented 1 year ago

Faced the same issue, this fix solve it.