Closed shekhirin closed 2 years ago
I'm curious to how you would test this feature, but in my mind, I'm thinking something like
./build/bin/geth --dev --dev.period 100
And then send some test transactions around then calling flashbots_getWork
--dev
is PoA network with Clique consensus engine, so you can't really use ethash
-based endpoints with it
> web3.currentProvider.send({method: 'eth_getWork'})
{
error: {
code: -32601,
message: "the method eth_getWork does not exist/is not available"
},
id: 0,
jsonrpc: "2.0"
}
> web3.currentProvider.send({method: 'flashbots_getWork'})
{
error: {
code: -32601,
message: "the method flashbots_getWork does not exist/is not available"
},
id: 0,
jsonrpc: "2.0"
}
Set up a local PoW net, everything seems to be working fine with simple transaction, will test with sendBundle
a bit later
> function getWork() { for (let i = 0; i < 10; i++) { setTimeout(() => console.log(JSON.stringify(web3.currentProvider.send({method: 'flashbots_getWork'}).result)), i*1000) } }
undefined
> eth.sendTransaction({from: '0xe394dd7832d8a26c5b4c6205649f85df25617a45', to: '0xe394dd7832d8a26c5b4c6205649f85df25617a45'}); getWork()
undefined
["0x7521d7254c597ed37a6fa67c3eb879a952582c7599ce853046da99b7324d1b40","0x0000000000000000000000000000000000000000000000000000000000000000","0x00006246fe64d8fdb818328ad2c48d383bb531be34f4e5407374e75cf9ec1206","0x227","0x0"]
["0xfd6d5a1180060b6bc0eb8f02b01f39c6fb7bb71ad6b81d1ccc2938c21f08d223","0x0000000000000000000000000000000000000000000000000000000000000000","0x00006246fe64d8fdb818328ad2c48d383bb531be34f4e5407374e75cf9ec1206","0x227","0x1319718a5000"]
["0xfd6d5a1180060b6bc0eb8f02b01f39c6fb7bb71ad6b81d1ccc2938c21f08d223","0x0000000000000000000000000000000000000000000000000000000000000000","0x00006246fe64d8fdb818328ad2c48d383bb531be34f4e5407374e75cf9ec1206","0x227","0x1319718a5000"]
["0xf079d4a29cf2d1e272fc7aa91559cae370d7300051f44ba64d374f5a75f218e5","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000622259be21c99badfa5a0dddb286296e288b391bb16d8f358ce29ca28bf5","0x22a","0x0"]
...
The mev-callbundle changes have been squashed and picked into the master branch, which messed up this PR. I think best would be to cherry-pick your original commit(s) onto the latest master state, and pointing the PR towards the master branch.
@metachris oh that's nice that master is relevant now. Cherry-picked my commit and pointed branch towards the master.
I tested it with https://github.com/flashbots/mev-geth-demo and demo-simple-old
script, everything seems to be working.
> print = () => { console.log(JSON.stringify(web3.currentProvider.send({method: 'flashbots_getWork'}).result.slice(3)) + '\n' + JSON.stringify(web3.currentProvider.send({method: 'eth_getWork'}).result.slice(3)) + '\n\n'); setTimeout(print, 1000) }
() =>
> print()
["0xcd","0x0"]
["0xcd"]
...
➜ mev-geth-demo git:(main) ✗ yarn demo-simple-old
...
["0xcd","0x0"]
["0xcd"]
["0xcd","0xecd8fae8c0fc20"]
["0xcd"]
...
This looks great, thanks! Sorry for the delay getting it reviewed, I was distracted over the holidays
https://github.com/flashbots/mev-geth/issues/103
Adds new RPC method
flashbots_getWork
which adds a new block reward including MEV toeth_getWork
RPC result.Block reward matches the profit number used in the mining worker https://github.com/flashbots/mev-geth/blob/516e2c3982109dd4176f3eae71015dd385f65ea2/miner/worker.go#L105
Not sure how I can test it, but running on Sepolia with (
mainnet
in the log is a bug, see https://github.com/ethereum/go-ethereum/pull/24147)successfully returns both
eth_getWork
andflashbots_getWork
RPCsGuess I could try syncing Ropsten and trying to mine it watching for
profit
value inflashbots_getWork
response.