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

Do not return the error in case if onRamp not initialized #1487

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

valerii-kabisov-cll
Copy link
Contributor

@valerii-kabisov-cll valerii-kabisov-cll commented Oct 4, 2024

Motivation

For the exec provider, in some cases, the onRamp reader is not initialized. For immediate reaction, we need to allow execution without blocking in cases if onRamp is not initialized. It fails due the issue when onRampReader is not initialized for execProvider. This fix should fix this issue. In case the onRamp reader is not initialized, the module will return 0 values and DAGasEstimator will behave as it worked before this feature been implemented.

@cl-sonarqube-production
Copy link

@@ -42,7 +41,7 @@ func (c *FeeEstimatorConfigService) SetOnRampReader(reader ccip.OnRampReader) {
// GetDynamicConfig should be cached in the onRamp reader to avoid unnecessary on-chain calls
func (c *FeeEstimatorConfigService) GetDataAvailabilityConfig(ctx context.Context) (destDataAvailabilityOverheadGas, destGasPerDataAvailabilityByte, destDataAvailabilityMultiplierBps int64, err error) {
if c.onRampReader == nil {
return 0, 0, 0, errors.New("no OnRampReader has been configured")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you share some reasoning behind this decision? IIUC this will return 0s to daOverheadGas, gasPerDAByte, daMultiplier. Does the calling function know how to handle that case? What would happen to estimateDACostUSD when 0s are returned?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mateusz-sekara Calling this function will multiply gasPrice with 0 and return 0 DAGasPrice
https://github.com/smartcontractkit/ccip/blob/ccip-develop/core/services/ocr2/plugins/ccip/prices/da_price_estimator.go#L182

Then just added 0 gas price to the estimatedExecCost
https://github.com/smartcontractkit/ccip/blob/ccip-develop/core/services/ocr2/plugins/ccip/prices/da_price_estimator.go#L154

This is worked in the same way before this feature been implemented

Copy link
Contributor

@mateusz-sekara mateusz-sekara Oct 4, 2024

Choose a reason for hiding this comment

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

Okay, I would consider some warning log in this if if that's something that should not happen

@valerii-kabisov-cll valerii-kabisov-cll merged commit 29f7edf into ccip-develop Oct 4, 2024
117 checks passed
@valerii-kabisov-cll valerii-kabisov-cll deleted the hotfix/DAGasPriceInit branch October 4, 2024 13:58
valerii-kabisov-cll added a commit that referenced this pull request Oct 4, 2024
## Motivation
For the exec provider, in some cases, the onRamp reader is not
initialized. For immediate reaction, we need to allow execution without
blocking in cases if onRamp is not initialized. It fails due the issue
when onRampReader is not initialized for execProvider. This fix should
fix this issue. In case the onRamp reader is not initialized, the module
will return 0 values and DAGasEstimator will behave as it worked before
this feature been implemented.
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.

3 participants