Skip to content

Commit

Permalink
pkg/peergroup: use libocr interfaces directly (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
makramkd authored Nov 1, 2024
1 parent 4b133b0 commit 00090bf
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 22 deletions.
12 changes: 8 additions & 4 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ packages:
CCIPReader:
PriceReader:
RMNHome:
github.com/smartcontractkit/chainlink-ccip/pkg/peergroup:
interfaces:
PeerGroupFactory:
PeerGroup:
github.com/smartcontractkit/chainlink-ccip/pkg/contractreader:
interfaces:
Extended:
ContractReaderFacade:
github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3:
interfaces:
ExecutePluginCodec:
github.com/smartcontractkit/libocr/networking:
interfaces:
PeerGroupFactory:
config:
dir: mocks/libocr_networking/
PeerGroup:
config:
dir: mocks/libocr_networking/
4 changes: 2 additions & 2 deletions commit/merkleroot/rmn/peerclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type peerClient struct {
lggr logger.Logger
peerGroupCreator *peergroup.Creator
respChan chan PeerResponse
peerGroup peergroup.PeerGroup
peerGroup networking.PeerGroup
genericEndpointConfigDigest cciptypes.Bytes32
rageP2PStreams map[rmntypes.NodeID]Stream
bootstrappers []commontypes.BootstrapperLocator
Expand All @@ -68,7 +68,7 @@ type peerClient struct {

func NewPeerClient(
lggr logger.Logger,
peerGroupFactory peergroup.PeerGroupFactory,
peerGroupFactory networking.PeerGroupFactory,
bootstrappers []commontypes.BootstrapperLocator,
ocrRoundInterval time.Duration,
) PeerClient {
Expand Down

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

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

17 changes: 4 additions & 13 deletions pkg/peergroup/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"encoding/binary"
"fmt"

"github.com/smartcontractkit/libocr/networking"

"github.com/smartcontractkit/libocr/commontypes"
"github.com/smartcontractkit/libocr/networking"
ocr2types "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
ragep2ptypes "github.com/smartcontractkit/libocr/ragep2p/types"

Expand All @@ -20,13 +19,13 @@ import (
// Creator handles peer group creation
type Creator struct {
lggr logger.Logger
factory PeerGroupFactory
factory networking.PeerGroupFactory
bootstrappers []commontypes.BootstrapperLocator
}

func NewCreator(
lggr logger.Logger,
factory PeerGroupFactory,
factory networking.PeerGroupFactory,
bootstrappers []commontypes.BootstrapperLocator,
) *Creator {
return &Creator{
Expand All @@ -46,7 +45,7 @@ type CreateOpts struct {

// Result contains the created peer group and its config digest
type Result struct {
PeerGroup PeerGroup
PeerGroup networking.PeerGroup
ConfigDigest cciptypes.Bytes32
}

Expand Down Expand Up @@ -99,11 +98,3 @@ func writePrefix(prefix ocr2types.ConfigDigestPrefix, hash cciptypes.Bytes32) cc

return hCopy
}

type PeerGroupFactory interface {
networking.PeerGroupFactory
}

type PeerGroup interface {
networking.PeerGroup
}
2 changes: 1 addition & 1 deletion pkg/peergroup/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// pgmocks "github.com/smartcontractkit/chainlink-ccip/mocks/commit/merkleroot/rmn"
"github.com/smartcontractkit/libocr/networking"

pgfactorymocks "github.com/smartcontractkit/chainlink-ccip/mocks/pkg/peergroup"
pgfactorymocks "github.com/smartcontractkit/chainlink-ccip/mocks/libocr_networking"
)

type mockPeerGroup struct {
Expand Down

0 comments on commit 00090bf

Please sign in to comment.