suapp-examples icon indicating copy to clipboard operation
suapp-examples copied to clipboard

Readme example does not work

Open pistomat opened this issue 10 months ago • 0 comments

Problem no.1

Error

If you follow the main README.md example https://github.com/flashbots/suapp-examples/blob/bf735798f18821f080da90f221b40ee60f2b60a2/README.md#L63-L74

You will actually get the following error:

1. Create and fund test accounts
2024/04/17 14:56:43 Test address 1: 0x349Ce222066B547B296d7089b0D7EFDC0A4f6404
2024/04/17 14:56:43 Test address 2: 0xfDAf66c2a181Dd5F0728Ea9Bf76c3753228d89b5
2024/04/17 14:56:43 funding account 0x349Ce222066B547B296d7089b0D7EFDC0A4f6404 with 100000000000000000
2024/04/17 14:56:43 funder 0x8943545177806ED17B9F23F0a21ee5948eCaa776 0
2024/04/17 14:56:43 insufficient funds for transfer
exit status 1

Solution

The L1_PRIVKEY is wrong. The default private key from empty variable works though:

export L1_PRIVKEY=6c45335a22461ccdb978b78ab61b238bad2fae4544fb55c14eb096c875ccfc52

and you get the desired funds.

Problem no.2

Error

Now the funding works well, but you get another error:

4. Emit batch
panic: transaction failed: execution reverted: precompile '0x0000000000000000000000000000000043200002' reverted: 'Post "http://el-4-geth-builder-lighthouse:8545": dial tcp: lookup el-4-geth-builder-lighthouse on 127.0.0.11:53: no such host'

Solution

The BUILDER_URL env variable is wrong. If you leave it blank, it defaults to local which is resolved to http://host.docker.internal:1234 and the example works.

unset BUILDER_URL

Now the whole example works as expected:

4. Emit batch
{"jsonrpc":"2.0","method":"mev_sendBundle","params":[{"version":"v0.1","inclusion":{"block":"0x1d","maxBlock":"0x36"},"body":[{"tx":"0xf867808427f2492f82520894fbeadd53e5418e73de130fef0af081548decfad78203e880820a96a093e9eef9b9741be075aeaa1f7123ac002be625596a990b69103e35d75d4a32ffa032643f510d5d43d89ea4b928093894502792bc645237b170935f4cd9be077b8c","canRevert":false},{"tx":"0xf867808427f2492f8253ac94fbeadd53e5418e73de130fef0af081548decfad78203e880820a95a076ffdb9c91833b1973fab85d721a22729f362e17c98b3d62fb26e765a08bd258a07f0c08a3133f948cf1f10c74b18a965c59e0b53905ec7c518221f23f9654ebee","canRevert":false}],"validity":{"refund":[{"bodyIdx":0,"percent":10}]}}],"id":1}
2024/04/17 15:02:59 transaction hash: 0xe4228c47530cc451eceeb44a682caf3284329d02c360634fe902448247ceeebc
2024/04/17 15:02:59 mev_share response: [{"id":1,"result":{"bundleHash":"0x8b3302e3ffe34149ba5b2e801f21d4227faf6c7860a4e03ace2b8a6bbac54f07"},"jsonrpc":"2.0"}]
Bundle hash 0x8b3302e3ffe34149ba5b2e801f21d4227faf6c7860a4e03ace2b8a6bbac54f07

pistomat avatar Apr 17 '24 14:04 pistomat