Skip to content

Commit c3bccad

Browse files
authored
update go-utils: parse uuids, delayed refund (#55)
## 📝 Summary * force uuids to be correct (otherwise bundles are dropped on rbuilder side silently) * update go-utils so bundle have delayedRefund field ## ⛱ Motivation and Context <!--- Why is this change required? What problem does it solve? --> ## 📚 References <!-- Any interesting external links to documentation, articles, tweets which add value to the PR --> --- ## ✅ I have run these commands * [ ] `make lint` * [ ] `make test` * [ ] `go mod tidy`
1 parent e179462 commit c3bccad

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

cmd/test-tx-sender/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ func main() {
8383
slog.Info("Sent eth_sendRawTransaction")
8484

8585
// send eth_sendBundle
86-
replacementUUIDTyped := uuid.New()
87-
repacementUUID := replacementUUIDTyped.String()
86+
repacementUUID := uuid.New()
8887
slog.Info("Using the following replacement UUID", "value", repacementUUID)
8988
blockNumber := hexutil.Uint64(block)
9089
bundleArgs := rpctypes.EthSendBundleArgs{
@@ -124,7 +123,7 @@ func main() {
124123
// send mev_sendBundle (normal bundle)
125124
sbundleArgs := rpctypes.MevSendBundleArgs{
126125
Version: "v0.1",
127-
ReplacementUUID: repacementUUID,
126+
ReplacementUUID: &repacementUUID,
128127
Inclusion: rpctypes.MevBundleInclusion{
129128
BlockNumber: hexutil.Uint64(block),
130129
},
@@ -153,7 +152,7 @@ func main() {
153152
// send mev_sendBundle (cancellation bundle)
154153
sbundleCancelArgs := rpctypes.MevSendBundleArgs{
155154
Version: "v0.1",
156-
ReplacementUUID: repacementUUID,
155+
ReplacementUUID: &repacementUUID,
157156
}
158157
resp, err = client.Call(context.Background(), "mev_sendBundle", sbundleCancelArgs)
159158
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/VictoriaMetrics/metrics v1.35.1
99
github.com/cenkalti/backoff v2.2.1+incompatible
1010
github.com/ethereum/go-ethereum v1.15.5
11-
github.com/flashbots/go-utils v0.14.0
11+
github.com/flashbots/go-utils v0.15.1-0.20250926154733-c032999a9c01
1212
github.com/goccy/go-json v0.10.5
1313
github.com/google/uuid v1.6.0
1414
github.com/hashicorp/golang-lru/v2 v2.0.7

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ github.com/ethereum/go-ethereum v1.15.5 h1:Fo2TbBWC61lWVkFw9tsMoHCNX1ndpuaQBRJ8H
3434
github.com/ethereum/go-ethereum v1.15.5/go.mod h1:1LG2LnMOx2yPRHR/S+xuipXH29vPr6BIH6GElD8N/fo=
3535
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
3636
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
37-
github.com/flashbots/go-utils v0.14.0 h1:gg9UAGWhwMrnnhY/wV9W5TPRUhhM8GS6bFh4H2VqgsA=
38-
github.com/flashbots/go-utils v0.14.0/go.mod h1:vESXnJKP/r6WRrf8pr87Dr0gJdkGUpzOiMae8yangEc=
37+
github.com/flashbots/go-utils v0.15.1-0.20250926154733-c032999a9c01 h1:QgHnB0L4qhZrCBdc7imoaYRlOhi+7v9DaO+638NoQ7U=
38+
github.com/flashbots/go-utils v0.15.1-0.20250926154733-c032999a9c01/go.mod h1:vESXnJKP/r6WRrf8pr87Dr0gJdkGUpzOiMae8yangEc=
3939
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
4040
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
4141
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=

proxy/receiver_api.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ var (
3232
errSubsidyWrongCaller = errors.New("subsidy can only be called by Flashbots")
3333
errRateLimiting = errors.New("requests to user API are rate limited")
3434

35-
errUUIDParse = errors.New("failed to parse UUID")
36-
3735
apiNow = time.Now
3836

3937
handleParsedRequestTimeout = time.Second * 1
@@ -230,11 +228,8 @@ func (prx *ReceiverProxy) MevSendBundle(ctx context.Context, mevSendBundle rpcty
230228
mevSendBundle.Metadata = &rpctypes.MevBundleMetadata{
231229
Signer: &parsedRequest.signer,
232230
}
233-
if mevSendBundle.ReplacementUUID != "" {
234-
replUUID, err := uuid.Parse(mevSendBundle.ReplacementUUID)
235-
if err != nil {
236-
return errors.Join(errUUIDParse, err)
237-
}
231+
if mevSendBundle.ReplacementUUID != nil {
232+
replUUID := *mevSendBundle.ReplacementUUID
238233
replacementKey := replacementNonceKey{
239234
uuid: replUUID,
240235
signer: parsedRequest.signer,

proxy/receiver_proxy_test.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/flashbots/go-utils/rpctypes"
2424
"github.com/flashbots/go-utils/signature"
2525
utils_tls "github.com/flashbots/go-utils/tls"
26+
"github.com/google/uuid"
2627
"github.com/stretchr/testify/require"
2728
)
2829

@@ -370,7 +371,8 @@ func TestProxyBundleRequestWithPeerUpdate(t *testing.T) {
370371
proxiesUpdatePeers(t)
371372

372373
blockNumber = hexutil.Uint64(1002)
373-
replacementUUID := "550e8400-e29b-41d4-a716-446655440000"
374+
375+
replacementUUID := uuid.MustParse("550e8400-e29b-41d4-a716-446655440000")
374376
_, err = client.Call(context.Background(), EthSendBundleMethod, &rpctypes.EthSendBundleArgs{
375377
BlockNumber: &blockNumber,
376378
ReplacementUUID: &replacementUUID,
@@ -497,9 +499,10 @@ func TestProxyShareBundleReplacementUUIDAndCancellation(t *testing.T) {
497499
proxiesUpdatePeers(t)
498500

499501
// first call
502+
repalcementUUID := uuid.MustParse("550e8400-e29b-41d4-a716-446655440000")
500503
resp, err := client.Call(context.Background(), MevSendBundleMethod, &rpctypes.MevSendBundleArgs{
501504
Version: "v0.1",
502-
ReplacementUUID: "550e8400-e29b-41d4-a716-446655440000",
505+
ReplacementUUID: &repalcementUUID,
503506
Inclusion: rpctypes.MevBundleInclusion{
504507
BlockNumber: 10,
505508
},
@@ -518,9 +521,10 @@ func TestProxyShareBundleReplacementUUIDAndCancellation(t *testing.T) {
518521
require.Equal(t, expectedRequest, builderRequest.body)
519522

520523
// second call
524+
replacementUUID := uuid.MustParse("550e8400-e29b-41d4-a716-446655440000")
521525
resp, err = client.Call(context.Background(), MevSendBundleMethod, &rpctypes.MevSendBundleArgs{
522526
Version: "v0.1",
523-
ReplacementUUID: "550e8400-e29b-41d4-a716-446655440000",
527+
ReplacementUUID: &replacementUUID,
524528
Inclusion: rpctypes.MevBundleInclusion{
525529
BlockNumber: 10,
526530
},
@@ -541,7 +545,7 @@ func TestProxyShareBundleReplacementUUIDAndCancellation(t *testing.T) {
541545
// cancell
542546
resp, err = client.Call(context.Background(), MevSendBundleMethod, &rpctypes.MevSendBundleArgs{
543547
Version: "v0.1",
544-
ReplacementUUID: "550e8400-e29b-41d4-a716-446655440000",
548+
ReplacementUUID: &replacementUUID,
545549
})
546550
require.NoError(t, err)
547551
require.Nil(t, resp.Error)
@@ -620,7 +624,7 @@ func TestValidateLocalBundles(t *testing.T) {
620624
expectNoRequest(t, proxies[0].localBuilderRequests)
621625

622626
blockNumber = hexutil.Uint64(124)
623-
uid := "52840671-89dc-484f-80f6-401753513ba9"
627+
uid := uuid.MustParse("52840671-89dc-484f-80f6-401753513ba9")
624628
resp, err = client.Call(context.Background(), EthSendBundleMethod, &rpctypes.EthSendBundleArgs{
625629
BlockNumber: &blockNumber,
626630
UUID: &uid,
@@ -653,7 +657,7 @@ func TestValidateLocalBundles(t *testing.T) {
653657
expectNoRequest(t, proxies[0].localBuilderRequests)
654658

655659
blockNumber = hexutil.Uint64(125)
656-
uid = "4749af2a-1b99-45f2-a9bf-827cc0840964"
660+
uid = uuid.MustParse("4749af2a-1b99-45f2-a9bf-827cc0840964")
657661
version := rpctypes.BundleVersionV1
658662
resp, err = pubClient.Call(context.Background(), EthSendBundleMethod, &rpctypes.EthSendBundleArgs{
659663
BlockNumber: &blockNumber,

0 commit comments

Comments
 (0)