-
Notifications
You must be signed in to change notification settings - Fork 56
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
Conversation
I see you updated files related to core. Please run |
@@ -256,18 +269,13 @@ func (r *ExecutionReportingPlugin) buildBatch( | |||
ctx context.Context, | |||
lggr logger.Logger, | |||
report commitReportWithSendRequests, | |||
inflight []InflightInternalExecutionReport, | |||
inflightAggregateValue *big.Int, |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused function
## 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.
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.