Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
5 changes: 0 additions & 5 deletions internal/ethapi/api_mev.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ethapi
import (
"context"
"fmt"
"math/big"
"time"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -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()
}
Expand Down
4 changes: 0 additions & 4 deletions internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 0 additions & 2 deletions internal/ethapi/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 0 additions & 3 deletions internal/ethapi/transaction_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
13 changes: 5 additions & 8 deletions miner/bid_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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())
}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)
}
}
Expand Down
9 changes: 0 additions & 9 deletions miner/miner_mev.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down