-
Notifications
You must be signed in to change notification settings - Fork 121
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
feature: boost proposer and builder profits #519
base: main
Are you sure you want to change the base?
Conversation
services/api/service.go
Outdated
return | ||
} | ||
// Overwrite the builder's gasLimit with the relay-set fictitious limit | ||
payload.Capella.ExecutionPayload.GasLimit = RelayFictitiousGasLimit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overriding any payload field renders the payload's block hash invalid and the payload simulation would fail on this integrity check. might be missing smth obv here...
https://github.com/flashbots/builder/blob/ca9f4b1ae44aadc6c254e9198ce72d143c19badd/eth/block-validation/api.go#L247-L249
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, iiuc, even tho the expected desired gas limit increase will be calculated correctly, the gas limit check will still fail on header verification here
https://github.com/flashbots/builder/blob/ca9f4b1ae44aadc6c254e9198ce72d143c19badd/core/blockchain.go#L2519
since the payload's gas limit is not auto-adjusted during simulation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya there are 3 changes to be made rn
- change invocation such that
ValidateBlock
callutils.CalcGasLimit
with the fictitious target - Set payload gasLimit to output of
utils.CalcGasLimit
with the ficititous target - Calculate correct hash & override payload header hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hopeful I could do it all in the API layer, however, that would require looking up the parent block. So we'll have to make some changes to the builder backend as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay new implementation plan:
We require the builder backend to look up the previous blockhash in order to calculate the correct gasLimit given the ficitious registered target. We then require a way to get that info back to the relay API. So we need to return data from the builder's RPC endpoint that currently returns no data. That data is the new gas_limit and blockhash. This output can then used to modify the Builder's payload
So to enumerate changes:
- modify the ValidateBuilderSubmissionV2 behavior to calculate the correct gasLimit and blockhash before simulating the block
- modify ValidateBuilderSubmissionV2 to return the modified gasLimit and blockHash
- modify the relay API to override the builder payload with the returned result before storing it in the bids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay updated 👍
This PR relies on the behavior in flashbots/builder#113 |
oh i also need to change the defered database upsert function in the middle to use the overridden payload value. will push that commit later |
📝 Summary
Boosts proposer and builder profits by adjusting gas limit behavior in the relay api
⛱ Motivation and Context
Proposers and builders lose money that would be paid in fees, because users are forced to burn it via the base fee mechanism. This PR implements a simple Relay-side fix to help recapture these funds
This fix does 2 things:
These two behaviors will have the following effect:
📚 References
Discussion of motivation
✅ I have run these commands
make lint
make test-race
go mod tidy
CONTRIBUTING.md