-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ethash): flashbots_getWork RPC with profit #106
Conversation
I'm curious to how you would test this feature, but in my mind, I'm thinking something like
And then send some test transactions around then calling |
> 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 > 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"]
... |
72a9c78
to
516e2c3
Compare
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. |
d68e765
to
1cfb26f
Compare
@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 > 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 |
#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
mev-geth/miner/worker.go
Line 105 in 516e2c3
Not sure how I can test it, but running on Sepolia with (
mainnet
in the log is a bug, see ethereum#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.