Skip to content

Commit

Permalink
create commit and exec factories
Browse files Browse the repository at this point in the history
just missing exec codec
  • Loading branch information
makramkd committed Jul 10, 2024
1 parent 9438c4f commit 1764741
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ require (
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240702144807-761f63e7b527 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 // indirect
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,8 @@ github.com/smartcontractkit/chain-selectors v1.0.17 h1:otOlYUnutS8oQBEAi9RLQICqZ
github.com/smartcontractkit/chain-selectors v1.0.17/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b h1:6zmX2y7bWhGGYNCahRLG0noX/oEGD3AlYLR4aOFGZ6g=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 h1:z3AKjCXrUUzvUwYplra/ePrpyaf/KQZ/N+FQSvlsDZQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a h1:0HUP3qmHejg7FyFdY+R+8iFg0kNtrvnAxaQ//+fuZfc=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 h1:TMOoYaeSDkkI3jkCH7lKHOZaLkeDuxFTNC+XblD6M0M=
Expand Down
45 changes: 34 additions & 11 deletions core/services/ccipcapability/oraclecreator/inprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
chainsel "github.com/smartcontractkit/chain-selectors"
commitocr3 "github.com/smartcontractkit/chainlink-ccip/commit"
execocr3 "github.com/smartcontractkit/chainlink-ccip/execute"
ccipreaderpkg "github.com/smartcontractkit/chainlink-ccip/pkg/reader"
cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
"github.com/smartcontractkit/libocr/commontypes"
Expand Down Expand Up @@ -208,6 +209,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp
// build the contract transmitter
// assume that we are using the first account in the keybundle as the from account
// and that we are able to transmit to the dest chain.
// TODO: revisit this in the future, since not all oracles will be able to transmit to the dest chain.
destChainWriter, ok := chainWriters[cciptypes.ChainSelector(config.Config.ChainSelector)]

Check failure on line 213 in core/services/ccipcapability/oraclecreator/inprocess.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary conversion (unconvert)
if !ok {
return nil, fmt.Errorf("no chain writer found for dest chain selector %d, can't create contract transmitter",
Expand All @@ -218,6 +220,37 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp
return nil, fmt.Errorf("no transmitter found for dest relay ID %s, can't create contract transmitter", destRelayID)
}

var factory ocr3types.ReportingPluginFactory[[]byte]
if config.Config.PluginType == uint8(cctypes.PluginTypeCCIPCommit) {
factory = commitocr3.NewPluginFactory(
i.lggr.
Named("CCIPCommitPlugin").
Named(destRelayID.String()).
Named(hexutil.Encode(config.Config.OfframpAddress)),
ccipreaderpkg.OCR3ConfigWithMeta(config),
ccipevm.NewCommitPluginCodecV1(),
ccipevm.NewMessageHasherV1(),
i.homeChainReader,
contractReaders,
chainWriters,
)
} else if config.Config.PluginType == uint8(cctypes.PluginTypeCCIPExec) {
factory = execocr3.NewPluginFactory(
i.lggr.
Named("CCIPExecPlugin").
Named(destRelayID.String()).
Named(hexutil.Encode(config.Config.OfframpAddress)),
ccipreaderpkg.OCR3ConfigWithMeta(config),
nil, // TODO: ccipevm.NewExecutePluginCodecV1(),
ccipevm.NewMessageHasherV1(),
i.homeChainReader,
contractReaders,
chainWriters,
)
} else {
return nil, fmt.Errorf("unsupported plugin type %d", config.Config.PluginType)
}

oracleArgs := libocr3.OCR3OracleArgs[[]byte]{
BinaryNetworkEndpointFactory: i.peerWrapper.Peer2,
Database: i.db,
Expand Down Expand Up @@ -255,17 +288,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp
OffchainConfigDigester: ocrimpls.NewConfigDigester(config.ConfigDigest),
OffchainKeyring: keybundle,
OnchainKeyring: onchainKeyring,
ReportingPluginFactory: commitocr3.NewPluginFactory(
i.lggr.
Named("CCIPCommitPlugin").
Named(destRelayID.String()).
Named(hexutil.Encode(config.Config.OfframpAddress)),
ccipreaderpkg.OCR3ConfigWithMeta(config),
ccipevm.NewCommitPluginCodecV1(),
ccipevm.NewMessageHasherV1(),
i.homeChainReader,
contractReaders,
),
ReportingPluginFactory: factory,
}
oracle, err := libocr3.NewOracle(oracleArgs)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ require (
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/chain-selectors v1.0.17
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240702144807-761f63e7b527
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,8 @@ github.com/smartcontractkit/chain-selectors v1.0.17 h1:otOlYUnutS8oQBEAi9RLQICqZ
github.com/smartcontractkit/chain-selectors v1.0.17/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b h1:6zmX2y7bWhGGYNCahRLG0noX/oEGD3AlYLR4aOFGZ6g=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 h1:z3AKjCXrUUzvUwYplra/ePrpyaf/KQZ/N+FQSvlsDZQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a h1:0HUP3qmHejg7FyFdY+R+8iFg0kNtrvnAxaQ//+fuZfc=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 h1:TMOoYaeSDkkI3jkCH7lKHOZaLkeDuxFTNC+XblD6M0M=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ require (
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240702144807-761f63e7b527 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 // indirect
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1423,8 +1423,8 @@ github.com/smartcontractkit/chain-selectors v1.0.17 h1:otOlYUnutS8oQBEAi9RLQICqZ
github.com/smartcontractkit/chain-selectors v1.0.17/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b h1:6zmX2y7bWhGGYNCahRLG0noX/oEGD3AlYLR4aOFGZ6g=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 h1:z3AKjCXrUUzvUwYplra/ePrpyaf/KQZ/N+FQSvlsDZQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a h1:0HUP3qmHejg7FyFdY+R+8iFg0kNtrvnAxaQ//+fuZfc=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 h1:TMOoYaeSDkkI3jkCH7lKHOZaLkeDuxFTNC+XblD6M0M=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ require (
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.17 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240702144807-761f63e7b527 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 // indirect
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,8 @@ github.com/smartcontractkit/chain-selectors v1.0.17 h1:otOlYUnutS8oQBEAi9RLQICqZ
github.com/smartcontractkit/chain-selectors v1.0.17/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b h1:6zmX2y7bWhGGYNCahRLG0noX/oEGD3AlYLR4aOFGZ6g=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240709161813-ce929632b93b/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411 h1:z3AKjCXrUUzvUwYplra/ePrpyaf/KQZ/N+FQSvlsDZQ=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240710102812-639e06fa5411/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a h1:0HUP3qmHejg7FyFdY+R+8iFg0kNtrvnAxaQ//+fuZfc=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240708180634-24440372521a/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 h1:TMOoYaeSDkkI3jkCH7lKHOZaLkeDuxFTNC+XblD6M0M=
Expand Down

0 comments on commit 1764741

Please sign in to comment.