diff --git a/core/types/bid.go b/core/types/bid.go index 2826bb7f69..a0d50239a8 100644 --- a/core/types/bid.go +++ b/core/types/bid.go @@ -182,4 +182,5 @@ type MevParams struct { ValidatorCommission uint64 // 100 means 1% BidSimulationLeftOver time.Duration GasCeil uint64 + BuilderFeeCeil *big.Int } diff --git a/internal/ethapi/api_mev.go b/internal/ethapi/api_mev.go index 0fa92af1af..d6e6d66e57 100644 --- a/internal/ethapi/api_mev.go +++ b/internal/ethapi/api_mev.go @@ -27,7 +27,7 @@ func NewMevAPI(b Backend) *MevAPI { // SendBid receives bid from the builders. // If mev is not running or bid is invalid, return error. // Otherwise, creates a builder bid for the given argument, submit it to the miner. -func (m *MevAPI) SendBid(ctx context.Context, args *types.BidArgs) (common.Hash, error) { +func (m *MevAPI) SendBid(ctx context.Context, args types.BidArgs) (common.Hash, error) { if !m.b.MevRunning() { return common.Hash{}, types.ErrMevNotRunning } @@ -94,7 +94,7 @@ func (m *MevAPI) SendBid(ctx context.Context, args *types.BidArgs) (common.Hash, } } - return m.b.SendBid(ctx, args) + return m.b.SendBid(ctx, &args) } func (m *MevAPI) BestBidGasFee(_ context.Context, parentHash common.Hash) *big.Int { diff --git a/miner/miner_mev.go b/miner/miner_mev.go index 8393ead135..8f5315d178 100644 --- a/miner/miner_mev.go +++ b/miner/miner_mev.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/log" ) type BuilderConfig struct { @@ -17,6 +18,7 @@ type BuilderConfig struct { type MevConfig struct { Enabled bool // Whether to enable Mev or not + BuilderFeeCeil string // The maximum builder fee of a bid SentryURL string // The url of Mev sentry Builders []BuilderConfig // The list of builders ValidatorCommission uint64 // 100 means 1% @@ -104,9 +106,16 @@ func (miner *Miner) BestPackedBlockReward(parentHash common.Hash) *big.Int { } func (miner *Miner) MevParams() *types.MevParams { + builderFeeCeil, ok := big.NewInt(0).SetString(miner.worker.config.Mev.BuilderFeeCeil, 10) + if !ok { + log.Error("failed to parse builder fee ceil", "BuilderFeeCeil", miner.worker.config.Mev.BuilderFeeCeil) + return nil + } + return &types.MevParams{ ValidatorCommission: miner.worker.config.Mev.ValidatorCommission, BidSimulationLeftOver: miner.worker.config.Mev.BidSimulationLeftOver, GasCeil: miner.worker.config.GasCeil, + BuilderFeeCeil: builderFeeCeil, } }