-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow for querying a specific contract's owner #312
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ureeves
added
team:Core
Low Level Core Development Team (Rust)
type:enhancement
Issues concerning code or feature improvement (performance, refactoring, etc)
type:feature
implementing a new feature
labels
Jan 12, 2024
ureeves
requested review from
miloszm,
fed-franz,
HDauven,
moCello,
herr-seppia and
Neotamandua
January 12, 2024 14:52
The `owner` extern is modified to allow for querying the host for a given contract's owner. Along the same lines the public `owner` function is changed to accomodate this and a new `self_owner` function is added to handle the case of querying for the calling contract's owner. Co-authored-by: Milosz Muszynski <[email protected]>
The `read_owner` function is modified to use `uplink::self_owner` instead of `uplink::owner` and a new function - `read_owner_of` - is added to allow callers to query for a given contract's owner. Co-authored-by: Milosz Muszynski <[email protected]>
ureeves
force-pushed
the
specific-contract-owner
branch
from
January 12, 2024 14:56
e53b291
to
ae60e88
Compare
fed-franz
approved these changes
Jan 12, 2024
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.
LGTM
pointed a typo (I think)
moCello
approved these changes
Jan 12, 2024
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.
LGTM
miloszm
approved these changes
Jan 12, 2024
The `owner` import is changed to accept a pointer to a contract ID. If the pointer is null, it assumed that the calling contract is querying for its owner, whereas if the pointer is not null, a contract ID is presumed to exist at that address, and read from its memory. The relevant owner is then emplaced in the contract's argument buffer, if it exists, and 1 is returned. If the contract whose owner is asked for does not exist, 0 is returned instead. Co-authored-by: Milosz Muszynski <[email protected]>
ureeves
force-pushed
the
specific-contract-owner
branch
from
January 15, 2024 11:06
ae60e88
to
6f55455
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
team:Core
Low Level Core Development Team (Rust)
type:enhancement
Issues concerning code or feature improvement (performance, refactoring, etc)
type:feature
implementing a new feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently it is only possible for contract's to query for their own owners. This PR makes it possible for contract's to query for any other contract's owner as well.
This is achieved by modifying the
owner
import to accept a pointer to a contract ID in the calling contract's memory. If the passed pointer is non-null, the host reads the contract ID from the contract's memory, otherwise it is assumed to be the calling contract's.If the contract queried for exists, its owner is emplaced in the calling contract's argument buffer, and 1 is returned, otherwise 0 is returned.