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

Add gobenchdata integration #1

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
54befcb
docs(boards): specify --recover before the argument to match flags wi…
thehowl Apr 4, 2023
4091fb3
ci: fix tm2.yml syntax (#695)
thehowl Apr 4, 2023
fdd0b61
chore(deps): bump github.com/golang/protobuf from 1.5.2 to 1.5.3 (#594)
dependabot[bot] Apr 4, 2023
ae75fea
test: fix CI running on master (#696)
moul Apr 4, 2023
721bfc3
chore(tests): different address on test caller (#662)
albttx Apr 4, 2023
8e64a3e
chore: fix CODEOWNERS (#702)
thehowl Apr 5, 2023
e8e2d02
chore(deployments): fix staging docker configuration (#704)
moul Apr 5, 2023
d144928
chore: remove misc/ directory from gitignore (#705)
thehowl Apr 5, 2023
0eb5ff7
chore: remove `std.TestDerivePkgAddr` (#707)
tbruyelle Apr 6, 2023
5a180a0
feat: use os.UserConfigDir() if possible when $GNO_HOME not set (#719)
grepsuzette Apr 11, 2023
d4e37cc
refactor(tm2/pkg/db): Avoid panicking when creating DBs. (#726)
ajnavarro Apr 11, 2023
5b275ff
feat(test): support `*OriginCall` funcs in `_test` files (#703)
tbruyelle Apr 12, 2023
c9f99f6
fix: Execute tm2 tests on PRs too (#736)
ajnavarro Apr 12, 2023
28efad2
Add gobenchdata integration
ajnavarro Apr 14, 2023
ba837a7
Fix go_bench_test.go
ajnavarro Apr 14, 2023
ca11bb2
Remove slow benchmarks
ajnavarro Apr 14, 2023
ca7cd4b
Fix broken benchmarks.
ajnavarro Apr 14, 2023
8044f48
Avoid executing tests and use latest go version
ajnavarro Apr 14, 2023
69a67b4
Skip failing benchmarks
ajnavarro Apr 14, 2023
e772e70
Change to self-hosted to avoid limitations
ajnavarro Apr 14, 2023
5c63351
Avoid NaN results
ajnavarro Apr 14, 2023
a3d9f0f
Use GITHUB_TOKEN.
ajnavarro Apr 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/


# Primary repo maintainers.
* @gnolang/core-tech
* @gnolang/tech-staff


# Tendermint2 (Gno version).
pkgs/* @gnolang/core-tech
tm2/* @gnolang/tech-staff


# Docs & Content.
docs/ @gnolang/core-tech
*.md @gnolang/core-tech
docs/ @gnolang/tech-staff
*.md @gnolang/tech-staff
# TODO: add non-tech people here.


# Gno examples and default contracts.
examples/* @gnolang/core-tech
examples/* @gnolang/tech-staff
# TODO: add people from the community here.


# Gnoland, Gno.land.
examples/gno.land/system/* @gnolang/core-tech
examples/gno.land/gnoland/* @gnolang/core-tech
gnoland/* @gnolang/core-tech
cmd/gnoland/* @gnolang/core-tech
# Gno.land.
gno.land/* @gnolang/tech-staff


# GnoVM/Gnolang.
pkgs/gnolang/* @gnolang/core-tech
stdlibs/* @gnolang/core-tech
gnovm/* @gnolang/tech-staff


# Special files.
PLAN.md @jaekwon @moul
PHILOSOPHY.md @jaekwon @moul
CONTRIBUTING.md @jaekwon @moul
LICENSE.md @jaekwon @moul
.github/CODEOWNERS @jaekwon @moul
21 changes: 21 additions & 0 deletions .github/workflows/benchdata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: gobenchdata publish
on: push
# branches: [ "master" ]
jobs:
publish:
runs-on: self-hosted
strategy:
fail-fast: false
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-go@v2
with: { go-version: "1.20" }
- name: gobenchdata publish
run: go run go.bobheadxi.dev/gobenchdata@v1 action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_PRUNE_COUNT: 0
INPUT_GO_TEST_FLAGS: -cpu 1,2 -run=^$
INPUT_PUBLISH: true
INPUT_PUBLISH_BRANCH: gh-pages
4 changes: 2 additions & 2 deletions .github/workflows/db-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: db-tests
on:
pull_request:
paths:
- "t2/pkg/db/**.go"
- "tm2/pkg/db/**.go"
- "go.sum"
- ".github/workflows/db-tests.yml"
push:
branches: [ $default-branch ]
branches: [ "master" ]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "!docs/**"
- "!**.md"
push:
branches: [ $default-branch ]
branches: [ "master" ]

jobs:
build-push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "examples/**.gno"
- ".github/workflows/examples.yml"
push:
branches: [ $default-branch ]
branches: [ "master" ]

jobs:
gno2go:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "gno.land/**"
- ".github/workflows/gnovm.yml"
push:
branches: [ $default-branch ]
branches: [ "master" ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gnovm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "tm2/**.go"
- ".github/workflows/gnovm.yml"
push:
branches: [ $default-branch ]
branches: [ "master" ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: misc

on:
push:
branches: [ $default-branch ]
branches: [ "master" ]
pull_request:

jobs:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:
- "tm2/**.go"
- ".github/workflows/tm2.yml"
push:
branches:
- [ $default-branch ]
branches: [ "master" ]

jobs:
build:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
misc/
*.sw[pon]
cmd/foo.go
unsorted.*
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update && apt-get install -y expect ca-certificates && updat

# slim images
FROM runtime-base AS gnoland-slim
WORKDIR /opt/gno/src/gno.land/
COPY --from=build /opt/build/build/gnoland /opt/gno/bin/
ENTRYPOINT ["gnoland"]
EXPOSE 26657 36657
Expand Down
6 changes: 4 additions & 2 deletions examples/gno.land/r/demo/banktest/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import (
)

func main() {
banktestAddr := std.TestDerivePkgAddr("gno.land/r/banktest")
banktestAddr := std.DerivePkgAddr("gno.land/r/banktest")

// print main balance before.
mainaddr := std.TestDerivePkgAddr("main")
mainaddr := std.DerivePkgAddr("main")
std.TestSetOrigCaller(mainaddr)

banker := std.GetBanker(std.BankerTypeReadonly)
mainbal := banker.GetCoins(mainaddr)
println("main before:", mainbal) // plus OrigSend equals 300.
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/banktest/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func main() {
banktestAddr := std.TestDerivePkgAddr("gno.land/r/banktest")
banktestAddr := std.DerivePkgAddr("gno.land/r/banktest")

// simulate a Deposit call.
std.TestSetOrigPkgAddr(banktestAddr)
Expand Down
6 changes: 4 additions & 2 deletions examples/gno.land/r/demo/banktest/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import (
)

func main() {
banktestAddr := std.TestDerivePkgAddr("gno.land/r/demo/banktest")
banktestAddr := std.DerivePkgAddr("gno.land/r/demo/banktest")

// print main balance before.
mainaddr := std.TestDerivePkgAddr("main")
mainaddr := std.DerivePkgAddr("main")
std.TestSetOrigCaller(mainaddr)

banker := std.GetBanker(std.BankerTypeReadonly)
mainbal := banker.GetCoins(mainaddr)
println("main before:", mainbal) // plus OrigSend equals 300.
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/boards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NOTE: You can generate 24 words with any good bip39 generator.
### Create a new account using your mnemonic.

```bash
./build/gnokey add KEYNAME --recover
./build/gnokey add --recover KEYNAME
```

NOTE: `KEYNAME` is your key identifier, and should be changed.
Expand Down
6 changes: 3 additions & 3 deletions examples/gno.land/r/demo/boards/z_4_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func main() {
// },
// "V": {
// "@type": "/gno.StringValue",
// "value": "g1arjyc64rpthwn8zhxtzjvearm5scy43y7vm985"
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// }
// },
// {
Expand Down Expand Up @@ -837,7 +837,7 @@ func main() {
// },
// "V": {
// "@type": "/gno.StringValue",
// "value": "g1arjyc64rpthwn8zhxtzjvearm5scy43y7vm985"
// "value": "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"
// }
// },
// {
Expand All @@ -847,7 +847,7 @@ func main() {
// },
// "V": {
// "@type": "/gno.RefValue",
// "Hash": "04bcdca23188f0e1b9a57b36c4bb33ed3cd72446",
// "Hash": "5b4b593f1d4b37cb99166247ea28174f91087fdd",
// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:82"
// }
// },
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/nft/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ func main() {
}

// Output:
// g1zur8hjter6pzguerw02rqqq0rgzysy2mg9eq2v
// g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// g1v9jxgu33ta047h6lta047h6lta047h6l43dqc5
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/nft/z_3_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ func main() {
}

// Output:
// g1zur8hjter6pzguerw02rqqq0rgzysy2mg9eq2v
// g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// g1v9jxgu33ta047h6lta047h6lta047h6l43dqc5
8 changes: 8 additions & 0 deletions examples/gno.land/r/demo/tests/tests.gno
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ func CurrentRealmPath() string {
return std.CurrentRealmPath()
}

func AssertOriginCall() {
std.AssertOriginCall()
}

func IsOriginCall() bool {
return std.IsOriginCall()
}

//----------------------------------------
// Test structure to ensure cross-realm modification is prevented.

Expand Down
28 changes: 28 additions & 0 deletions examples/gno.land/r/demo/tests/tests_filetest.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"gno.land/r/demo/tests"
)

func main() {
println("IsOriginCall:", tests.IsOriginCall())
tests.AssertOriginCall()
println("AssertOriginCall doesn't panic when called directly")

func() {
// if called inside a function literal, this is no longer an origin call
// because there's one additional frame (the function literal).
println("IsOriginCall:", tests.IsOriginCall())
defer func() {
r := recover()
println("AssertOriginCall panics if when called inside a function literal:", r)
}()
tests.AssertOriginCall()
}()
}

// Output:
// IsOriginCall: true
// AssertOriginCall doesn't panic when called directly
// IsOriginCall: false
// AssertOriginCall panics if when called inside a function literal: invalid non-origin call
32 changes: 32 additions & 0 deletions examples/gno.land/r/demo/tests/tests_test.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package tests

import (
"testing"

"gno.land/p/demo/testutils"
)

func TestAssertOriginCall(t *testing.T) {
// No-panic case
AssertOriginCall()
if !IsOriginCall() {
t.Errorf("expected IsOriginCall=true but got false")
}

// Panic case
expectedReason := "invalid non-origin call"
defer func() {
r := recover()
if r == nil || r.(string) != expectedReason {
t.Errorf("expected panic with '%v', got '%v'", expectedReason, r)
}
}()
func() {
// if called inside a function literal, this is no longer an origin call
// because there's one additional frame (the function literal).
if IsOriginCall() {
t.Errorf("expected IsOriginCall=false but got true")
}
AssertOriginCall()
}()
}
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/users/z_5_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
// ========================================
// ## user gnouser
//
// * address = g17rgsdnfxzza0sdfsdma37sdwxagsz378833ca4
// * address = g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
// * 9 invites
//
// my profile
Expand All @@ -52,7 +52,7 @@ func main() {
//
// * address = g1w3jhxap3ta047h6lta047h6lta047h6l4mfnm7
// * 0 invites
// * invited by g17rgsdnfxzza0sdfsdma37sdwxagsz378833ca4
// * invited by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
//
// my other profile
//
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/users/z_6_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
const admin = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj")

func main() {
caller := std.GetOrigCaller() // main
caller := std.GetOrigCaller()
// as admin, grant invites to unregistered user.
std.TestSetOrigCaller(admin)
users.GrantInvites(caller.String() + ":1")
println("done")
}

// Error:
// invalid user g17rgsdnfxzza0sdfsdma37sdwxagsz378833ca4
// invalid user g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
2 changes: 1 addition & 1 deletion examples/gno.land/r/gnoland/faucet/faucet_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestPackage(t *testing.T) {
var (
adminaddr = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")
faucetaddr = std.TestDerivePkgAddr("gno.land/r/faucet")
faucetaddr = std.DerivePkgAddr("gno.land/r/faucet")
controlleraddr1 = testutils.TestAddress("controller1")
controlleraddr2 = testutils.TestAddress("controller2")
controlleraddr3 = testutils.TestAddress("controller3")
Expand Down
5 changes: 4 additions & 1 deletion gno.land/pkg/gnoland/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ import (
// NewApp creates the GnoLand application.
func NewApp(rootDir string, skipFailingGenesisTxs bool, logger log.Logger) (abci.Application, error) {
// Get main DB.
db := dbm.NewDB("gnolang", dbm.GoLevelDBBackend, filepath.Join(rootDir, "data"))
db, err := dbm.NewDB("gnolang", dbm.GoLevelDBBackend, filepath.Join(rootDir, "data"))
if err != nil {
return nil, fmt.Errorf("error initializing database %q using path %q: %w", dbm.GoLevelDBBackend, rootDir, err)
}

// Capabilities keys.
mainKey := store.NewStoreKey("main")
Expand Down
Loading