mev-share-node icon indicating copy to clipboard operation
mev-share-node copied to clipboard

Where does `WantRefund` come from?

Open ghost opened this issue 2 years ago • 7 comments

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 avatar Nov 27 '23 11:11 ghost

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

ghost avatar Dec 06 '23 11:12 ghost

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 avatar Dec 06 '23 17:12 dvush

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

dvush avatar Dec 06 '23 17:12 dvush

@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?

ghost avatar Dec 08 '23 07:12 ghost

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.

dvush avatar Dec 08 '23 18:12 dvush

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

ghost avatar Dec 09 '23 07:12 ghost

Yes, you can

dvush avatar Dec 09 '23 11:12 dvush