Skip to content

Commit 648a2e4

Browse files
authored
fix: remove mayan driver check (#55)
* Remove invalid mayan driver check * Fix mayan tests
1 parent 1982ae9 commit 648a2e4

File tree

2 files changed

+0
-68
lines changed

2 files changed

+0
-68
lines changed

chains/evm/message/mayan.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ func (h *MayanMessageHandler) verifyOrder(
254254
return fmt.Errorf("swap and msg hash not matching")
255255
}
256256

257-
if common.BytesToAddress(msg.Driver[12:]) != data.Caller {
258-
return fmt.Errorf("driver and caller address is not the same")
259-
}
260-
261257
if order.Status != contracts.OrderCreated {
262258
return fmt.Errorf("invalid order status %d", order.Status)
263259
}

chains/evm/message/mayan_test.go

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -309,70 +309,6 @@ func (s *MayanMessageHandlerTestSuite) Test_HandleMessage_InvalidOrderHash() {
309309
s.NotNil(err)
310310
}
311311

312-
func (s *MayanMessageHandlerTestSuite) Test_HandleMessage_InvalidCaller() {
313-
s.mockCommunication.EXPECT().Broadcast(
314-
gomock.Any(),
315-
gomock.Any(),
316-
comm.MayanMsg,
317-
fmt.Sprintf("%d-%s", 10, comm.MayanSessionID),
318-
).Return(nil)
319-
p, _ := pstoremem.NewPeerstore()
320-
s.mockHost.EXPECT().Peerstore().Return(p)
321-
322-
errChn := make(chan error, 1)
323-
ad := &message.MayanData{
324-
ErrChn: errChn,
325-
Nonce: big.NewInt(101),
326-
LiquidityPool: common.HexToAddress("0xbe526bA5d1ad94cC59D7A79d99A59F607d31A657"),
327-
Caller: common.HexToAddress("0xde526bA5d1ad94cC59D7A79d99A59F607d31A657"),
328-
Calldata: mayanCalldata,
329-
BorrowAmount: big.NewInt(900000000000000000),
330-
OrderHash: "orderHash",
331-
DepositTxHash: "0x6cd3de31d0085c8318a19eb1299b00e1d0636838cb6359da6199adcd6d142952",
332-
}
333-
334-
calldataBytes, _ := hex.DecodeString(ad.Calldata)
335-
orderHash := common.HexToHash(common.Bytes2Hex([]byte("orderHash")))
336-
337-
s.mockContract.EXPECT().DecodeFulfillCall(calldataBytes).Return(
338-
&contracts.MayanFulfillParams{
339-
Recipient: common.HexToHash("0x5c7BCd6E7De5423a257D81B442095A1a6ced35C6"),
340-
FulfillAmount: big.NewInt(99000000000000000),
341-
},
342-
&contracts.MayanFulfillMsg{
343-
OrderHash: orderHash,
344-
SrcChainId: 24,
345-
DestChainId: 30,
346-
Driver: common.HexToHash("0xde526bA5d1ad94cC59D7A79d99A59F607d31A658"),
347-
ReferrerAddr: common.HexToHash(ad.Caller.Hex()),
348-
ReferrerBps: 1,
349-
ProtocolBps: 3,
350-
PromisedAmount: 989000,
351-
},
352-
nil)
353-
s.mockSwapFetcher.EXPECT().GetSwap(ad.OrderHash).Return(&mayan.MayanSwap{
354-
OrderHash: orderHash.Hex(),
355-
}, nil)
356-
s.mockContract.EXPECT().GetOrder(gomock.Any(), gomock.Any(), uint8(18)).Return(&contracts.MayanOrder{
357-
Status: contracts.OrderCreated,
358-
AmountIn: 100000000000,
359-
}, nil)
360-
361-
m := &coreMessage.Message{
362-
Data: ad,
363-
Source: 0,
364-
Destination: 10,
365-
}
366-
367-
prop, err := s.handler.HandleMessage(m)
368-
369-
s.Nil(prop)
370-
s.NotNil(err)
371-
372-
err = <-errChn
373-
s.NotNil(err)
374-
}
375-
376312
func (s *MayanMessageHandlerTestSuite) Test_HandleMessage_InvalidFulfillAmount() {
377313
s.mockCommunication.EXPECT().Broadcast(
378314
gomock.Any(),

0 commit comments

Comments
 (0)