Skip to content

Commit

Permalink
Use both TXMv1 and TXMv2 for OEV (#16077)
Browse files Browse the repository at this point in the history
* Fix txmv2 for oev

* Fix txmv2 not false errors
  • Loading branch information
dimriou authored and Bwest981 committed Jan 27, 2025
1 parent 039217d commit a1a2753
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions core/chains/evm/txm/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"math"
"math/big"
"strings"

"github.com/ethereum/go-ethereum/common"
"github.com/google/uuid"
Expand Down Expand Up @@ -86,7 +87,10 @@ func (o *Orchestrator[BLOCK_HASH, HEAD]) Start(ctx context.Context) error {
return o.StartOnce("Orchestrator", func() error {
var ms services.MultiStart
if err := ms.Start(ctx, o.attemptBuilder); err != nil {
return fmt.Errorf("Orchestrator: AttemptBuilder failed to start: %w", err)
// TODO: hacky fix for DualBroadcast
if !strings.Contains(err.Error(), "already been started once") {
return fmt.Errorf("Orchestrator: AttemptBuilder failed to start: %w", err)
}
}
addresses, err := o.keystore.EnabledAddressesForChain(ctx, o.chainID)
if err != nil {
Expand Down Expand Up @@ -121,7 +125,10 @@ func (o *Orchestrator[BLOCK_HASH, HEAD]) Close() (merr error) {
merr = errors.Join(merr, fmt.Errorf("Orchestrator failed to stop Txm: %w", err))
}
if err := o.attemptBuilder.Close(); err != nil {
merr = errors.Join(merr, fmt.Errorf("Orchestrator failed to stop AttemptBuilder: %w", err))
// TODO: hacky fix for DualBroadcast
if !strings.Contains(err.Error(), "already been stopped") {
merr = errors.Join(merr, fmt.Errorf("Orchestrator failed to stop AttemptBuilder: %w", err))
}
}
return merr
})
Expand Down
2 changes: 1 addition & 1 deletion core/chains/legacyevm/evm_txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func newEvmTxm(
opts.KeyStore,
estimator,
)
if cfg.Transactions().TransactionManagerV2().DualBroadcast() != nil && *cfg.Transactions().TransactionManagerV2().DualBroadcast() {
if cfg.Transactions().TransactionManagerV2().DualBroadcast() == nil || !*cfg.Transactions().TransactionManagerV2().DualBroadcast() {
return txmv2, err
}
}
Expand Down

0 comments on commit a1a2753

Please sign in to comment.