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
6 changes: 1 addition & 5 deletions rocketpool-cli/service/config/settings-commit-boost.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type CommitBoostConfigPage struct {
localItems []*parameterizedFormItem
externalItems []*parameterizedFormItem
flashbotsBox *parameterizedFormItem
bloxrouteMaxProfitBox *parameterizedFormItem
bloxrouteRegulatedBox *parameterizedFormItem
titanRegionalBox *parameterizedFormItem
ultrasoundFilteredBox *parameterizedFormItem
Expand Down Expand Up @@ -78,15 +77,14 @@ func (configPage *CommitBoostConfigPage) createContent() {

// Relay checkboxes - using CommitBoost's own relay parameters
configPage.flashbotsBox = createParameterizedCheckbox(&configPage.masterConfig.CommitBoost.FlashbotsRelay)
configPage.bloxrouteMaxProfitBox = createParameterizedCheckbox(&configPage.masterConfig.CommitBoost.BloxRouteMaxProfitRelay)
configPage.bloxrouteRegulatedBox = createParameterizedCheckbox(&configPage.masterConfig.CommitBoost.BloxRouteRegulatedRelay)
configPage.titanRegionalBox = createParameterizedCheckbox(&configPage.masterConfig.CommitBoost.TitanRegionalRelay)
configPage.ultrasoundFilteredBox = createParameterizedCheckbox(&configPage.masterConfig.CommitBoost.UltrasoundFilteredRelay)
configPage.btcsOfacBox = createParameterizedCheckbox(&configPage.masterConfig.CommitBoost.BtcsOfacRelay)

// Map the parameters to the form items in the layout
configPage.layout.mapParameterizedFormItems(configPage.enableBox, configPage.modeBox, configPage.selectionModeBox)
configPage.layout.mapParameterizedFormItems(configPage.flashbotsBox, configPage.bloxrouteMaxProfitBox, configPage.bloxrouteRegulatedBox, configPage.titanRegionalBox, configPage.ultrasoundFilteredBox, configPage.btcsOfacBox)
configPage.layout.mapParameterizedFormItems(configPage.flashbotsBox, configPage.bloxrouteRegulatedBox, configPage.titanRegionalBox, configPage.ultrasoundFilteredBox, configPage.btcsOfacBox)
configPage.layout.mapParameterizedFormItems(configPage.localItems...)
configPage.layout.mapParameterizedFormItems(configPage.externalItems...)

Expand Down Expand Up @@ -177,8 +175,6 @@ func (configPage *CommitBoostConfigPage) handleSelectionModeChanged() {
switch relay.ID {
case cfgtypes.MevRelayID_Flashbots:
configPage.layout.form.AddFormItem(configPage.flashbotsBox.item)
case cfgtypes.MevRelayID_BloxrouteMaxProfit:
configPage.layout.form.AddFormItem(configPage.bloxrouteMaxProfitBox.item)
case cfgtypes.MevRelayID_BloxrouteRegulated:
configPage.layout.form.AddFormItem(configPage.bloxrouteRegulatedBox.item)
case cfgtypes.MevRelayID_TitanRegional:
Expand Down
6 changes: 1 addition & 5 deletions rocketpool-cli/service/config/settings-mev-boost.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type MevBoostConfigPage struct {
regulatedAllMevBox *parameterizedFormItem
unregulatedAllMevBox *parameterizedFormItem
flashbotsBox *parameterizedFormItem
bloxrouteMaxProfitBox *parameterizedFormItem
bloxrouteRegulatedBox *parameterizedFormItem
ultrasoundBox *parameterizedFormItem
ultrasoundFilteredBox *parameterizedFormItem
Expand Down Expand Up @@ -82,7 +81,6 @@ func (configPage *MevBoostConfigPage) createContent() {
configPage.externalItems = createParameterizedFormItems(externalParams, configPage.layout)

configPage.flashbotsBox = createParameterizedCheckbox(&configPage.masterConfig.MevBoost.FlashbotsRelay)
configPage.bloxrouteMaxProfitBox = createParameterizedCheckbox(&configPage.masterConfig.MevBoost.BloxRouteMaxProfitRelay)
configPage.bloxrouteRegulatedBox = createParameterizedCheckbox(&configPage.masterConfig.MevBoost.BloxRouteRegulatedRelay)
configPage.ultrasoundBox = createParameterizedCheckbox(&configPage.masterConfig.MevBoost.UltrasoundRelay)
configPage.ultrasoundFilteredBox = createParameterizedCheckbox(&configPage.masterConfig.MevBoost.UltrasoundFilteredRelay)
Expand All @@ -93,7 +91,7 @@ func (configPage *MevBoostConfigPage) createContent() {

// Map the parameters to the form items in the layout
configPage.layout.mapParameterizedFormItems(configPage.enableBox, configPage.modeBox, configPage.selectionModeBox)
configPage.layout.mapParameterizedFormItems(configPage.flashbotsBox, configPage.bloxrouteMaxProfitBox, configPage.bloxrouteRegulatedBox, configPage.ultrasoundBox, configPage.ultrasoundFilteredBox, configPage.aestusBox, configPage.titanGlobalBox, configPage.titanRegionalBox, configPage.btcsOfacBox)
configPage.layout.mapParameterizedFormItems(configPage.flashbotsBox, configPage.bloxrouteRegulatedBox, configPage.ultrasoundBox, configPage.ultrasoundFilteredBox, configPage.aestusBox, configPage.titanGlobalBox, configPage.titanRegionalBox, configPage.btcsOfacBox)
configPage.layout.mapParameterizedFormItems(configPage.localItems...)
configPage.layout.mapParameterizedFormItems(configPage.externalItems...)

Expand Down Expand Up @@ -170,8 +168,6 @@ func (configPage *MevBoostConfigPage) handleSelectionModeChanged() {
switch relay.ID {
case cfgtypes.MevRelayID_Flashbots:
configPage.layout.form.AddFormItem(configPage.flashbotsBox.item)
case cfgtypes.MevRelayID_BloxrouteMaxProfit:
configPage.layout.form.AddFormItem(configPage.bloxrouteMaxProfitBox.item)
case cfgtypes.MevRelayID_BloxrouteRegulated:
configPage.layout.form.AddFormItem(configPage.bloxrouteRegulatedBox.item)
case cfgtypes.MevRelayID_Ultrasound:
Expand Down
19 changes: 0 additions & 19 deletions shared/services/config/commit-boost-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ type CommitBoostConfig struct {
// Flashbots relay
FlashbotsRelay config.Parameter `yaml:"cbFlashbotsEnabled,omitempty"`

// bloXroute max profit relay
BloxRouteMaxProfitRelay config.Parameter `yaml:"cbBloxRouteMaxProfitEnabled,omitempty"`

// bloXroute regulated relay
BloxRouteRegulatedRelay config.Parameter `yaml:"cbBloxRouteRegulatedEnabled,omitempty"`

Expand Down Expand Up @@ -136,7 +133,6 @@ func NewCommitBoostConfig(cfg *RocketPoolConfig) *CommitBoostConfig {
},

FlashbotsRelay: generateCbRelayParameter("cbFlashbotsEnabled", relayMap[config.MevRelayID_Flashbots]),
BloxRouteMaxProfitRelay: generateCbRelayParameter("cbBloxRouteMaxProfitEnabled", relayMap[config.MevRelayID_BloxrouteMaxProfit]),
BloxRouteRegulatedRelay: generateCbRelayParameter("cbBloxRouteRegulatedEnabled", relayMap[config.MevRelayID_BloxrouteRegulated]),
TitanRegionalRelay: generateCbRelayParameter("cbTitanRegionalEnabled", relayMap[config.MevRelayID_TitanRegional]),
UltrasoundFilteredRelay: generateCbRelayParameter("cbUltrasoundFilteredEnabled", relayMap[config.MevRelayID_UltrasoundFiltered]),
Expand Down Expand Up @@ -212,7 +208,6 @@ func (cfg *CommitBoostConfig) GetParameters() []*config.Parameter {
&cfg.Mode,
&cfg.RelaySelectionMode,
&cfg.FlashbotsRelay,
&cfg.BloxRouteMaxProfitRelay,
&cfg.BloxRouteRegulatedRelay,
&cfg.TitanRegionalRelay,
&cfg.UltrasoundFilteredRelay,
Expand Down Expand Up @@ -304,7 +299,6 @@ func (cfg *CommitBoostConfig) getEnabledRelays() []config.MevRelay {

case PbsRelaySelectionMode_Manual:
relays = cfg.maybeAddRelay(relays, cfg.FlashbotsRelay, config.MevRelayID_Flashbots, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.BloxRouteMaxProfitRelay, config.MevRelayID_BloxrouteMaxProfit, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.BloxRouteRegulatedRelay, config.MevRelayID_BloxrouteRegulated, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.TitanRegionalRelay, config.MevRelayID_TitanRegional, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.UltrasoundFilteredRelay, config.MevRelayID_UltrasoundFiltered, currentNetwork)
Expand Down Expand Up @@ -376,19 +370,6 @@ func createCommitBoostRelays() []config.MevRelay {
Regulated: true,
},

// bloXroute Max Profit
{
ID: config.MevRelayID_BloxrouteMaxProfit,
Name: "bloXroute Max Profit",
Description: "Select this to enable the \"max profit\" relay from bloXroute.",
Urls: map[config.Network]string{
config.Network_Mainnet: "https://0x8b5d2e73e2a3a55c6c87b8b6eb92e0149a125c852751db1422fa951e42a09b82c142c3ea98d0d9930b056a3bc9896b8f@bloxroute.max-profit.blxrbdn.com?id=rocketpool",
config.Network_Testnet: "https://0x821f2a65afb70e7f2e820a925a9b4c80a159620582c1766b1b09729fec178b11ea22abb3a51f07b288be815a1a2ff516@bloxroute.hoodi.blxrbdn.com?id=rocketpool",
config.Network_Devnet: "https://0x821f2a65afb70e7f2e820a925a9b4c80a159620582c1766b1b09729fec178b11ea22abb3a51f07b288be815a1a2ff516@bloxroute.hoodi.blxrbdn.com?id=rocketpool",
},
Regulated: true,
},

// bloXroute Regulated
{
ID: config.MevRelayID_BloxrouteRegulated,
Expand Down
21 changes: 1 addition & 20 deletions shared/services/config/mev-boost-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ type MevBoostConfig struct {
// Flashbots relay
FlashbotsRelay config.Parameter `yaml:"flashbotsEnabled,omitempty"`

// bloXroute max profit relay
BloxRouteMaxProfitRelay config.Parameter `yaml:"bloxRouteMaxProfitEnabled,omitempty"`

// bloXroute regulated relay
BloxRouteRegulatedRelay config.Parameter `yaml:"bloxRouteRegulatedEnabled,omitempty"`

Expand Down Expand Up @@ -146,7 +143,6 @@ func NewMevBoostConfig(cfg *RocketPoolConfig) *MevBoostConfig {

// Explicit relay params
FlashbotsRelay: generateRelayParameter("flashbotsEnabled", relayMap[config.MevRelayID_Flashbots]),
BloxRouteMaxProfitRelay: generateRelayParameter("bloxRouteMaxProfitEnabled", relayMap[config.MevRelayID_BloxrouteMaxProfit]),
BloxRouteRegulatedRelay: generateRelayParameter("bloxRouteRegulatedEnabled", relayMap[config.MevRelayID_BloxrouteRegulated]),
UltrasoundRelay: generateRelayParameter("ultrasoundEnabled", relayMap[config.MevRelayID_Ultrasound]),
UltrasoundFilteredRelay: generateRelayParameter("ultrasoundFilteredEnabled", relayMap[config.MevRelayID_UltrasoundFiltered]),
Expand Down Expand Up @@ -228,7 +224,6 @@ func (cfg *MevBoostConfig) GetParameters() []*config.Parameter {
&cfg.EnableRegulatedAllMev,
&cfg.EnableUnregulatedAllMev,
&cfg.FlashbotsRelay,
&cfg.BloxRouteMaxProfitRelay,
&cfg.BloxRouteRegulatedRelay,
&cfg.UltrasoundRelay,
&cfg.UltrasoundFilteredRelay,
Expand Down Expand Up @@ -303,7 +298,6 @@ func (cfg *MevBoostConfig) GetEnabledMevRelays() []config.MevRelay {

case config.MevSelectionMode_Relay:
relays = cfg.maybeAddRelay(relays, cfg.FlashbotsRelay, config.MevRelayID_Flashbots, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.BloxRouteMaxProfitRelay, config.MevRelayID_BloxrouteMaxProfit, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.BloxRouteRegulatedRelay, config.MevRelayID_BloxrouteRegulated, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.UltrasoundRelay, config.MevRelayID_Ultrasound, currentNetwork)
relays = cfg.maybeAddRelay(relays, cfg.UltrasoundFilteredRelay, config.MevRelayID_UltrasoundFiltered, currentNetwork)
Expand Down Expand Up @@ -346,24 +340,11 @@ func createDefaultRelays() []config.MevRelay {
Regulated: true,
},

// bloXroute Max Profit
{
ID: config.MevRelayID_BloxrouteMaxProfit,
Name: "bloXroute Max Profit",
Description: "Select this to enable the relay from bloXroute (formerly) known as \"Max Profit\". (Both bloXroute relays propagate the same transactions...)",
Urls: map[config.Network]string{
config.Network_Mainnet: "https://0x8b5d2e73e2a3a55c6c87b8b6eb92e0149a125c852751db1422fa951e42a09b82c142c3ea98d0d9930b056a3bc9896b8f@bloxroute.max-profit.blxrbdn.com?id=rocketpool",
config.Network_Testnet: "https://0x821f2a65afb70e7f2e820a925a9b4c80a159620582c1766b1b09729fec178b11ea22abb3a51f07b288be815a1a2ff516@bloxroute.hoodi.blxrbdn.com?id=rocketpool",
config.Network_Devnet: "https://0x821f2a65afb70e7f2e820a925a9b4c80a159620582c1766b1b09729fec178b11ea22abb3a51f07b288be815a1a2ff516@bloxroute.hoodi.blxrbdn.com?id=rocketpool",
},
Regulated: true,
},

// bloXroute Regulated
{
ID: config.MevRelayID_BloxrouteRegulated,
Name: "bloXroute Regulated",
Description: "Select this to enable the relay from bloXroute (formerly) known as \"Regulated\". (Both bloXroute relays propagate the same transactions...)",
Description: "Select this to enable the bloXroute relay.",
Urls: map[config.Network]string{
config.Network_Mainnet: "https://0xb0b07cd0abef743db4260b0ed50619cf6ad4d82064cb4fbec9d3ec530f7c5e6793d9f286c4e082c0244ffb9f2658fe88@bloxroute.regulated.blxrbdn.com?id=rocketpool",
},
Expand Down
8 changes: 8 additions & 0 deletions shared/services/config/migration/migration-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func UpdateConfig(serializedConfig map[string]map[string]string) error {
if err != nil {
return err
}
v1210, err := parseVersion("1.21.0")
if err != nil {
return err
}

// Create the collection of upgraders
upgraders := []ConfigUpgrader{
Expand Down Expand Up @@ -77,6 +81,10 @@ func UpdateConfig(serializedConfig map[string]map[string]string) error {
Version: v1205,
UpgradeFunc: upgradeFromV1205,
},
{
Version: v1210,
UpgradeFunc: upgradeFromV1210,
},
}

// Find the index of the provided config's version
Expand Down
98 changes: 98 additions & 0 deletions shared/services/config/migration/v1210-manager.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package migration

import "strconv"

const (
mevMaxProfitKey = "bloxRouteMaxProfitEnabled"
mevRegulatedKey = "bloxRouteRegulatedEnabled"
mevFlashbotsKey = "flashbotsEnabled"
mevSelectionModeKey = "selectionMode"
mevSelectionModeRelay = "relay"

cbMaxProfitKey = "cbBloxRouteMaxProfitEnabled"
cbRegulatedKey = "cbBloxRouteRegulatedEnabled"
cbFlashbotsKey = "cbFlashbotsEnabled"
cbSelectionModeKey = "relaySelectionMode"
cbSelectionModeManual = "manual"
cbCustomRelaysKey = "customRelays"
)

var remainingMevRelayKeys = []string{
mevFlashbotsKey,
mevRegulatedKey,
"ultrasoundEnabled",
"ultrasoundFilteredEnabled",
"aestusEnabled",
"titanGlobalEnabled",
"titanRegionalEnabled",
"btcsOfacEnabled",
}

var remainingCbRelayKeys = []string{
cbFlashbotsKey,
cbRegulatedKey,
"cbTitanRegionalEnabled",
"cbUltrasoundFilteredEnabled",
"cbBtcsOfacEnabled",
}

func upgradeFromV1210(serializedConfig map[string]map[string]string) error {
network := ""
if sn, ok := serializedConfig["smartnode"]; ok {
network = sn["network"]
}

migrateMevBoostMaxProfit(serializedConfig["mevBoost"], network)
migrateCommitBoostMaxProfit(serializedConfig["commitBoostConfig"], network)
return nil
}

func migrateMevBoostMaxProfit(section map[string]string, network string) {
if section == nil || !isTrue(section[mevMaxProfitKey]) {
return
}

if section[mevSelectionModeKey] == mevSelectionModeRelay {
if isMainnet(network) {
section[mevRegulatedKey] = "true"
} else if !anyTrue(section, remainingMevRelayKeys) {
section[mevFlashbotsKey] = "true"
}
}

delete(section, mevMaxProfitKey)
}

func migrateCommitBoostMaxProfit(section map[string]string, network string) {
if section == nil || !isTrue(section[cbMaxProfitKey]) {
return
}

if section[cbSelectionModeKey] == cbSelectionModeManual {
if isMainnet(network) {
section[cbRegulatedKey] = "true"
} else if !anyTrue(section, remainingCbRelayKeys) && section[cbCustomRelaysKey] == "" {
section[cbFlashbotsKey] = "true"
}
}

delete(section, cbMaxProfitKey)
}

func isMainnet(network string) bool {
return network == "" || network == "mainnet"
}

func isTrue(value string) bool {
parsed, err := strconv.ParseBool(value)
return err == nil && parsed
}

func anyTrue(section map[string]string, keys []string) bool {
for _, key := range keys {
if isTrue(section[key]) {
return true
}
}
return false
}
1 change: 0 additions & 1 deletion shared/types/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ const (
MevRelayID_Unknown MevRelayID = ""
MevRelayID_Flashbots MevRelayID = "flashbots"
MevRelayID_BloxrouteEthical MevRelayID = "bloxrouteEthical"
MevRelayID_BloxrouteMaxProfit MevRelayID = "bloxrouteMaxProfit"
MevRelayID_BloxrouteRegulated MevRelayID = "bloxrouteRegulated"
MevRelayID_Ultrasound MevRelayID = "ultrasound"
MevRelayID_UltrasoundFiltered MevRelayID = "ultrasoundFiltered"
Expand Down
Loading