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

docs: improve Realm, PrevRealm and CurrentRealm docs #2592

Closed
wants to merge 1 commit into from

Conversation

thehowl
Copy link
Member

@thehowl thehowl commented Jul 15, 2024

Following some confusion for onbloc.

@thehowl thehowl requested a review from moul as a code owner July 15, 2024 19:33
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jul 15, 2024
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@leohhhn
Copy link
Contributor

leohhhn commented Jul 15, 2024

Related: #1469

My PR above has been sitting for a long time, maybe someone else should take a look and we can merge it. @zivkovicmilos hasn't gotten around to it.

@thehowl
Copy link
Member Author

thehowl commented Jul 17, 2024

I'll take a look @leohhhn

Copy link
Contributor

@deelawn deelawn left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. A few things should be addressed before merging and there is a question about the wording in the PrevRealm section.

application in your mind with built-in composability,
transparency, and censorship resistance. Here are some ideas of what you can build with realms:
A Realm represents an on-chain entity which has an address, can execute code
and is capable of managing Coins associated with the given address.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
and is capable of managing Coins associated with the given address.
and is capable of managing [Coins](../reference/stdlibs/std/coins.md) associated with the given address.

application while being:

- Composable: using other realms is an `import` statement away.
- Transparent: like all code on Gno.land, they must be added to the chain in
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Transparent: like all code on Gno.land, they must be added to the chain in
- Transparent: like all code on gno.land, they must be added to the chain in

I understand we are now supposed to refer to gno.land in all lowercase from now on.

- Self-custodial financial exchanges (decentralized exchanges), like
[Gnoswap](https://github.com/gnoswap-labs/gnoswap).
- Chess servers, like [GnoChess](https://github.com/gnolang/gnochess), and
generally speaking game servers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
generally speaking game servers.
generally speaking, game servers.

```go
func CurrentRealm() Realm
```
Returns current [Realm](realm.md) object.
CurrentRealm returns the [Realm](md) in which the caller is being executed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
CurrentRealm returns the [Realm](md) in which the caller is being executed.
CurrentRealm returns the [Realm](realm.md) in which the caller is being executed.


PrevRealm returns the [Realm](realm.md) which called the code being executed.
The value of PrevRealm remains the same if called by a function within the
same realm, or a function in a pure package. It will change if called by a
Copy link
Contributor

Choose a reason for hiding this comment

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

It will change if called by a realm with a different pkgpath.

Was this copied from the PrevRealm section? Because it doesn't change when called by realm1 which has a different pkgpath than the main package.

func CurrentRealm() Realm {
addr, path := getRealm(0)
return Realm{Address(addr), path}
}

// PrevRealm returns the [Realm] which called the code being executed.
// The value of PrevRealm remains the same if called by a function within the
// same realm, or a function in a pure package. It will change if called by a
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as in the doc

Copy link

github-actions bot commented Nov 7, 2024

This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months.

@github-actions github-actions bot added Stale and removed Stale labels Nov 7, 2024
Copy link

github-actions bot commented Feb 7, 2025

This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months.

@github-actions github-actions bot added the Stale label Feb 7, 2025
@thehowl
Copy link
Member Author

thehowl commented Feb 7, 2025

stale and updated in docs-v2

@thehowl thehowl closed this Feb 7, 2025
@thehowl thehowl deleted the dev/morgan/docs-prevrealm branch February 10, 2025 18:05
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 Stale
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants