From 6d74d088835437de1b277f915c0fb33b8f205ff5 Mon Sep 17 00:00:00 2001 From: vahoo5 Date: Tue, 6 Jun 2023 01:46:50 +0200 Subject: [PATCH] F --- internal/ethapi/api.go | 20 ++++++++++---------- internal/ethapi/transaction_args.go | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index ecb52f1fcc..3952cbf54b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1331,6 +1331,10 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs, overrid return nil, errors.New("bundle txs and block numbers mismatch") } + if len(args.Timestamps) != len(args.Transactions) { + return nil, errors.New("bundle txs and timestamps mismatch") + } + defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) timeoutMilliSeconds := int64(5000) @@ -1347,10 +1351,6 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs, overrid return nil, err } - timestamp := parent.Time + 1 - if args.Timestamp != nil { - timestamp = *args.Timestamp - } coinbase := parent.Coinbase if args.Coinbase != nil { coinbase = common.HexToAddress(*args.Coinbase) @@ -1398,7 +1398,7 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs, overrid ParentHash: parent.Hash(), Number: big.NewInt(int64(args.BlockNumbers[i])), GasLimit: gasLimit, - Time: timestamp, + Time: args.Timestamps[i], Difficulty: difficulty, Coinbase: coinbase, BaseFee: baseFee, @@ -1471,6 +1471,10 @@ func doCallBundle(ctx context.Context, b Backend, chain *core.BlockChain, args C return nil, errors.New("bundle txs and block numbers mismatch") } + if len(args.Timestamps) != len(args.Transactions) { + return nil, errors.New("bundle txs and timestamps mismatch") + } + defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) timeoutMilliSeconds := int64(5000) @@ -1487,10 +1491,6 @@ func doCallBundle(ctx context.Context, b Backend, chain *core.BlockChain, args C return nil, err } - timestamp := parent.Time + 1 - if args.Timestamp != nil { - timestamp = *args.Timestamp - } coinbase := parent.Coinbase if args.Coinbase != nil { coinbase = common.HexToAddress(*args.Coinbase) @@ -1539,7 +1539,7 @@ func doCallBundle(ctx context.Context, b Backend, chain *core.BlockChain, args C ParentHash: parent.Hash(), Number: big.NewInt(int64(args.BlockNumbers[i])), GasLimit: gasLimit, - Time: timestamp, + Time: args.Timestamps[i], Difficulty: difficulty, Coinbase: coinbase, BaseFee: baseFee, diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index f020fa6731..5126874214 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -73,9 +73,9 @@ type MaxWalletSearchArgs struct { type CallBundleArgs struct { Transactions []TransactionArgs `json:"transactions"` BlockNumbers []rpc.BlockNumber `json:"blockNumbers"` + Timestamps []uint64 `json:"timestamps"` StateBlockNumberOrHash rpc.BlockNumberOrHash `json:"stateBlockNumber"` Coinbase *string `json:"coinbase"` - Timestamp *uint64 `json:"timestamp"` Timeout *int64 `json:"timeout"` GasLimit *uint64 `json:"gasLimit"` Difficulty *big.Int `json:"difficulty"`