From 19fc05d6c376687d6aad073647417efd0058c7c6 Mon Sep 17 00:00:00 2001 From: Dror Tirosh Date: Wed, 29 May 2024 13:54:37 +0300 Subject: [PATCH] remove expectedRevenue --- core/txpool/rip7560pool/rip7560pool.go | 11 ++++------- core/types/tx_rip7560.go | 9 ++++----- internal/ethapi/rip7560api.go | 9 ++++----- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/core/txpool/rip7560pool/rip7560pool.go b/core/txpool/rip7560pool/rip7560pool.go index 3c6670d34e..19bcad417d 100644 --- a/core/txpool/rip7560pool/rip7560pool.go +++ b/core/txpool/rip7560pool/rip7560pool.go @@ -261,13 +261,10 @@ func (pool *Rip7560BundlerPool) GetRip7560BundleStatus(hash common.Hash) (*types return pool.includedBundles[hash], nil } -// Simply returns the bundle with the highest promised revenue by fully trusting the bundler-provided value. +// return first bundle func (pool *Rip7560BundlerPool) selectExternalBundle() *types.ExternallyReceivedBundle { - var selectedBundle *types.ExternallyReceivedBundle - for _, bundle := range pool.pendingBundles { - if selectedBundle == nil || selectedBundle.ExpectedRevenue.Cmp(bundle.ExpectedRevenue) == -1 { - selectedBundle = bundle - } + if len(pool.pendingBundles) == 0 { + return nil } - return selectedBundle + return pool.pendingBundles[0] } diff --git a/core/types/tx_rip7560.go b/core/types/tx_rip7560.go index 47019c750b..aee22df7a3 100644 --- a/core/types/tx_rip7560.go +++ b/core/types/tx_rip7560.go @@ -188,11 +188,10 @@ func (tx *Rip7560AccountAbstractionTx) AbiEncode() ([]byte, error) { // ExternallyReceivedBundle represents a bundle of Type 4 transactions received from a trusted 3rd party. // The validator includes the bundle in the original order atomically or drops it completely. type ExternallyReceivedBundle struct { - BundlerId string - BundleHash common.Hash - ExpectedRevenue *big.Int - ValidForBlock *big.Int - Transactions []*Transaction + BundlerId string + BundleHash common.Hash + ValidForBlock *big.Int + Transactions []*Transaction } // BundleReceipt represents a receipt for an ExternallyReceivedBundle successfully included in a block. diff --git a/internal/ethapi/rip7560api.go b/internal/ethapi/rip7560api.go index 0245b32077..4e669cc19c 100644 --- a/internal/ethapi/rip7560api.go +++ b/internal/ethapi/rip7560api.go @@ -10,7 +10,7 @@ import ( "math/big" ) -func (s *TransactionAPI) SendRip7560TransactionsBundle(ctx context.Context, args []TransactionArgs, creationBlock *big.Int, expectedRevenue *big.Int, bundlerId string) (common.Hash, error) { +func (s *TransactionAPI) SendRip7560TransactionsBundle(ctx context.Context, args []TransactionArgs, creationBlock *big.Int, bundlerId string) (common.Hash, error) { if len(args) == 0 { return common.Hash{}, errors.New("submitted bundle has zero length") } @@ -19,10 +19,9 @@ func (s *TransactionAPI) SendRip7560TransactionsBundle(ctx context.Context, args txs[i] = args[i].ToTransaction() } bundle := &types.ExternallyReceivedBundle{ - BundlerId: bundlerId, - ExpectedRevenue: expectedRevenue, - ValidForBlock: creationBlock, - Transactions: txs, + BundlerId: bundlerId, + ValidForBlock: creationBlock, + Transactions: txs, } bundleHash := calculateBundleHash(txs) bundle.BundleHash = bundleHash