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

fix(gnovm): fix max names in block check #2645

Merged
merged 4 commits into from
Jul 31, 2024

Conversation

deelawn
Copy link
Contributor

@deelawn deelawn commented Jul 31, 2024

I noticed this while reviewing #2429. The previous conditional could never evaluate to true: if (1<<16 - 1) < sb.NumNames {. sb.NumNames is a uint16 and the value it is being compared to, 1<<16 - 1 is the max uint16 value, so it is impossible the the number of names to be greater than this value. Instead, we should check to see if the current number of names is the maximum value and panic if this is the case.

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@deelawn deelawn self-assigned this Jul 31, 2024
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jul 31, 2024
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.15%. Comparing base (5f28803) to head (1db651f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2645   +/-   ##
=======================================
  Coverage   60.14%   60.15%           
=======================================
  Files         560      560           
  Lines       74738    74738           
=======================================
+ Hits        44950    44957    +7     
+ Misses      26400    26394    -6     
+ Partials     3388     3387    -1     
Flag Coverage Δ
contribs/gnodev 60.58% <ø> (ø)
contribs/gnofaucet 14.46% <ø> (ø)
gno.land 64.15% <ø> (ø)
gnovm 64.29% <100.00%> (+<0.01%) ⬆️
misc/genstd 80.54% <ø> (ø)
misc/logos 20.23% <ø> (+0.35%) ⬆️
tm2 62.04% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@piux2 piux2 left a comment

Choose a reason for hiding this comment

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

LGTM

@thehowl
Copy link
Member

thehowl commented Jul 31, 2024

good catch, I'll be pedantic but do you think you can add a test that checks for this panic happening when we add the 65536'th name in a block?

could be a unit test, or a code-generated filetest.

@deelawn
Copy link
Contributor Author

deelawn commented Jul 31, 2024

good catch, I'll be pedantic but do you think you can add a test that checks for this panic happening when we add the 65536'th name in a block?

could be a unit test, or a code-generated filetest.

Sure, I've added a test for this.

@deelawn deelawn merged commit 14b9015 into gnolang:master Jul 31, 2024
114 of 115 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants