flashbots / mev-share-node

GNU Affero General Public License v3.0
94 stars 13 forks source link

Where does `WantRefund` come from? #18

Open ghost opened 9 months ago

ghost commented 9 months ago

I was wondering where WantRefund comes from. I did a search for the entire flashbots organization and I only found matches in mev-share-node.

First I thought WantRefund is just an old unused property, but it must be used since users somehow must be able to specify a custom refund percentage.

1) I'm assuming this property is set in the new version of the relay, which isn't open source. Is that correct? Is there a chance this repo becomes public? 2) Why don't just use refundConfig? The rpc-endpoint uses it too

Specific code snippet I'm taking about at mevshare/api.go L133:

// send 90 % of the refund to the unmatched bundle or the suggested refund if set
refundPercent := RefundPercent
if unmatchedBundle.Privacy != nil && unmatchedBundle.Privacy.WantRefund != nil {
    refundPercent = *unmatchedBundle.Privacy.WantRefund
}

Thanks in advance for your reply.

ghost commented 9 months ago

Pining you @dvush, since you edited those files most recently

dvush commented 9 months ago

Hi! Want refund is used in the code of the mev share node if you take a look at where this variable is used. Basically, when the user wants tx to be backrun and they want to set refund percentage other than 90 they set this field.

It's used on our api when sending eth_sendPrivateTransaction where we have a way for user to configure this. The code for our api is indeed closed but essentially it converts user preferred refund into correct values for wantRefund and refundConfig

dvush commented 9 months ago

So why not use refund config?

It's the way we refund config works and how rpc endpoint refund config works.

Let's say you want to set refund like that: send x percent of the refund to address a.

On rpc endpoint and eth-sendPrivateTransaction you would set refund config to be (x, a)

On mev share mev-sendBundle you would set wantRefund = x, refundConfig = (100, a)

We want to encourage users to use private tx api and use the first convention for refund config so this detail of mev share api is not well documented

ghost commented 9 months ago

@dvush thanks for answering! Just to be clear: When I want a refund other than 90% I never need to set wantRefund unless it is mev_sendBundle?

dvush commented 9 months ago

I don't quite understand the question wantRefund is a field in mev_sendBundle call so there is no place to set it outside of mev_sendBundle call.

If you are using eth_sendPrivateTx of relay.flashbots.net where you set your refund configuration call then you don't need to know that this thing exist.

ghost commented 9 months ago

can I set wantRefund in my mev_sendBundle before sending it to relay.flashbots.net?

dvush commented 9 months ago

Yes, you can