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
}
// 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]
}

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.
// 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.

View file

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