From 1a41a013694674d1049680793595eca180d2f16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jer=C3=B3nimo=20Albi?= Date: Fri, 14 Oct 2022 22:06:55 +0200 Subject: [PATCH 1/9] fix: change session print loop to block until all events are handled (#2920) --- changelog.md | 1 + ignite/pkg/cliui/cliui.go | 15 ++++++++++++--- ignite/services/network/publish.go | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 69cb896dac..af6b2fc67e 100644 --- a/changelog.md +++ b/changelog.md @@ -30,6 +30,7 @@ - Seal the capability keeper in the `app.go` template - Change faucet to allow C.O.R.S. preflight requests. - Fix config file migration to void leaving end of file content chunks +- Change session print loop to block until all events are handled. - Handle "No records were found in keyring" message when checking keys. ### Features diff --git a/ignite/pkg/cliui/cliui.go b/ignite/pkg/cliui/cliui.go index e4be2832b3..f01edc3f64 100644 --- a/ignite/pkg/cliui/cliui.go +++ b/ignite/pkg/cliui/cliui.go @@ -4,6 +4,7 @@ import ( "fmt" "io" "os" + "sync" "github.com/manifoldco/promptui" @@ -29,6 +30,7 @@ type Session struct { ev events.Bus spinner *clispinner.Spinner out uilog.Output + wg *sync.WaitGroup } // Option configures session options. @@ -73,6 +75,7 @@ func StartSpinner() Option { func New(options ...Option) Session { session := Session{ ev: events.NewBus(), + wg: &sync.WaitGroup{}, options: sessionOptions{ stdin: os.Stdin, stdout: os.Stdout, @@ -99,7 +102,10 @@ func New(options ...Option) Session { session.spinner = clispinner.New(clispinner.WithWriter(session.out.Stdout())) } - go session.handleEvents() + // The main loop that prints the events uses a wait group to block + // the session end until all the events are printed. + session.wg.Add(1) + go session.handleEvents(session.wg) return session } @@ -215,9 +221,12 @@ func (s Session) PrintTable(header []string, entries ...[]string) error { func (s Session) End() { s.StopSpinner() s.ev.Stop() + s.wg.Wait() } -func (s Session) handleEvents() { +func (s Session) handleEvents(wg *sync.WaitGroup) { + defer wg.Done() + stdout := s.out.Stdout() for e := range s.ev.Events() { @@ -227,7 +236,7 @@ func (s Session) handleEvents() { case events.IndicationFinish: s.StopSpinner() fmt.Fprintf(stdout, "%s\n", e) - case events.IndicationNone: + default: resume := s.PauseSpinner() fmt.Fprintf(stdout, "%s\n", e) resume() diff --git a/ignite/services/network/publish.go b/ignite/services/network/publish.go index 87c175968f..43a0acf9d3 100644 --- a/ignite/services/network/publish.go +++ b/ignite/services/network/publish.go @@ -307,11 +307,11 @@ func (n Network) sendAccountRequest( } if requestRes.AutoApproved { - n.ev.Send("Account added to the network by the coordinator!", events.ProgressStarted()) + n.ev.Send("Account added to the network by the coordinator!", events.ProgressFinished()) } else { n.ev.Send( fmt.Sprintf("Request %d to add account to the network has been submitted!", requestRes.RequestID), - events.ProgressStarted(), + events.ProgressFinished(), ) } return nil From 533b96be3d656ddddc59ece3ec9acf4685cfece4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Sun, 16 Oct 2022 04:12:00 +0300 Subject: [PATCH 2/9] ci/docs: update Firebase settings (#2924) --- .github/workflows/docs-deploy-preview.yml | 4 ++-- .github/workflows/docs-deploy.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs-deploy-preview.yml b/.github/workflows/docs-deploy-preview.yml index a55bfd2861..8a6f71904d 100644 --- a/.github/workflows/docs-deploy-preview.yml +++ b/.github/workflows/docs-deploy-preview.yml @@ -38,7 +38,7 @@ jobs: uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: "${{ secrets.GITHUB_TOKEN }}" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IGNITE_HQ }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IGNITESRVC }}" expires: 7d target: docs.ignite.com - projectId: ignite-hq + projectId: ignitesrvc diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index fbe49117a9..a7833fa77a 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -46,7 +46,7 @@ jobs: uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: "${{ secrets.GITHUB_TOKEN }}" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IGNITE_HQ }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IGNITESRVC }}" channelId: live target: docs.ignite.com - projectId: ignite-hq + projectId: ignitesrvc From b25c2692f4fb0602967ddc698f85d55c125a19ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Sun, 16 Oct 2022 04:18:44 +0300 Subject: [PATCH 3/9] ci/docs: run on self host (#2925) --- .github/workflows/docs-deploy-preview.yml | 2 +- .github/workflows/docs-deploy.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-deploy-preview.yml b/.github/workflows/docs-deploy-preview.yml index 8a6f71904d..0c2460e643 100644 --- a/.github/workflows/docs-deploy-preview.yml +++ b/.github/workflows/docs-deploy-preview.yml @@ -7,7 +7,7 @@ on: jobs: build_and_deploy: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Checkout diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index a7833fa77a..8a82f08028 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -7,14 +7,14 @@ on: jobs: consecutiveness: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: mktcode/consecutive-workflow-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} build_and_deploy: - runs-on: ubuntu-latest + runs-on: self-hosted needs: [ consecutiveness ] steps: From 85fd5f6373edb07acba23cb374a735378d474ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Sun, 16 Oct 2022 22:53:36 +0300 Subject: [PATCH 4/9] feat: upgrade SDK version to v0.46.2 --- changelog.md | 6 +++ go.mod | 4 +- go.sum | 16 +++---- ignite/pkg/chaincmd/runner/account.go | 4 ++ ignite/pkg/cosmoscmd/root.go | 16 ++++--- ignite/templates/app/stargate/go.mod.plush | 4 +- ignite/templates/app/stargate/go.sum | 52 ++++++++++++++-------- 7 files changed, 67 insertions(+), 35 deletions(-) diff --git a/changelog.md b/changelog.md index 43e5e9e008..a1935f1cb6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## [`v0.24.1`](https://github.com/ignite/cli/releases/tag/v0.24.1) + +### Features + +- Upgraded Cosmos SDK to `v0.46.2`. + ## [`v0.24.0`](https://github.com/ignite/cli/releases/tag/v0.24.0) ### Features diff --git a/go.mod b/go.mod index ca009427b2..016c037968 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/cenkalti/backoff v2.2.1+incompatible github.com/charmbracelet/glow v1.4.0 - github.com/cosmos/cosmos-sdk v0.46.1 + github.com/cosmos/cosmos-sdk v0.46.2 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go/v5 v5.0.0-rc1 github.com/docker/docker v20.10.17+incompatible @@ -120,7 +120,7 @@ require ( github.com/cosmos/btcutil v1.0.4 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect - github.com/cosmos/iavl v0.19.1 // indirect + github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect diff --git a/go.sum b/go.sum index 4ffff42fd8..8b294943a5 100644 --- a/go.sum +++ b/go.sum @@ -22,7 +22,7 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.102.0 h1:DAq3r8y4mDgyB/ZPJ9v/5VJNqjgJAxTn6ZYLlUywOu8= +cloud.google.com/go v0.102.1 h1:vpK6iQWv/2uUeFJth4/cBHsQAGjn1iIE6AAlxipRaA0= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -34,7 +34,7 @@ cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9U cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= +cloud.google.com/go/iam v0.4.0 h1:YBYU00SCDzZJdHqVc4I5d6lsklcYIjQZa1YmEz4jlSE= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -458,15 +458,15 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk v0.46.1 h1:7vUZXMyrmEb4xtBYpz1TobtrcnpgiZTi+tVjc0XWB4o= -github.com/cosmos/cosmos-sdk v0.46.1/go.mod h1:2+o8Qw8qnE02V+lQVZDJFQ8tri/hsiA5GmWaPERqVa0= +github.com/cosmos/cosmos-sdk v0.46.2 h1:3dUNqbLas94ud5aTcJKCwxVOmNXpuGBtVQTMrYczTwY= +github.com/cosmos/cosmos-sdk v0.46.2/go.mod h1:0aUPGPU6PWaDEaHNjtgrpNhgxo9bAUrQ7BO7XCvFOfs= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.1 h1:3gaq9b6SjiB0KBTygRnAvEGml2pQlu1TH8uma5g63Ys= -github.com/cosmos/iavl v0.19.1/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= +github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313 h1:R7CnaI/0OLwOusy7n9750n8fqQ3yCQ8OJQI2L3ws9RA= +github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v5 v5.0.0-rc1 h1:9cgpYmHh2jodB/t3LwB/pYA2sG9rdKB9cmXP0D5M0Fs= github.com/cosmos/ibc-go/v5 v5.0.0-rc1/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= @@ -894,7 +894,7 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa h1:7MYGT2XEMam7Mtzv1yDUYXANedWvwk3HKkR3MyGowy8= +github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.4.0 h1:dS9eYAjhrE2RjmzYw2XAPvcXfmcQLtFEQWn0CR82awk= @@ -2306,7 +2306,7 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.84.0 h1:NMB9J4cCxs9xEm+1Z9QiO3eFvn7EnQj3Eo3hN6ugVlg= +google.golang.org/api v0.93.0 h1:T2xt9gi0gHdxdnRkVQhT8mIvPaXKNsDNWz+L696M66M= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/ignite/pkg/chaincmd/runner/account.go b/ignite/pkg/chaincmd/runner/account.go index 2410678bea..093a73ec83 100644 --- a/ignite/pkg/chaincmd/runner/account.go +++ b/ignite/pkg/chaincmd/runner/account.go @@ -120,6 +120,10 @@ func (r Runner) CheckAccountExist(ctx context.Context, name string) error { return err } + if strings.TrimSpace(b.String()) == "No records were found in keyring" { // sdk no longer respects to --output when there is no record + return nil + } + data, err := b.JSONEnsuredBytes() if err != nil { return err diff --git a/ignite/pkg/cosmoscmd/root.go b/ignite/pkg/cosmoscmd/root.go index f4155d84bb..39e8945561 100644 --- a/ignite/pkg/cosmoscmd/root.go +++ b/ignite/pkg/cosmoscmd/root.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" @@ -149,6 +150,7 @@ func NewRootCmd( // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) cmd.SetErr(cmd.ErrOrStderr()) + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) if err != nil { return err @@ -198,6 +200,12 @@ func initRootCmd( buildApp AppBuilder, options rootOptions, ) { + + a := appCreator{ + encodingConfig, + buildApp, + } + rootCmd.AddCommand( genutilcli.InitCmd(moduleBasics, defaultNodeHome), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome), @@ -213,13 +221,9 @@ func initRootCmd( tmcli.NewCompletionCmd(rootCmd, true), debug.Cmd(), config.Cmd(), + pruning.PruningCmd(a.newApp), ) - a := appCreator{ - encodingConfig, - buildApp, - } - // add server commands server.AddCommands( rootCmd, @@ -378,6 +382,8 @@ func (a appCreator) newApp( baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), baseapp.SetSnapshot(snapshotStore, snapshotOptions), + baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))), + baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagIAVLFastNode))), ) } diff --git a/ignite/templates/app/stargate/go.mod.plush b/ignite/templates/app/stargate/go.mod.plush index b47b6a09a2..f6b414ee46 100644 --- a/ignite/templates/app/stargate/go.mod.plush +++ b/ignite/templates/app/stargate/go.mod.plush @@ -3,12 +3,12 @@ module <%= ModulePath %> go 1.18 require ( - github.com/cosmos/cosmos-sdk v0.46.1 + github.com/cosmos/cosmos-sdk v0.46.2 github.com/cosmos/ibc-go/v5 v5.0.0-rc1 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/ignite/cli v0.24.0 + github.com/ignite/cli v0.24.1 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.5.0 github.com/stretchr/testify v1.8.0 diff --git a/ignite/templates/app/stargate/go.sum b/ignite/templates/app/stargate/go.sum index bfdd26b9e1..537f0eec1a 100644 --- a/ignite/templates/app/stargate/go.sum +++ b/ignite/templates/app/stargate/go.sum @@ -32,8 +32,9 @@ cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0 h1:DAq3r8y4mDgyB/ZPJ9v/5VJNqjgJAxTn6ZYLlUywOu8= cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= +cloud.google.com/go v0.102.1 h1:vpK6iQWv/2uUeFJth4/cBHsQAGjn1iIE6AAlxipRaA0= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -50,8 +51,9 @@ cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9U cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= +cloud.google.com/go/iam v0.4.0 h1:YBYU00SCDzZJdHqVc4I5d6lsklcYIjQZa1YmEz4jlSE= +cloud.google.com/go/iam v0.4.0/go.mod h1:cbaZxyScUhxl7ZAkNWiALgihfP75wS/fUsVNaa1r3vA= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -257,8 +259,11 @@ github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOo github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= @@ -404,15 +409,15 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk v0.46.1 h1:7vUZXMyrmEb4xtBYpz1TobtrcnpgiZTi+tVjc0XWB4o= -github.com/cosmos/cosmos-sdk v0.46.1/go.mod h1:2+o8Qw8qnE02V+lQVZDJFQ8tri/hsiA5GmWaPERqVa0= +github.com/cosmos/cosmos-sdk v0.46.2 h1:3dUNqbLas94ud5aTcJKCwxVOmNXpuGBtVQTMrYczTwY= +github.com/cosmos/cosmos-sdk v0.46.2/go.mod h1:0aUPGPU6PWaDEaHNjtgrpNhgxo9bAUrQ7BO7XCvFOfs= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.1 h1:3gaq9b6SjiB0KBTygRnAvEGml2pQlu1TH8uma5g63Ys= -github.com/cosmos/iavl v0.19.1/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= +github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313 h1:R7CnaI/0OLwOusy7n9750n8fqQ3yCQ8OJQI2L3ws9RA= +github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v5 v5.0.0-rc1 h1:9cgpYmHh2jodB/t3LwB/pYA2sG9rdKB9cmXP0D5M0Fs= github.com/cosmos/ibc-go/v5 v5.0.0-rc1/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= @@ -737,8 +742,9 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa h1:7MYGT2XEMam7Mtzv1yDUYXANedWvwk3HKkR3MyGowy8= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= +github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -751,8 +757,8 @@ github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3i github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gookit/color v1.5.0 h1:1Opow3+BWDwqor78DcJkJCIwnkviFi+rrOANki9BUFw= -github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= +github.com/gookit/color v1.5.1 h1:Vjg2VEcdHpwq+oY63s/ksHrgJYCTo0bwWvmmYWdE9fQ= +github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -967,6 +973,8 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -974,15 +982,17 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1353,8 +1363,8 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM github.com/tendermint/fundraising v0.3.1 h1:S4uOV/T7YNBqXhsCZnq/TUoHB0d2kM+6tKeTD4WhLN0= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/spn v0.2.1-0.20220826123316-985b629a92dd h1:G50RK8x61pNFGVSAI5UmXaBDA4h/P2+SDdftha9jjSM= -github.com/tendermint/spn v0.2.1-0.20220826123316-985b629a92dd/go.mod h1:5eAAx0g6FEXubQ1Sb7zJcDZqCSjb9yoJMVOQwjEt9qQ= +github.com/tendermint/spn v0.2.1-0.20220907161743-aab4d3df1f2b h1:QqEBIiWRC+uPM8FCXuxcvzTS6isR/lycQJDRHgsmg2c= +github.com/tendermint/spn v0.2.1-0.20220907161743-aab4d3df1f2b/go.mod h1:CMzd3oBkjR9I1h/BEaU1K2V78XqARFWGjxPP9Xy/FIE= github.com/tendermint/tendermint v0.34.21 h1:UiGGnBFHVrZhoQVQ7EfwSOLuCtarqCSsRf8VrklqB7s= github.com/tendermint/tendermint v0.34.21/go.mod h1:XDvfg6U7grcFTDx7VkzxnhazQ/bspGJAn4DZ6DcLLjQ= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= @@ -1483,8 +1493,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1597,6 +1607,7 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220726230323-06994584191e h1:wOQNKh1uuDGRnmgF0jDxh7ctgGy/3P4rYWQRVJD4/Yg= golang.org/x/net v0.0.0-20220726230323-06994584191e/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1619,6 +1630,7 @@ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 h1:2o1E+E8TpNLklK9nHiPiK1uzIYrIHt+cQx3ynCwq9V8= golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1764,9 +1776,10 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220727055044-e65921a090b8 h1:dyU22nBWzrmTQxtNrr4dzVOvaw35nUYE279vF9UmsI8= -golang.org/x/sys v0.0.0-20220727055044-e65921a090b8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1915,8 +1928,9 @@ google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRR google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0 h1:NMB9J4cCxs9xEm+1Z9QiO3eFvn7EnQj3Eo3hN6ugVlg= google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= +google.golang.org/api v0.93.0 h1:T2xt9gi0gHdxdnRkVQhT8mIvPaXKNsDNWz+L696M66M= +google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2018,6 +2032,8 @@ google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc h1:Nf+EdcTLHR8qDNN/KfkQL0u0ssxt9OhbaWCl5C0ucEI= google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= From 8f3354b59b236c8b0000b026c2d9578714d92c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Mon, 17 Oct 2022 14:09:08 +0300 Subject: [PATCH 5/9] chore: change firebase project id (#2929) --- .firebaserc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.firebaserc b/.firebaserc index 7df6587a1a..e8d6193129 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,6 +1,6 @@ { "projects": { - "default": "ignite-hq" + "default": "ignitesrvc" }, "targets": { "ignite-hq": { From bca9aa71914d8c5c2f628a62a59d160d8c65b10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Mon, 17 Oct 2022 14:28:40 +0300 Subject: [PATCH 6/9] chore: tidy and format --- go.mod | 2 +- go.sum | 6 ++++-- ignite/pkg/cosmoscmd/root.go | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 1cdd40ad8c..6ec1bdb657 100644 --- a/go.mod +++ b/go.mod @@ -40,6 +40,7 @@ require ( github.com/lib/pq v1.10.6 github.com/manifoldco/promptui v0.9.0 github.com/mattn/go-zglob v0.0.3 + github.com/mitchellh/mapstructure v1.5.0 github.com/otiai10/copy v1.6.0 github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 @@ -261,7 +262,6 @@ require ( github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/sys/mount v0.3.1 // indirect github.com/moby/sys/mountinfo v0.6.0 // indirect github.com/moricho/tparallel v0.2.1 // indirect diff --git a/go.sum b/go.sum index 1babab8fc0..85ca5654db 100644 --- a/go.sum +++ b/go.sum @@ -471,6 +471,10 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= +github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313 h1:R7CnaI/0OLwOusy7n9750n8fqQ3yCQ8OJQI2L3ws9RA= +github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= +github.com/cosmos/ibc-go/v5 v5.0.0 h1:MkObdarpoICPHXoRg/Ne9NRix4j7eQlJZq74/uzH3Zc= +github.com/cosmos/ibc-go/v5 v5.0.0/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -572,8 +576,6 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/proto v1.9.0 h1:l0QiNT6Qs7Yj0Mb4X6dnWBQer4ebei2BFcgQLbGqUDc= -github.com/emicklei/proto v1.9.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= github.com/emicklei/proto v1.11.0 h1:XcDEsxxv5xBp0jeZ4rt7dj1wuv/GQ4cSAe4BHbhrRXY= github.com/emicklei/proto v1.11.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= diff --git a/ignite/pkg/cosmoscmd/root.go b/ignite/pkg/cosmoscmd/root.go index 39e8945561..dd7dcc3ae4 100644 --- a/ignite/pkg/cosmoscmd/root.go +++ b/ignite/pkg/cosmoscmd/root.go @@ -200,7 +200,6 @@ func initRootCmd( buildApp AppBuilder, options rootOptions, ) { - a := appCreator{ encodingConfig, buildApp, From 42a47891e8c1c5359cabe5274d646b6502baf995 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Mon, 17 Oct 2022 15:00:05 +0200 Subject: [PATCH 7/9] feat: move cosmoscmd in templates (#2910) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: cosmoscmd in template This is no longer a simple copy of pkg/cosmoscmd into a template, in addition, this removes some parametization that's no required for a template. Also removed some app interfaces to better match the gaia/cmd package. * format files and improve Execute error handling * add placeholders to add commands and flags * chore: deprecate pkg/cosmoscmd * add StartTunneledPeers in services/network * feat: add start-with-tunneling command * update cli version * go mod tidy * update cli version * Recommand run appd start-with-tunneling when on gitpod * disable sumdb on go mod tidy go mod tidy triggers a 404 not found when it requests the sumdb, until we understand why, we disable sumdb. Also removes indirect dependencies from go.mod.plush since they will be repopulated by go mod tidy. * fill chain tools.go from constants * restore formatting * MakeEncodingConfig/SetPrefix don't need parameters * fix import format * fix import format * CL * add --quit-on-fail to ignite chain serve cmd Useful flag for integration test. * fix network integration test spn doesn't have a tools.go file, so it's not possible to install directly the dep tools, we need to go get then first. * fix import format * format imports with local imports at bottom * quit on fail also when validation error * chore: change cmd name for new start Co-authored-by: İlker G. Öztürk --- changelog.md | 1 + ignite/cmd/chain_serve.go | 9 + ignite/cmd/network_chain_prepare.go | 7 +- ignite/cmd/scaffold_band.go | 2 +- ignite/cmd/scaffold_chain.go | 5 +- ignite/cmd/scaffold_module.go | 2 +- ignite/cmd/scaffold_mwasm.go | 2 +- ignite/pkg/cmdrunner/cmdrunner.go | 7 +- ignite/pkg/cosmoscmd/cosmoscmd.go | 2 + ignite/pkg/cosmoscmd/genaccounts.go | 3 +- ignite/pkg/cosmosgen/install.go | 38 +- ignite/pkg/gocmd/gocmd.go | 31 ++ ignite/services/chain/generate.go | 2 +- ignite/services/chain/serve.go | 14 + ignite/services/network/peer.go | 71 ++++ ignite/services/scaffolder/init.go | 20 +- ignite/services/scaffolder/message.go | 2 +- ignite/services/scaffolder/module.go | 12 +- ignite/services/scaffolder/oracle.go | 3 +- ignite/services/scaffolder/packet.go | 2 +- ignite/services/scaffolder/query.go | 2 +- ignite/services/scaffolder/scaffolder.go | 46 +- ignite/services/scaffolder/type.go | 2 +- ignite/templates/app/app.go | 2 + .../templates/app/stargate/app/app.go.plush | 23 +- .../app/stargate/app/encoding.go.plush | 35 ++ .../app/stargate/app/export.go.plush | 14 +- .../app/stargate/app/genesis.go.plush | 4 +- .../app/stargate/app/params/encoding.go.plush | 16 + .../app/stargate/app/simulation_test.go.plush | 38 +- .../{{binaryNamePrefix}}d/cmd/config.go.plush | 23 + .../cmd/genaccounts.go.plush | 192 +++++++++ .../{{binaryNamePrefix}}d/cmd/root.go.plush | 398 ++++++++++++++++++ .../cmd/{{binaryNamePrefix}}d/main.go.plush | 27 +- ignite/templates/app/stargate/go.mod.plush | 184 +------- ignite/templates/app/stargate/tools.go.plush | 9 + ignite/templates/module/import/stargate.go | 24 +- ignite/templates/module/placeholders.go | 6 +- .../testutil/network/network.go.plush | 9 +- integration/app.go | 1 + 40 files changed, 949 insertions(+), 341 deletions(-) create mode 100644 ignite/pkg/cosmoscmd/cosmoscmd.go create mode 100644 ignite/templates/app/stargate/app/encoding.go.plush create mode 100644 ignite/templates/app/stargate/app/params/encoding.go.plush create mode 100644 ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush create mode 100644 ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush create mode 100644 ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush create mode 100644 ignite/templates/app/stargate/tools.go.plush diff --git a/changelog.md b/changelog.md index cad0b35a69..985349767a 100644 --- a/changelog.md +++ b/changelog.md @@ -35,6 +35,7 @@ ### Features +- Move cosmoscmd in chain's templates. - Add generated TS client test support to integration tests. ### Changes diff --git a/ignite/cmd/chain_serve.go b/ignite/cmd/chain_serve.go index ed988e39d2..c1c76f14f0 100644 --- a/ignite/cmd/chain_serve.go +++ b/ignite/cmd/chain_serve.go @@ -11,6 +11,7 @@ const ( flagForceReset = "force-reset" flagResetOnce = "reset-once" flagConfig = "config" + flagQuitOnFail = "quit-on-fail" ) // NewChainServe creates a new serve command to serve a blockchain. @@ -64,6 +65,7 @@ production, you may want to run "appd start" manually. c.Flags().BoolP("verbose", "v", false, "Verbose output") c.Flags().BoolP(flagForceReset, "f", false, "Force reset of the app state on start and every source change") c.Flags().BoolP(flagResetOnce, "r", false, "Reset of the app state on first start") + c.Flags().Bool(flagQuitOnFail, false, "Quit program if the app fails to start") return c } @@ -121,6 +123,13 @@ func chainServeHandler(cmd *cobra.Command, args []string) error { if resetOnce { serveOptions = append(serveOptions, chain.ServeResetOnce()) } + quitOnFail, err := cmd.Flags().GetBool(flagQuitOnFail) + if err != nil { + return err + } + if quitOnFail { + serveOptions = append(serveOptions, chain.QuitOnFail()) + } if flagGetSkipProto(cmd) { serveOptions = append(serveOptions, chain.ServeSkipProto()) diff --git a/ignite/cmd/network_chain_prepare.go b/ignite/cmd/network_chain_prepare.go index 76658d1c59..e05521004a 100644 --- a/ignite/cmd/network_chain_prepare.go +++ b/ignite/cmd/network_chain_prepare.go @@ -10,6 +10,7 @@ import ( "github.com/ignite/cli/ignite/pkg/cliui" "github.com/ignite/cli/ignite/pkg/cliui/colors" "github.com/ignite/cli/ignite/pkg/cliui/icons" + "github.com/ignite/cli/ignite/pkg/gitpod" "github.com/ignite/cli/ignite/pkg/goenv" "github.com/ignite/cli/ignite/services/network" "github.com/ignite/cli/ignite/services/network/networkchain" @@ -111,7 +112,11 @@ func networkChainPrepareHandler(cmd *cobra.Command, args []string) error { session.Printf("%s Chain is prepared for launch\n", icons.OK) session.Println("\nYou can start your node by running the following command:") - commandStr := fmt.Sprintf("%s start --home %s", binaryName, chainHome) + startCmd := "start" + if gitpod.IsOnGitpod() { + startCmd = "start-with-http-tunneling" + } + commandStr := fmt.Sprintf("%s %s --home %s", binaryName, startCmd, chainHome) session.Printf("\t%s/%s\n", binaryDir, colors.Info(commandStr)) return nil diff --git a/ignite/cmd/scaffold_band.go b/ignite/cmd/scaffold_band.go index 05a28b07ea..d5bb09ea5e 100644 --- a/ignite/cmd/scaffold_band.go +++ b/ignite/cmd/scaffold_band.go @@ -77,7 +77,7 @@ func createBandchainHandler(cmd *cobra.Command, args []string) error { return err } - sm, err := sc.AddOracle(cacheStorage, placeholder.New(), module, oracle, options...) + sm, err := sc.AddOracle(cmd.Context(), cacheStorage, placeholder.New(), module, oracle, options...) if err != nil { return err } diff --git a/ignite/cmd/scaffold_chain.go b/ignite/cmd/scaffold_chain.go index 2af2076618..776288939e 100644 --- a/ignite/cmd/scaffold_chain.go +++ b/ignite/cmd/scaffold_chain.go @@ -98,7 +98,10 @@ func scaffoldChainHandler(cmd *cobra.Command, args []string) error { return err } - appdir, err := scaffolder.Init(cacheStorage, placeholder.New(), appPath, name, addressPrefix, noDefaultModule) + appdir, err := scaffolder.Init( + cmd.Context(), cacheStorage, placeholder.New(), appPath, name, + addressPrefix, noDefaultModule, + ) if err != nil { return err } diff --git a/ignite/cmd/scaffold_module.go b/ignite/cmd/scaffold_module.go index e4b191c153..e93cf11f70 100644 --- a/ignite/cmd/scaffold_module.go +++ b/ignite/cmd/scaffold_module.go @@ -191,7 +191,7 @@ func scaffoldModuleHandler(cmd *cobra.Command, args []string) error { return err } - sm, err := sc.CreateModule(cacheStorage, placeholder.New(), name, options...) + sm, err := sc.CreateModule(cmd.Context(), cacheStorage, placeholder.New(), name, options...) if err != nil { var validationErr validation.Error if !requireRegistration && errors.As(err, &validationErr) { diff --git a/ignite/cmd/scaffold_mwasm.go b/ignite/cmd/scaffold_mwasm.go index 83c012a03d..ad9a649fed 100644 --- a/ignite/cmd/scaffold_mwasm.go +++ b/ignite/cmd/scaffold_mwasm.go @@ -39,7 +39,7 @@ func scaffoldWasmHandler(cmd *cobra.Command, args []string) error { return err } - sm, err := sc.ImportModule(cacheStorage, placeholder.New(), "wasm") + sm, err := sc.ImportModule(cmd.Context(), cacheStorage, placeholder.New(), "wasm") if err != nil { return err } diff --git a/ignite/pkg/cmdrunner/cmdrunner.go b/ignite/pkg/cmdrunner/cmdrunner.go index d1574334d9..56a2f31758 100644 --- a/ignite/pkg/cmdrunner/cmdrunner.go +++ b/ignite/pkg/cmdrunner/cmdrunner.go @@ -97,7 +97,12 @@ func (r *Runner) Run(ctx context.Context, steps ...*step.Step) error { // copy s to a new variable to allocate a new address // so we can safely use it inside goroutines spawned in this loop. if r.debug { - fmt.Printf("Step %d: %s %s\n", i, step.Exec.Command, + var cd string + if step.Workdir != "" { + cd = fmt.Sprintf("cd %s;", step.Workdir) + } + fmt.Printf("Step %d: %s%s %s %s\n", i, cd, strings.Join(step.Env, " "), + step.Exec.Command, strings.Join(step.Exec.Args, " ")) } step := step diff --git a/ignite/pkg/cosmoscmd/cosmoscmd.go b/ignite/pkg/cosmoscmd/cosmoscmd.go new file mode 100644 index 0000000000..a1b1173830 --- /dev/null +++ b/ignite/pkg/cosmoscmd/cosmoscmd.go @@ -0,0 +1,2 @@ +// Deprecated: the content of this package is now scaffolded in chains. +package cosmoscmd diff --git a/ignite/pkg/cosmoscmd/genaccounts.go b/ignite/pkg/cosmoscmd/genaccounts.go index 0589637c11..36f4654ee0 100644 --- a/ignite/pkg/cosmoscmd/genaccounts.go +++ b/ignite/pkg/cosmoscmd/genaccounts.go @@ -6,8 +6,6 @@ import ( "errors" "fmt" - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -18,6 +16,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/spf13/cobra" ) const ( diff --git a/ignite/pkg/cosmosgen/install.go b/ignite/pkg/cosmosgen/install.go index 5f6221ec7b..38c523bf09 100644 --- a/ignite/pkg/cosmosgen/install.go +++ b/ignite/pkg/cosmosgen/install.go @@ -1,39 +1,33 @@ package cosmosgen import ( - "bytes" "context" - "github.com/pkg/errors" - - "github.com/ignite/cli/ignite/pkg/cmdrunner" - "github.com/ignite/cli/ignite/pkg/cmdrunner/step" + "github.com/ignite/cli/ignite/pkg/gocmd" ) -// InstallDependencies installs protoc dependencies needed by Cosmos ecosystem. -func InstallDependencies(ctx context.Context, appPath string) error { - plugins := []string{ - // installs the gocosmos plugin. +func DepTools() []string { + return []string{ + // the gocosmos plugin. "github.com/regen-network/cosmos-proto/protoc-gen-gocosmos", - // install Go code generation plugin. + // Go code generation plugin. "github.com/golang/protobuf/protoc-gen-go", - // install grpc-gateway plugins. + // grpc-gateway plugins. "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway", "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2", } +} - errb := &bytes.Buffer{} - err := cmdrunner. - New( - cmdrunner.DefaultStderr(errb), - cmdrunner.DefaultWorkdir(appPath), - ). - Run(ctx, - step.New(step.Exec("go", append([]string{"get"}, plugins...)...)), - step.New(step.Exec("go", append([]string{"install"}, plugins...)...)), - ) - return errors.Wrap(err, errb.String()) +// InstallDepTools installs protoc dependencies needed by Cosmos ecosystem. +func InstallDepTools(ctx context.Context, appPath string) error { + // NOTE(tb): go get is not required thanks to tools.go, but for retrocompat + // with older scaffolded chains that doesn't have this file, we need to run + // it anyway. + if err := gocmd.Get(ctx, appPath, DepTools()); err != nil { + return err + } + return gocmd.Install(ctx, appPath, DepTools()) } diff --git a/ignite/pkg/gocmd/gocmd.go b/ignite/pkg/gocmd/gocmd.go index 7c05d6d2e9..16171caa65 100644 --- a/ignite/pkg/gocmd/gocmd.go +++ b/ignite/pkg/gocmd/gocmd.go @@ -17,6 +17,9 @@ const ( // CommandInstall represents go "install" command. CommandInstall = "install" + // CommandGet represents go "get" command. + CommandGet = "get" + // CommandBuild represents go "build" command. CommandBuild = "build" @@ -28,6 +31,9 @@ const ( // CommandModVerify represents go mod "verify" command. CommandModVerify = "verify" + + // CommandFmt represents go "fmt" command. + CommandFmt = "fmt" ) const ( @@ -51,6 +57,11 @@ func Name() string { return "go" } +// Fmt runs go fmt on path +func Fmt(ctx context.Context, path string, options ...exec.Option) error { + return exec.Exec(ctx, []string{Name(), CommandFmt, "./..."}, append(options, exec.StepOption(step.Workdir(path)))...) +} + // ModTidy runs go mod tidy on path with options. func ModTidy(ctx context.Context, path string, options ...exec.Option) error { return exec.Exec(ctx, []string{Name(), CommandMod, CommandModTidy}, append(options, exec.StepOption(step.Workdir(path)))...) @@ -100,6 +111,26 @@ func InstallAll(ctx context.Context, path string, flags []string, options ...exe return exec.Exec(ctx, command, append(options, exec.StepOption(step.Workdir(path)))...) } +// Install runs go install pkgs on path with options. +func Install(ctx context.Context, path string, pkgs []string, options ...exec.Option) error { + command := []string{ + Name(), + CommandInstall, + } + command = append(command, pkgs...) + return exec.Exec(ctx, command, append(options, exec.StepOption(step.Workdir(path)))...) +} + +// Get runs go get pkgs on path with options. +func Get(ctx context.Context, path string, pkgs []string, options ...exec.Option) error { + command := []string{ + Name(), + CommandGet, + } + command = append(command, pkgs...) + return exec.Exec(ctx, command, append(options, exec.StepOption(step.Workdir(path)))...) +} + // Ldflags returns a combined ldflags set from flags. func Ldflags(flags ...string) string { return strings.Join(flags, " ") diff --git a/ignite/services/chain/generate.go b/ignite/services/chain/generate.go index fc7d8b4b65..214322e7ce 100644 --- a/ignite/services/chain/generate.go +++ b/ignite/services/chain/generate.go @@ -115,7 +115,7 @@ func (c *Chain) Generate( return err } - if err := cosmosgen.InstallDependencies(ctx, c.app.Path); err != nil { + if err := cosmosgen.InstallDepTools(ctx, c.app.Path); err != nil { return err } diff --git a/ignite/services/chain/serve.go b/ignite/services/chain/serve.go index 31f778f6bc..90560527b3 100644 --- a/ignite/services/chain/serve.go +++ b/ignite/services/chain/serve.go @@ -62,6 +62,7 @@ type serveOptions struct { forceReset bool resetOnce bool skipProto bool + quitOnFail bool } func newServeOption() serveOptions { @@ -88,6 +89,13 @@ func ServeResetOnce() ServeOption { } } +// QuitOnFail exits the serve immediately if an error occurs. +func QuitOnFail() ServeOption { + return func(c *serveOptions) { + c.quitOnFail = true + } +} + // ServeSkipProto allows to serve the app without generate Go from proto func ServeSkipProto() ServeOption { return func(c *serveOptions) { @@ -179,11 +187,17 @@ func (c *Chain) Serve(ctx context.Context, cacheStorage cache.Storage, options . c.ev.Sendf("💿 Genesis state saved in %s", genesisPath) } case errors.As(err, &validationErr): + if serveOptions.quitOnFail { + return err + } // Change error message to add a link to the configuration docs err = fmt.Errorf("%w\nsee: https://github.com/ignite/cli#configure", err) c.ev.SendView(errorview.NewError(err), events.ProgressFinished()) case errors.As(err, &buildErr): + if serveOptions.quitOnFail { + return err + } c.ev.SendView(errorview.NewError(err), events.ProgressFinished()) case errors.As(err, &startErr): // Parse returned error logs diff --git a/ignite/services/network/peer.go b/ignite/services/network/peer.go index bf350d6e54..166b092423 100644 --- a/ignite/services/network/peer.go +++ b/ignite/services/network/peer.go @@ -1,11 +1,22 @@ package network import ( + "context" "fmt" + "path/filepath" "strings" + "time" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" "github.com/pkg/errors" launchtypes "github.com/tendermint/spn/x/launch/types" + + "github.com/ignite/cli/ignite/pkg/cosmosutil" + "github.com/ignite/cli/ignite/pkg/ctxticker" + "github.com/ignite/cli/ignite/pkg/gitpod" + "github.com/ignite/cli/ignite/pkg/xchisel" + "github.com/ignite/cli/ignite/services/network/networkchain" ) func PeerAddress(peer launchtypes.Peer) (string, error) { @@ -28,3 +39,63 @@ func ParsePeerAddress(addr string) (launchtypes.Peer, error) { } return launchtypes.NewPeerConn(sp[0], sp[1]), nil } + +const TunnelRerunDelay = 5 * time.Second + +// StartProxyForTunneledPeers starts an HTTP proxy server and HTTP proxy clients +// for each node that needs HTTP tunneling. +// HTTP tunneling is activated **ONLY** if your app's `$APP_HOME/config` dir has an `spn.yml` file +// and only if this file has `tunneled_peers` field inside with a list of tunneled peers/nodes. +// +// If you're using SPN as coordinator and do not want to allow HTTP tunneling feature at all, +// you can prevent `spn.yml` file to being generated by not approving validator requests +// that has HTTP tunneling enabled instead of plain TCP connections. +func StartProxyForTunneledPeers(ctx context.Context, clientCtx client.Context, serverCtx *server.Context) { + spnConfigPath := filepath.Join(clientCtx.HomeDir, cosmosutil.ChainConfigDir, networkchain.SPNConfigFile) + spnConfig, err := networkchain.GetSPNConfig(spnConfigPath) + if err != nil { + serverCtx.Logger.Error("Failed to open spn config file", "reason", err.Error()) + return + } + // exit if there aren't tunneled validators in the network + if len(spnConfig.TunneledPeers) == 0 { + return + } + + for _, peer := range spnConfig.TunneledPeers { + if peer.Name == networkchain.HTTPTunnelChisel { + peer := peer + go func() { + ctxticker.DoNow(ctx, TunnelRerunDelay, func() error { + serverCtx.Logger.Info("Starting chisel client", "tunnelAddress", peer.Address, "localPort", peer.LocalPort) + err := xchisel.StartClient(ctx, peer.Address, peer.LocalPort, "26656") + if err != nil { + serverCtx.Logger.Error("Failed to start chisel client", + "tunnelAddress", peer.Address, + "localPort", peer.LocalPort, + "reason", err.Error(), + ) + } + return nil + }) + }() + } + } + + if gitpod.IsOnGitpod() { + go func() { + ctxticker.DoNow(ctx, TunnelRerunDelay, func() error { + serverCtx.Logger.Info("Starting chisel server", "port", xchisel.DefaultServerPort) + err := xchisel.StartServer(ctx, xchisel.DefaultServerPort) + if err != nil { + serverCtx.Logger.Error( + "Failed to start chisel server", + "port", xchisel.DefaultServerPort, + "reason", err.Error(), + ) + } + return nil + }) + }() + } +} diff --git a/ignite/services/scaffolder/init.go b/ignite/services/scaffolder/init.go index b9fe640ae5..c4487db1b0 100644 --- a/ignite/services/scaffolder/init.go +++ b/ignite/services/scaffolder/init.go @@ -14,6 +14,9 @@ import ( "github.com/tendermint/flutter/v2" "github.com/ignite/cli/ignite/pkg/cache" + "github.com/ignite/cli/ignite/pkg/cmdrunner/exec" + "github.com/ignite/cli/ignite/pkg/cmdrunner/step" + "github.com/ignite/cli/ignite/pkg/gocmd" "github.com/ignite/cli/ignite/pkg/gomodulepath" "github.com/ignite/cli/ignite/pkg/localfs" "github.com/ignite/cli/ignite/pkg/placeholder" @@ -31,7 +34,7 @@ var ( ) // Init initializes a new app with name and given options. -func Init(cacheStorage cache.Storage, tracer *placeholder.Tracer, root, name, addressPrefix string, noDefaultModule bool) (path string, err error) { +func Init(ctx context.Context, cacheStorage cache.Storage, tracer *placeholder.Tracer, root, name, addressPrefix string, noDefaultModule bool) (path string, err error) { if root, err = filepath.Abs(root); err != nil { return "", err } @@ -44,11 +47,11 @@ func Init(cacheStorage cache.Storage, tracer *placeholder.Tracer, root, name, ad path = filepath.Join(root, pathInfo.Root) // create the project - if err := generate(tracer, pathInfo, addressPrefix, path, noDefaultModule); err != nil { + if err := generate(ctx, tracer, pathInfo, addressPrefix, path, noDefaultModule); err != nil { return "", err } - if err := finish(cacheStorage, path, pathInfo.RawPath); err != nil { + if err := finish(ctx, cacheStorage, path, pathInfo.RawPath); err != nil { return "", err } @@ -62,6 +65,7 @@ func Init(cacheStorage cache.Storage, tracer *placeholder.Tracer, root, name, ad //nolint:interfacer func generate( + ctx context.Context, tracer *placeholder.Tracer, pathInfo gomodulepath.Path, addressPrefix, @@ -92,7 +96,7 @@ func generate( runner.Root = absRoot return runner.Run() } - if err := run(genny.WetRunner(context.Background()), g); err != nil { + if err := run(genny.WetRunner(ctx), g); err != nil { return err } @@ -119,6 +123,14 @@ func generate( } + // FIXME(tb) untagged version of ignite/cli triggers a 404 not found when go + // mod tidy requests the sumdb, until we understand why, we disable sumdb. + // related issue: https://github.com/golang/go/issues/56174 + opt := exec.StepOption(step.Env("GOSUMDB=off")) + if err := gocmd.ModTidy(ctx, absRoot, opt); err != nil { + return err + } + // generate the vue app. return Vue(filepath.Join(absRoot, "vue")) } diff --git a/ignite/services/scaffolder/message.go b/ignite/services/scaffolder/message.go index bd356dd501..1752120c8e 100644 --- a/ignite/services/scaffolder/message.go +++ b/ignite/services/scaffolder/message.go @@ -167,7 +167,7 @@ func (s Scaffolder) AddMessage( if err != nil { return sm, err } - return sm, finish(cacheStorage, opts.AppPath, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath) } // checkForbiddenMessageField returns true if the name is forbidden as a message name diff --git a/ignite/services/scaffolder/module.go b/ignite/services/scaffolder/module.go index 8313bc1b39..8e2815b0f5 100644 --- a/ignite/services/scaffolder/module.go +++ b/ignite/services/scaffolder/module.go @@ -146,6 +146,7 @@ func WithDependencies(dependencies []modulecreate.Dependency) ModuleCreationOpti // CreateModule creates a new empty module in the scaffolded app func (s Scaffolder) CreateModule( + ctx context.Context, cacheStorage cache.Storage, tracer *placeholder.Tracer, moduleName string, @@ -227,11 +228,16 @@ func (s Scaffolder) CreateModule( return sm, runErr } - return sm, finish(cacheStorage, opts.AppPath, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath) } // ImportModule imports specified module with name to the scaffolded app. -func (s Scaffolder) ImportModule(cacheStorage cache.Storage, tracer *placeholder.Tracer, name string) (sm xgenny.SourceModification, err error) { +func (s Scaffolder) ImportModule( + ctx context.Context, + cacheStorage cache.Storage, + tracer *placeholder.Tracer, + name string, +) (sm xgenny.SourceModification, err error) { // Only wasm is currently supported if name != "wasm" { return sm, errors.New("module cannot be imported. Supported module: wasm") @@ -272,7 +278,7 @@ func (s Scaffolder) ImportModule(cacheStorage cache.Storage, tracer *placeholder return sm, err } - return sm, finish(cacheStorage, s.path, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, s.path, s.modpath.RawPath) } // moduleExists checks if the module exists in the app diff --git a/ignite/services/scaffolder/oracle.go b/ignite/services/scaffolder/oracle.go index 4ff78dca70..11c2ce7701 100644 --- a/ignite/services/scaffolder/oracle.go +++ b/ignite/services/scaffolder/oracle.go @@ -44,6 +44,7 @@ func OracleWithSigner(signer string) OracleOption { // AddOracle adds a new BandChain oracle envtest. func (s *Scaffolder) AddOracle( + ctx context.Context, cacheStorage cache.Storage, tracer *placeholder.Tracer, moduleName, @@ -108,7 +109,7 @@ func (s *Scaffolder) AddOracle( if err != nil { return sm, err } - return sm, finish(cacheStorage, opts.AppPath, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath) } func (s Scaffolder) installBandPacket() error { diff --git a/ignite/services/scaffolder/packet.go b/ignite/services/scaffolder/packet.go index 02f77ce393..6499af6c70 100644 --- a/ignite/services/scaffolder/packet.go +++ b/ignite/services/scaffolder/packet.go @@ -143,7 +143,7 @@ func (s Scaffolder) AddPacket( if err != nil { return sm, err } - return sm, finish(cacheStorage, opts.AppPath, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath) } // isIBCModule returns true if the provided module implements the IBC module interface diff --git a/ignite/services/scaffolder/query.go b/ignite/services/scaffolder/query.go index cb1ff9a13b..ef83229f08 100644 --- a/ignite/services/scaffolder/query.go +++ b/ignite/services/scaffolder/query.go @@ -87,5 +87,5 @@ func (s Scaffolder) AddQuery( if err != nil { return sm, err } - return sm, finish(cacheStorage, opts.AppPath, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath) } diff --git a/ignite/services/scaffolder/scaffolder.go b/ignite/services/scaffolder/scaffolder.go index 80df60c62a..5ef02aa558 100644 --- a/ignite/services/scaffolder/scaffolder.go +++ b/ignite/services/scaffolder/scaffolder.go @@ -10,8 +10,6 @@ import ( "github.com/ignite/cli/ignite/chainconfig" sperrors "github.com/ignite/cli/ignite/errors" "github.com/ignite/cli/ignite/pkg/cache" - "github.com/ignite/cli/ignite/pkg/cmdrunner" - "github.com/ignite/cli/ignite/pkg/cmdrunner/step" "github.com/ignite/cli/ignite/pkg/cosmosanalysis" "github.com/ignite/cli/ignite/pkg/cosmosgen" "github.com/ignite/cli/ignite/pkg/cosmosver" @@ -69,18 +67,18 @@ func App(path string) (Scaffolder, error) { return s, nil } -func finish(cacheStorage cache.Storage, path, gomodPath string) error { - if err := protoc(cacheStorage, path, gomodPath); err != nil { +func finish(ctx context.Context, cacheStorage cache.Storage, path, gomodPath string) error { + if err := protoc(ctx, cacheStorage, path, gomodPath); err != nil { return err } - if err := tidy(path); err != nil { + if err := gocmd.ModTidy(ctx, path); err != nil { return err } - return fmtProject(path) + return gocmd.Fmt(ctx, path) } -func protoc(cacheStorage cache.Storage, projectPath, gomodPath string) error { - if err := cosmosgen.InstallDependencies(context.Background(), projectPath); err != nil { +func protoc(ctx context.Context, cacheStorage cache.Storage, projectPath, gomodPath string) error { + if err := cosmosgen.InstallDepTools(ctx, projectPath); err != nil { return err } @@ -129,35 +127,5 @@ func protoc(cacheStorage cache.Storage, projectPath, gomodPath string) error { options = append(options, cosmosgen.WithOpenAPIGeneration(conf.Client.OpenAPI.Path)) } - return cosmosgen.Generate(context.Background(), cacheStorage, projectPath, conf.Build.Proto.Path, options...) -} - -func tidy(path string) error { - return cmdrunner. - New( - cmdrunner.DefaultStderr(os.Stderr), - cmdrunner.DefaultWorkdir(path), - ). - Run(context.Background(), - step.New( - step.Exec(gocmd.Name(), "mod", "tidy"), - ), - ) -} - -func fmtProject(path string) error { - return cmdrunner. - New( - cmdrunner.DefaultStderr(os.Stderr), - cmdrunner.DefaultWorkdir(path), - ). - Run(context.Background(), - step.New( - step.Exec( - gocmd.Name(), - "fmt", - "./...", - ), - ), - ) + return cosmosgen.Generate(ctx, cacheStorage, projectPath, conf.Build.Proto.Path, options...) } diff --git a/ignite/services/scaffolder/type.go b/ignite/services/scaffolder/type.go index 5f8c7f10b2..cb437cf824 100644 --- a/ignite/services/scaffolder/type.go +++ b/ignite/services/scaffolder/type.go @@ -245,7 +245,7 @@ func (s Scaffolder) AddType( return sm, err } - return sm, finish(cacheStorage, opts.AppPath, s.modpath.RawPath) + return sm, finish(ctx, cacheStorage, opts.AppPath, s.modpath.RawPath) } // checkForbiddenTypeIndex returns true if the name is forbidden as a field name diff --git a/ignite/templates/app/app.go b/ignite/templates/app/app.go index db059f4dce..0338f5e578 100644 --- a/ignite/templates/app/app.go +++ b/ignite/templates/app/app.go @@ -7,6 +7,7 @@ import ( "github.com/gobuffalo/plush" "github.com/gobuffalo/plushgen" + "github.com/ignite/cli/ignite/pkg/cosmosgen" "github.com/ignite/cli/ignite/pkg/xgenny" "github.com/ignite/cli/ignite/templates/field/plushhelpers" "github.com/ignite/cli/ignite/templates/testutil" @@ -30,6 +31,7 @@ func New(opts *Options) (*genny.Generator, error) { ctx.Set("GitHubPath", opts.GitHubPath) ctx.Set("BinaryNamePrefix", opts.BinaryNamePrefix) ctx.Set("AddressPrefix", opts.AddressPrefix) + ctx.Set("DepTools", cosmosgen.DepTools()) plushhelpers.ExtendPlushContext(ctx) g.Transformer(plushgen.Transformer(ctx)) diff --git a/ignite/templates/app/stargate/app/app.go.plush b/ignite/templates/app/stargate/app/app.go.plush index 7a713c5e73..d49fb6e709 100644 --- a/ignite/templates/app/stargate/app/app.go.plush +++ b/ignite/templates/app/stargate/app/app.go.plush @@ -102,13 +102,12 @@ import ( "github.com/tendermint/tendermint/libs/log" tmos "github.com/tendermint/tendermint/libs/os" dbm "github.com/tendermint/tm-db" - - "github.com/ignite/cli/ignite/pkg/cosmoscmd" "github.com/ignite/cli/ignite/pkg/openapiconsole" - "<%= ModulePath %>/docs" - // this line is used by starport scaffolding # stargate/app/moduleImport + + "<%= ModulePath %>/docs" + appparams "<%= ModulePath %>/app/params" ) const ( @@ -181,7 +180,6 @@ var ( ) var ( - _ cosmoscmd.App = (*App)(nil) _ servertypes.Application = (*App)(nil) _ simapp.App = (*App)(nil) ) @@ -256,15 +254,21 @@ func New( skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, - encodingConfig cosmoscmd.EncodingConfig, + encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) cosmoscmd.App { +) *App { appCodec := encodingConfig.Marshaler cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry - bApp := baseapp.NewBaseApp(Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) + bApp := baseapp.NewBaseApp( + Name, + logger, + db, + encodingConfig.TxConfig.TxDecoder(), + baseAppOptions..., + ) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) @@ -695,9 +699,6 @@ func New( // Name returns the name of the App func (app *App) Name() string { return app.BaseApp.Name() } -// GetBaseApp returns the base app of the application -func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } - // BeginBlocker application updates every begin block func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) diff --git a/ignite/templates/app/stargate/app/encoding.go.plush b/ignite/templates/app/stargate/app/encoding.go.plush new file mode 100644 index 0000000000..a376774363 --- /dev/null +++ b/ignite/templates/app/stargate/app/encoding.go.plush @@ -0,0 +1,35 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + + "<%= ModulePath %>/app/params" +) + +// makeEncodingConfig creates an EncodingConfig for an amino based test configuration. +func makeEncodingConfig() params.EncodingConfig { + amino := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) + + return params.EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: txCfg, + Amino: amino, + } +} + +// MakeEncodingConfig creates an EncodingConfig for testing +func MakeEncodingConfig() params.EncodingConfig { + encodingConfig := makeEncodingConfig() + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} diff --git a/ignite/templates/app/stargate/app/export.go.plush b/ignite/templates/app/stargate/app/export.go.plush index 815de1a7c8..4f09d80a51 100644 --- a/ignite/templates/app/stargate/app/export.go.plush +++ b/ignite/templates/app/stargate/app/export.go.plush @@ -4,13 +4,12 @@ import ( "encoding/json" "log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) // ExportAppStateAndValidators exports the state of the application for a genesis @@ -18,7 +17,6 @@ import ( func (app *App) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error) { - // as if they could withdraw from the start of the next block ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) @@ -50,7 +48,7 @@ func (app *App) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height +// in favour of export at a block height func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -112,7 +110,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) if err != nil { - panic(err) + panic(err) } return false }) @@ -120,12 +118,12 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // reinitialize all delegations for _, del := range dels { err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr()) - if err != nil { - panic(err) + if err != nil { + panic(err) } err = app.DistrKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr()) if err != nil { - panic(err) + panic(err) } } diff --git a/ignite/templates/app/stargate/app/genesis.go.plush b/ignite/templates/app/stargate/app/genesis.go.plush index 2cca151ef9..5bf0c1da80 100644 --- a/ignite/templates/app/stargate/app/genesis.go.plush +++ b/ignite/templates/app/stargate/app/genesis.go.plush @@ -3,7 +3,7 @@ package app import ( "encoding/json" - "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec" ) // The genesis state of the blockchain is represented here as a map of raw json @@ -17,5 +17,5 @@ type GenesisState map[string]json.RawMessage // NewDefaultGenesisState generates the default state for the application. func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) + return ModuleBasics.DefaultGenesis(cdc) } diff --git a/ignite/templates/app/stargate/app/params/encoding.go.plush b/ignite/templates/app/stargate/app/params/encoding.go.plush new file mode 100644 index 0000000000..3d634abf16 --- /dev/null +++ b/ignite/templates/app/stargate/app/params/encoding.go.plush @@ -0,0 +1,16 @@ +package params + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Marshaler codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} diff --git a/ignite/templates/app/stargate/app/simulation_test.go.plush b/ignite/templates/app/stargate/app/simulation_test.go.plush index cf2e22e397..ddb7bb4997 100644 --- a/ignite/templates/app/stargate/app/simulation_test.go.plush +++ b/ignite/templates/app/stargate/app/simulation_test.go.plush @@ -5,38 +5,21 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/stretchr/testify/require" - "github.com/ignite/cli/ignite/pkg/cosmoscmd" - "<%= ModulePath %>/app" abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmtypes "github.com/tendermint/tendermint/types" + + "<%= ModulePath %>/app" ) func init() { simapp.GetSimulatorFlags() } -type SimApp interface { - cosmoscmd.App - GetBaseApp() *baseapp.BaseApp - AppCodec() codec.Codec - SimulationManager() *module.SimulationManager - ModuleAccountAddrs() map[string]bool - Name() string - LegacyAmino() *codec.LegacyAmino - BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock - EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock - InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain -} - var defaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 200000, @@ -72,7 +55,7 @@ func BenchmarkSimulation(b *testing.B) { require.NoError(b, err) }) - encoding := cosmoscmd.MakeEncodingConfig(app.ModuleBasics) + encoding := app.MakeEncodingConfig() app := app.New( logger, @@ -86,24 +69,21 @@ func BenchmarkSimulation(b *testing.B) { simapp.EmptyAppOptions{}, ) - simApp, ok := app.(SimApp) - require.True(b, ok, "can't use simapp") - // Run randomized simulations _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, - simApp.GetBaseApp(), - simapp.AppStateFn(simApp.AppCodec(), simApp.SimulationManager()), + app.BaseApp, + simapp.AppStateFn(app.AppCodec(), app.SimulationManager()), simulationtypes.RandomAccounts, - simapp.SimulationOperations(simApp, simApp.AppCodec(), config), - simApp.ModuleAccountAddrs(), + simapp.SimulationOperations(app, app.AppCodec(), config), + app.ModuleAccountAddrs(), config, - simApp.AppCodec(), + app.AppCodec(), ) // export state and simParams before the simulation error is checked - err = simapp.CheckExportSimulation(simApp, config, simParams) + err = simapp.CheckExportSimulation(app, config, simParams) require.NoError(b, err) require.NoError(b, simErr) diff --git a/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush new file mode 100644 index 0000000000..580a6ae7de --- /dev/null +++ b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush @@ -0,0 +1,23 @@ +package cmd + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "<%= ModulePath %>/app" +) + +func initSDKConfig() { + // Set prefixes + accountPubKeyPrefix := app.AccountAddressPrefix + "pub" + validatorAddressPrefix := app.AccountAddressPrefix + "valoper" + validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" + consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" + consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" + + // Set and seal config + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) + config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) + config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) + config.Seal() +} diff --git a/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush new file mode 100644 index 0000000000..d5ec65337f --- /dev/null +++ b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush @@ -0,0 +1,192 @@ +package cmd + +import ( + "bufio" + "encoding/json" + "errors" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/spf13/cobra" +) + +const ( + flagVestingStart = "vesting-start-time" + flagVestingEnd = "vesting-end-time" + flagVestingAmt = "vesting-amount" +) + +// AddGenesisAccountCmd returns add-genesis-account cobra Command. +func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", + Short: "Add a genesis account to genesis.json", + Long: `Add a genesis account to genesis.json. The provided account must specify +the account address or key name and a list of initial coins. If a key name is given, +the address will be looked up in the local Keybase. The list of initial tokens must +contain valid denominations. Accounts may optionally be supplied with vesting parameters. +`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + cdc := clientCtx.Codec + + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + config.SetRoot(clientCtx.HomeDir) + + coins, err := sdk.ParseCoinsNormalized(args[1]) + if err != nil { + return fmt.Errorf("failed to parse coins: %w", err) + } + + addr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + inBuf := bufio.NewReader(cmd.InOrStdin()) + keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend) + if err != nil { + return err + } + + // attempt to lookup address from Keybase if no address was provided + kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf, cdc) + if err != nil { + return err + } + + info, err := kb.Key(args[0]) + if err != nil { + return fmt.Errorf("failed to get address from Keybase: %w", err) + } + + addr, err = info.GetAddress() + if err != nil { + return fmt.Errorf("failed to get address from Keybase: %w", err) + } + } + + vestingStart, err := cmd.Flags().GetInt64(flagVestingStart) + if err != nil { + return err + } + vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd) + if err != nil { + return err + } + vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt) + if err != nil { + return err + } + + vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) + if err != nil { + return fmt.Errorf("failed to parse vesting amount: %w", err) + } + + // create concrete account type based on input parameters + var genAccount authtypes.GenesisAccount + + balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} + baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) + + if !vestingAmt.IsZero() { + baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) + + if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || + baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { + return errors.New("vesting amount cannot be greater than total amount") + } + + switch { + case vestingStart != 0 && vestingEnd != 0: + genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) + + case vestingEnd != 0: + genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) + + default: + return errors.New("invalid vesting parameters; must supply start and end time or end time") + } + } else { + genAccount = baseAccount + } + + if err := genAccount.Validate(); err != nil { + return fmt.Errorf("failed to validate new genesis account: %w", err) + } + + genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + if err != nil { + return fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) + + accs, err := authtypes.UnpackAccounts(authGenState.Accounts) + if err != nil { + return fmt.Errorf("failed to get accounts from any: %w", err) + } + + if accs.Contains(addr) { + return fmt.Errorf("cannot add account at existing address %s", addr) + } + + // Add the new account to the set of genesis accounts and sanitize the + // accounts afterwards. + accs = append(accs, genAccount) + accs = authtypes.SanitizeGenesisAccounts(accs) + + genAccs, err := authtypes.PackAccounts(accs) + if err != nil { + return fmt.Errorf("failed to convert accounts into any's: %w", err) + } + authGenState.Accounts = genAccs + + authGenStateBz, err := cdc.MarshalJSON(&authGenState) + if err != nil { + return fmt.Errorf("failed to marshal auth genesis state: %w", err) + } + + appState[authtypes.ModuleName] = authGenStateBz + + bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState) + bankGenState.Balances = append(bankGenState.Balances, balances) + bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) + + bankGenStateBz, err := cdc.MarshalJSON(bankGenState) + if err != nil { + return fmt.Errorf("failed to marshal bank genesis state: %w", err) + } + + appState[banktypes.ModuleName] = bankGenStateBz + + appStateJSON, err := json.Marshal(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + + genDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(genDoc, genFile) + }, + } + + cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") + cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") + cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush new file mode 100644 index 0000000000..e6ea7c43ec --- /dev/null +++ b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush @@ -0,0 +1,398 @@ +package cmd + +import ( + "errors" + "io" + "os" + "path/filepath" + "strings" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/server" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/snapshots" + snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" + "github.com/cosmos/cosmos-sdk/store" + sdk "github.com/cosmos/cosmos-sdk/types" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + "github.com/ignite/cli/ignite/services/network" + "github.com/spf13/cast" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + tmcfg "github.com/tendermint/tendermint/config" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" + // this line is used by starport scaffolding # root/moduleImport + + "<%= ModulePath %>/app" + appparams "<%= ModulePath %>/app/params" +) + +// NewRootCmd creates a new root command for a Cosmos SDK application +func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { + encodingConfig := app.MakeEncodingConfig() + initClientCtx := client.Context{}. + WithCodec(encodingConfig.Marshaler). + WithInterfaceRegistry(encodingConfig.InterfaceRegistry). + WithTxConfig(encodingConfig.TxConfig). + WithLegacyAmino(encodingConfig.Amino). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(app.DefaultNodeHome). + WithViper("") + + rootCmd := &cobra.Command{ + Use: app.Name + "d", + Short: "Stargate CosmosHub App", + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + // set the default command outputs + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) + if err != nil { + return err + } + initClientCtx, err = config.ReadFromClientConfig(initClientCtx) + if err != nil { + return err + } + + if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + customTMConfig := initTendermintConfig() + return server.InterceptConfigsPreRunHandler( + cmd, customAppTemplate, customAppConfig, customTMConfig, + ) + }, + } + + initRootCmd(rootCmd, encodingConfig) + overwriteFlagDefaults(rootCmd, map[string]string{ + flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), + flags.FlagKeyringBackend: "test", + }) + + return rootCmd, encodingConfig +} + +// initTendermintConfig helps to override default Tendermint Config values. +// return tmcfg.DefaultConfig if no custom configuration is required for the application. +func initTendermintConfig() *tmcfg.Config { + cfg := tmcfg.DefaultConfig() + return cfg +} + +func initRootCmd( + rootCmd *cobra.Command, + encodingConfig appparams.EncodingConfig, +) { + // Set config + initSDKConfig() + + rootCmd.AddCommand( + genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), + genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + genutilcli.MigrateGenesisCmd(), + genutilcli.GenTxCmd( + app.ModuleBasics, + encodingConfig.TxConfig, + banktypes.GenesisBalancesIterator{}, + app.DefaultNodeHome, + ), + genutilcli.ValidateGenesisCmd(app.ModuleBasics), + AddGenesisAccountCmd(app.DefaultNodeHome), + tmcli.NewCompletionCmd(rootCmd, true), + debug.Cmd(), + config.Cmd(), + // this line is used by starport scaffolding # root/commands + ) + + a := appCreator{ + encodingConfig, + } + + // add server commands + server.AddCommands( + rootCmd, + app.DefaultNodeHome, + a.newApp, + a.appExport, + addModuleInitFlags, + ) + + // add keybase, auxiliary RPC, query, and tx child commands + rootCmd.AddCommand( + rpc.StatusCommand(), + queryCommand(), + txCommand(), + keys.Commands(app.DefaultNodeHome), + startWithTunnelingCommand(a, app.DefaultNodeHome), + ) +} + +// queryCommand returns the sub-command to send queries to the app +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetAccountCmd(), + rpc.ValidatorCommand(), + rpc.BlockCommand(), + authcmd.QueryTxsByEventsCmd(), + authcmd.QueryTxCmd(), + ) + + app.ModuleBasics.AddQueryCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +// txCommand returns the sub-command to send transactions to the app +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + ) + + app.ModuleBasics.AddTxCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +// startWithTunnelingCommand returns a new start command with http tunneling +// enabled. +func startWithTunnelingCommand(appCreator appCreator, defaultNodeHome string) *cobra.Command { + startCmd := server.StartCmd(appCreator.newApp, defaultNodeHome) + startCmd.Use = "start-with-http-tunneling" + startCmd.Short = "Run the full node with http tunneling" + // Backup existing PreRunE, since we'll override it. + startPreRunE := startCmd.PreRunE + startCmd.PreRunE = func(cmd *cobra.Command, args []string) error { + var ( + ctx = cmd.Context() + clientCtx = client.GetClientContextFromCmd(cmd) + serverCtx = server.GetServerContextFromCmd(cmd) + ) + network.StartProxyForTunneledPeers(ctx, clientCtx, serverCtx) + if startPreRunE == nil { + return nil + } + return startPreRunE(cmd, args) + } + return startCmd +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) + // this line is used by starport scaffolding # root/arguments +} + +func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { + set := func(s *pflag.FlagSet, key, val string) { + if f := s.Lookup(key); f != nil { + f.DefValue = val + f.Value.Set(val) + } + } + for key, val := range defaults { + set(c.Flags(), key, val) + set(c.PersistentFlags(), key, val) + } + for _, c := range c.Commands() { + overwriteFlagDefaults(c, defaults) + } +} + +type appCreator struct { + encodingConfig appparams.EncodingConfig +} + +// newApp creates a new Cosmos SDK app +func (a appCreator) newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + var cache sdk.MultiStorePersistentCache + + if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { + cache = store.NewCommitKVStoreCacheManager() + } + + skipUpgradeHeights := make(map[int64]bool) + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + + pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) + if err != nil { + panic(err) + } + + snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") + snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir) + if err != nil { + panic(err) + } + snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) + if err != nil { + panic(err) + } + + snapshotOptions := snapshottypes.NewSnapshotOptions( + cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), + cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), + ) + + return app.New( + logger, + db, + traceStore, + true, + skipUpgradeHeights, + cast.ToString(appOpts.Get(flags.FlagHome)), + cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), + a.encodingConfig, + appOpts, + baseapp.SetPruning(pruningOpts), + baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), + baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), + baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), + baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), + baseapp.SetInterBlockCache(cache), + baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), + baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), + baseapp.SetSnapshot(snapshotStore, snapshotOptions), + ) +} + +// appExport creates a new simapp (optionally at a given height) +func (a appCreator) appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, +) (servertypes.ExportedApp, error) { + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home not set") + } + + app := app.New( + logger, + db, + traceStore, + height == -1, // -1: no height provided + map[int64]bool{}, + homePath, + uint(1), + a.encodingConfig, + appOpts, + ) + + if height != -1 { + if err := app.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } + + return app.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs) +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + + // WASMConfig defines configuration for the wasm module. + type WASMConfig struct { + // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries + QueryGasLimit uint64 `mapstructure:"query_gas_limit"` + + // Address defines the gRPC-web server to listen on + LruSize uint64 `mapstructure:"lru_size"` + } + + type CustomAppConfig struct { + serverconfig.Config + + WASM WASMConfig `mapstructure:"wasm"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In simapp, we set the min gas prices to 0. + srvCfg.MinGasPrices = "0stake" + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + WASM: WASMConfig{ + LruSize: 1, + QueryGasLimit: 300000, + }, + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + ` +[wasm] +# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +query_gas_limit = 300000 +# This is the number of wasm vm instances we keep cached in memory for speed-up +# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally +lru_size = 0` + + return customAppTemplate, customAppConfig +} diff --git a/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/main.go.plush b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/main.go.plush index 83191ff50f..39d4d70cd8 100644 --- a/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/main.go.plush +++ b/ignite/templates/app/stargate/cmd/{{binaryNamePrefix}}d/main.go.plush @@ -3,23 +3,22 @@ package main import ( "os" - svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + "github.com/cosmos/cosmos-sdk/server" + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + "<%= ModulePath %>/app" - "github.com/ignite/cli/ignite/pkg/cosmoscmd" - "github.com/ignite/cli/ignite/pkg/xstrings" + "<%= ModulePath %>/cmd/<%= BinaryNamePrefix %>d/cmd" ) func main() { - rootCmd, _ := cosmoscmd.NewRootCmd( - app.Name, - app.AccountAddressPrefix, - app.DefaultNodeHome, - xstrings.NoDash(app.Name), - app.ModuleBasics, - app.New, - // this line is used by starport scaffolding # root/arguments - ) - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - os.Exit(1) + rootCmd, _ := cmd.NewRootCmd() + if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { + switch e := err.(type) { + case server.ErrorCode: + os.Exit(e.Code) + + default: + os.Exit(1) + } } } diff --git a/ignite/templates/app/stargate/go.mod.plush b/ignite/templates/app/stargate/go.mod.plush index ae758db812..660e179679 100644 --- a/ignite/templates/app/stargate/go.mod.plush +++ b/ignite/templates/app/stargate/go.mod.plush @@ -8,9 +8,12 @@ require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 github.com/ignite/cli v0.24.1 + github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.5.0 + github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.0 github.com/tendermint/tendermint v0.34.21 github.com/tendermint/tm-db v0.6.7 @@ -19,185 +22,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -require ( - cloud.google.com/go v0.102.0 // indirect - cloud.google.com/go/compute v1.7.0 // indirect - cloud.google.com/go/iam v0.3.0 // indirect - cloud.google.com/go/storage v1.22.1 // indirect - cosmossdk.io/errors v1.0.0-beta.7 // indirect - cosmossdk.io/math v1.0.0-beta.3 // indirect - filippo.io/edwards25519 v1.0.0-rc.1 // indirect - github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/Microsoft/go-winio v0.5.2 // indirect - github.com/Microsoft/hcsshim v0.9.3 // indirect - github.com/Workiva/go-datastructures v1.0.53 // indirect - github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect - github.com/armon/go-metrics v0.4.0 // indirect - github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 // indirect - github.com/aws/aws-sdk-go v1.40.45 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/bgentry/speakeasy v0.1.0 // indirect - github.com/blang/semver v3.5.1+incompatible // indirect - github.com/btcsuite/btcd v0.22.1 // indirect - github.com/buger/jsonparser v1.1.1 // indirect - github.com/cenkalti/backoff v2.2.1+incompatible // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/confio/ics23/go v0.7.0 // indirect - github.com/containerd/cgroups v1.0.3 // indirect - github.com/containerd/containerd v1.6.6 // indirect - github.com/cosmos/btcutil v1.0.4 // indirect - github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gorocksdb v1.2.0 // indirect - github.com/cosmos/iavl v0.19.1 // indirect - github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect - github.com/cosmos/ledger-go v0.9.2 // indirect - github.com/creachadair/taskgroup v0.3.2 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect - github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.0 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/docker v20.10.17+incompatible // indirect - github.com/docker/go-units v0.4.0 // indirect - github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect - github.com/emicklei/proto v1.9.0 // indirect - github.com/emirpasic/gods v1.12.0 // indirect - github.com/fatih/color v1.13.0 // indirect - github.com/felixge/httpsnoop v1.0.1 // indirect - github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-git/gcfg v1.5.0 // indirect - github.com/go-git/go-billy/v5 v5.0.0 // indirect - github.com/go-git/go-git/v5 v5.1.0 // indirect - github.com/go-kit/kit v0.12.0 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect - github.com/goccy/go-yaml v1.9.4 // indirect - github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/glog v1.0.0 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.0.1 // indirect - github.com/google/go-cmp v0.5.8 // indirect - github.com/google/orderedcode v0.0.1 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa // indirect - github.com/googleapis/gax-go/v2 v2.4.0 // indirect - github.com/googleapis/go-type-adapters v1.0.0 // indirect - github.com/gookit/color v1.5.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/mux v1.8.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect - github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.6.1 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-safetemp v1.0.0 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect - github.com/iancoleman/strcase v0.2.0 // indirect - github.com/imdario/mergo v0.3.13 // indirect - github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/jpillora/ansi v1.0.2 // indirect - github.com/jpillora/backoff v1.0.0 // indirect - github.com/jpillora/chisel v1.7.7 // indirect - github.com/jpillora/requestlog v1.0.0 // indirect - github.com/jpillora/sizestr v1.0.0 // indirect - github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect - github.com/klauspost/compress v1.15.9 // indirect - github.com/lib/pq v1.10.6 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect - github.com/mattn/go-zglob v0.0.3 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect - github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect - github.com/minio/highwayhash v1.0.2 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/go-testing-interface v1.0.0 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moby/sys/mount v0.3.1 // indirect - github.com/moby/sys/mountinfo v0.6.0 // indirect - github.com/mtibben/percent v0.2.1 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect - github.com/opencontainers/runc v1.1.3 // indirect - github.com/otiai10/copy v1.6.0 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.2 // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.12.2 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.34.0 // indirect - github.com/prometheus/procfs v0.7.3 // indirect - github.com/radovskyb/watcher v1.0.7 // indirect - github.com/rakyll/statik v0.1.7 // indirect - github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect - github.com/regen-network/cosmos-proto v0.3.1 // indirect - github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.27.0 // indirect - github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect - github.com/sergi/go-diff v1.2.0 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect - github.com/spf13/afero v1.8.2 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.12.0 // indirect - github.com/subosito/gotenv v1.4.0 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect - github.com/takuoki/gocase v1.0.0 // indirect - github.com/tendermint/btcd v0.1.1 // indirect - github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect - github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tendermint/spn v0.2.1-0.20220826123316-985b629a92dd // indirect - github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect - github.com/ulikunitz/xz v0.5.8 // indirect - github.com/xanzy/ssh-agent v0.2.1 // indirect - github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect - github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - go.opencensus.io v0.23.0 // indirect - golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/net v0.0.0-20220726230323-06994584191e // indirect - golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 // indirect - golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.0.0-20220727055044-e65921a090b8 // indirect - golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect - google.golang.org/api v0.84.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.28.1 // indirect - gopkg.in/ini.v1 v1.66.6 // indirect - gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - nhooyr.io/websocket v1.8.6 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect -) - replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/ignite/templates/app/stargate/tools.go.plush b/ignite/templates/app/stargate/tools.go.plush new file mode 100644 index 0000000000..9b9b5bb60e --- /dev/null +++ b/ignite/templates/app/stargate/tools.go.plush @@ -0,0 +1,9 @@ +//go:build tools + +package tools + +import ( + <%= for (depTool) in DepTools { %> + _ "<%= depTool %>" + <% } %> +) diff --git a/ignite/templates/module/import/stargate.go b/ignite/templates/module/import/stargate.go index e35b9deac9..20c3786b28 100644 --- a/ignite/templates/module/import/stargate.go +++ b/ignite/templates/module/import/stargate.go @@ -148,21 +148,29 @@ func appModifyStargate(replacer placeholder.Replacer, opts *ImportOptions) genny // main.go modification on Stargate when importing wasm func cmdModifyStargate(replacer placeholder.Replacer, opts *ImportOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "cmd", opts.BinaryNamePrefix+"d/main.go") + path := filepath.Join(opts.AppPath, "cmd", opts.BinaryNamePrefix+"d/cmd/root.go") f, err := r.Disk.Find(path) if err != nil { return err } - templateArgs := `cosmoscmd.AddSubCmd(wasmcmd.GenesisWasmMsgCmd(app.DefaultNodeHome)), -cosmoscmd.CustomizeStartCmd(wasmcmd.AddModuleInitFlags), + // add wasm import + templateImport := `%[1]v + "github.com/tendermint/spm-extras/wasmcmd"` + replacementImport := fmt.Sprintf(templateImport, module.PlaceholderSgRootModuleImport) + content := replacer.Replace(f.String(), module.PlaceholderSgRootModuleImport, replacementImport) + + // add wasm command + templateCommands := `wasmcmd.GenesisWasmMsgCmd(app.DefaultNodeHome), %[1]v` - replacementArgs := fmt.Sprintf(templateArgs, module.PlaceholderSgRootArgument) - content := replacer.Replace(f.String(), module.PlaceholderSgRootArgument, replacementArgs) + replacementCommands := fmt.Sprintf(templateCommands, module.PlaceholderSgRootCommands) + content = replacer.Replace(content, module.PlaceholderSgRootCommands, replacementCommands) - // import spm-extras. - content = replacer.Replace(content, "package main", `package main -import "github.com/tendermint/spm-extras/wasmcmd"`) + // add wasm start args + templateArgs := `wasmcmd.AddModuleInitFlags(startCmd) + %[1]v` + replacementArgs := fmt.Sprintf(templateArgs, module.PlaceholderSgRootArgument) + content = replacer.Replace(content, module.PlaceholderSgRootArgument, replacementArgs) newFile := genny.NewFileS(path, content) return r.File(newFile) diff --git a/ignite/templates/module/placeholders.go b/ignite/templates/module/placeholders.go index 708c693a26..0d8f203879 100644 --- a/ignite/templates/module/placeholders.go +++ b/ignite/templates/module/placeholders.go @@ -23,7 +23,11 @@ const ( // Placeholders in Stargate app.go for wasm PlaceholderSgWasmAppEnabledProposals = "// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals" - PlaceholderSgRootArgument = "// this line is used by starport scaffolding # root/arguments" + + // Placeholders in cmd/appd/cmd/root.go + PlaceholderSgRootModuleImport = "// this line is used by starport scaffolding # root/moduleImport" + PlaceholderSgRootCommands = "// this line is used by starport scaffolding # root/commands" + PlaceholderSgRootArgument = "// this line is used by starport scaffolding # root/arguments" // Placeholders IBC PlaceholderIBCKeysName = "// this line is used by starport scaffolding # ibc/keys/name" diff --git a/ignite/templates/testutil/stargate/testutil/network/network.go.plush b/ignite/templates/testutil/stargate/testutil/network/network.go.plush index 02655e68c9..8ad18a1d35 100644 --- a/ignite/templates/testutil/stargate/testutil/network/network.go.plush +++ b/ignite/templates/testutil/stargate/testutil/network/network.go.plush @@ -5,7 +5,8 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" + "<%= ModulePath %>/app" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -15,11 +16,9 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/network" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/ignite/cli/ignite/pkg/cosmoscmd" + "github.com/stretchr/testify/require" tmrand "github.com/tendermint/tendermint/libs/rand" tmdb "github.com/tendermint/tm-db" - - "<%= ModulePath %>/app" ) type ( @@ -48,7 +47,7 @@ func New(t *testing.T, configs ...network.Config) *network.Network { // DefaultConfig will initialize config for the network with custom application, // genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig func DefaultConfig() network.Config { - encoding := cosmoscmd.MakeEncodingConfig(app.ModuleBasics) + encoding := app.MakeEncodingConfig() return network.Config{ Codec: encoding.Marshaler, TxConfig: encoding.TxConfig, diff --git a/integration/app.go b/integration/app.go index 18223fa5da..88f50c74b5 100644 --- a/integration/app.go +++ b/integration/app.go @@ -124,6 +124,7 @@ func (a App) Serve(msg string, options ...ExecOption) (ok bool) { "chain", "serve", "-v", + "--quit-on-fail", } if a.homePath != "" { From 4979da1137d9ace6ad40aa9ed588f640a22c5ea5 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Mon, 17 Oct 2022 09:09:43 -0400 Subject: [PATCH 8/9] docs: fix migration docs (#2912) * fix sidebar * fix v0.22.0 migration * Update docs/docs/migration/v0.22.0.md Co-authored-by: Lucas Bertrand * set positions Co-authored-by: Lucas Bertrand --- docs/docs/migration/v0.22.0.md | 13 +++++++++++-- docs/docs/migration/v0.22.2.md | 16 ---------------- docs/docs/migration/v0.24.0.md | 2 +- docs/docs/migration/v0.25.0.md | 4 ++-- 4 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 docs/docs/migration/v0.22.2.md diff --git a/docs/docs/migration/v0.22.0.md b/docs/docs/migration/v0.22.0.md index 8c3c5b5a8a..13eedde81f 100644 --- a/docs/docs/migration/v0.22.0.md +++ b/docs/docs/migration/v0.22.0.md @@ -6,9 +6,18 @@ description: For chains that were scaffolded with Ignite CLI versions lower than # Upgrading a blockchain to use Ignite CLI v0.22.0 -1. Open your `go.mod` and change the Ignite CLI line with `github.com/ignite-hq/cli v0.22.0` +Ignite CLI v0.22.2 changed the GitHub username from "ignite-hq" to "ignite", which means the imports must be fixed to reflect this change. -2. Upgrade your IBC version to [v3](https://github.com/cosmos/ibc-go/releases/tag/v3.0.0). +1. In your `go.mod` file find the require line for Ignite CLI that starts with `github.com/ignite-hq/cli` and is followed by a version. + It looks something like `github.com/ignite-hq/cli v0.22.0`, and replace it by `github.com/ignite/cli v0.22.2`. + +2. Make a bulk find and replace in the import statements for `github.com/ignite-hq/cli` to be replaced by `github.com/ignite/cli`. + +3. Finally run `go mod tidy` and ensure there's no mention if `ignite-hq/cli` in your `go.sum` file. + +This update includes an upgrade to the `ibc-go` packages. Please make the according changes: + +1. Upgrade your IBC version to [v3](https://github.com/cosmos/ibc-go/releases/tag/v3.0.0). 1. Search for `github.com/cosmos/ibc-go/v2` in the import statements of your `.go` files and replace `v2` in the end with `v3` diff --git a/docs/docs/migration/v0.22.2.md b/docs/docs/migration/v0.22.2.md deleted file mode 100644 index d4bcd6ff88..0000000000 --- a/docs/docs/migration/v0.22.2.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -sidebar_position: 1 -title: v0.22.2 -description: For chains that were scaffolded with Ignite CLI versions lower than v0.22.2, changes are required to use Ignite CLI v0.22.2. ---- - -# Upgrading a blockchain to use Ignite CLI v0.22.2 - -Ignite CLI v0.22.2 changed the GitHub username from "ignite-hq" to "ignite", which means the imports must be fixed to reflect this change. - -1. In your `go.mod` file find the require line for Ignite CLI that starts with `github.com/ignite-hq/cli` and is followed by a version. - It looks something like `github.com/ignite-hq/cli v0.22.0`, and replace it by `github.com/ignite/cli v0.22.2`. - -2. Make a bulk find and replace in the import statements for `github.com/ignite-hq/cli` to be replaced by `github.com/ignite/cli`. - -3. Finally run `go mod tidy` and ensure there's no mention if `ignite-hq/cli` in your `go.mod` file. diff --git a/docs/docs/migration/v0.24.0.md b/docs/docs/migration/v0.24.0.md index 1fb23bd7a6..79d7036b7b 100644 --- a/docs/docs/migration/v0.24.0.md +++ b/docs/docs/migration/v0.24.0.md @@ -1,5 +1,5 @@ --- -sidebar_position: 0 +sidebar_position: 1 title: v0.24.0 description: For chains that were scaffolded with Ignite CLI versions lower than v0.24, changes are required to use Ignite CLI v0.24. --- diff --git a/docs/docs/migration/v0.25.0.md b/docs/docs/migration/v0.25.0.md index 85560081f1..0abcaaf216 100644 --- a/docs/docs/migration/v0.25.0.md +++ b/docs/docs/migration/v0.25.0.md @@ -1,7 +1,7 @@ --- sidebar_position: 0 -title: v0.24.0 -description: For chains that were scaffolded with Ignite CLI versions lower than v0.25,0, changes are required to use Ignite CLI v0.24.0. +title: v0.25.0 +description: For chains that were scaffolded with Ignite CLI versions lower than v0.25.0. changes are required to use Ignite CLI v0.24.0. --- ## Protobuf directory migration From 83a0746ec96452ad588b800bbfb6ca4f4bf4e8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Mon, 17 Oct 2022 16:21:49 +0300 Subject: [PATCH 9/9] docs(changelog): fix format (#2932) --- changelog.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index 985349767a..6db776011d 100644 --- a/changelog.md +++ b/changelog.md @@ -4,8 +4,10 @@ ### Features - Add `pkg/cosmostxcollector` package with support to query and save TXs and events. -- Add `ignite network coordinator` command set -- Add `ignite network validator` command set +- Add `ignite network coordinator` command set. +- Add `ignite network validator` command set. +- Move cosmoscmd in chain's templates. +- Add generated TS client test support to integration tests. ### Changes @@ -21,6 +23,8 @@ - Change CLI to use an events bus to print to stdout. - Move generated proto files to `proto/{appname}/{module}` - Update `pkg/cosmosanalysis` to detect when proto RPC services are using pagination. +- Change nightly tag format +- Add cosmos-sdk version in `version` command ### Fixes @@ -33,16 +37,6 @@ - Change session print loop to block until all events are handled. - Handle "No records were found in keyring" message when checking keys. -### Features - -- Move cosmoscmd in chain's templates. -- Add generated TS client test support to integration tests. - -### Changes - -- Change nightly tag format -- Add cosmos-sdk version in `version` command - ## [`v0.24.1`](https://github.com/ignite/cli/releases/tag/v0.24.1) ### Features