Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into feat/grc7211-by-spec
Browse files Browse the repository at this point in the history
# Conflicts:
#	examples/gno.land/r/demo/nft/README.md
#	examples/gno.land/r/demo/nft/z_0_filetest.gno
#	examples/gno.land/r/demo/nft/z_1_filetest.gno
#	examples/gno.land/r/demo/nft/z_2_filetest.gno
#	examples/gno.land/r/demo/nft/z_3_filetest.gno
#	examples/gno.land/r/demo/nft/z_4_filetest.gno
  • Loading branch information
leohhhn committed Jun 25, 2024
2 parents 742d6d5 + 28c3b1a commit f401bc7
Show file tree
Hide file tree
Showing 662 changed files with 21,089 additions and 4,933 deletions.
4 changes: 2 additions & 2 deletions .benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Things to take into account:
- All benchmarks on a package will be shown on the same graph.
- The value on `package` and `benchmarks` are regular expressions.
- You have to explicitly add your new package here to make it appears on generated graphs.
- If you have benchmarks on the same package that takes much more time pero op than the rest, you should divide it into a separate graph for visibility. In this example we can see how we separated tests from the gnolang package into the ones finishing with `Equality` and `LoopyMain`, because `LoopyMain` is taking an order of magnitude more time per operation than the other tests:
- If you have benchmarks on the same package that takes much more time per op than the rest, you should divide it into a separate graph for visibility. In this example we can see how we separated tests from the gnolang package into the ones finishing with `Equality` and `LoopyMain`, because `LoopyMain` is taking an order of magnitude more time per operation than the other tests:
```yaml
- name: Equality benchmarks (gnovm)
benchmarks: [ '.Equality' ]
Expand All @@ -31,4 +31,4 @@ Things to take into account:
## Add new checks for PRs
If we want to add a new package to check all the fast benchmarks on it on every PR, we should have a look into [gobenchdata-checks.yml](./gobenchdata-checks.yml).
If we want to add a new package to check all the fast benchmarks on it on every PR, we should have a look into [gobenchdata-checks.yml](./gobenchdata-checks.yml).
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
/examples/gno.land/p/demo/seqid/ @thehowl
/examples/gno.land/p/demo/ownable/ @leohhhn
/examples/gno.land/p/demo/pausable/ @leohhhn
/examples/gno.land/p/demo/stack/ @harry-hov
/examples/gno.land/p/demo/svg/ @moul
/examples/gno.land/p/demo/tamagotchi/ @moul
/examples/gno.land/p/demo/ui/ @moul
Expand Down Expand Up @@ -64,11 +63,11 @@
/gnovm/ @jaekwon @moul @piux2 @thehowl
/gnovm/stdlibs/ @thehowl
/gnovm/tests/ @jaekwon @deelawn @thehowl @mvertes
/gnovm/cmd/gno/ @moul @thehowl @harry-hov
/gnovm/cmd/gno/ @moul @thehowl
/gnovm/pkg/gnolang/ @jaekwon @moul @piux2 @deelawn
/gnovm/pkg/doc/ @thehowl
/gnovm/pkg/repl/ @mvertes @ajnavarro
/gnovm/pkg/gnomod/ @harry-hov
/gnovm/pkg/gnomod/ @thehowl
/gnovm/pkg/gnoenv/ @gfanton
/gnovm/pkg/transpiler/ @thehowl
/gnovm/pkg/integration/ @gfanton
Expand All @@ -91,5 +90,6 @@
/CONTRIBUTING.md @jaekwon @moul @gnolang/tech-staff
/LICENSE.md @jaekwon
/.github/ @moul @gnolang/tech-staff
/.github/workflows @ajnavarro @moul
/.github/CODEOWNERS @jaekwon @moul
/go.mod @gnolang/tech-staff # no unnecessary dependencies
4 changes: 2 additions & 2 deletions .github/workflows/build_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}

- name: Checkout code
uses: actions/checkout@v4

- name: Check generated files are up to date
working-directory: ${{ inputs.modulepath }}
run: |
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/contribs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ on:
paths:
- "contribs/**"
- ".github/**"
# Contribs directly depend on gno, so we need to test it whenever changes
# are made to one of those
- "go.*" # check on go.mod/sum update
- "gno.land/**"
- "tm2/**.go"
- "gnovm/**.go"

jobs:
setup:
Expand All @@ -30,4 +36,4 @@ jobs:
with:
modulepath: contribs/${{ matrix.program }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/docs-404-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "docs / 404 checker"

on:
push:
paths:
- master
pull_request:
paths:
- "docs/**"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21'

- name: Install dependencies
run: go mod download

- name: Build docs
run: make -C docs/ build

- name: Run linter
run: make -C docs/ lint
7 changes: 5 additions & 2 deletions .github/workflows/gnoland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
branches:
- master
workflow_dispatch:
pull_request:
pull_request:
paths:
- "gno.land/**"
- "tm2/**.go"
- "gnovm/**.go"
- "go.*" # check on go.mod/sum update
- ".github/**"

jobs:
Expand All @@ -17,4 +20,4 @@ jobs:
with:
modulepath: "gno.land"
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/gnovm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
pull_request:
paths:
- "gnovm/**"
- "go.*" # check on go.mod/sum update
- ".github/**"

jobs:
Expand All @@ -17,4 +18,4 @@ jobs:
with:
modulepath: "gnovm"
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
pull_request:
paths:
- "tm2/**"
- "go.*" # check on go.mod/sum update
- ".github/**"

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ pbbindings.go
# Test coverage leftovers
cover.out
coverage.out

*.swp
*.swo
*.bak
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install.gno:
@printf "\033[0;32m[+] 'gno' has been installed. Read more in ./gnovm/\033[0m\n"
.PHONY: install.gnodev
install.gnodev:
$(MAKE) --no-print-directory -C ./contribs install.gnodev
$(MAKE) --no-print-directory -C ./contribs/gnodev install
@printf "\033[0;32m[+] 'gnodev' has been installed. Read more in ./contribs/gnodev/\033[0m\n"

# old aliases
Expand Down
53 changes: 26 additions & 27 deletions contribs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ help:
@echo "Available make commands:"
@cat Makefile | grep '^[a-z][^:]*:' | cut -d: -f1 | sort | sed 's/^/ /'

programs=gnodev gnofaucet

# command to run dependency utilities, like goimports.
rundep=go run -modfile ../misc/devdeps/go.mod

Expand All @@ -25,15 +27,31 @@ GOTEST_FLAGS ?= -v -p 1 -timeout=30m
########################################
# Dev tools
.PHONY: install
install: install.gnomd install.gnodev install.gnofaucet
install:
@echo 'To install a tool, go to the subdirectory, then run `make install`.'
@echo 'To do a full installation, run `make install_all`.'

install_all: $(addprefix install.,$(programs))
install.%:
@echo "[+] make -C $(subst install.,,$@) install"
$(MAKE) --no-print-directory -C $(subst install.,,$@) install
.PHONY: install_all

install.gnomd:; cd gnomd && go install .
install.gnodev:; $(MAKE) -C ./gnodev install
install.gnofaucet:; $(MAKE) -C ./gnofaucet install
########################################
# Test suite
test: $(addprefix test.,$(programs))
test.%:
@echo "[+] make -C $(subst test.,,$@) install"
$(MAKE) --no-print-directory -C $(subst test.,,$@) test
.PHONY: test

.PHONY: clean
clean:
rm -rf build
########################################
# Lint
.PHONY: lint
lint: $(addprefix lint.,$(programs))
lint.%:
@echo "[+] make -C $(subst lint.,,$@) install"
$(MAKE) --no-print-directory -C $(subst lint.,,$@) lint

########################################
# Dev tools
Expand All @@ -45,23 +63,4 @@ fmt:

.PHONY: tidy
tidy:
@for gomod in `find . -name go.mod`; do ( \
dir=`dirname $$gomod`; \
set -xe; \
cd $$dir; \
go mod tidy -v; \
); done

########################################
# Test suite
.PHONY: test
test: test.gnodev
test.gnodev:
$(MAKE) -C ./gnodev test

########################################
# Lint
.PHONY: test
lint: lint.gnodev
lint.gnodev:
$(MAKE) -C ./gnodev test
find . -name go.mod -execdir go mod tidy -v \;
22 changes: 20 additions & 2 deletions contribs/gnodev/cmd/gnodev/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var (

type devCfg struct {
// Listeners
webListenerAddr string
nodeRPCListenerAddr string
nodeP2PListenerAddr string
nodeProxyAppListenerAddr string
Expand All @@ -49,6 +48,11 @@ type devCfg struct {
root string
premineAccounts varPremineAccounts
balancesFile string
txsFile string

// Web Configuration
webListenerAddr string
webRemoteHelperAddr string

// Node Configuration
minimal bool
Expand Down Expand Up @@ -113,7 +117,14 @@ func (c *devCfg) RegisterFlags(fs *flag.FlagSet) {
&c.webListenerAddr,
"web-listener",
defaultDevOptions.webListenerAddr,
"web server listening address",
"web server listener address",
)

fs.StringVar(
&c.webRemoteHelperAddr,
"web-help-remote",
defaultDevOptions.webRemoteHelperAddr,
"web server help page's remote addr (default to <node-rpc-listener>)",
)

fs.StringVar(
Expand All @@ -136,6 +147,13 @@ func (c *devCfg) RegisterFlags(fs *flag.FlagSet) {
"load the provided balance file (refer to the documentation for format)",
)

fs.StringVar(
&c.txsFile,
"txs-file",
defaultDevOptions.txsFile,
"load the provided transactions file (refer to the documentation for format)",
)

fs.StringVar(
&c.deployKey,
"deploy-key",
Expand Down
17 changes: 15 additions & 2 deletions contribs/gnodev/cmd/gnodev/setup_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
gnodev "github.com/gnolang/gno/contribs/gnodev/pkg/dev"
"github.com/gnolang/gno/contribs/gnodev/pkg/emitter"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/std"
)

// setupDevNode initializes and returns a new DevNode.
Expand All @@ -21,19 +22,31 @@ func setupDevNode(
balances gnoland.Balances,
pkgspath []gnodev.PackagePath,
) (*gnodev.Node, error) {
config := setupDevNodeConfig(cfg, balances, pkgspath)
// Load transactions.
txs, err := parseTxs(cfg.txsFile)
if err != nil {
return nil, fmt.Errorf("unable to load transactions: %w", err)
}

config := setupDevNodeConfig(cfg, balances, pkgspath, txs)
return gnodev.NewDevNode(ctx, logger, remitter, config)
}

// setupDevNodeConfig creates and returns a new dev.NodeConfig.
func setupDevNodeConfig(cfg *devCfg, balances gnoland.Balances, pkgspath []gnodev.PackagePath) *gnodev.NodeConfig {
func setupDevNodeConfig(
cfg *devCfg,
balances gnoland.Balances,
pkgspath []gnodev.PackagePath,
txs []std.Tx,
) *gnodev.NodeConfig {
config := gnodev.DefaultNodeConfig(cfg.root)
config.BalancesList = balances.List()
config.PackagesPathList = pkgspath
config.TMConfig.RPC.ListenAddress = resolveUnixOrTCPAddr(cfg.nodeRPCListenerAddr)
config.NoReplay = cfg.noReplay
config.MaxGasPerBlock = cfg.maxGas
config.ChainID = cfg.chainId
config.Txs = txs

// other listeners
config.TMConfig.P2P.ListenAddress = defaultDevOptions.nodeP2PListenerAddr
Expand Down
10 changes: 8 additions & 2 deletions contribs/gnodev/cmd/gnodev/setup_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import (
// setupGnowebServer initializes and starts the Gnoweb server.
func setupGnoWebServer(logger *slog.Logger, cfg *devCfg, dnode *gnodev.Node) http.Handler {
webConfig := gnoweb.NewDefaultConfig()
webConfig.RemoteAddr = dnode.GetRemoteAddress()
webConfig.HelpRemote = dnode.GetRemoteAddress()

webConfig.HelpChainID = cfg.chainId
webConfig.RemoteAddr = dnode.GetRemoteAddress()
webConfig.HelpRemote = cfg.webRemoteHelperAddr

// If `HelpRemote` is empty default it to `RemoteAddr`
if webConfig.HelpRemote == "" {
webConfig.HelpRemote = webConfig.RemoteAddr
}

app := gnoweb.MakeApp(logger, webConfig)
return app.Router
Expand Down
23 changes: 23 additions & 0 deletions contribs/gnodev/cmd/gnodev/txs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"context"
"fmt"
"os"

"github.com/gnolang/gno/tm2/pkg/std"
)

func parseTxs(txFile string) ([]std.Tx, error) {
if txFile == "" {
return nil, nil
}

file, loadErr := os.Open(txFile)
if loadErr != nil {
return nil, fmt.Errorf("unable to open tx file %s: %w", txFile, loadErr)
}
defer file.Close()

return std.ParseTxs(context.Background(), file)
}
Loading

0 comments on commit f401bc7

Please sign in to comment.