Skip to content

Commit 9bab7dc

Browse files
committed
Migrated CCIP PluginType from core
1 parent 8817bb8 commit 9bab7dc

File tree

6 files changed

+32
-8
lines changed

6 files changed

+32
-8
lines changed

pkg/loop/internal/pb/relayer.pb.go

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

pkg/loop/internal/pb/relayer.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ message CCIPProviderArgs {
6161
bytes contractReaderConfig = 2;
6262
bytes chainWriterConfig = 3;
6363
string OffRampAddress = 4;
64+
// pluginType is actually a uint8 but uint32 is the smallest supported by protobuf
6465
uint32 pluginType = 5;
6566
map<string, bytes> synced_addresses = 6; // map[contract_name]contract_address
6667
}

pkg/loop/internal/relayer/relayer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/smartcontractkit/chainlink-common/pkg/loop/internal/relayer/pluginprovider/ocr2"
3232
looptypes "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/types"
3333
"github.com/smartcontractkit/chainlink-common/pkg/types"
34+
cctypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
3435
"github.com/smartcontractkit/chainlink-common/pkg/types/core"
3536
)
3637

@@ -298,7 +299,7 @@ func (r *relayerClient) NewCCIPProvider(ctx context.Context, cargs types.CCIPPro
298299
ContractReaderConfig: cargs.ContractReaderConfig,
299300
ChainWriterConfig: cargs.ChainWriterConfig,
300301
OffRampAddress: cargs.OffRampAddress,
301-
PluginType: cargs.PluginType,
302+
PluginType: uint32(cargs.PluginType),
302303
SyncedAddresses: persistedSyncs,
303304
},
304305
})
@@ -731,7 +732,7 @@ func (r *relayerServer) NewCCIPProvider(ctx context.Context, request *pb.NewCCIP
731732
ContractReaderConfig: rargs.ContractReaderConfig,
732733
ChainWriterConfig: rargs.ChainWriterConfig,
733734
OffRampAddress: rargs.OffRampAddress,
734-
PluginType: rargs.PluginType,
735+
PluginType: cctypes.PluginType(rargs.PluginType),
735736
}
736737

737738
provider, err := r.impl.NewCCIPProvider(ctx, ccipProviderArgs)

pkg/loop/internal/relayer/test/relayer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/smartcontractkit/chainlink-common/pkg/services"
3232
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
3333
"github.com/smartcontractkit/chainlink-common/pkg/types"
34+
"github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
3435
"github.com/smartcontractkit/chainlink-common/pkg/types/core"
3536
)
3637

@@ -75,7 +76,7 @@ type staticRelayerConfig struct {
7576
contractReaderConfig []byte
7677
chainWriterConfig []byte
7778
offRampAddress string
78-
pluginType uint32
79+
pluginType ccipocr3.PluginType
7980
medianProvider testtypes.MedianProviderTester
8081
agnosticProvider testtypes.PluginProviderTester
8182
mercuryProvider mercurytest.MercuryProviderTester

pkg/types/ccipocr3/generic_types.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,23 @@ func (ca ContractAddresses) Append(contract string, chain ChainSelector, address
373373
resp[contract][chain] = address
374374
return resp
375375
}
376+
377+
// PluginType represents the type of CCIP plugin.
378+
// It mirrors the OCRPluginType in Internal.sol.
379+
type PluginType uint8
380+
381+
const (
382+
PluginTypeCCIPCommit PluginType = 0
383+
PluginTypeCCIPExec PluginType = 1
384+
)
385+
386+
func (pt PluginType) String() string {
387+
switch pt {
388+
case PluginTypeCCIPCommit:
389+
return "CCIPCommit"
390+
case PluginTypeCCIPExec:
391+
return "CCIPExec"
392+
default:
393+
return "Unknown"
394+
}
395+
}

pkg/types/provider_ccip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ type CCIPProviderArgs struct {
6363
ContractReaderConfig []byte
6464
ChainWriterConfig []byte
6565
OffRampAddress string
66-
PluginType uint32
66+
PluginType ccipocr3.PluginType
6767
}

0 commit comments

Comments
 (0)