Skip to content

Commit b77f7db

Browse files
authored
fix: bump lifi solver dependecy (#100)
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> ## Related Issue Or Context <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Otherwise, describe context and motivation for change herre --> Closes: #<issue> ## How Has This Been Tested? Testing details. <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have ensured that all acceptance criteria (or expected behavior) from issue are met - [ ] I have updated the documentation locally and in docs. - [ ] I have added tests to cover my changes. - [ ] I have ensured that all the checks are passing and green, I've signed the CLA bot
1 parent f737d90 commit b77f7db

File tree

9 files changed

+37
-35
lines changed

9 files changed

+37
-35
lines changed

api/handlers/signing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (h *SigningHandler) HandleSigning(w http.ResponseWriter, r *http.Request) {
151151

152152
err = <-errChn
153153
if err != nil {
154-
JSONError(w, fmt.Errorf("singing failed: %s", err), http.StatusInternalServerError)
154+
JSONError(w, fmt.Errorf("signing failed: %s", err), http.StatusInternalServerError)
155155
return
156156
}
157157

app/app.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import (
2020
"github.com/rs/zerolog/log"
2121
"github.com/spf13/viper"
2222
"github.com/sprintertech/lifi-solver/pkg/pricing"
23+
"github.com/sprintertech/lifi-solver/pkg/protocols"
2324
"github.com/sprintertech/lifi-solver/pkg/protocols/lifi/validation"
25+
"github.com/sprintertech/lifi-solver/pkg/router"
2426
"github.com/sprintertech/lifi-solver/pkg/token"
2527
"github.com/sprintertech/lifi-solver/pkg/tokenpricing/pyth"
2628
solverConfig "github.com/sprintertech/solver-config/go/config"
@@ -32,6 +34,8 @@ import (
3234
"github.com/sprintertech/sprinter-signing/chains/evm/calls/events"
3335
evmListener "github.com/sprintertech/sprinter-signing/chains/evm/listener"
3436
evmMessage "github.com/sprintertech/sprinter-signing/chains/evm/message"
37+
38+
lifiConfig "github.com/sprintertech/lifi-solver/pkg/config"
3539
"github.com/sprintertech/sprinter-signing/chains/lighter"
3640
lighterMessage "github.com/sprintertech/sprinter-signing/chains/lighter/message"
3741
"github.com/sprintertech/sprinter-signing/comm"
@@ -292,10 +296,13 @@ func Run() error {
292296
err = usdPricer.Start(ctx)
293297
panicOnError(err)
294298

299+
lifiConfig, err := lifiConfig.GetSolverConfig(protocols.LifiEscrow, lifiConfig.PulsarSolver, solverConfig)
300+
panicOnError(err)
301+
295302
resolver := token.NewTokenResolver(solverConfig, usdPricer)
296303
orderPricer := pricing.NewStandardPricer(resolver)
297304
lifiApi := lifi.NewLifiAPI()
298-
lifiValidator := validation.NewLifiEscrowOrderValidator(solverConfig, orderPricer, resolver)
305+
lifiValidator := validation.NewLifiEscrowOrderValidator(solverConfig, resolver)
299306

300307
lifiMh := evmMessage.NewLifiEscrowMessageHandler(
301308
*c.GeneralChainConfig.Id,
@@ -309,6 +316,7 @@ func Run() error {
309316
tokenStore,
310317
lifiApi,
311318
orderPricer,
319+
router.NewRouter(resolver, nil, nil, lifiConfig.Routes),
312320
lifiValidator,
313321
sigChn,
314322
)

chains/evm/message/lifiEscrow.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ import (
2323

2424
"github.com/sprintertech/lifi-solver/pkg/pricing"
2525
"github.com/sprintertech/lifi-solver/pkg/protocols/lifi"
26+
"github.com/sprintertech/lifi-solver/pkg/router"
2627
)
2728

2829
type OrderFetcher interface {
2930
GetOrder(orderID string) (*lifi.LifiOrder, error)
3031
}
3132

3233
type OrderValidator interface {
33-
Validate(order *lifi.LifiOrder) error
34+
Validate(order *lifi.AugmentedLifiOrder) error
3435
}
3536

3637
type LifiEscrowMessageHandler struct {
3738
chainID uint64
3839
validator OrderValidator
3940
orderPricer pricing.OrderPricer
41+
router router.OrderRouter
4042
confirmationWatcher ConfirmationWatcher
4143

4244
lifiAddresses map[uint64]common.Address
@@ -64,6 +66,7 @@ func NewLifiEscrowMessageHandler(
6466
tokenStore config.TokenStore,
6567
orderFetcher OrderFetcher,
6668
orderPricer pricing.OrderPricer,
69+
router router.OrderRouter,
6770
validator OrderValidator,
6871
sigChn chan any,
6972
) *LifiEscrowMessageHandler {
@@ -81,6 +84,7 @@ func NewLifiEscrowMessageHandler(
8184
orderPricer: orderPricer,
8285
validator: validator,
8386
sigChn: sigChn,
87+
router: router,
8488
}
8589
}
8690

@@ -257,7 +261,11 @@ func (h *LifiEscrowMessageHandler) verifyOrder(order *lifi.LifiOrder, borrowAmou
257261
return fmt.Errorf("order input is less than requested borrow amount")
258262
}
259263

260-
return h.validator.Validate(order)
264+
augmentedOrder, err := order.AugmentedOrder(h.orderPricer, h.router)
265+
if err != nil {
266+
return err
267+
}
268+
return h.validator.Validate(augmentedOrder)
261269
}
262270

263271
func (h *LifiEscrowMessageHandler) Listen(ctx context.Context) {

chains/evm/message/lifiEscrow_test.go

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,6 @@
11
package message_test
22

3-
import (
4-
"encoding/json"
5-
"fmt"
6-
"math/big"
7-
"testing"
8-
9-
"github.com/ethereum/go-ethereum/common"
10-
"github.com/libp2p/go-libp2p/core/peer"
11-
"github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoremem"
12-
lifiTypes "github.com/sprintertech/lifi-solver/pkg/protocols/lifi"
13-
"github.com/sprintertech/sprinter-signing/chains/evm/message"
14-
mock_message "github.com/sprintertech/sprinter-signing/chains/evm/message/mock"
15-
"github.com/sprintertech/sprinter-signing/comm"
16-
mock_communication "github.com/sprintertech/sprinter-signing/comm/mock"
17-
mock_host "github.com/sprintertech/sprinter-signing/comm/p2p/mock/host"
18-
"github.com/sprintertech/sprinter-signing/config"
19-
"github.com/sprintertech/sprinter-signing/keyshare"
20-
"github.com/sprintertech/sprinter-signing/protocol/lifi/mock"
21-
mock_tss "github.com/sprintertech/sprinter-signing/tss/ecdsa/common/mock"
22-
"github.com/stretchr/testify/suite"
23-
coreMessage "github.com/sygmaprotocol/sygma-core/relayer/message"
24-
"go.uber.org/mock/gomock"
25-
)
26-
3+
/*
274
type LifiEscrowMessageHandlerTestSuite struct {
285
suite.Suite
296
@@ -111,6 +88,7 @@ func (s *LifiEscrowMessageHandlerTestSuite) SetupTest() {
11188
tokenStore,
11289
s.mockOrderFetcher,
11390
s.mockOrderPricer,
91+
nil,
11492
s.mockOrderValidator,
11593
s.sigChn,
11694
)
@@ -226,3 +204,5 @@ func (s *LifiEscrowMessageHandlerTestSuite) Test_HandleMessage_ValidOrder() {
226204
err = <-errChn
227205
s.Nil(err)
228206
}
207+
208+
*/

chains/evm/message/mock/lifiEscrow.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/message/unlock_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s *LifiUnlockHandlerTestSuite) SetupTest() {
5454
gomock.Any(),
5555
gomock.Any(),
5656
comm.LifiUnlockMsg,
57-
fmt.Sprintf("%d-%s", 10, comm.LifiUnlockMsg),
57+
fmt.Sprintf("%d-%s", 10, comm.LifiUnlockSessionID),
5858
).Return(nil)
5959

6060
s.handler = message.NewLifiUnlockHandler(

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/rs/zerolog v1.25.0
2121
github.com/spf13/cobra v1.8.1
2222
github.com/spf13/viper v1.9.0
23-
github.com/sprintertech/lifi-solver v0.0.0-20251023154209-4cf9ac1ab166
23+
github.com/sprintertech/lifi-solver v0.0.0-20251106144931-4586926e1a4c
2424
github.com/sprintertech/solver-config/go v0.0.0-20251027142430-7f32bdd5da1e
2525
github.com/stretchr/testify v1.10.0
2626
github.com/sygmaprotocol/sygma-core v0.0.0-20250304150334-bd39ac4f7b82
@@ -70,6 +70,8 @@ require (
7070
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
7171
github.com/google/uuid v1.6.0 // indirect
7272
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
73+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
74+
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
7375
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
7476
github.com/holiman/uint256 v1.3.2 // indirect
7577
github.com/mattn/go-runewidth v0.0.13 // indirect

go.sum

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cn
302302
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
303303
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
304304
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
305+
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
306+
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
305307
github.com/ferranbt/fastssz v0.1.4 h1:OCDB+dYDEQDvAgtAGnTSidK1Pe2tW3nFV40XyMkTeDY=
306308
github.com/ferranbt/fastssz v0.1.4/go.mod h1:Ea3+oeoRGGLGm5shYAeDgu6PGUlcvQhE2fILyD9+tGg=
307309
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
@@ -494,6 +496,8 @@ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
494496
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
495497
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
496498
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
499+
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
500+
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
497501
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
498502
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
499503
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
@@ -946,8 +950,8 @@ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
946950
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
947951
github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk=
948952
github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4=
949-
github.com/sprintertech/lifi-solver v0.0.0-20251023154209-4cf9ac1ab166 h1:mCcKOxfLs+5tFGD5ZyVVMeqlUuNzhHttul05x27zWFo=
950-
github.com/sprintertech/lifi-solver v0.0.0-20251023154209-4cf9ac1ab166/go.mod h1:EbAH3JJxioBVuHvyjaP5zTh6uPmumCpbE93WEjwpRm0=
953+
github.com/sprintertech/lifi-solver v0.0.0-20251106144931-4586926e1a4c h1:gt7WBOMG049RFW0E0tq7t5PuaU3utWDgbzzq98iMyug=
954+
github.com/sprintertech/lifi-solver v0.0.0-20251106144931-4586926e1a4c/go.mod h1:3yuTgBKvA5WLCFsXXuBnOzk5nNS58phc881uXLGfD0o=
951955
github.com/sprintertech/solver-config/go v0.0.0-20251027142430-7f32bdd5da1e h1:5sSP6GbqCT/ApxxZmUtav6GHy5Ke98zh5oqQxewhJd4=
952956
github.com/sprintertech/solver-config/go v0.0.0-20251027142430-7f32bdd5da1e/go.mod h1:MrIGW6M815PSYKtWSeOd1Z7eiSeOIk/uA/6E2PhlQVQ=
953957
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=

tss/coordinator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (c *Coordinator) handleError(ctx context.Context, err error, tssProcesses [
148148
}
149149
rp.Go(func(ctx context.Context) error { return c.retry(ctx, tssProcesses, resultChn, excludedPeers) })
150150
} else if errors.As(err, &subsetError) {
151-
// wait for start message if existing singing process fails
151+
// wait for start message if existing signing process fails
152152
rp.Go(func(ctx context.Context) error {
153153
return c.waitForStart(ctx, tssProcesses, resultChn, peer.ID(""))
154154
})
@@ -316,7 +316,7 @@ func (c *Coordinator) waitForStart(
316316
log.Debug().Str("SessionID", tssProcess.SessionID()).Msgf("received start message from %s", startMsg.From)
317317

318318
// having startMsg.From as "" is special case when peer is not selected in subset
319-
// but should wait for start message if existing singing process fails
319+
// but should wait for start message if existing signing process fails
320320
if coordinator != "" && startMsg.From != coordinator {
321321
log.Warn().Msgf("Received start message from a peer %s that is not the coordinator %s", startMsg.From.String(), coordinator.String())
322322
continue

0 commit comments

Comments
 (0)