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

Remove error on missing value in destTokenPricesUSD #692

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

RensR
Copy link
Collaborator

@RensR RensR commented Apr 8, 2024

Motivation

Self serve will not offer a full mapping of source to dest tokens. This PR enables optimistic aggregate rate limiting, meaning it will only calculate the rate limit value for tokens which are mapped. For all lanes before 1.5, this means no change. For the 1.5+ lanes it means no token will be included. This will be fixed in a future PR, before 1.5 will ever be deployed.

@RensR RensR requested a review from a team as a code owner April 8, 2024 12:13
Copy link
Contributor

github-actions bot commented Apr 8, 2024

I see you updated files related to core. Please run pnpm changeset to add a changeset.

@@ -256,18 +269,13 @@ func (r *ExecutionReportingPlugin) buildBatch(
ctx context.Context,
lggr logger.Logger,
report commitReportWithSendRequests,
inflight []InflightInternalExecutionReport,
inflightAggregateValue *big.Int,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only used once, extracted the calculation to the function above to keep this cleaner and easier to test

@@ -527,7 +535,8 @@ func aggregateTokenValue(destTokenPricesUSD map[cciptypes.Address]*big.Int, sour
for i := 0; i < len(tokensAndAmount); i++ {
price, ok := destTokenPricesUSD[sourceToDest[tokensAndAmount[i].Token]]
if !ok {
return nil, errors.Errorf("do not have price for source token %v", tokensAndAmount[i].Token)
// If we don't have a price for the token, we will assume it's worth 0.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Main change of this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log these 0 token prices for the debug purpose?

@@ -775,25 +784,6 @@ func (r *ExecutionReportingPlugin) Close() error {
return nil
}

func inflightAggregates(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since the removal of most of the logic of this func in the previous PR, we can inline this function

Copy link
Contributor

Choose a reason for hiding this comment

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

I would keep it extracted as it was. It's easier for me to read through the code when this behaviour is extracted than inlined

@@ -254,10 +254,6 @@ func (o *OffRamp) CurrentRateLimiterState(ctx context.Context) (cciptypes.TokenB
}, nil
}

func (o *OffRamp) GetDestinationToken(ctx context.Context, address common.Address) (common.Address, error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused function

@RensR RensR merged commit 580d53c into ccip-develop Apr 8, 2024
74 of 77 checks passed
@RensR RensR deleted the streamline-ocr branch April 8, 2024 13:28
asoliman92 pushed a commit that referenced this pull request Jul 31, 2024
## Motivation
Self serve will not offer a full mapping of source to dest tokens. This
PR enables optimistic aggregate rate limiting, meaning it will only
calculate the rate limit value for tokens which are mapped. For all
lanes before 1.5, this means no change. For the 1.5+ lanes it means no
token will be included. This will be fixed in a future PR, before 1.5
will ever be deployed.
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.

2 participants