Replies: 11 comments 12 replies
-
v0.2 proposalMiner payments in v0.2 must be done via a proxy payment contract as opposed to direct coinbase transfers. This will allow for reliable logging of payment amounts, as well as enable miners to route payments freely. Update April 11th: While processing payments through a smart contract adds a gas overhead to all bundles, we expect it to provide significant improvements to the security of the chain as it allows for more experimentation in payout mechanics (for example, smoothing MEV revenue variance across blocks to reduce incentive for time-bandit attacks). Here is the implementation currently being considered. You can find it deployed to goerli at address /**
*Submitted for verification at Etherscan.io on 2021-04-07
*/
pragma solidity 0.8.3;
contract MinerPayment {
mapping (address => address) private _minerReceivingAddresses;
event FlashbotsPayment(address coinbase, address receivingAddress, address msgSender, uint256 amount);
event RecipientUpdate(address coinbase, address receivingAddress);
receive() external payable {
_payMiner();
}
function setMinerReceivingAddress(address _newReceivingAddress) external {
_minerReceivingAddresses[msg.sender] = _newReceivingAddress;
emit RecipientUpdate(msg.sender, _newReceivingAddress);
}
function _getMinerReceivingAddress(address _who) private view returns (address) {
address receivingAddress = _minerReceivingAddresses[_who];
return (receivingAddress == address(0)) ? _who : receivingAddress;
}
function getMinerReceivingAddress(address _who) external view returns (address) {
return _getMinerReceivingAddress(_who);
}
function _payMiner() private {
address receivingAddress = _getMinerReceivingAddress(block.coinbase);
uint256 amount = address(this).balance;
payable(receivingAddress).transfer(amount);
emit FlashbotsPayment(block.coinbase, receivingAddress, msg.sender, amount);
}
function payMiner() external payable {
_payMiner();
}
function queueEther() external payable { }
} |
Beta Was this translation helpful? Give feedback.
-
I made a GitHub account just to say this: Therefore, despite whatever flexibility/logging we gain from implementing this, we lose out so much more in terms of gas costs. Say this operation takes a (conservative) extra 4,000 gas: there will be plenty of times when a miner could have fit more profitable transactions in the block had this extra operation not taken place. Not to mention that we are already using up a lot of the Ethereum network - think how much more gas would be wasted on logging Flashbots payments. So both the miners AND the searchers would be losing out on this proposal. If miners want to route it to some other address, they can do that sort of routing at periodic intervals. There is no need to be calculating a routing every single MEV transaction. Logging payment amounts and doing custom routing is simply too expensive to do on-chain. As far as I can tell, logging payment amounts right now by looking at coinbase transfers and gas does not seem too difficult as it is. |
Beta Was this translation helpful? Give feedback.
-
I don't see why this feature is needed, and agree to the points @jgorfenger made about gas usage. You mention these objectives:
Direct transfer to COINBASE are already a unique pattern, that's very easy to search for and analyze. Can you explain why this is needed?
The COINBASE address is already meant to be the address where miners want to get fees sent to, sending MEV there seems like a logical thing. Can you explain why this is needed?
It looks like the start of an interesting idea, but there is nothing else. Can you clarify what this is about? What is the concrete proposal here? |
Beta Was this translation helpful? Give feedback.
-
I was originally against this, but now I see this as the only way to protect against a future of damaging the consensus through miner-on-miner Salmonella. In such a scenario one miner attacks another miner performing MEV trading through block reorgs. In a simple example, you create a bait token which creates winning sandwiches that have a small win and very large trade size. You sustain a few round of losses while the competing miner sandwiches you, until you get the re-org, at which point you take their buy transaction and include it in your block, and discard the sell/victim transactions, essentially draining your competitor. This strategy can be extended in a variety of ways to attack other miners or traders who perform MEV, but a proxy contract can mitigate this by punishing re-orgs. |
Beta Was this translation helpful? Give feedback.
-
I think the gas costs here are a non-issue for the Ethereum network and for searcher competitiveness. For the Ethereum network as a whole: flashbots reduces the amount of gas used for the extraction any given MEV opportunity. If flashbots prevents even one failed tx from landing on chain (and it usually prevents several from landing on chain) then the extra gas spent on logging will have been paid for many times over by the gas savings from a single failed tx not landing on chain. For individual searchers: The small increase in gas cost applies to all searcher competitors, so this payment contract has no effect at all on searcher competition among searchers. As for the competition between flashbots searchers and non-flashbots bots, the small added gas costs are more than compensated for (again, by several multiples) by the prevention of even a single of your failed txs from landing on chain. So gas costs shouldn't be of any concern for flashbots searchers or people who care about the Ethereum network as a whole. |
Beta Was this translation helpful? Give feedback.
-
Some thoughts:
Ultimately, it should be up to the user if they want to use the logging router or a coinbase transfer. IMO this feature should be in the "nice to have" category. Definitely not a "required". |
Beta Was this translation helpful? Give feedback.
-
I have done some more testing using the router contract code that @thegostep provided using the settings identical to the ones deployed on Georli. I've found that for a sample searcher contract, the gas used in the transaction increased by 11,345 when using the standard payment router contract compared to a coinbase transfer. For many contracts, this is comparatively a huge amount of gas - most transactions will see a 3-10% increase in gas usage. This means that the relative gas price for these bundles will go down by about 2-9%. A bundle costing 151,000 gas with a relative gas price of 150 Gwei in v0.1 will have a relative gas price of only 139.5 Gwei in v0.2. The miner, searcher, and Ethereum network as a whole all take a hit because of this router contract. With bundle merging being introduced in v0.2, all it takes are two Flashbots bundles using the standard payment router to boot a regular ETH transfer transaction out of the block. The gas that would have been used for a standard ETH transfer - paid for by the sender - is replaced by Flashbots logging, whose extra gas (a) pays nothing to the miner, causing the miner to lose out on potential profits, and (b) makes bundle inclusion more difficult against on-chain mempool transactions for searchers. Proof that miners will lose outI will assume (b) needs no proof and will prove (a). Consider a situation in which the greatest-price transactions from the mempool to be included in the next block have a relative gas price of x. Let there be one Flashbots bundle whose relative gas price via a coinbase transfer is y, where y > x. Let z = y - e, where e is the loss in relative gas price when sending the miner payment through the standard payment router contract; therefore, z is the relative gas price of sending the miner payment through the standard payment router contract. Let us also assume that the searcher is paying 100% to the miner, which is the approximate outcome of searcher competition. There are two cases:
In both cases, the miner will certainly lose profits if the standard payment router is used. Why this is importantSome of the benefits espoused by the proponents of this proposal are well and good except that most of them simply do not apply to the proposed contract. The proxy contract is simply redirecting where the transfer is going and making a log message. It cannot help protect against reorganization attacks in its current state. It does not evenly distribute miner rewards, either. It should be up to the miner to distribute the rewards in, perhaps, a more efficient manner than to force all Flashbots bundles to include them. This is coming from someone who at this time is neither a searcher nor a miner. I appreciate any/all critiques of my methods and simply want the best for Flashbots. The contracts I used in my tests are quite trivial - one does a coinbase transfer, while the other directly calls |
Beta Was this translation helpful? Give feedback.
-
this would probably decrease the cost of the contract by ~10% the contract is relatively easy that the Solidity overhead may not be worth it |
Beta Was this translation helpful? Give feedback.
-
I have an alternative solution to the router contract that could preserve coinbase transfers but still allow Flashbots transactions to be identified more effectively. In this proposal, searchers could choose one of two options:
I guess this would depend on what Flashbots is trying to accomplish with its logging. I think the goals of the router contract would be made clearer if you shared your current difficulties in logging miner payments. Maybe we could even find a solution that preserves the current structure. |
Beta Was this translation helpful? Give feedback.
-
The nice thing is, this will make flashbots less competitive than alternatives, and reduce their influence over the network. There are no other upsides; this is just a waste of gas. The coinbase key can already redirect as much eth as they want to as many addresses as they want, and in less gas than this. It's trivial to track coinbase payments; this log is an expensive crutch for terrible engineers. |
Beta Was this translation helpful? Give feedback.
-
The below is without any warranties attached and is only for educational purposes, but it would be possible to use something like Yul to get better efficiency: {
// Construct the log for "event FlashbotsPayment(address coinbase, address msgSender, uint256 amount);"
mstore(0x00, coinbase())
mstore(0x20, caller())
mstore(0x40, callvalue())
log1(0, 0x60, 0x82bfd7d226ef75398f858bca413814d37886af582526e7fae712e36fe8a5d297 /*topic*/)
// Transfer the incoming payment to the coinbase
pop(call(not(0), coinbase(), callvalue(), 0, 0, 0, 0))
} This will emit the log as implemented in #45 (reply in thread) and transmit any incoming value to the coinbase. It translates to the following bytecode:
Some potential optimisations:
If one wants to have that event emitted, I do not think this can be made any more cheaper. |
Beta Was this translation helpful? Give feedback.
-
A standard payment router contract can help achieve a few key objectives:
Beta Was this translation helpful? Give feedback.
All reactions