Skip to content

Commit 55344d7

Browse files
authored
fix: standardize lifi protocol (#97)
<!--- 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 295f195 commit 55344d7

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

api/handlers/signing.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const (
2222
MayanProtocol ProtocolType = "mayan"
2323
RhinestoneProtocol ProtocolType = "rhinestone"
2424
LifiEscrowProtocol ProtocolType = "lifi-escrow"
25-
LifiProtocol ProtocolType = "lifi"
2625
LighterProtocol ProtocolType = "lighter"
2726
)
2827

api/handlers/unlock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (h *UnlockHandler) HandleUnlock(w http.ResponseWriter, r *http.Request) {
6262
sigChn := make(chan interface{}, 1)
6363
var m *message.Message
6464
switch b.Protocol {
65-
case LifiProtocol:
65+
case LifiEscrowProtocol:
6666
{
6767
m = evmMessage.NewLifiUnlockMessage(0, b.ChainId, &evmMessage.LifiUnlockData{
6868
Source: 0,

api/handlers/unlock_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (s *UnlockHandlerTestSuite) Test_HandleUnlock_InvalidRequest() {
3838
handler := handlers.NewUnlockHandler(msgChn, s.chains)
3939

4040
input := handlers.UnlockBody{
41-
Protocol: "lifi",
41+
Protocol: "lifi-escrow",
4242
OrderID: "id",
4343
Settler: "settler",
4444
}
@@ -95,7 +95,7 @@ func (s *UnlockHandlerTestSuite) Test_HandleUnlock_ValidRequest() {
9595
handler := handlers.NewUnlockHandler(msgChn, s.chains)
9696

9797
input := handlers.UnlockBody{
98-
Protocol: "lifi",
98+
Protocol: "lifi-escrow",
9999
OrderID: "id",
100100
Settler: "settler",
101101
}

chains/evm/message/unlock.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@ import (
1313
"github.com/libp2p/go-libp2p/core/host"
1414
"github.com/libp2p/go-libp2p/core/peer"
1515
"github.com/rs/zerolog/log"
16-
"github.com/sprintertech/sprinter-signing/chains/evm/signature"
1716
"github.com/sprintertech/sprinter-signing/comm"
1817
"github.com/sprintertech/sprinter-signing/tss"
1918
"github.com/sprintertech/sprinter-signing/tss/ecdsa/signing"
2019
"github.com/sygmaprotocol/sygma-core/relayer/message"
2120
"github.com/sygmaprotocol/sygma-core/relayer/proposal"
2221
)
2322

23+
const (
24+
DOMAIN_NAME = "OIFEscrowLIFI"
25+
VERSION = "1"
26+
)
27+
2428
type LifiUnlockHandler struct {
2529
chainID uint64
2630

@@ -158,9 +162,9 @@ func (h *LifiUnlockHandler) lifiUnlockHash(data *LifiUnlockData) ([]byte, error)
158162
},
159163
PrimaryType: "AllowOpen",
160164
Domain: apitypes.TypedDataDomain{
161-
Name: signature.DOMAIN_NAME,
165+
Name: DOMAIN_NAME,
162166
ChainId: &chainId,
163-
Version: signature.VERSION,
167+
Version: VERSION,
164168
VerifyingContract: data.Settler.Hex(),
165169
},
166170
Message: msg,

0 commit comments

Comments
 (0)