remove expectedRevenue

This commit is contained in:
Dror Tirosh 2024-05-29 13:54:37 +03:00
parent 28a79ec98d
commit 19fc05d6c3
3 changed files with 12 additions and 17 deletions

View file

@ -261,13 +261,10 @@ func (pool *Rip7560BundlerPool) GetRip7560BundleStatus(hash common.Hash) (*types
return pool.includedBundles[hash], nil 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 { func (pool *Rip7560BundlerPool) selectExternalBundle() *types.ExternallyReceivedBundle {
var selectedBundle *types.ExternallyReceivedBundle if len(pool.pendingBundles) == 0 {
for _, bundle := range pool.pendingBundles { return nil
if selectedBundle == nil || selectedBundle.ExpectedRevenue.Cmp(bundle.ExpectedRevenue) == -1 {
selectedBundle = bundle
}
} }
return selectedBundle return pool.pendingBundles[0]
} }

View file

@ -188,11 +188,10 @@ func (tx *Rip7560AccountAbstractionTx) AbiEncode() ([]byte, error) {
// ExternallyReceivedBundle represents a bundle of Type 4 transactions received from a trusted 3rd party. // 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. // The validator includes the bundle in the original order atomically or drops it completely.
type ExternallyReceivedBundle struct { type ExternallyReceivedBundle struct {
BundlerId string BundlerId string
BundleHash common.Hash BundleHash common.Hash
ExpectedRevenue *big.Int ValidForBlock *big.Int
ValidForBlock *big.Int Transactions []*Transaction
Transactions []*Transaction
} }
// BundleReceipt represents a receipt for an ExternallyReceivedBundle successfully included in a block. // BundleReceipt represents a receipt for an ExternallyReceivedBundle successfully included in a block.

View file

@ -10,7 +10,7 @@ import (
"math/big" "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 { if len(args) == 0 {
return common.Hash{}, errors.New("submitted bundle has zero length") 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() txs[i] = args[i].ToTransaction()
} }
bundle := &types.ExternallyReceivedBundle{ bundle := &types.ExternallyReceivedBundle{
BundlerId: bundlerId, BundlerId: bundlerId,
ExpectedRevenue: expectedRevenue, ValidForBlock: creationBlock,
ValidForBlock: creationBlock, Transactions: txs,
Transactions: txs,
} }
bundleHash := calculateBundleHash(txs) bundleHash := calculateBundleHash(txs)
bundle.BundleHash = bundleHash bundle.BundleHash = bundleHash