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
5 changes: 5 additions & 0 deletions pkg/mev/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const (
Endpoint48Club = "https://puissant-builder.48.club"
EndpointBlockRazor = "https://bsc.blockrazor.xyz"
EndpointBloxRouteBundleSubmissions = "https://api.blxrbdn.com"
EndpointEthGasUS = "https://us.builder.ethgas.com"
EndpointEthGasEU = "https://eu.builder.ethgas.com"
EndpointEthGasAP = "https://ap.builder.ethgas.com"
EndpointEthGasAP2 = "https://ap-2.builder.ethgas.com"
)

const (
Expand All @@ -48,4 +52,5 @@ const (
BuilderBobTheBuilder string = "builder-bobthebuilder"
Builder48Club string = "builder-48club"
BuilderBlockRazor string = "builder-blockrazor"
BuilderEthGasID string = "builder-ethgas"
)
19 changes: 19 additions & 0 deletions pkg/mev/bsc_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,22 @@ func TestSendBundleV2_48ClubFieldsStayOffOtherBuilders(t *testing.T) {

require.NotContains(t, got.params, "noMerge")
}

// TestSendBundleV2_EthGasGetsBomboraFields: EthGas accepts the same optional fields as Bombora,
// including replacementSeqNumber, which Ultrasound does not.
func TestSendBundleV2_EthGasGetsBomboraFields(t *testing.T) {
t.Parallel()
blockNumber, seq, refund := uint64(1), uint64(2), uint64(90)
dropping := []string{"0x01"}
got := sendOne(t, mev.BundleSenderTypeEthGas, mev.SendBundleV2Request{
BlockNumber: &blockNumber,
DroppingTxs: &dropping,
ReplacementSeqNumber: &seq,
RefundPercent: &refund,
})

require.Equal(t, mev.ETHSendBundleMethod, got.method)
require.Equal(t, []any{"0x01"}, got.params["droppingTxHashes"])
require.InDelta(t, float64(seq), got.params["replacementSeqNumber"], 0)
require.InDelta(t, float64(refund), got.params["refundPercent"], 0)
}
8 changes: 5 additions & 3 deletions pkg/mev/bundle_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ type SendBundleParams struct {
// (Optional) String, UUID that can be used to cancel/replace this bundle (For beaverbuild)
UUID string `json:"uuid,omitempty"`
StateBlockNumber string `json:"stateBlockNumber,omitempty"`
// Bundle fields that only Bombora and Ultrasound accept.
// ReplacementSeqNumber is Bombora only.
// Bundle fields that only Bombora, EthGas and Ultrasound accept.
// ReplacementSeqNumber is Bombora and EthGas only.
DroppingTxHashes *[]string `json:"droppingTxHashes,omitempty"`
ReplacementSeqNumber *uint64 `json:"replacementSeqNumber,omitempty"`
RefundPercent *uint64 `json:"refundPercent,omitempty"`
Expand Down Expand Up @@ -571,7 +571,7 @@ func (p *SendBundleParams) setSenderSpecificFields(
senderType BundleSenderType, req SendBundleV2Request,
) *SendBundleParams {
switch senderType {
case BundleSenderTypeBombora:
case BundleSenderTypeBombora, BundleSenderTypeEthGas:
return p.SetBomboraFields(req)
case BundleSenderTypeUltrasound:
return p.SetUltrasoundFields(req)
Expand Down Expand Up @@ -674,6 +674,8 @@ func (p *SendBundleParams) SetBuilderNetRefundAddress(addr string) *SendBundlePa
}

// SetBomboraFields copies Bombora-only bundle options onto p.
// EthGas accepts the same fields with the same limits, so it shares this method.
// ref: https://docs.ethgas.com/get-started/searchers/builder-endpoint
func (p *SendBundleParams) SetBomboraFields(req SendBundleV2Request) *SendBundleParams {
if req.DroppingTxs != nil {
p.DroppingTxHashes = req.DroppingTxs
Expand Down
77 changes: 42 additions & 35 deletions pkg/mev/bundlesendertype_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions pkg/mev/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
BundleSenderTypeBombora
BundleSenderTypeUltrasound
BundleSenderTypeServo
BundleSenderTypeEthGas
)

const (
Expand Down Expand Up @@ -396,16 +397,16 @@ type SendBundleV2Request struct {
// (Optional) Array[String], A list of tx hashes that are allowed to revert
RevertingTxs *[]string `json:"revertingTxHashes,omitempty"`
// (Optional) Array[String], A list of tx hashes that may be omitted from the bundle,
// but must never be included in a reverted state. Bombora and Ultrasound only.
// but must never be included in a reverted state. Bombora, EthGas and Ultrasound only.
DroppingTxs *[]string `json:"droppingTxHashes,omitempty"`
// (Optional) Number, monotonically increasing sequence number for bundles sharing
// one replacement UUID. Bombora only.
// one replacement UUID. Bombora and EthGas only.
ReplacementSeqNumber *uint64 `json:"replacementSeqNumber,omitempty"`
// (Optional) Number, percentage of the bundle MEV profit to refund, 0 to 99. Bombora and Ultrasound only.
// (Optional) Number, percentage of the bundle MEV profit to refund, 0 to 99. Bombora, EthGas and Ultrasound only.
RefundPercent *uint64 `json:"refundPercent,omitempty"`
// (Optional) String, the address that receives the refund. Bombora and Ultrasound only.
// (Optional) String, the address that receives the refund. Bombora, EthGas and Ultrasound only.
RefundRecipient string `json:"refundRecipient,omitempty"`
// (Optional) Array[String], one tx hash that anchors the refund calculation. Bombora and Ultrasound only.
// (Optional) Array[String], one tx hash that anchors the refund calculation. Bombora, EthGas and Ultrasound only.
RefundTxHashes *[]string `json:"refundTxHashes,omitempty"`
// (Optional) String, UUID that can be used to cancel/replace this bundle
ReplacementUUID *string `json:"ReplacementUuid,omitempty"`
Expand Down
Loading