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: initial r/gh realm #1134

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

moul
Copy link
Member

@moul moul commented Sep 16, 2023

This PR initiates the new r/github realm, overseen by an oracle to transition offchain information onchain.

While this is foundational and will be augmented with new features, I welcome feedback on the codebase. Reviewers, please advise if we should merge as is and refine later, or if it would be preferable to transition this to a draft PR for continued development.

Addresses #1133

Related with gnolang/game-of-realms#3

cc @gnolang/devrels @gnolang/tokenomics

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.

@moul moul self-assigned this Sep 16, 2023
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Sep 16, 2023
@moul moul changed the title dev/moul/gh oracle GitHub oracle foundations Sep 16, 2023
@moul moul changed the title GitHub oracle foundations feat: r/github foundations Sep 16, 2023
@moul moul changed the title feat: r/github foundations feat: initial r/gh realm Sep 16, 2023
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul moul marked this pull request as ready for review September 16, 2023 20:27
@moul moul requested a review from a team as a code owner September 16, 2023 20:27
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul moul added this to the 🌟 main.gno.land (wanted) milestone Sep 16, 2023
@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (61f3ada) 47.08% compared to head (517a002) 47.08%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1134   +/-   ##
=======================================
  Coverage   47.08%   47.08%           
=======================================
  Files         365      365           
  Lines       61156    61156           
=======================================
  Hits        28793    28793           
  Misses      30011    30011           
  Partials     2352     2352           
Flag Coverage Δ
gnovm-_test.cmd 45.89% <ø> (ø)
gnovm-_test.gnolang.native 63.09% <ø> (ø)
gnovm-_test.gnolang.other 16.63% <ø> (ø)
gnovm-_test.gnolang.pkg0 17.98% <ø> (ø)
gnovm-_test.gnolang.pkg1 8.21% <ø> (ø)
gnovm-_test.gnolang.pkg2 9.87% <ø> (ø)
gnovm-_test.gnolang.realm 41.68% <ø> (ø)
gnovm-_test.gnolang.stdlibs 53.53% <ø> (ø)
gnovm-_test.pkg 25.96% <ø> (ø)

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.

@@ -0,0 +1 @@
module gno.land/r/gh
Copy link
Contributor

Choose a reason for hiding this comment

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

missing require?

Suggested change
module gno.land/r/gh
module gno.land/r/gh
require "gno.land/p/demo/avl" v0.0.0-latest

Copy link
Contributor

Choose a reason for hiding this comment

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

gno lint should complain?

anyways gno mod tidy implementation is complete. CI will start complaining about this soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

@harry-hov: We need a solution to eliminate those comments. The gno mod process should be fully automated, from creation to clarity in CI feedback. Please ensure it's streamlined so you don't have to review this aspect in future PRs. Otherwise, we might just bypass the need for gno.mod and switch to automatic detection.

@MichaelFrazzy
Copy link

MichaelFrazzy commented Oct 1, 2023

I really love this idea, it'll also give a home to some of the Python scripts that are being messed around with. I always figured everything would eventually need to be ported over to Gno, in Python we have GitHub CI calculating different averages and other additional metrics/statistics if that'd be helpful to try to bring over into this instead. Or after a certain point should pulling a wider range of stats like that be its own system? Maybe it'd be overkill to provide too many categories by default via an oracle?

I also still agree that initially just creating a database itself based on both GitHub and blockchain metrics will be ideal, with point rewards staying largely manual. Could lead to a bunch of cool systems down the road and something like this would make facilitating and experimenting with all of that way easier. If nothing else it'll lead to some cool data study ideas! Maybe one day leading to further automations as enough training data is built up, and a great building block well before that.

What are your thoughts in terms of how the metrics themselves/database should be stored or output for use elsewhere? Maybe even a Chainstack-style RPC that can return the data in a bunch of different formats?

Copy link

@MichaelFrazzy MichaelFrazzy left a comment

Choose a reason for hiding this comment

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

Just to make sure I'm reading it correctly, we'd be creating our own oracle from scratch and assigning it to an address within this code? Seems like it'd give us some really cool possibilities even beyond what I was initially thinking.

Comment on lines +5 to +10
// Account represents a GitHub user account or organization.
type Account struct {
id string
name string
kind string
}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm. What about having types User, Organization, and type Handle interface { Name() string; URL() string; assertHandle() }? Or Namespace


/*
// IssueOrPR represents a GitHub issue or pull request
type IssueOrPR struct {
Copy link
Member

Choose a reason for hiding this comment

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

For this, I think we should have type Issue and type PR, which embeds Issue, Issue implements type Referencer interface { Reference() string }, returns "#1134"

(feel free to ignore, I think the comment makes it clear that you want to tackle this in another PR)


// Account represents a GitHub user account or organization.
type Account struct {
id string
Copy link
Member

Choose a reason for hiding this comment

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

handle?

}

func (a Account) String() string {
// XXX: better idea?
Copy link
Member

Choose a reason for hiding this comment

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

either @handle or markdown representation?


func OracleLastUpdated() time.Time { return lastUpdateTime }

func OracleUpsertAccount(id, name, kind string) {
Copy link
Member

Choose a reason for hiding this comment

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

Upsert feels sql-y, when under the hood we just have a k-v. Can we not do Set?

id string
owner *Account
name string
isPrivate bool
Copy link
Member

Choose a reason for hiding this comment

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

if it's private, the oracle probably shouldn't know about it, right?

Comment on lines +60 to +65
parts := strings.Split(id, "/")
if len(parts) != 2 {
panic("invalid id")
}
ownerID := parts[0]
name := parts[1]
Copy link
Member

Choose a reason for hiding this comment

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

add util func, de-duplicate from above?

accounts.Set(id, account)
}

func OracleUpsertRepo(id string, isPrivate, isFork bool) {
Copy link
Member

Choose a reason for hiding this comment

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

s/id/path/

Comment on lines +12 to +14
accounts avl.Tree // uri -> Account
repos avl.Tree // uri -> Repo
issueOrPRs avl.Tree // uri -> IssueOrPR
Copy link
Member

Choose a reason for hiding this comment

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

they're not uris

@MichaelFrazzy
Copy link

@waymobetta

@moul
Copy link
Member Author

moul commented Oct 20, 2023

Related with #1265

moul added a commit that referenced this pull request Oct 26, 2023
## Current Status

```console
$ cd ./misc/list-gnophers
$ ./main.sh
```

```csv
1617467419,53785+jaekwon@users.noreply.github.com,./examples/gno.land/p/demo/flow/flow.gno
1651096034,94029+moul@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc721/igrc721.gno
1673524438,hariom.verma@tendermint.com,./examples/gno.land/p/demo/grc/grc721/basic_nft.gno
1677669053,100383075+Jammyaa@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc1155/basic_grc1155_token.gno
1678259597,350354+grepsuzette@users.noreply.github.com,./examples/gno.land/r/demo/deep/very/deep/render.gno
1678709422,pushkarshetye803@gmail.com,./examples/gno.land/r/demo/groups/group.gno
1684921090,contact@albttx.tech,./examples/gno.land/p/demo/merkle/merkle.gno
1687179019,nir1218@users.noreply.github.com,./examples/gno.land/r/x/nir1218_evaluation_proposal/category.gno
1687263124,zack.scholl@gmail.com,./examples/gno.land/p/demo/microblog/microblog.gno
```

## Future Plans

- Translate into GitHub usernames.
- Share the gnopher list on `r/gh` (#1134).
- Create a new `r/gnoland/gnophers` page with the following features:
  - Add a widget on `r/gnoland/home` displaying the "latest gnophers."
- Create a helper function like
`r/gnoland/gnophers.NumberByAddr("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq`)
-> `(2 int)` to use this info on other meta profiles, such as the future
"gnolinkedin" mixing facts and personal presentation
(gnolang/game-of-realms#5).
- Create a `r/gnoland/gnophers:username` route that returns a badge with
the username, gnopher number, "gnopher since <date>," and a `gnoface`
(#690).
- Stop checking and order t-shirts for the first 100 official gnophers.

### Example Gnopher Badges

```markdown
# @jaekwon proudly became the 1st gnopher on Oct 3, 2021.
  |||||||                                                                                                                                                                                                                                                                                                 
 ////////\                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 | ~   . |                                                                                                                                                                                                                                                                                                
)| X   X |.                                                                                                                                                                                                                                                                                               
 |       |                                                                                                                                                                                                                                                                                                
 |   C   |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 |  __/  |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 \~~~~~~~/
Gnopher#1
```

```markdown
# @moul proudly became the 2nd gnopher on May 24, 2022.
  |||||||                                                                                                                                                                                                                                                                                                 
 ////////\                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 | ~   . |                                                                                                                                                                                                                                                                                                
)| X   X |.                                                                                                                                                                                                                                                                                               
 |       |                                                                                                                                                                                                                                                                                                
 |   C   |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 |  __/  |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 \~~~~~~~/
Gnopher#2
```

cc @gnolang/devrels

Signed-off-by: moul <94029+moul@users.noreply.github.com>
irreverentsimplicity pushed a commit to irreverentsimplicity/gno that referenced this pull request Oct 27, 2023
```console
$ cd ./misc/list-gnophers
$ ./main.sh
```

```csv
1617467419,53785+jaekwon@users.noreply.github.com,./examples/gno.land/p/demo/flow/flow.gno
1651096034,94029+moul@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc721/igrc721.gno
1673524438,hariom.verma@tendermint.com,./examples/gno.land/p/demo/grc/grc721/basic_nft.gno
1677669053,100383075+Jammyaa@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc1155/basic_grc1155_token.gno
1678259597,350354+grepsuzette@users.noreply.github.com,./examples/gno.land/r/demo/deep/very/deep/render.gno
1678709422,pushkarshetye803@gmail.com,./examples/gno.land/r/demo/groups/group.gno
1684921090,contact@albttx.tech,./examples/gno.land/p/demo/merkle/merkle.gno
1687179019,nir1218@users.noreply.github.com,./examples/gno.land/r/x/nir1218_evaluation_proposal/category.gno
1687263124,zack.scholl@gmail.com,./examples/gno.land/p/demo/microblog/microblog.gno
```

- Translate into GitHub usernames.
- Share the gnopher list on `r/gh` (gnolang#1134).
- Create a new `r/gnoland/gnophers` page with the following features:
  - Add a widget on `r/gnoland/home` displaying the "latest gnophers."
- Create a helper function like
`r/gnoland/gnophers.NumberByAddr("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq`)
-> `(2 int)` to use this info on other meta profiles, such as the future
"gnolinkedin" mixing facts and personal presentation
(gnolang/game-of-realms#5).
- Create a `r/gnoland/gnophers:username` route that returns a badge with
the username, gnopher number, "gnopher since <date>," and a `gnoface`
(gnolang#690).
- Stop checking and order t-shirts for the first 100 official gnophers.

```markdown
  |||||||
 ////////\
 |       |
 | ~   . |
)| X   X |.
 |       |
 |   C   |
 |       |
 |  __/  |
 |       |
 \~~~~~~~/
Gnopher#1
```

```markdown
  |||||||
 ////////\
 |       |
 | ~   . |
)| X   X |.
 |       |
 |   C   |
 |       |
 |  __/  |
 |       |
 \~~~~~~~/
Gnopher#2
```

cc @gnolang/devrels

Signed-off-by: moul <94029+moul@users.noreply.github.com>

SetTokenURI wip
irreverentsimplicity pushed a commit to irreverentsimplicity/gno that referenced this pull request Oct 27, 2023
```console
$ cd ./misc/list-gnophers
$ ./main.sh
```

```csv
1617467419,53785+jaekwon@users.noreply.github.com,./examples/gno.land/p/demo/flow/flow.gno
1651096034,94029+moul@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc721/igrc721.gno
1673524438,hariom.verma@tendermint.com,./examples/gno.land/p/demo/grc/grc721/basic_nft.gno
1677669053,100383075+Jammyaa@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc1155/basic_grc1155_token.gno
1678259597,350354+grepsuzette@users.noreply.github.com,./examples/gno.land/r/demo/deep/very/deep/render.gno
1678709422,pushkarshetye803@gmail.com,./examples/gno.land/r/demo/groups/group.gno
1684921090,contact@albttx.tech,./examples/gno.land/p/demo/merkle/merkle.gno
1687179019,nir1218@users.noreply.github.com,./examples/gno.land/r/x/nir1218_evaluation_proposal/category.gno
1687263124,zack.scholl@gmail.com,./examples/gno.land/p/demo/microblog/microblog.gno
```

- Translate into GitHub usernames.
- Share the gnopher list on `r/gh` (gnolang#1134).
- Create a new `r/gnoland/gnophers` page with the following features:
  - Add a widget on `r/gnoland/home` displaying the "latest gnophers."
- Create a helper function like
`r/gnoland/gnophers.NumberByAddr("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq`)
-> `(2 int)` to use this info on other meta profiles, such as the future
"gnolinkedin" mixing facts and personal presentation
(gnolang/game-of-realms#5).
- Create a `r/gnoland/gnophers:username` route that returns a badge with
the username, gnopher number, "gnopher since <date>," and a `gnoface`
(gnolang#690).
- Stop checking and order t-shirts for the first 100 official gnophers.

```markdown
  |||||||
 ////////\
 |       |
 | ~   . |
)| X   X |.
 |       |
 |   C   |
 |       |
 |  __/  |
 |       |
 \~~~~~~~/
Gnopher#1
```

```markdown
  |||||||
 ////////\
 |       |
 | ~   . |
)| X   X |.
 |       |
 |   C   |
 |       |
 |  __/  |
 |       |
 \~~~~~~~/
Gnopher#2
```

cc @gnolang/devrels

Signed-off-by: moul <94029+moul@users.noreply.github.com>

SetTokenURI wip
gfanton pushed a commit to gfanton/gno that referenced this pull request Nov 9, 2023
## Current Status

```console
$ cd ./misc/list-gnophers
$ ./main.sh
```

```csv
1617467419,53785+jaekwon@users.noreply.github.com,./examples/gno.land/p/demo/flow/flow.gno
1651096034,94029+moul@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc721/igrc721.gno
1673524438,hariom.verma@tendermint.com,./examples/gno.land/p/demo/grc/grc721/basic_nft.gno
1677669053,100383075+Jammyaa@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc1155/basic_grc1155_token.gno
1678259597,350354+grepsuzette@users.noreply.github.com,./examples/gno.land/r/demo/deep/very/deep/render.gno
1678709422,pushkarshetye803@gmail.com,./examples/gno.land/r/demo/groups/group.gno
1684921090,contact@albttx.tech,./examples/gno.land/p/demo/merkle/merkle.gno
1687179019,nir1218@users.noreply.github.com,./examples/gno.land/r/x/nir1218_evaluation_proposal/category.gno
1687263124,zack.scholl@gmail.com,./examples/gno.land/p/demo/microblog/microblog.gno
```

## Future Plans

- Translate into GitHub usernames.
- Share the gnopher list on `r/gh` (gnolang#1134).
- Create a new `r/gnoland/gnophers` page with the following features:
  - Add a widget on `r/gnoland/home` displaying the "latest gnophers."
- Create a helper function like
`r/gnoland/gnophers.NumberByAddr("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq`)
-> `(2 int)` to use this info on other meta profiles, such as the future
"gnolinkedin" mixing facts and personal presentation
(gnolang/game-of-realms#5).
- Create a `r/gnoland/gnophers:username` route that returns a badge with
the username, gnopher number, "gnopher since <date>," and a `gnoface`
(gnolang#690).
- Stop checking and order t-shirts for the first 100 official gnophers.

### Example Gnopher Badges

```markdown
# @jaekwon proudly became the 1st gnopher on Oct 3, 2021.
  |||||||                                                                                                                                                                                                                                                                                                 
 ////////\                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 | ~   . |                                                                                                                                                                                                                                                                                                
)| X   X |.                                                                                                                                                                                                                                                                                               
 |       |                                                                                                                                                                                                                                                                                                
 |   C   |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 |  __/  |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 \~~~~~~~/
Gnopher#1
```

```markdown
# @moul proudly became the 2nd gnopher on May 24, 2022.
  |||||||                                                                                                                                                                                                                                                                                                 
 ////////\                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 | ~   . |                                                                                                                                                                                                                                                                                                
)| X   X |.                                                                                                                                                                                                                                                                                               
 |       |                                                                                                                                                                                                                                                                                                
 |   C   |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 |  __/  |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 \~~~~~~~/
Gnopher#2
```

cc @gnolang/devrels

Signed-off-by: moul <94029+moul@users.noreply.github.com>
moul added a commit to moul/gno that referenced this pull request Nov 14, 2023
## Current Status

```console
$ cd ./misc/list-gnophers
$ ./main.sh
```

```csv
1617467419,53785+jaekwon@users.noreply.github.com,./examples/gno.land/p/demo/flow/flow.gno
1651096034,94029+moul@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc721/igrc721.gno
1673524438,hariom.verma@tendermint.com,./examples/gno.land/p/demo/grc/grc721/basic_nft.gno
1677669053,100383075+Jammyaa@users.noreply.github.com,./examples/gno.land/p/demo/grc/grc1155/basic_grc1155_token.gno
1678259597,350354+grepsuzette@users.noreply.github.com,./examples/gno.land/r/demo/deep/very/deep/render.gno
1678709422,pushkarshetye803@gmail.com,./examples/gno.land/r/demo/groups/group.gno
1684921090,contact@albttx.tech,./examples/gno.land/p/demo/merkle/merkle.gno
1687179019,nir1218@users.noreply.github.com,./examples/gno.land/r/x/nir1218_evaluation_proposal/category.gno
1687263124,zack.scholl@gmail.com,./examples/gno.land/p/demo/microblog/microblog.gno
```

## Future Plans

- Translate into GitHub usernames.
- Share the gnopher list on `r/gh` (gnolang#1134).
- Create a new `r/gnoland/gnophers` page with the following features:
  - Add a widget on `r/gnoland/home` displaying the "latest gnophers."
- Create a helper function like
`r/gnoland/gnophers.NumberByAddr("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq`)
-> `(2 int)` to use this info on other meta profiles, such as the future
"gnolinkedin" mixing facts and personal presentation
(gnolang/game-of-realms#5).
- Create a `r/gnoland/gnophers:username` route that returns a badge with
the username, gnopher number, "gnopher since <date>," and a `gnoface`
(gnolang#690).
- Stop checking and order t-shirts for the first 100 official gnophers.

### Example Gnopher Badges

```markdown
# @jaekwon proudly became the 1st gnopher on Oct 3, 2021.
  |||||||                                                                                                                                                                                                                                                                                                 
 ////////\                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 | ~   . |                                                                                                                                                                                                                                                                                                
)| X   X |.                                                                                                                                                                                                                                                                                               
 |       |                                                                                                                                                                                                                                                                                                
 |   C   |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 |  __/  |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 \~~~~~~~/
Gnopher#1
```

```markdown
# @moul proudly became the 2nd gnopher on May 24, 2022.
  |||||||                                                                                                                                                                                                                                                                                                 
 ////////\                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 | ~   . |                                                                                                                                                                                                                                                                                                
)| X   X |.                                                                                                                                                                                                                                                                                               
 |       |                                                                                                                                                                                                                                                                                                
 |   C   |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 |  __/  |                                                                                                                                                                                                                                                                                                
 |       |                                                                                                                                                                                                                                                                                                
 \~~~~~~~/
Gnopher#2
```

cc @gnolang/devrels

Signed-off-by: moul <94029+moul@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: No status
Status: 🙏🏻 To Delegate
Status: 🌟 Wanted for Launch
Status: Backlog
Status: No status
Status: In Review
Development

Successfully merging this pull request may close these issues.

5 participants