Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add bid fee ceil in mev_params #2357

Merged
merged 3 commits into from
Apr 1, 2024
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
1 change: 1 addition & 0 deletions core/types/bid.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,5 @@ type MevParams struct {
ValidatorCommission uint64 // 100 means 1%
BidSimulationLeftOver time.Duration
GasCeil uint64
BuilderFeeCeil *big.Int
}
4 changes: 2 additions & 2 deletions internal/ethapi/api_mev.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions miner/miner_mev.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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%
Expand Down Expand Up @@ -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,
}
}
Loading