Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-paginated-signup
Browse files Browse the repository at this point in the history
  • Loading branch information
leohhhn authored Apr 26, 2024
2 parents e54e145 + 15ad779 commit bf84da4
Show file tree
Hide file tree
Showing 103 changed files with 6,274 additions and 4,627 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
Expand All @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target: [gnoland-slim, gnokey-slim, gno-slim, gnofaucet-slim, gnoweb-slim]
target: [ gnoland-slim, gnokey-slim, gno-slim, gnofaucet-slim, gnoweb-slim ]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -71,7 +71,7 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tm2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
working-directory: tm2
run: |
export GOPATH=$HOME/go
export GOTEST_FLAGS="-v -p 1 -timeout=20m -coverprofile=coverage.out -covermode=atomic"
export GOTEST_FLAGS="-v -p 1 -timeout=20m -coverprofile=coverage.out -covermode=atomic -tags='ledger_suite'"
make ${{ matrix.args }}
touch coverage.out
- uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions contribs/gnodev/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ require (
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions contribs/gnodev/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contribs/gnokeykc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
Expand All @@ -32,6 +31,7 @@ require (
github.com/peterbourgon/ff/v3 v3.4.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/zondax/hid v0.9.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions contribs/gnokeykc/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/how-to-guides/connecting-from-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ A few things to note:
You can initialize the RPC Client used to connect to the Gno.land network with
the following line:
```go
rpc := rpcclient.NewHTTP("<gno_chain_endpoint>", "")
rpc := rpcclient.NewHTTP("<gno_chain_endpoint>")
```

A list of Gno.land network endpoints & chain IDs can be found in the [Gno RPC
Expand Down Expand Up @@ -138,7 +138,7 @@ func main() {
}

// Initialize the RPC client
rpc := rpcclient.NewHTTP("<gno.land_remote_endpoint>", "")
rpc := rpcclient.NewHTTP("<gno.land_remote_endpoint>")

// Initialize the gnoclient
client := gnoclient.Client{
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions gno.land/cmd/gnoland/config_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ func TestConfig_Get_Base(t *testing.T) {
assert.Equal(t, loadedCfg.DBPath, value)
},
},
{
"genesis path fetched",
"genesis_file",
func(loadedCfg *config.Config, value string) {
assert.Equal(t, loadedCfg.Genesis, value)
},
},
{
"validator key fetched",
"priv_validator_key_file",
Expand Down
10 changes: 0 additions & 10 deletions gno.land/cmd/gnoland/config_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@ func TestConfig_Set_Base(t *testing.T) {
assert.Equal(t, value, loadedCfg.DBPath)
},
},
{
"genesis path updated",
[]string{
"genesis_file",
"example path",
},
func(loadedCfg *config.Config, value string) {
assert.Equal(t, value, loadedCfg.Genesis)
},
},
{
"validator key updated",
[]string{
Expand Down
26 changes: 19 additions & 7 deletions gno.land/cmd/gnoland/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type startCfg struct {
skipStart bool
genesisBalancesFile string
genesisTxsFile string
genesisFile string
chainID string
genesisRemote string
dataDir string
Expand Down Expand Up @@ -106,6 +107,13 @@ func (c *startCfg) RegisterFlags(fs *flag.FlagSet) {
"initial txs to replay",
)

fs.StringVar(
&c.genesisFile,
"genesis",
"genesis.json",
"the path to the genesis.json",
)

fs.StringVar(
&c.chainID,
"chainid",
Expand Down Expand Up @@ -200,6 +208,12 @@ func execStart(c *startCfg, io commands.IO) error {
return fmt.Errorf("unable to get absolute path for data directory, %w", err)
}

// Get the absolute path to the node's genesis.json
genesisPath, err := filepath.Abs(c.genesisFile)
if err != nil {
return fmt.Errorf("unable to get absolute path for the genesis.json, %w", err)
}

var (
cfg *config.Config
loadCfgErr error
Expand Down Expand Up @@ -241,11 +255,9 @@ func execStart(c *startCfg, io commands.IO) error {
logger := log.ZapLoggerToSlog(zapLogger)

// Write genesis file if missing.
// NOTE: this will be dropped in a PR that resolves issue #1883:
// https://github.com/gnolang/gno/issues/1883
genesisFilePath := filepath.Join(nodeDir, "../", "genesis.json")

if !osm.FileExists(genesisFilePath) {
// NOTE: this will be dropped in a PR that resolves issue #1886:
// https://github.com/gnolang/gno/issues/1886
if !osm.FileExists(genesisPath) {
// Create priv validator first.
// Need it to generate genesis.json
newPrivValKey := cfg.PrivValidatorKeyFile()
Expand All @@ -254,7 +266,7 @@ func execStart(c *startCfg, io commands.IO) error {
pk := priv.GetPubKey()

// Generate genesis.json file
if err := generateGenesisFile(genesisFilePath, pk, c); err != nil {
if err := generateGenesisFile(genesisPath, pk, c); err != nil {
return fmt.Errorf("unable to generate genesis file: %w", err)
}
}
Expand All @@ -277,7 +289,7 @@ func execStart(c *startCfg, io commands.IO) error {
io.Println(startGraphic)
}

gnoNode, err := node.DefaultNewNode(cfg, genesisFilePath, logger)
gnoNode, err := node.DefaultNewNode(cfg, genesisPath, logger)
if err != nil {
return fmt.Errorf("error in creating node: %w", err)
}
Expand Down
13 changes: 12 additions & 1 deletion gno.land/cmd/gnoland/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bytes"
"context"
"path/filepath"
"testing"
"time"

Expand All @@ -14,15 +15,24 @@ import (
func TestStartInitialize(t *testing.T) {
t.Parallel()

// NOTE: cannot be txtar tests as they use their own parsing for the
// "gnoland" command line. See pkg/integration.

var (
nodeDir = t.TempDir()
nodeDir = t.TempDir()
genesisFile = filepath.Join(nodeDir, "test_genesis.json")

args = []string{
"start",
"--skip-start",
"--skip-failing-genesis-txs",

// These two flags are tested together as they would otherwise
// pollute this directory (cmd/gnoland) if not set.
"--data-dir",
nodeDir,
"--genesis",
genesisFile,
}
)

Expand All @@ -42,4 +52,5 @@ func TestStartInitialize(t *testing.T) {

// Make sure the directory is created
assert.DirExists(t, nodeDir)
assert.FileExists(t, genesisFile)
}
40 changes: 27 additions & 13 deletions gno.land/cmd/gnoland/testdata/addpkg.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,35 @@
## start a new node
gnoland start

## add bar.gno package located in $WORK directory as gno.land/r/foobar/bar
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/foobar/bar -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1
## add hello.gno package located in $WORK directory as gno.land/r/hello
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/hello -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1

## execute Render
gnokey maketx call -pkgpath gno.land/r/foobar/bar -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -args '' -broadcast -chainid=tendermint_test test1
## compare AddPkg
cmp stdout stdout.addpkg.success

## compare render
stdout '("hello from foo" string)'
stdout 'OK!'
stdout 'GAS WANTED: 2000000'
stdout 'GAS USED: [0-9]+'

-- bar.gno --
package bar
## execute SayHello
gnokey maketx call -pkgpath gno.land/r/hello -func SayHello -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1

func Render(path string) string {
return "hello from foo"

## compare SayHello
cmp stdout stdout.call.success

-- hello.gno --
package hello

func SayHello() string {
return "hello world!"
}


-- stdout.addpkg.success --

OK!
GAS WANTED: 2000000
GAS USED: 119829
-- stdout.call.success --
("hello world!" string)
OK!
GAS WANTED: 2000000
GAS USED: 52801
6 changes: 3 additions & 3 deletions gno.land/pkg/gnoclient/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func Example_withDisk() {
}

remote := "127.0.0.1:26657"
rpcClient := rpcclient.NewHTTP(remote, "/websocket")
rpcClient, _ := rpcclient.NewHTTPClient(remote)

client := gnoclient.Client{
Signer: signer,
Expand All @@ -35,7 +35,7 @@ func Example_withInMemCrypto() {
signer, _ := gnoclient.SignerFromBip39(mnemo, chainID, bip39Passphrase, account, index)

remote := "127.0.0.1:26657"
rpcClient := rpcclient.NewHTTP(remote, "/websocket")
rpcClient, _ := rpcclient.NewHTTPClient(remote)

client := gnoclient.Client{
Signer: signer,
Expand All @@ -47,7 +47,7 @@ func Example_withInMemCrypto() {
// Example_readOnly demonstrates how to initialize a read-only gnoclient, which can only query.
func Example_readOnly() {
remote := "127.0.0.1:26657"
rpcClient := rpcclient.NewHTTP(remote, "/websocket")
rpcClient, _ := rpcclient.NewHTTPClient(remote)

client := gnoclient.Client{
RPCClient: rpcClient,
Expand Down
Loading

0 comments on commit bf84da4

Please sign in to comment.