erigon icon indicating copy to clipboard operation
erigon copied to clipboard

The first parameter of `eth_callBundle` is wrong

Open zzh1996 opened this issue 3 years ago • 1 comments

System information

Erigon version: 2022.02.02-beta

OS & Version: Linux

Commit hash :

Expected behaviour

The first parameter of eth_callBundle should be a list of raw txs, according to https://docs.flashbots.net/flashbots-auction/miners/mev-geth-spec/v04-rpc

Actual behaviour

The first parameter of eth_callBundle is a list of tx hashes

Steps to reproduce the behaviour

Backtrace

[backtrace]

zzh1996 avatar Feb 12 '22 08:02 zzh1996

I confirm that erigon's implementation of eth_callBundle is not compatible with the flashbots specification.

@kushalbabel is that on purpose?

monperrus avatar Oct 19 '22 12:10 monperrus

FTR, a draft fix is

func (api *APIImpl) CallBundle(ctx context.Context, rawTxs []hexutil.Bytes, stateBlockNumberOrHash rpc.BlockNumberOrHash, timeoutMilliSecondsPtr *int64) (map[string]interface{}, error) {
...
	var txs types.Transactions

	for _, encodedTx := range rawTxs {		
		txn, err := types.DecodeTransaction(rlp.NewStream(bytes.NewReader(encodedTx), uint64(len(encodedTx))))
		if err != nil {
			return nil, err
		}
		txs2 = append(txs2, txn)
	}

However, the request cannot be unmarshalled to []hexutil.Bytes, there is more work to be done on a unmarshable input datatype.

monperrus avatar Oct 21 '22 17:10 monperrus

Hey @monperrus It is indeed on purpose back then, as I was using this call to simulate transactions (by their hashes) at a historical state (different state than what they were actually executed on). The call was never intended to be compatible with the flashbots specification. Now that flashbots has grown in popularity, I agree that indeed this can cause confusion. I propose to rename the current eth_callBundle to eth_simulate and have another implementation for eth_callBundle

kushalbabel avatar Jan 03 '23 16:01 kushalbabel

I propose to rename the current eth_callBundle to eth_simulate and have another implementation for eth_callBundle

excellent idea @kushalbabel!

monperrus avatar Jan 07 '23 12:01 monperrus

This issue is stale because it has been open for 40 days with no activity. Remove stale label or comment, or this will be closed in 7 days.

github-actions[bot] avatar Jun 14 '23 02:06 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Jun 27 '23 02:06 github-actions[bot]

Any updates on this?

Is current eth_callBundle compatible with Flashbots RPC?

praveenbm5 avatar Aug 04 '23 05:08 praveenbm5