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: deprecate std.GetOrigCaller #2906

Closed
wants to merge 2 commits into from

Conversation

n0izn0iz
Copy link
Contributor

@n0izn0iz n0izn0iz commented Oct 4, 2024

Screenshot 2024-10-04 at 18 44 53
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.

Signed-off-by: Norman Meier <norman@samourai.coop>
@n0izn0iz n0izn0iz requested a review from thehowl as a code owner October 4, 2024 16:40
@n0izn0iz n0izn0iz changed the title chore: deprecate std.GetOrigCaller fix: deprecate std.GetOrigCaller Oct 4, 2024
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Oct 4, 2024
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.96%. Comparing base (8a62a28) to head (9cf6e30).
Report is 91 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2906   +/-   ##
=======================================
  Coverage   60.95%   60.96%           
=======================================
  Files         564      564           
  Lines       75273    75273           
=======================================
+ Hits        45884    45889    +5     
+ Misses      26019    26012    -7     
- Partials     3370     3372    +2     
Flag Coverage Δ
contribs/gnodev 61.46% <ø> (ø)
contribs/gnofaucet 14.46% <ø> (ø)
gno.land 67.92% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 19.88% <ø> (ø)
tm2 62.09% <ø> (+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.

Signed-off-by: Norman Meier <norman@samourai.coop>
@n0izn0iz
Copy link
Contributor Author

n0izn0iz commented Oct 4, 2024

from @leohhhn

Might sound weird coming from me, but we should possibly keep it. i've found a few occasions where i found it useful.
We should have PrevRealm or its equivalent as the primary, non-limiting choice, while keeping OriginCaller as a specific functionality, discouraging it unless the user really knows what they're doing.
checkout RegisterCode(): https://gno.land/r/gc24/raffle/raffle.gno

What is the advantage or GetOrigCaller vs taking the address as input?

@thehowl
Copy link
Member

thehowl commented Oct 4, 2024

For stdlibs, we'll err on the side of caution and add things after launch if necessary. So, relating to Leon's point, I'd remove it then add it back if necessary.

@leohhhn
Copy link
Contributor

leohhhn commented Oct 4, 2024

@n0izn0iz

What is the advantage or GetOrigCaller vs taking the address as input?

The difference is that the developer can enforce this rule. If the address was an input, the user could put in any random address.

In my specific example, I needed the realm calling my realm to be deployed by the same user that did some other action. This specific case I've seen a couple of times.

@n0izn0iz
Copy link
Contributor Author

n0izn0iz commented Oct 4, 2024

@leohhhn wdyt about getting the user address by inspecting the PrevRealm() pkg path and calling users.Resolve if it's a namespace?

Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

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

Blocking to prevent merging until the necessary discussions have taken place.

@thehowl
Copy link
Member

thehowl commented Nov 14, 2024

We'll actually be keeping GetOriginCaller for now: #1475 (comment)

Thanks!

@thehowl thehowl closed this Nov 14, 2024
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.

4 participants