Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/capabilities/ccip: use OCR offchain config #1264

Merged
merged 6 commits into from
Aug 6, 2024

Conversation

makramkd
Copy link
Contributor

@makramkd makramkd commented Aug 6, 2024

Motivation

We want to define and use the appropriate OCR offchain config for each plugin.

Solution

Requires smartcontractkit/chainlink-ccip#36

Comment on lines +437 to +440
GasPriceDeviationPPB: ccipocr3.NewBigIntFromInt64(1000),
DAGasPriceDeviationPPB: ccipocr3.NewBigIntFromInt64(0),
FinalityDepth: 10,
OptimisticConfirmations: 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not used explicitly yet, will create a ticket. Expected usage:

  • GasPriceDeviationPPB: used by the commit plugin
  • DAGasPriceDeviationPPB: used by the commit plugin
  • FinalityDepth: used by the CCIP reader (both plugins)
  • OptimisticConfirmations: used by the exec plugin (via the CCIP reader)

Comment on lines +479 to +481
RemoteGasPriceBatchWriteFrequency: *commonconfig.MustNewDuration(RemoteGasPriceBatchWriteFrequency),
// TODO: implement token price writes
// TokenPriceBatchWriteFrequency: *commonconfig.MustNewDuration(tokenPriceBatchWriteFrequency),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will create a ticket on using these in the commit plugin, post re-write. Expected usage:

  • RemoteGasPriceBatchWriteFrequency: commit plugin uses this to determine when to write a gas price on chain if the deviation threshold isn't met
  • TokenPriceBatchWriteFrequency: commit plugin uses this to determine when to write a token price on chain if the deviation threshold isn't met

} else {
encodedOffchainConfig, err2 = pluginconfig.EncodeExecuteOffchainConfig(pluginconfig.ExecuteOffchainConfig{
BatchGasLimit: BatchGasLimit,
RelativeBoostPerWaitHour: RelativeBoostPerWaitHour,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently unused, but needed for fee boosting in exec.

Comment on lines +490 to +491
RootSnoozeTime: *commonconfig.MustNewDuration(RootSnoozeTime),
BatchingStrategyID: BatchingStrategyID,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used by exec

@@ -46,6 +47,10 @@ import (

var _ cctypes.OracleCreator = &inprocessOracleCreator{}

const (
defaultCommitGasLimit = 500_000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't define this in the offchain config for commit, we might have to at some point though to keep things chain agnostic in this launcher.

Comment on lines +168 to +170
if execOffchainConfig.BatchGasLimit == 0 && destChainFamily == relay.NetworkEVM {
return nil, fmt.Errorf("BatchGasLimit not set in execute offchain config, must be > 0")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the Validate function from chainlink-ccip? Does that function need to consider destChainFamily somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a good note, I have this zero check there but I think long term it doesn't make much sense for it to be there unless it has extra info like chain family.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured I'd put this check here just in case to catch a misconfig, but maybe better to change the Validate API to accept a chain family...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more not sure what is the best place to put the chain-specific validation logic. Originally chainlink-ccip was supposed to be totally chain agnostic, I feel like if we put these types there its kinda breaking that promise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing is validation that certain fields are correct based on whether the chain is an L2 or not (e.g DA deviation ppb)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's something that MUST be set if the chain is an L2. We don't have that info anywhere though, far as I can tell. It's not exposed as part of the chain family.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think will keep as-is now, we need to do a pass where we chain-agnostify all of this code here anyways, hopefully we can find a pattern that works for all chain families and per-family quirks

@makramkd makramkd enabled auto-merge (squash) August 6, 2024 14:45
@makramkd makramkd merged commit 5611576 into ccip-develop Aug 6, 2024
103 checks passed
@makramkd makramkd deleted the mk/add-ocr-offchain-configs-to-tests branch August 6, 2024 15:02
huangzhen1997 pushed a commit that referenced this pull request Aug 19, 2024
* [CCIP Merge] Add ccip capabilities directory [CCIP-2943] (#14044)

* Add ccip capabilities directory

* [CCIP Merge] Capabilities fix [CCIP-2943] (#14048)

* Fix compilation for launcher, diff

Make application.go ready for adding more fixes


* Fix launcher tests

* ks-409 fix the mock trigger to ensure events are sent (#14047)

* Add ccip to job orm

* Add capabilities directory under BUSL license

* Prep to instantiate separate registrysyncer for CCIP

* Move registrySyncer creation into ccip delegate

* [chore] Change registrysyncer config to bytes

* Fix launcher diff tests after changing structs in syncer

* Fix linting

* MAke simulated backend client work with chains other than 1337

* core/capabilities/ccip: use OCR offchain config (#1264)

We want to define and use the appropriate OCR offchain config for each
plugin.

Requires smartcontractkit/chainlink-ccip#36

* Cleaning up

* Add capabilities types to mockery

---------

Co-authored-by: Cedric Cordenier <[email protected]>
Co-authored-by: Matthew Pendrey <[email protected]>
Co-authored-by: Makram <[email protected]>

* make modgraph

* Add changeset

* Fix test with new TxMgr constructor

---------

Co-authored-by: Cedric Cordenier <[email protected]>
Co-authored-by: Matthew Pendrey <[email protected]>
Co-authored-by: Makram <[email protected]>
dhaidashenko pushed a commit that referenced this pull request Sep 2, 2024
We want to define and use the appropriate OCR offchain config for each
plugin.

Requires smartcontractkit/chainlink-ccip#36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants