Skip to content

Commit 89733ba

Browse files
committed
Add across message handler tests
1 parent 54b76d6 commit 89733ba

File tree

25 files changed

+828
-202
lines changed

25 files changed

+828
-202
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ test:
2626
genmocks:
2727
mockgen -destination=./tss/ecdsa/common/mock/tss.go github.com/binance-chain/tss-lib/tss Message
2828
mockgen -destination=./tss/ecdsa/common/mock/communication.go -source=./tss/ecdsa/common/base.go -package mock_tss
29+
mockgen -destination=./tss/ecdsa/common/mock/fetcher.go -source=./tss/ecdsa/signing/signing.go -package mock_tss
2930
mockgen --package mock_tss -destination=./tss/mock/ecdsa.go -source=./tss/ecdsa/keygen/keygen.go
3031
mockgen -source=./tss/coordinator.go -destination=./tss/mock/coordinator.go
3132
mockgen -source=./comm/communication.go -destination=./comm/mock/communication.go
@@ -34,6 +35,7 @@ genmocks:
3435
mockgen -destination=./comm/p2p/mock/host/host.go github.com/libp2p/go-libp2p/core/host Host
3536
mockgen -destination=./comm/p2p/mock/conn/conn.go github.com/libp2p/go-libp2p/core/network Conn
3637
mockgen -destination=./comm/p2p/mock/stream/stream.go github.com/libp2p/go-libp2p/core/network Stream,Conn
38+
mockgen -source=./chains/evm/message/across.go -destination=./chains/evm/message/mock/across.go
3739

3840

3941

cache/signature_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"testing"
66
"time"
77

8-
"github.com/golang/mock/gomock"
98
"github.com/sprintertech/sprinter-signing/cache"
109
"github.com/sprintertech/sprinter-signing/comm"
1110
mock_communication "github.com/sprintertech/sprinter-signing/comm/mock"
1211
"github.com/sprintertech/sprinter-signing/tss/ecdsa/signing"
1312
"github.com/sprintertech/sprinter-signing/tss/message"
1413
"github.com/stretchr/testify/suite"
14+
"go.uber.org/mock/gomock"
1515
)
1616

1717
type SignatureCacheTestSuite struct {

chains/evm/calls/consts/across.go

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,91 @@ const SpokePoolABI = `
8686
"outputs": [],
8787
"stateMutability": "nonpayable",
8888
"type": "function"
89-
}
89+
},
90+
{
91+
"anonymous": false,
92+
"inputs": [
93+
{
94+
"indexed": false,
95+
"internalType": "bytes32",
96+
"name": "inputToken",
97+
"type": "bytes32"
98+
},
99+
{
100+
"indexed": false,
101+
"internalType": "bytes32",
102+
"name": "outputToken",
103+
"type": "bytes32"
104+
},
105+
{
106+
"indexed": false,
107+
"internalType": "uint256",
108+
"name": "inputAmount",
109+
"type": "uint256"
110+
},
111+
{
112+
"indexed": false,
113+
"internalType": "uint256",
114+
"name": "outputAmount",
115+
"type": "uint256"
116+
},
117+
{
118+
"indexed": true,
119+
"internalType": "uint256",
120+
"name": "destinationChainId",
121+
"type": "uint256"
122+
},
123+
{
124+
"indexed": true,
125+
"internalType": "uint256",
126+
"name": "depositId",
127+
"type": "uint256"
128+
},
129+
{
130+
"indexed": false,
131+
"internalType": "uint32",
132+
"name": "quoteTimestamp",
133+
"type": "uint32"
134+
},
135+
{
136+
"indexed": false,
137+
"internalType": "uint32",
138+
"name": "fillDeadline",
139+
"type": "uint32"
140+
},
141+
{
142+
"indexed": false,
143+
"internalType": "uint32",
144+
"name": "exclusivityDeadline",
145+
"type": "uint32"
146+
},
147+
{
148+
"indexed": true,
149+
"internalType": "bytes32",
150+
"name": "depositor",
151+
"type": "bytes32"
152+
},
153+
{
154+
"indexed": false,
155+
"internalType": "bytes32",
156+
"name": "recipient",
157+
"type": "bytes32"
158+
},
159+
{
160+
"indexed": false,
161+
"internalType": "bytes32",
162+
"name": "exclusiveRelayer",
163+
"type": "bytes32"
164+
},
165+
{
166+
"indexed": false,
167+
"internalType": "bytes",
168+
"name": "message",
169+
"type": "bytes"
170+
}
171+
],
172+
"name": "FundsDeposited",
173+
"type": "event"
174+
}
90175
]
91176
`

chains/evm/calls/events/events.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
StartKeygenSig EventSig = "StartKeygen()"
2424
KeyRefreshSig EventSig = "KeyRefresh(string)"
2525

26-
AcrossDepositSig EventSig = "FundsDeposited(address,address,uint256,uin256,uint256,uint32,uint32,uint32,uint32,address,address,address,bytes)"
26+
AcrossDepositSig EventSig = "FundsDeposited(bytes32,bytes32,uint256,uint256,uint256,uint256,uint32,uint32,uint32,bytes32,bytes32,bytes32,bytes)"
2727
)
2828

2929
// Refresh struct holds key refresh event data
@@ -80,9 +80,9 @@ type AcrossV3RelayData struct {
8080
Message []byte
8181
}
8282

83-
func (a *AcrossV3RelayData) Calldata() ([]byte, error) {
83+
func (a *AcrossV3RelayData) Calldata(repaymentChainID *big.Int, repaymentAddress common.Address) ([]byte, error) {
8484
abi, _ := abi.JSON(strings.NewReader(consts.SpokePoolABI))
85-
input, err := abi.Pack("fillRelay", a)
85+
input, err := abi.Pack("fillRelay", a, repaymentChainID, [32]byte(common.LeftPadBytes(repaymentAddress.Bytes(), 32)))
8686
if err != nil {
8787
return []byte{}, err
8888
}

chains/evm/calls/events/mock/listener.go

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)