-
Notifications
You must be signed in to change notification settings - Fork 4
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
CCIP-4703: Adding check for ChainFeeUpdates field #410
base: main
Are you sure you want to change the base?
Conversation
return fmt.Errorf("nil or non-positive %s", "execution fee price") | ||
} | ||
|
||
if update.ChainFee.DataAvFeePriceUSD == nil || update.ChainFee.DataAvFeePriceUSD.Cmp(zero) < 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.
I believe this DataAvFeePriceUSD might be zero for EVM chain and shouldn't be zero for L2 chains. Is that right? If at all we can know the given chain is L2, then we can add additional check here.
|
for _, token := range obs.NativeTokenPrices { | ||
if token.Int == nil || token.Int.Cmp(zero) <= 0 { | ||
return fmt.Errorf("nil or non-positive %s", "execution fee") | ||
func (p *processor) ValidateObservedChains( |
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.
This function shouldn't be public since it'll only get called from the chainfee processor
if err != nil { | ||
return fmt.Errorf("failed to get supported chains: %w", err) | ||
} | ||
|
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.
We'll need to add extra checks here to make sure that all keys in all maps are exactly the same, otherwise we can end up with same lengths but for different chains on different maps.
|
||
for _, token := range obs.NativeTokenPrices { | ||
if token.Int == nil || token.Int.Cmp(zero) <= 0 { | ||
return fmt.Errorf("nil or non-positive %s", "execution fee") | ||
} | ||
} | ||
|
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.
Add validation for timpestamps making sure they're not zero or more than current utc timestamp.
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.
Please add validation for timestamps and for keys in maps as mentioned in the comments.
Added missing check for ChainFeeUpdates field.
The review comment asks to check for non-positive value on DataAvailableFee field but I believe that can be zero when it is EVM chain so keeping that check for only non-negative values. Only if it is L2 chain, it should be non-positive.