Skip to content

Commit 7fdfa8a

Browse files
committed
Migrated CCIP PluginType from core
1 parent 4542724 commit 7fdfa8a

File tree

6 files changed

+36
-12
lines changed

6 files changed

+36
-12
lines changed

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

Lines changed: 9 additions & 8 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
uint32 extraDataCodecBundleID = 7; // LOOP service ID for ExtraDataCodecBundle served by core node

pkg/loop/internal/relayer/relayer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
looptypes "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/types"
3434
"github.com/smartcontractkit/chainlink-common/pkg/types"
3535
ccipocr3types "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
36+
cctypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
3637
"github.com/smartcontractkit/chainlink-common/pkg/types/core"
3738
)
3839

@@ -314,7 +315,7 @@ func (r *relayerClient) NewCCIPProvider(ctx context.Context, cargs types.CCIPPro
314315
ContractReaderConfig: cargs.ContractReaderConfig,
315316
ChainWriterConfig: cargs.ChainWriterConfig,
316317
OffRampAddress: cargs.OffRampAddress,
317-
PluginType: cargs.PluginType,
318+
PluginType: uint32(cargs.PluginType),
318319
SyncedAddresses: persistedSyncs,
319320
ExtraDataCodecBundleID: extraDataCodecBundleID,
320321
},
@@ -762,7 +763,7 @@ func (r *relayerServer) NewCCIPProvider(ctx context.Context, request *pb.NewCCIP
762763
ContractReaderConfig: rargs.ContractReaderConfig,
763764
ChainWriterConfig: rargs.ChainWriterConfig,
764765
OffRampAddress: rargs.OffRampAddress,
765-
PluginType: rargs.PluginType,
766+
PluginType: cctypes.PluginType(rargs.PluginType),
766767
ExtraDataCodecBundle: extraDataCodecBundle,
767768
}
768769

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
@@ -374,3 +374,23 @@ func (ca ContractAddresses) Append(contract string, chain ChainSelector, address
374374
resp[contract][chain] = address
375375
return resp
376376
}
377+
378+
// PluginType represents the type of CCIP plugin.
379+
// It mirrors the OCRPluginType in Internal.sol.
380+
type PluginType uint8
381+
382+
const (
383+
PluginTypeCCIPCommit PluginType = 0
384+
PluginTypeCCIPExec PluginType = 1
385+
)
386+
387+
func (pt PluginType) String() string {
388+
switch pt {
389+
case PluginTypeCCIPCommit:
390+
return "CCIPCommit"
391+
case PluginTypeCCIPExec:
392+
return "CCIPExec"
393+
default:
394+
return "Unknown"
395+
}
396+
}

pkg/types/provider_ccip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type CCIPProvider interface {
6161
type CCIPProviderArgs struct {
6262
ExternalJobID uuid.UUID
6363
OffRampAddress string
64-
PluginType uint32
64+
PluginType ccipocr3.PluginType
6565

6666
// These CR/CW configs are only used by accessors that still rely on ChainReader
6767
// and ChainWriter, like SolanaAccessor.

0 commit comments

Comments
 (0)