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: 3 additions & 2 deletions chains/lighter/message/lighter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/rs/zerolog/log"
"github.com/sprintertech/sprinter-signing/chains/evm/calls/consts"
"github.com/sprintertech/sprinter-signing/chains/evm/signature"
lighterChain "github.com/sprintertech/sprinter-signing/chains/lighter"
"github.com/sprintertech/sprinter-signing/comm"
"github.com/sprintertech/sprinter-signing/protocol/lighter"
"github.com/sprintertech/sprinter-signing/tss"
Expand Down Expand Up @@ -118,7 +119,7 @@ func (h *LighterMessageHandler) HandleMessage(m *message.Message) (*proposal.Pro
return nil, err
}

sessionID := fmt.Sprintf("lighter-%s", "")
sessionID := fmt.Sprintf("%d-%s", lighterChain.LIGHTER_DOMAIN_ID, data.OrderHash)
signing, err := signing.NewSigning(
new(big.Int).SetBytes(unlockHash),
sessionID,
Expand Down Expand Up @@ -147,7 +148,7 @@ func (h *LighterMessageHandler) verifyWithdrawal(tx *lighter.LighterTx, borrowAm
}

if borrowAmount.Cmp(new(big.Int).SetUint64(tx.Transfer.USDCAmount)) != -1 {
return errors.New("borrow amount higher transfer amount")
return errors.New("borrow amount higher than transfer amount")
}

return nil
Expand Down
5 changes: 5 additions & 0 deletions chains/lighter/message/lighter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_ValidMessage() {
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
Caller: common.HexToAddress("0xde526bA5d1ad94cC59D7A79d99A59F607d31A657"),
OrderHash: "orderHash",
DepositTxHash: "orderHash",
BorrowAmount: big.NewInt(1900000),
}

Expand Down Expand Up @@ -128,6 +129,7 @@ func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_InvalidTxType() {
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
Caller: common.HexToAddress("0xde526bA5d1ad94cC59D7A79d99A59F607d31A657"),
OrderHash: "orderHash",
DepositTxHash: "orderHash",
BorrowAmount: big.NewInt(1900000),
}
s.mockTxFetcher.EXPECT().GetTx(ad.OrderHash).Return(&lighter.LighterTx{
Expand Down Expand Up @@ -169,6 +171,7 @@ func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_InvalidAccount() {
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
Caller: common.HexToAddress("0xde526bA5d1ad94cC59D7A79d99A59F607d31A657"),
OrderHash: "orderHash",
DepositTxHash: "orderHash",
BorrowAmount: big.NewInt(1900000),
}
s.mockTxFetcher.EXPECT().GetTx(ad.OrderHash).Return(&lighter.LighterTx{
Expand Down Expand Up @@ -210,6 +213,7 @@ func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_MissingTx() {
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
Caller: common.HexToAddress("0xde526bA5d1ad94cC59D7A79d99A59F607d31A657"),
OrderHash: "orderHash",
DepositTxHash: "orderHash",
BorrowAmount: big.NewInt(1900000),
}
s.mockTxFetcher.EXPECT().GetTx(ad.OrderHash).Return(nil, fmt.Errorf("not found"))
Expand Down Expand Up @@ -245,6 +249,7 @@ func (s *LighterMessageHandlerTestSuite) Test_HandleMessage_BorrowAmountTooHigh(
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
Caller: common.HexToAddress("0xde526bA5d1ad94cC59D7A79d99A59F607d31A657"),
OrderHash: "orderHash",
DepositTxHash: "orderHash",
BorrowAmount: big.NewInt(2000000),
}

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,6 @@ github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk=
github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4=
github.com/sprintertech/lifi-solver v0.0.0-20251023154209-4cf9ac1ab166 h1:mCcKOxfLs+5tFGD5ZyVVMeqlUuNzhHttul05x27zWFo=
github.com/sprintertech/lifi-solver v0.0.0-20251023154209-4cf9ac1ab166/go.mod h1:EbAH3JJxioBVuHvyjaP5zTh6uPmumCpbE93WEjwpRm0=
github.com/sprintertech/solver-config/go v0.0.0-20251024140304-ee77ffefd608 h1:J5RxJUhqMGfoIUb8XnSjDBlUMH658nM9NIjXft+DjkA=
github.com/sprintertech/solver-config/go v0.0.0-20251024140304-ee77ffefd608/go.mod h1:MrIGW6M815PSYKtWSeOd1Z7eiSeOIk/uA/6E2PhlQVQ=
github.com/sprintertech/solver-config/go v0.0.0-20251027142430-7f32bdd5da1e h1:5sSP6GbqCT/ApxxZmUtav6GHy5Ke98zh5oqQxewhJd4=
github.com/sprintertech/solver-config/go v0.0.0-20251027142430-7f32bdd5da1e/go.mod h1:MrIGW6M815PSYKtWSeOd1Z7eiSeOIk/uA/6E2PhlQVQ=
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
Expand Down
Loading