Skip to content

Conversation

@jetbldr
Copy link

@jetbldr jetbldr commented Jul 18, 2025

Summary

Change bid submission limit mechanism from builder address (pubkey) to builder name for more flexible configuration.

Problem

The original bid limiting mechanism was based on builder address, but in some scenarios, the same builder might use different addresses, or we want to group limits by builder name.

Solution

  1. Extend BuilderConfig struct: Add Name field to support explicit builder name configuration
  2. Smart name extraction: Auto-extract builder name from URL domain when Name is not configured
  3. Update limit logic: Use builderName instead of address in bidSimulator
  4. Backward compatibility: Maintain compatibility with existing config format

Changes

1. Config structure update

type BuilderConfig struct {
    Address common.Address
    URL     string
    Name    string `toml:",omitempty"` // Builder name, if empty will use domain suffix from URL
}

2. New methods

  • GetBuilderName(): Get builder name, prioritize configured Name, otherwise extract from URL
  • extractDomainSuffix(): Extract builder name from URL domain

3. Limit logic adjustment

  • bidSimulator limits by builderName instead of address
  • Keep existing maxBidsPerBuilder config parameter

Config example

[[builders]]
address = "0x1234567890123456789012345678901234567890"
url = "https://tokyo.builder.blockrazor.io"
name = "blockrazor"  # Optional, auto-extract from URL if not set

[[builders]]
address = "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"
url = "https://builder.flashbots.net"
# No name configured, will auto-extract as "flashbots"

Backward compatibility

  • ✅ Existing config files work without modification
  • ✅ Auto-extract from URL when Name field is not configured
  • ✅ Keep existing maxBidsPerBuilder config parameter

Testing

  • ✅ Test with configured Name field
  • ✅ Test auto-extraction from URL
  • ✅ Test various URL formats
  • ✅ Test edge cases

Impact

  • Positive: More flexible builder grouping limit mechanism
  • No negative impact: Fully backward compatible

@jetbldr jetbldr changed the title fix: limit builder submissions by name instead of pubkey# MR: Limit bids by builder name instead of address fix: limit builder submissions by name instead of pubkey Jul 18, 2025
@zzzckck
Copy link
Collaborator

zzzckck commented Jul 22, 2025

Currently, each builder can have at most 6 addresses, each address can bid twice for each block at most.
With this proposal, the bid limitation will be builder granularity, rather than builder-address granularity.

2 feedbacks:

  • 1.lower the builder's bid for each block from 12(6*2) to 6? Builder should be self-constraint from sending to many bids.
  • 2.this proposal will impact builder's bid strategy, needs to be confirmed with builders and set up a timeline for it, so builders can have enough time to migrate.

@jetbldr
Copy link
Author

jetbldr commented Jul 22, 2025

@zzzckck thank you for response

🔧 Assumption Behind the Proposal
With blind bidding, each builder may submit more blocks, increasing the validator's simulation load

This isn’t malicious — just rational behavior under the new rules: since builders are only competing against their own previous bids, they’ll send a new block as long as it shows any improvement.

✅ Feedback 1: Limit from 12 to 6
We’re okay with this change.
It reduces the max simulations per block from 60 to 30 — a meaningful improvement.

✅ Feedback 2: Need more time
Agreed. Since this assumption isn't backed by hard data yet, it’s reasonable to monitor post-launch behavior before enforcing stricter rules.

@jetbldr
Copy link
Author

jetbldr commented Jul 22, 2025

If this limitation is going to be enforced, we suggest first updating the configuration format used by the Good Will Alliance.

This would simplify the implementation and make the enforcement logic much cleaner in code.

@zzzckck zzzckck requested a review from Copilot July 28, 2025 08:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR changes the bid submission limiting mechanism from builder address-based to builder name-based for more flexible configuration. The change allows for better grouping of builders that may use different addresses but share the same name or domain.

Key Changes:

  • Extended BuilderConfig struct with optional Name field and smart name extraction from URL domains
  • Updated bid limiting logic to use builder names instead of addresses in bidSimulator
  • Added comprehensive test coverage for name extraction and configuration handling

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
miner/minerconfig/config.go Adds Name field to BuilderConfig, implements name extraction logic and getter methods
miner/minerconfig/config_test.go Comprehensive test suite covering name extraction, config methods, and edge cases
miner/bid_simulator.go Updates bid limiting to use builder names instead of addresses with dual tracking system

Comment on lines +120 to +122
pendingMu sync.RWMutex
pending map[uint64]map[common.Address]map[common.Hash]struct{} // blockNumber -> builder -> bidHash -> struct{}
pendingByName map[uint64]map[string]map[common.Hash]struct{} // blockNumber -> builderName -> bidHash -> struct{}
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code now maintains two separate pending maps (pending and pendingByName) that track the same data but with different keys. This duplication increases memory usage and complexity. Consider consolidating into a single data structure or clearly documenting why both are necessary.

Suggested change
pendingMu sync.RWMutex
pending map[uint64]map[common.Address]map[common.Hash]struct{} // blockNumber -> builder -> bidHash -> struct{}
pendingByName map[uint64]map[string]map[common.Hash]struct{} // blockNumber -> builderName -> bidHash -> struct{}
pendingMu sync.RWMutex
pending map[uint64]map[builderKey]map[common.Hash]struct{} // blockNumber -> builderKey -> bidHash -> struct{}
// builderKey is a composite key containing both common.Address and builderName.

Copilot uses AI. Check for mistakes.
Comment on lines 639 to +665

b.pending[blockNumber][builder][bidHash] = struct{}{}

// Also add to pendingByName
builderName := b.getBuilderName(builder)
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code assumes that b.pending[blockNumber][builder] exists, but there's no guarantee that the nested maps have been initialized. This will cause a panic if the maps don't exist. The same initialization pattern used for pendingByName should be applied here.

Suggested change
b.pending[blockNumber][builder][bidHash] = struct{}{}
// Also add to pendingByName
builderName := b.getBuilderName(builder)
// Ensure nested maps are initialized
if _, ok := b.pending[blockNumber]; !ok {
b.pending[blockNumber] = make(map[common.Address]map[common.Hash]struct{})
}
if _, ok := b.pending[blockNumber][builder]; !ok {
b.pending[blockNumber][builder] = make(map[common.Hash]struct{})
}
b.pending[blockNumber][builder][bidHash] = struct{}{}
// Also add to pendingByName
builderName := b.getBuilderName(builder)
if _, ok := b.pendingByName[blockNumber]; !ok {
b.pendingByName[blockNumber] = make(map[string]map[common.Hash]struct{})
}
if _, ok := b.pendingByName[blockNumber][builderName]; !ok {
b.pendingByName[blockNumber][builderName] = make(map[common.Hash]struct{})
}

Copilot uses AI. Check for mistakes.
Comment on lines +132 to +133
// For invalid formats, return the original URL
return url
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the URL format is invalid, returning the original URL as the domain suffix could lead to unexpected behavior. Consider returning a more descriptive fallback value or logging a warning about the invalid URL format.

Suggested change
// For invalid formats, return the original URL
return url
// For invalid formats, log a warning and return a descriptive fallback value
log.Warn("Invalid URL format encountered in extractDomainSuffix", "url", url)
return "invalid"

Copilot uses AI. Check for mistakes.
}

if len(b.pendingByName[blockNumber][builderName]) >= int(b.maxBidsPerBuilder) {
return fmt.Errorf("too many bids: exceeded limit of %d bids per builder name (%s) per block", b.maxBidsPerBuilder, builderName)
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The error message includes the builder name, which could potentially expose sensitive information in logs. Consider whether the builder name should be included in error messages or if a sanitized version should be used.

Copilot uses AI. Check for mistakes.
@huihzhao
Copy link

If this limitation is going to be enforced, we suggest first updating the configuration format used by the Good Will Alliance.

This would simplify the implementation and make the enforcement logic much cleaner in code.

Template for builders

[Name of Builder]
Address = ["0x04d6...73F197ccd186","0x05fe...73F19dfdsafd86"] // up to 6 addresses can be configurated
RPC = ["https://rpc-builder.io/"] // up to 6 RPCs
Website = "https://example-builder.io"
Description = "This is the fastest builder on BSC network"
Contact = "example-builder@mail.com"

@allformless allformless marked this pull request as draft January 19, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants