-
Notifications
You must be signed in to change notification settings - Fork 4
[NONEVM-3359] [L11] tokenPrices getter contradicts its comment and may revert on missing tokens #481
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR fixes a bug in the tokenPrices getter function where it could revert when encountering missing tokens, contradicting its own documentation that states it should skip missing items.
Key changes:
- Added a conditional check to verify token existence before loading its value
- Moved the comment to appear before the conditional check for better readability
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val entry = st.usdPerToken.get(token); | ||
| list.push(entry.loadValue().toCell()); | ||
| // NOTE: Need to skip missing items as nil entries rather than fail the query | ||
| if (entry.isFound) { |
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 is incorrect: we need to still store a null for those missing entries. Otherwise you'll get back a tuple of a different size than what you passed as the input and won't be able to correctly associate the prices
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.
You are right! Last commit should do it. I've added a quick test just to confirm
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.
One more thing: does this need any matching changes in the go bindings? I'm not sure if we handle nulls correctly there.
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 don't have a binding for this getter
fa9bd2a to
5047dec
Compare
NONEVM-3359