Skip to content

Commit

Permalink
delete unused code (#10588)
Browse files Browse the repository at this point in the history
  • Loading branch information
krehermann authored Sep 11, 2023
1 parent 7e4473c commit 2d40de4
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 48 deletions.
1 change: 0 additions & 1 deletion core/chains/chain_kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type ChainsKV[T types.ChainService] struct {
var ErrNoSuchChainID = errors.New("chain id does not exist")

func NewChainsKV[T types.ChainService](cs map[string]T) *ChainsKV[T] {

return &ChainsKV[T]{
chains: cs,
}
Expand Down
8 changes: 1 addition & 7 deletions core/chains/chain_kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,13 @@ func (s *testChainService) HealthReport() map[string]error {
return map[string]error{}
}

// Implement updated [loop.Relay] interface funcs in preparation for BCF-2441
// TODO update this comment after BCF-2441 is done
// Implement [types.ChainService] interface
func (s *testChainService) GetChainStatus(ctx context.Context) (stat types.ChainStatus, err error) {
return
}
func (s *testChainService) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []types.NodeStatus, nextPageToken string, total int, err error) {
return
}

func (s *testChainService) Transact(ctx context.Context, from string, to string, amount *big.Int, balanceCheck bool) error {
return nil
}

func (s *testChainService) SendTx(ctx context.Context, from string, to string, amount *big.Int, balanceCheck bool) error {
return nil
}
1 change: 0 additions & 1 deletion core/services/chainlink/relayer_chain_interoperators.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ func (rs *CoreRelayerChainInteroperators) Node(ctx context.Context, name string)

// ids must be a string representation of relay.Identifier
// ids are a filter; if none are specified, all are returned.
// TODO: BCF-2440/1 this signature can be changed to id relay.Identifier which is a much better API
func (rs *CoreRelayerChainInteroperators) NodeStatuses(ctx context.Context, offset, limit int, relayerIDs ...relay.ID) (nodes []types.NodeStatus, count int, err error) {
var (
totalErr error
Expand Down
28 changes: 0 additions & 28 deletions core/services/relay/evm/relayer_extender.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ type EVMChainRelayerExtender interface {
relay.RelayerExt
Chain() evmchain.Chain
Default() bool
// compatibility remove after BCF-2441
NodeStatuses(ctx context.Context, offset, limit int, chainIDs ...string) (nodes []relaytypes.NodeStatus, count int, err error)
}

type EVMChainRelayerExtenderSlicer interface {
Expand Down Expand Up @@ -133,32 +131,6 @@ func (s *ChainRelayerExt) Ready() (err error) {
return s.chain.Ready()
}

var ErrInconsistentChainRelayerExtender = errors.New("inconsistent evm chain relayer extender")

func (s *ChainRelayerExt) NodeStatuses(ctx context.Context, offset, limit int, chainIDs ...string) (nodes []relaytypes.NodeStatus, total int, err error) {
if len(chainIDs) > 1 {
return nil, -1, fmt.Errorf("single chain chain set only support one chain id. got %v", chainIDs)
}
cid := chainIDs[0]
if cid != s.chain.ID().String() {
return nil, -1, fmt.Errorf("unknown chain id %s. expected %s", cid, s.chain.ID())
}
nodes, _, total, err = s.ListNodeStatuses(ctx, int32(limit), "")
if err != nil {
return nil, -1, err
}
if len(nodes) < offset {
return []relaytypes.NodeStatus{}, -1, fmt.Errorf("out of range")
}
if limit <= 0 {
limit = len(nodes)
} else if len(nodes) < limit {
limit = len(nodes)
}
return nodes[offset:limit], total, nil

}

func NewChainRelayerExtenders(ctx context.Context, opts evmchain.ChainRelayExtenderConfig) (*ChainRelayerExtenders, error) {
if err := opts.Check(); err != nil {
return nil, err
Expand Down
11 changes: 0 additions & 11 deletions core/services/relay/evm/relayer_extender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,4 @@ func TestChainRelayExtenders(t *testing.T) {
assert.NotEmpty(t, s)
assert.NoError(t, err)

// test error conditions for NodeStatuses
nstats, cnt, err := relayExt.NodeStatuses(testutils.Context(t), 0, 0, cltest.FixtureChainID.String(), "error, only one chain supported")
assert.Error(t, err)
assert.Nil(t, nstats)
assert.Equal(t, -1, cnt)

nstats, cnt, err = relayExt.NodeStatuses(testutils.Context(t), 0, 0, "not the chain id")
assert.Error(t, err)
assert.Nil(t, nstats)
assert.Equal(t, -1, cnt)

}

0 comments on commit 2d40de4

Please sign in to comment.