diff --git a/eth/api_backend.go b/eth/api_backend.go index 9ed073ceb8..b1529e098e 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -505,10 +505,6 @@ func (b *EthAPIBackend) SendBid(ctx context.Context, bid *types.BidArgs) (common return b.Miner().SendBid(ctx, bid) } -func (b *EthAPIBackend) BestBidGasFee(parentHash common.Hash) *big.Int { - return b.Miner().BestPackedBlockReward(parentHash) -} - func (b *EthAPIBackend) MinerInTurn() bool { return b.Miner().InTurn() } diff --git a/internal/ethapi/api_mev.go b/internal/ethapi/api_mev.go index b1e0c08605..ff18f69009 100644 --- a/internal/ethapi/api_mev.go +++ b/internal/ethapi/api_mev.go @@ -3,7 +3,6 @@ package ethapi import ( "context" "fmt" - "math/big" "time" "github.com/ethereum/go-ethereum/common" @@ -88,10 +87,6 @@ func (m *MevAPI) SendBid(ctx context.Context, args types.BidArgs) (common.Hash, return m.b.SendBid(ctx, &args) } -func (m *MevAPI) BestBidGasFee(_ context.Context, parentHash common.Hash) *big.Int { - return m.b.BestBidGasFee(parentHash) -} - func (m *MevAPI) Params() *types.MevParams { return m.b.MevParams() } diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 774d2db699..7562d7f1ca 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -665,10 +665,6 @@ func (b *testBackend) SendBid(ctx context.Context, bid *types.BidArgs) (common.H panic("implement me") } func (b *testBackend) MinerInTurn() bool { return false } -func (b *testBackend) BestBidGasFee(parentHash common.Hash) *big.Int { - //TODO implement me - panic("implement me") -} func TestEstimateGas(t *testing.T) { t.Parallel() diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 8e6dfbea87..30d28aad41 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -120,8 +120,6 @@ type Backend interface { HasBuilder(builder common.Address) bool // SendBid receives bid from the builders. SendBid(ctx context.Context, bid *types.BidArgs) (common.Hash, error) - // BestBidGasFee returns the gas fee of the best bid for the given parent hash. - BestBidGasFee(parentHash common.Hash) *big.Int // MinerInTurn returns true if the validator is in turn to propose the block. MinerInTurn() bool } diff --git a/internal/ethapi/transaction_args_test.go b/internal/ethapi/transaction_args_test.go index bac730fc59..95a20870e2 100644 --- a/internal/ethapi/transaction_args_test.go +++ b/internal/ethapi/transaction_args_test.go @@ -430,6 +430,3 @@ func (b *backendMock) SendBid(ctx context.Context, bid *types.BidArgs) (common.H panic("implement me") } func (b *backendMock) MinerInTurn() bool { return false } -func (b *backendMock) BestBidGasFee(parentHash common.Hash) *big.Int { - panic("implement me") -} diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index df6c6b891f..33b9ab17e6 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -406,10 +406,6 @@ func (b *bidSimulator) newBidLoop() { } } - genDiscardedReply := func(betterBid *BidRuntime) error { - return fmt.Errorf("bid is discarded, current bestBid is [blockReward: %s, validatorReward: %s]", betterBid.expectedBlockReward, betterBid.expectedValidatorReward) - } - for { select { case newBid := <-b.newBidCh: @@ -435,6 +431,7 @@ func (b *bidSimulator) newBidLoop() { var replyErr error toCommit := true + bidAcceptted := true bestBidToRun := b.GetBestBidToRun(newBid.bid.ParentHash) if bestBidToRun != nil { bestBidRuntime, _ := newBidRuntime(bestBidToRun, *b.config.ValidatorCommission) @@ -445,13 +442,13 @@ func (b *bidSimulator) newBidLoop() { } else if !bestBidToRun.IsCommitted() { // bestBidToRun is not committed yet, this newBid will trigger bestBidToRun to commit bidRuntime = bestBidRuntime - replyErr = genDiscardedReply(bidRuntime) + bidAcceptted = false log.Debug("discard new bid and to simulate the non-committed bestBidToRun", "builder", bestBidToRun.Builder, "bidHash", bestBidToRun.Hash().TerminalString()) } else { // new bid will be discarded, as it is useless now. toCommit = false - replyErr = genDiscardedReply(bestBidRuntime) + bidAcceptted = false log.Debug("new bid will be discarded", "builder", bestBidToRun.Builder, "bidHash", bestBidToRun.Hash().TerminalString()) } @@ -493,7 +490,7 @@ func (b *bidSimulator) newBidLoop() { log.Info("[BID ARRIVED]", "block", newBid.bid.BlockNumber, "builder", newBid.bid.Builder, - "accepted", replyErr == nil, + "accepted", bidAcceptted, "blockReward", weiToEtherStringF6(bidRuntime.expectedBlockReward), "validatorReward", weiToEtherStringF6(bidRuntime.expectedValidatorReward), "tx", len(newBid.bid.Txs), @@ -685,7 +682,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { if err != nil { logCtx = append(logCtx, "err", err) log.Info("BidSimulator: simulation failed", logCtx...) - if err != errBetterBid { + if !errors.Is(errBetterBid, err) { go b.reportIssue(bidRuntime, err) } } diff --git a/miner/miner_mev.go b/miner/miner_mev.go index 102d8e4381..69a9195d15 100644 --- a/miner/miner_mev.go +++ b/miner/miner_mev.go @@ -80,15 +80,6 @@ func (miner *Miner) SendBid(ctx context.Context, bidArgs *types.BidArgs) (common return bid.Hash(), nil } -func (miner *Miner) BestPackedBlockReward(parentHash common.Hash) *big.Int { - bidRuntime := miner.bidSimulator.GetBestBid(parentHash) - if bidRuntime == nil { - return big.NewInt(0) - } - - return bidRuntime.packedBlockReward -} - func (miner *Miner) MevParams() *types.MevParams { builderFeeCeil, ok := big.NewInt(0).SetString(*miner.worker.config.Mev.BuilderFeeCeil, 10) if !ok {