Skip to content

Commit

Permalink
feat: change bribe accept EOA to EOA list, rename to `ValidatorBribeE…
Browse files Browse the repository at this point in the history
…OAs`
  • Loading branch information
Jolly23 committed Dec 28, 2024
1 parent 615fa16 commit 55ec12d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions miner/bid_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) {
err = fmt.Errorf("invalid tx in bid, %v", err)
return
}
if b.config.ValidatorBribeEOA != (common.Address{}) {
bidRuntime.checkValidatorBribe(b.config.ValidatorBribeEOA, tx, receipt)
}
bidRuntime.checkValidatorBribe(b.config.ValidatorBribeEOAs, tx, receipt)
}

// check if bid reward is valid
Expand Down Expand Up @@ -772,12 +770,20 @@ func (r *BidRuntime) isExpectedBetterThanBestBid(bestBid *BidRuntime) bool {
return r.expectedRewardFromBuilder().Cmp(bestBid.totalRewardFromBuilder()) > 0
}

func (r *BidRuntime) checkValidatorBribe(selfBribe common.Address, tx *types.Transaction, receipt *types.Receipt) {
if to := tx.To(); to != nil && *to == selfBribe &&
receipt.Status == types.ReceiptStatusSuccessful &&
func (r *BidRuntime) checkValidatorBribe(acceptBribeEOAs []common.Address, tx *types.Transaction, receipt *types.Receipt) {
if len(acceptBribeEOAs) == 0 {
return
}

if to := tx.To(); to != nil && receipt.Status == types.ReceiptStatusSuccessful &&
tx.Value() != nil && tx.Value().Cmp(common.Big0) > 0 {

Check failure on line 779 in miner/bid_simulator.go

View workflow job for this annotation

GitHub Actions / golang-lint (1.21.x, ubuntu-latest)

unnecessary leading newline (whitespace)

r.directBribe.Add(r.directBribe, tx.Value())
for _, acceptBribeEOA := range acceptBribeEOAs {
if acceptBribeEOA == *to {
r.directBribe.Add(r.directBribe, tx.Value())
break
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion miner/miner_mev.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type MevConfig struct {
Builders []BuilderConfig // The list of builders
ValidatorCommission uint64 // 100 means the validator claims 1% from block reward
BidSimulationLeftOver time.Duration
ValidatorBribeEOA common.Address
ValidatorBribeEOAs []common.Address
}

var DefaultMevConfig = MevConfig{
Expand Down

0 comments on commit 55ec12d

Please sign in to comment.