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

feat: full std.Address validation #1799

Merged
merged 6 commits into from
Mar 28, 2024

Conversation

r3v4s
Copy link
Contributor

@r3v4s r3v4s commented Mar 20, 2024

Length of std.Address was only condition to check whether address is valid or not.
Fixing it by checking whether address can be decoded

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.

@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Mar 20, 2024
@r3v4s r3v4s force-pushed the fix/std.Address-validation branch from 1a3a235 to db58dad Compare March 20, 2024 02:59
Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.48%. Comparing base (5c5d9ef) to head (5e8e935).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1799      +/-   ##
==========================================
- Coverage   47.49%   47.48%   -0.01%     
==========================================
  Files         388      388              
  Lines       61311    61329      +18     
==========================================
+ Hits        29117    29124       +7     
- Misses      29756    29767      +11     
  Partials     2438     2438              

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

@leohhhn
Copy link
Contributor

leohhhn commented Mar 20, 2024

Hey @r3v4s, thanks for the contribution. We initially thought about doing this, but then went with a simple length check because it would cover most human errors (ie inputting nothing for an address, or accidentally deleting a letter). I'll leave the reference for the PR/issue that introduced the initial address validation: #1298 (comment). We had an issue as the comment states, but now since #859 has been merged, your PR can work.

cc @thehowl

Please see why the CI is failing 🙏

@r3v4s
Copy link
Contributor Author

r3v4s commented Mar 20, 2024

Hey @r3v4s, thanks for the contribution. We initially thought about doing this, but then went with a simple length check because it would cover most human errors (ie inputting nothing for an address, or accidentally deleting a letter). I'll leave the reference for the PR/issue that introduced the initial address validation: #1298 (comment). We had an issue as the comment states, but now since #859 has been merged, your PR can work.

cc @thehowl

Please see why the CI is failing 🙏

Hello @leohhhn, if my memory serves me right, this issue was covered in Miami and I forgot to tag #1298

As you said, checking length does cover most human errors. However chain returns different result when used address has length of 40, but invalid character

g1ubwj0apf60hd90txhnh855fkac34rxlsvua0aa

  1. sending (native)ugnot using gnokey maketx send returns Error: Data: invalid character not part of charset
  2. sending (realm)grc20 token using gnokey maketx call -pkgpath {GRC20_PATH} -func Transfer -args {WRONG_FORMAT_ADDR} -args {SEND_AMOUNT} returns non error

I think second transaction should fail too.

P.S I'll fix cause of CI Failing

@r3v4s r3v4s requested review from a team as code owners March 21, 2024 02:34
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Mar 21, 2024
@r3v4s
Copy link
Contributor Author

r3v4s commented Mar 21, 2024

@leohhhn Fixed test case causing CI to fail. Not sure If I have to assign you as reviewer or not.

CI is still failing due to test case running too long

Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

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

you make a sound argument for addition. implementation looks good, testing can be improved. thanks!

gnovm/stdlibs/std/crypto.gno Show resolved Hide resolved
gno.land/cmd/gnoland/testdata/pr-1799.txtar Outdated Show resolved Hide resolved
examples/gno.land/r/demo/foo20/foo20_test.gno Show resolved Hide resolved
@r3v4s r3v4s requested a review from thehowl March 22, 2024 01:59
@r3v4s r3v4s force-pushed the fix/std.Address-validation branch from 9fa5ff9 to 5e8e935 Compare March 22, 2024 02:01
@thehowl thehowl changed the title fix: std.Address validation feat: full std.Address validation Mar 28, 2024
@thehowl thehowl merged commit cb52ae7 into gnolang:master Mar 28, 2024
257 of 265 checks passed
@r3v4s r3v4s deleted the fix/std.Address-validation branch April 3, 2024 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants