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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ genmocks:
mockgen -source=./chains/evm/listener/eventHandlers/retry.go -destination=./chains/evm/listener/eventHandlers/mock/retry.go
mockgen -source=./chains/evm/calls/events/listener.go -destination=./chains/evm/calls/events/mock/listener.go
mockgen -source=./chains/substrate/listener/event-handlers.go -destination=./chains/substrate/listener/mock/handlers.go
mockgen -source=./chains/substrate/executor/message-handler.go -destination=./chains/substrate/executor/mock/message-handler.go
mockgen -source=./chains/btc/listener/event-handlers.go -destination=./chains/btc/listener/mock/handlers.go
mockgen -source=./chains/btc/listener/listener.go -destination=./chains/btc/listener/mock/listener.go
mockgen -source=./topology/topology.go -destination=./topology/mock/topology.go
Expand Down
3 changes: 2 additions & 1 deletion chains/substrate/executor/message-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ChainSafe/sygma-relayer/relayer/transfer"
"github.com/ChainSafe/sygma-relayer/store"
"github.com/centrifuge/go-substrate-rpc-client/v4/types"
"github.com/centrifuge/go-substrate-rpc-client/v4/types/block"
"github.com/ethereum/go-ethereum/common"
"github.com/sygmaprotocol/sygma-core/relayer/message"
"github.com/sygmaprotocol/sygma-core/relayer/proposal"
Expand Down Expand Up @@ -67,7 +68,7 @@ type PropStorer interface {

type BlockFetcher interface {
GetFinalizedHead() (types.Hash, error)
GetBlock(blockHash types.Hash) (*types.SignedBlock, error)
GetBlock(blockHash types.Hash) (*block.SignedBlock, error)
}

type DepositProcessor interface {
Expand Down
13 changes: 7 additions & 6 deletions chains/substrate/executor/message-handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/ChainSafe/sygma-relayer/e2e/evm"
"github.com/ChainSafe/sygma-relayer/e2e/substrate"
"github.com/centrifuge/go-substrate-rpc-client/v4/types"
"github.com/centrifuge/go-substrate-rpc-client/v4/types/block"
"github.com/sygmaprotocol/sygma-core/relayer/message"
"github.com/sygmaprotocol/sygma-core/relayer/proposal"

Expand Down Expand Up @@ -227,8 +228,8 @@ func (s *RetryMessageHandlerTestSuite) SetupTest() {

func (s *RetryMessageHandlerTestSuite) Test_HandleMessage_RetryNotFinalized() {
s.mockBlockFetcher.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockBlockFetcher.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{
Block: types.Block{
s.mockBlockFetcher.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{
Block: block.Block{
Header: types.Header{
Number: 99,
},
Expand All @@ -255,8 +256,8 @@ func (s *RetryMessageHandlerTestSuite) Test_HandleMessage_RetryNotFinalized() {

func (s *RetryMessageHandlerTestSuite) Test_HandleMessage_NoDeposits() {
s.mockBlockFetcher.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockBlockFetcher.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{
Block: types.Block{
s.mockBlockFetcher.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{
Block: block.Block{
Header: types.Header{
Number: 101,
},
Expand Down Expand Up @@ -285,8 +286,8 @@ func (s *RetryMessageHandlerTestSuite) Test_HandleMessage_NoDeposits() {

func (s *RetryMessageHandlerTestSuite) Test_HandleMessage_ValidDeposits() {
s.mockBlockFetcher.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockBlockFetcher.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{
Block: types.Block{
s.mockBlockFetcher.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{
Block: block.Block{
Header: types.Header{
Number: 101,
},
Expand Down
5 changes: 3 additions & 2 deletions chains/substrate/executor/mock/message-handler.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chains/substrate/listener/event-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import (
"github.com/ChainSafe/sygma-relayer/chains/substrate/events"
"github.com/centrifuge/go-substrate-rpc-client/v4/registry/parser"
"github.com/centrifuge/go-substrate-rpc-client/v4/types"
"github.com/centrifuge/go-substrate-rpc-client/v4/types/block"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/sygmaprotocol/sygma-core/relayer/message"
)

type Connection interface {
GetFinalizedHead() (types.Hash, error)
GetBlock(blockHash types.Hash) (*types.SignedBlock, error)
GetBlock(blockHash types.Hash) (*block.SignedBlock, error)
GetBlockHash(blockNumber uint64) (types.Hash, error)
GetBlockEvents(hash types.Hash) ([]*parser.Event, error)
UpdateMetatdata() error
Expand Down
13 changes: 7 additions & 6 deletions chains/substrate/listener/event-handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/centrifuge/go-substrate-rpc-client/v4/registry"
"github.com/centrifuge/go-substrate-rpc-client/v4/registry/parser"
"github.com/centrifuge/go-substrate-rpc-client/v4/types"
"github.com/centrifuge/go-substrate-rpc-client/v4/types/block"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/suite"
)
Expand Down Expand Up @@ -360,7 +361,7 @@ func (s *RetryHandlerTestSuite) Test_CannotFetchLatestBlock() {

func (s *RetryHandlerTestSuite) Test_EventTooNew() {
s.mockConn.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{Block: types.Block{
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{Block: block.Block{
Header: types.Header{
Number: types.BlockNumber(uint32(100)),
},
Expand All @@ -386,7 +387,7 @@ func (s *RetryHandlerTestSuite) Test_EventTooNew() {

func (s *RetryHandlerTestSuite) Test_FetchingBlockHashFails() {
s.mockConn.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{Block: types.Block{
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{Block: block.Block{
Header: types.Header{
Number: types.BlockNumber(uint32(100)),
},
Expand Down Expand Up @@ -415,7 +416,7 @@ func (s *RetryHandlerTestSuite) Test_FetchingBlockHashFails() {

func (s *RetryHandlerTestSuite) Test_FetchingBlockEventsFails() {
s.mockConn.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{Block: types.Block{
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{Block: block.Block{
Header: types.Header{
Number: types.BlockNumber(uint32(100)),
},
Expand Down Expand Up @@ -444,7 +445,7 @@ func (s *RetryHandlerTestSuite) Test_FetchingBlockEventsFails() {

func (s *RetryHandlerTestSuite) Test_NoEvents() {
s.mockConn.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{Block: types.Block{
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{Block: block.Block{
Header: types.Header{
Number: types.BlockNumber(uint32(100)),
},
Expand Down Expand Up @@ -473,7 +474,7 @@ func (s *RetryHandlerTestSuite) Test_NoEvents() {

func (s *RetryHandlerTestSuite) Test_ValidEvents() {
s.mockConn.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{Block: types.Block{
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{Block: block.Block{
Header: types.Header{
Number: types.BlockNumber(uint32(100)),
},
Expand Down Expand Up @@ -571,7 +572,7 @@ func (s *RetryHandlerTestSuite) Test_ValidEvents() {

func (s *RetryHandlerTestSuite) Test_EventPanics() {
s.mockConn.EXPECT().GetFinalizedHead().Return(types.Hash{}, nil)
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&types.SignedBlock{Block: types.Block{
s.mockConn.EXPECT().GetBlock(gomock.Any()).Return(&block.SignedBlock{Block: block.Block{
Header: types.Header{
Number: types.BlockNumber(uint32(100)),
},
Expand Down
5 changes: 3 additions & 2 deletions chains/substrate/listener/mock/handlers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/btcsuite/btcd/btcutil v1.1.5
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/cenkalti/backoff/v4 v4.3.0
github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1
github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.2-0.20240919131012-e3b938563803
github.com/creasty/defaults v1.6.0
github.com/deckarep/golang-set/v2 v2.1.0
github.com/ethereum/go-ethereum v1.13.4
Expand All @@ -21,7 +21,7 @@ require (
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.9.0
github.com/stretchr/testify v1.8.4
github.com/sygmaprotocol/sygma-core v0.0.0-20241028121638-2c5597ae589f
github.com/sygmaprotocol/sygma-core v0.0.0-20250319134514-469dd1298ce6
github.com/taurusgroup/multi-party-sig v0.6.0-alpha-2021-09-21.0.20230619131919-9c7c6ffd7217
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/metric v1.16.0
Expand All @@ -43,13 +43,13 @@ require (
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/vedhavyas/go-subkey v1.0.4 // indirect
github.com/vedhavyas/go-subkey/v2 v2.0.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zeebo/assert v1.3.0 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
Expand Down Expand Up @@ -147,7 +147,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
Expand All @@ -156,7 +156,7 @@ require (
github.com/sourcegraph/conc v0.3.0
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down Expand Up @@ -195,5 +195,6 @@ require (
replace (
github.com/agl/ed25519 => github.com/binance-chain/edwards25519 v0.0.0-20200305024217-f36fc4b53d43
github.com/binance-chain/tss-lib => github.com/ChainSafe/threshlib v0.0.0-20230420112309-603112eb4684
github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/tolak/go-substrate-rpc-client/v4 v4.0.0-20250319114649-4e9cb7e9c67f
github.com/taurusgroup/multi-party-sig => github.com/sygmaprotocol/multi-party-sig v0.0.0-20240523153754-9377ba09c35e
)
Loading
Loading