diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index e515d8c7..e881d1b4 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci-smart-contract.yml b/.github/workflows/ci-smart-contract.yml index 233c3e40..613b97a5 100644 --- a/.github/workflows/ci-smart-contract.yml +++ b/.github/workflows/ci-smart-contract.yml @@ -9,7 +9,7 @@ on: env: TEST_DOCKER_IMAGE: finschianode:smartcontractci - GO_VERSION: "1.20" + GO_VERSION: "1.21" jobs: cleanup-runs: diff --git a/.github/workflows/e2e-ibc.yml b/.github/workflows/e2e-ibc.yml index 26e4e957..9d0c5169 100644 --- a/.github/workflows/e2e-ibc.yml +++ b/.github/workflows/e2e-ibc.yml @@ -13,7 +13,7 @@ permissions: packages: write env: - GO_VERSION: '1.20' + GO_VERSION: '1.21' TAR_PATH: /tmp/fnsad-docker-image.tar IMAGE_NAME: finschia diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 8a3b200b..64d1ecc8 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -13,22 +13,18 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - uses: actions/cache@v3 id: cache with: path: ~/go/bin - key: ${{ runner.os }}-go-v1.20-misspell-v0.3.4-goimports-reviser-v3.4.5 + key: ${{ runner.os }}-go-v1.21-misspell-v0.3.4 - name: install misspell if: steps.cache.outputs.cache-hit != 'true' run: | go install github.com/client9/misspell/cmd/misspell@v0.3.4 - - name: install goimports-reviser - if: steps.cache.outputs.cache-hit != 'true' - run: | - go install github.com/incu6us/goimports-reviser/v3@v3.4.5 - name: Make Format run: make format - name: Check Diff diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7eb3cb12..ff78cd45 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,6 @@ jobs: golangci: name: golangci-lint runs-on: ubuntu-latest - timeout-minutes: 6 steps: - uses: actions/checkout@v4 - uses: technote-space/get-diff-action@v6.1.2 @@ -22,11 +21,11 @@ jobs: go.sum - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - uses: golangci/golangci-lint-action@v4 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.51 + version: v1.55 args: --timeout 10m github-token: ${{ secrets.GITHUB_TOKEN }} if: env.GIT_DIFF diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index 06646559..ada815e5 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - run: make build @@ -35,7 +35,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - name: Install runsim @@ -52,7 +52,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - uses: technote-space/get-diff-action@v6.1.2 @@ -78,7 +78,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - uses: technote-space/get-diff-action@v6.1.2 @@ -106,7 +106,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - uses: technote-space/get-diff-action@v6.1.2 @@ -134,7 +134,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - uses: technote-space/get-diff-action@v6.1.2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index caece30f..c13dcb15 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Display go version run: go version - name: install tparse @@ -41,7 +41,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | @@ -59,7 +59,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Create a file with all the pkgs run: go list ./... > pkgs.txt - name: Split pkgs into 4 files @@ -93,7 +93,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | @@ -177,7 +177,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | @@ -250,7 +250,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | @@ -319,7 +319,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' - name: Install docker-compose run: sudo apt-get update && sudo apt-get install -y docker-compose - name: Start localnet @@ -336,10 +336,10 @@ jobs: exit 1 fi - test-upgrade-name: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Test upgrade name - run: | - make test-upgrade-name + # test-upgrade-name: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Test upgrade name + # run: | + # make test-upgrade-name diff --git a/.golangci.yml b/.golangci.yml index f2913eb6..079a5901 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,9 +2,9 @@ linters: enable: - bodyclose - deadcode - - depguard - dogsled - errcheck + - gci - goconst - gocritic - gofmt @@ -17,7 +17,6 @@ linters: - misspell - maligned - nakedret - - prealloc - scopelint - staticcheck - structcheck @@ -68,6 +67,18 @@ linters-settings: # Default is to use a neutral variety of English. # Setting locale to US will correct the British spelling of 'colour' to 'color'. locale: US + gci: + custom-order: true + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(cosmossdk.io) + - prefix(github.com/cosmos/cosmos-sdk) + - prefix(github.com/cosmos/ibc-go) + - prefix(github.com/CosmWasm/wasmd) + - prefix(github.com/Finschia/finschia-sdk) + - prefix(github.com/Finschia/finschia) + run: # default concurrency is a available CPU number concurrency: 4 diff --git a/CHANGELOG.md b/CHANGELOG.md index fa298559..ec4e7779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features +* (config) [\#345](https://github.com/Finschia/finschia/pull/345) set cointype ### Improvements diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28e060c2..f38ce08c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,7 +74,7 @@ Please don't make Pull Requests from `main`. ## Dependencies -We use [Go 1.20 Modules](https://github.com/golang/go/wiki/Modules) to manage +We use [Go 1.21 Modules](https://github.com/golang/go/wiki/Modules) to manage dependency versions. The `main` branch of every finschia repository should just build with `go get`, diff --git a/Dockerfile b/Dockerfile index f2567c38..556e64d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ # > docker run -it -p 26656:26656 -p 26657:26657 -v ~/.finschia:/root/.finschia -v finschia/finschianode fnsad init # > docker run -it -p 26656:26656 -p 26657:26657 -v ~/.finschia:/root/.finschia -v finschia/finschianode fnsad start --rpc.laddr=tcp://0.0.0.0:26657 --p2p.laddr=tcp://0.0.0.0:26656 -ARG GO_VERSION="1.20" +ARG GO_VERSION="1.21" ARG RUNNER_IMAGE="alpine:3.17" FROM golang:${GO_VERSION}-alpine3.17 AS build-env diff --git a/Makefile b/Makefile index aa40a00f..a0bc6b01 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,6 @@ lint: format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs -n1 goimports-reviser -rm-unused -set-alias -project-name "github.com/Finschia/finschia/" -company-prefixes "github.com/Finschia/" .PHONY: lint format diff --git a/README.md b/README.md index 9f5df274..c43bd789 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository hosts `Finschia`. This repository is forked from [gaia](https://github.com/cosmos/gaia) at 2021-03-15. Finschia is a mainnet app implementation using [finschia-sdk](https://github.com/Finschia/finschia-sdk), [ostracon](https://github.com/Finschia/ostracon), [wasmd](https://github.com/Finschia/wasmd) and [ibc-go](https://github.com/Finschia/ibc-go). -**Node**: Requires [Go 1.20+](https://golang.org/dl/) +**Node**: Requires [Go 1.21+](https://golang.org/dl/) **Warnings**: Initial development is in progress, but there has not yet been a stable. diff --git a/app/ante.go b/app/ante.go index 7b20ec60..a2c601f3 100644 --- a/app/ante.go +++ b/app/ante.go @@ -3,16 +3,16 @@ package app import ( "errors" - circuitante "cosmossdk.io/x/circuit/ante" - ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" - "github.com/cosmos/ibc-go/v8/modules/core/keeper" - corestoretypes "cosmossdk.io/core/store" + circuitante "cosmossdk.io/x/circuit/ante" circuitkeeper "cosmossdk.io/x/circuit/keeper" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + "github.com/cosmos/ibc-go/v8/modules/core/keeper" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/app/app.go b/app/app.go index 5eb361ea..0335d3ed 100644 --- a/app/app.go +++ b/app/app.go @@ -13,33 +13,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/gogoproto/proto" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - "github.com/cosmos/ibc-go/v8/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" @@ -114,6 +88,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/x/group" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" @@ -123,6 +98,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/params" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -130,6 +106,31 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -146,6 +147,7 @@ const ( appName = "Finschia" NodeDir = ".finschia" Bech32Prefix = "link" + CoinType = 438 ) // These constants are derived from the above variables. @@ -1026,8 +1028,8 @@ func (app *FnsaApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { return app.ModuleManager.EndBlock(ctx) } -func (a *FnsaApp) Configurator() module.Configurator { - return a.configurator +func (app *FnsaApp) Configurator() module.Configurator { + return app.configurator } // InitChainer application update at chain initialization @@ -1097,8 +1099,8 @@ func (app *FnsaApp) AutoCliOpts() autocli.AppOptions { } // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (a *FnsaApp) DefaultGenesis() map[string]json.RawMessage { - return a.BasicModuleManager.DefaultGenesis(a.appCodec) +func (app *FnsaApp) DefaultGenesis() map[string]json.RawMessage { + return app.BasicModuleManager.DefaultGenesis(app.appCodec) } // GetKey returns the KVStoreKey for the provided store key. @@ -1210,7 +1212,7 @@ func BlockedAddresses() map[string]bool { // allow the following addresses to receive funds // TODO: uncomment it when authority is ready - //delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + // delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) return modAccAddrs } diff --git a/app/app_test.go b/app/app_test.go index e0b57d37..7d5654a6 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -48,6 +48,8 @@ func TestBlockedAddrs(t *testing.T) { gapp := Setup(t) for acc := range BlockedAddresses() { + acc := acc + t.Run(acc, func(t *testing.T) { var addr sdk.AccAddress if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil { diff --git a/app/export.go b/app/export.go index 4406ea56..6f097b39 100644 --- a/app/export.go +++ b/app/export.go @@ -51,8 +51,9 @@ func (app *FnsaApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedA // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated +// in favor of export at a block height // -// in favor of export at a block height +//nolint:gocyclo func (app *FnsaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -82,7 +83,9 @@ func (app *FnsaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ if err != nil { panic(err) } - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) + if _, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz); err != nil { + panic(err) + } return false }) if err != nil { diff --git a/app/test_helpers.go b/app/test_helpers.go index 18afe864..eac4a051 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -292,7 +292,7 @@ func NewTestNetworkFixture() network.TestFixture { // SignAndDeliverWithoutCommit signs and delivers a transaction. No commit func SignAndDeliverWithoutCommit(t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, msgs []sdk.Msg, fees sdk.Coins, chainID string, accNums, accSeqs []uint64, blockTime time.Time, priv ...cryptotypes.PrivKey) (*abci.ResponseFinalizeBlock, error) { tx, err := simtestutil.GenSignedMockTx( - rand.New(rand.NewSource(time.Now().UnixNano())), + rand.New(rand.NewSource(time.Now().UnixNano())), //nolint:gosec txCfg, msgs, fees, @@ -358,7 +358,6 @@ func GenesisStateWithValSet( } validators = append(validators, validator) delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyOneDec())) - } // set validators and delegations diff --git a/app/test_support.go b/app/test_support.go index 20d433bb..243e6c0c 100644 --- a/app/test_support.go +++ b/app/test_support.go @@ -1,14 +1,14 @@ package app import ( - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - "github.com/cosmos/cosmos-sdk/baseapp" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) diff --git a/app/upgrades/types.go b/app/upgrades/types.go index 2ff71ce6..90448952 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -3,9 +3,6 @@ package upgrades import ( "context" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" @@ -14,6 +11,9 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" ) type AppKeepers struct { diff --git a/cmd/fnsad/commands.go b/cmd/fnsad/commands.go index 18146734..655f576a 100644 --- a/cmd/fnsad/commands.go +++ b/cmd/fnsad/commands.go @@ -5,6 +5,8 @@ import ( "io" "os" + cmtcfg "github.com/cometbft/cometbft/config" + dbm "github.com/cosmos/cosmos-db" "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" "github.com/spf13/cobra" @@ -12,8 +14,6 @@ import ( "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" - cmtcfg "github.com/cometbft/cometbft/config" - dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/debug" diff --git a/cmd/fnsad/root.go b/cmd/fnsad/root.go index 5734615e..ea515058 100644 --- a/cmd/fnsad/root.go +++ b/cmd/fnsad/root.go @@ -35,6 +35,7 @@ func NewRootCmd() *cobra.Command { cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) + cfg.SetCoinType(app.CoinType) cfg.Seal() // we "pre"-instantiate the application for getting the injected/configured encoding configuration // note, this is not necessary when using app wiring, as depinject can be directly used (see root_v2.go) @@ -80,7 +81,7 @@ func NewRootCmd() *cobra.Command { // sets the RPC client needed for SIGN_MODE_TEXTUAL. This sign mode // is only available if the client is online. if !initClientCtx.Offline { - enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + enabledSignModes := append(append([]signing.SignMode{}, tx.DefaultSignModes...), signing.SignMode_SIGN_MODE_TEXTUAL) txConfigOpts := tx.ConfigOptions{ EnabledSignModes: enabledSignModes, TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), @@ -111,8 +112,14 @@ func NewRootCmd() *cobra.Command { // add keyring to autocli opts autoCliOpts := tempApp.AutoCliOpts() - initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) - autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + initClientCtx, err := config.ReadFromClientConfig(initClientCtx) + if err != nil { + panic(err) + } + autoCliOpts.Keyring, err = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + if err != nil { + panic(err) + } autoCliOpts.ClientCtx = initClientCtx if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { diff --git a/cmd/fnsad/testnet.go b/cmd/fnsad/testnet.go index b4c15b1d..818e2ade 100644 --- a/cmd/fnsad/testnet.go +++ b/cmd/fnsad/testnet.go @@ -11,11 +11,10 @@ import ( "path/filepath" "time" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - cmtconfig "github.com/cometbft/cometbft/config" cmttime "github.com/cometbft/cometbft/types/time" + "github.com/spf13/cobra" + "github.com/spf13/pflag" "cosmossdk.io/math" "cosmossdk.io/math/unsafe" @@ -76,14 +75,14 @@ type startArgs struct { algo string apiAddress string chainID string - enableLogging bool grpcAddress string minGasPrices string - numValidators int outputDir string - printMnemonic bool rpcAddress string timeoutCommit time.Duration + numValidators int + enableLogging bool + printMnemonic bool } func addTestnetFlagsToCmd(cmd *cobra.Command) { @@ -146,17 +145,47 @@ Example: config := serverCtx.Config args := initArgs{} - args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) - args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend) - args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) - args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix) - args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome) - args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress) - args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) - args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) - - args.singleMachine, _ = cmd.Flags().GetBool(flagSingleHost) + args.outputDir, err = cmd.Flags().GetString(flagOutputDir) + if err != nil { + return err + } + args.keyringBackend, err = cmd.Flags().GetString(flags.FlagKeyringBackend) + if err != nil { + return err + } + args.chainID, err = cmd.Flags().GetString(flags.FlagChainID) + if err != nil { + return err + } + args.minGasPrices, err = cmd.Flags().GetString(server.FlagMinGasPrices) + if err != nil { + return err + } + args.nodeDirPrefix, err = cmd.Flags().GetString(flagNodeDirPrefix) + if err != nil { + return err + } + args.nodeDaemonHome, err = cmd.Flags().GetString(flagNodeDaemonHome) + if err != nil { + return err + } + args.startingIPAddress, err = cmd.Flags().GetString(flagStartingIPAddress) + if err != nil { + return err + } + args.numValidators, err = cmd.Flags().GetInt(flagNumValidators) + if err != nil { + return err + } + args.algo, err = cmd.Flags().GetString(flags.FlagKeyType) + if err != nil { + return err + } + + args.singleMachine, err = cmd.Flags().GetBool(flagSingleHost) + if err != nil { + return err + } config.Consensus.TimeoutCommit, err = cmd.Flags().GetDuration(flagCommitTimeout) if err != nil { return err @@ -190,16 +219,47 @@ Example: `, version.AppName), RunE: func(cmd *cobra.Command, _ []string) error { args := startArgs{} - args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) - args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) - args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) - args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) - args.enableLogging, _ = cmd.Flags().GetBool(flagEnableLogging) - args.rpcAddress, _ = cmd.Flags().GetString(flagRPCAddress) - args.apiAddress, _ = cmd.Flags().GetString(flagAPIAddress) - args.grpcAddress, _ = cmd.Flags().GetString(flagGRPCAddress) - args.printMnemonic, _ = cmd.Flags().GetBool(flagPrintMnemonic) + var err error + args.outputDir, err = cmd.Flags().GetString(flagOutputDir) + if err != nil { + return err + } + args.chainID, err = cmd.Flags().GetString(flags.FlagChainID) + if err != nil { + return err + } + args.minGasPrices, err = cmd.Flags().GetString(server.FlagMinGasPrices) + if err != nil { + return err + } + args.numValidators, err = cmd.Flags().GetInt(flagNumValidators) + if err != nil { + return err + } + args.algo, err = cmd.Flags().GetString(flags.FlagKeyType) + if err != nil { + return err + } + args.enableLogging, err = cmd.Flags().GetBool(flagEnableLogging) + if err != nil { + return err + } + args.rpcAddress, err = cmd.Flags().GetString(flagRPCAddress) + if err != nil { + return err + } + args.apiAddress, err = cmd.Flags().GetString(flagAPIAddress) + if err != nil { + return err + } + args.grpcAddress, err = cmd.Flags().GetString(flagGRPCAddress) + if err != nil { + return err + } + args.printMnemonic, err = cmd.Flags().GetBool(flagPrintMnemonic) + if err != nil { + return err + } return startTestnet(cmd, args) }, diff --git a/docs/finschia-tutorials/installation.md b/docs/finschia-tutorials/installation.md index 367a68b4..4de76fd1 100644 --- a/docs/finschia-tutorials/installation.md +++ b/docs/finschia-tutorials/installation.md @@ -21,7 +21,7 @@ source ~/.bash_profile ``` ::: tip -**Go 1.20+** is required for the Finschia SDK. +**Go 1.21+** is required for the Finschia SDK. ::: ## Static build(Optional) diff --git a/networks/local/finschianode/Dockerfile b/networks/local/finschianode/Dockerfile index 0175b711..be20ea96 100644 --- a/networks/local/finschianode/Dockerfile +++ b/networks/local/finschianode/Dockerfile @@ -4,7 +4,7 @@ # > docker run -it -p 26656:26656 -p 26657:26657 -v ~/.finschia:/root/.finschia -v networks/local/finschianode fnsad init # > docker run -it -p 26656:26656 -p 26657:26657 -v ~/.finschia:/root/.finschia -v networks/local/finschianode fnsad start --rpc.laddr=tcp://0.0.0.0:26657 --p2p.laddr=tcp://0.0.0.0:26656 -ARG GO_VERSION="1.20" +ARG GO_VERSION="1.21" ARG RUNNER_IMAGE="alpine:3.17" FROM golang:${GO_VERSION}-alpine3.17 AS build-env @@ -70,4 +70,4 @@ WORKDIR /finschia EXPOSE 26656 26657 ENTRYPOINT ["/usr/bin/wrapper.sh"] CMD ["start"] -STOPSIGNAL SIGTERM \ No newline at end of file +STOPSIGNAL SIGTERM