From c1d6d016073e01968abcb7e1490d0b86e223706e Mon Sep 17 00:00:00 2001 From: "jaeseung.bae" Date: Fri, 2 Feb 2024 20:42:52 +0900 Subject: [PATCH] chore: fix merge conflict --- .github/pr_labeler.yml | 2 + .github/workflows/build.yml | 3 - .github/workflows/pr_labeler.yml | 2 +- .github/workflows/proto.yml | 2 +- .github/workflows/test.yml | 109 +++-- .golangci.yml | 4 + CHANGELOG.md | 4 +- api/go.mod | 2 +- go.work.example | 2 + proto/buf.gen.pulsar.yaml | 6 +- scripts/mockgen.sh | 28 +- simapp/app.go | 796 ------------------------------- simapp/app_config.go | 19 + simapp/app_test.go | 5 +- simapp/app_v2.go | 4 + simapp/go.mod | 22 +- simapp/go.sum | 12 +- simapp/simd/cmd/root.go | 113 ----- x/bankplus/go.mod | 10 +- x/bankplus/go.sum | 12 +- 20 files changed, 142 insertions(+), 1015 deletions(-) delete mode 100644 simapp/app.go delete mode 100644 simapp/simd/cmd/root.go diff --git a/.github/pr_labeler.yml b/.github/pr_labeler.yml index de4b53db38..3751c70f7a 100644 --- a/.github/pr_labeler.yml +++ b/.github/pr_labeler.yml @@ -13,5 +13,7 @@ # - x/*/client/**/* # "Type: ADR": # - docs/architecture/**/* +"C:x/foundation": + - x/foundation/**/* "C:x/bankplus": - x/bankplus/**/* \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4face0733e..0e5806198c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,3 @@ jobs: - name: Build if: env.GIT_DIFF run: GOARCH=${{ matrix.go-arch }} make build - - name: Build Legacy - if: env.GIT_DIFF - run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS=legacy make build diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml index 885d8b47db..292508d34c 100644 --- a/.github/workflows/pr_labeler.yml +++ b/.github/workflows/pr_labeler.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write # for actions/labeler to add labels to PRs runs-on: ubuntu-latest steps: - - uses: actions/labeler@main + - uses: actions/labeler@v4 with: configuration-path: .github/pr_labeler.yml repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 1c997e8a65..14db6d8b62 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -28,4 +28,4 @@ jobs: - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" - against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto" + against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},subdir=proto" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12e228b661..cb01821ece 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -113,40 +113,41 @@ jobs: # name: "${{ github.sha }}-integration-coverage" # path: ./tests/integration-profile.out - # test-e2e: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-go@v4 - # with: - # go-version: "1.21" - # check-latest: true - # cache: true - # cache-dependency-path: go.sum - # - uses: technote-space/get-diff-action@v6.1.2 - # id: git_diff - # with: - # PATTERNS: | - # **/*.go - # go.mod - # go.sum - # **/go.mod - # **/go.sum - # **/Makefile - # Makefile - # - name: e2e tests - # if: env.GIT_DIFF - # run: | - # make test-e2e-cov - # - uses: actions/upload-artifact@v3 - # if: env.GIT_DIFF - # with: - # name: "${{ github.sha }}-e2e-coverage" - # path: ./tests/e2e-profile.out + test-e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + check-latest: true + cache: true + cache-dependency-path: go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/*.go + go.mod + go.sum + **/go.mod + **/go.sum + **/Makefile + Makefile + - name: e2e tests + if: env.GIT_DIFF + run: | + make test-e2e-cov + - uses: actions/upload-artifact@v3 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-e2e-coverage" + path: ./tests/e2e-profile.out repo-analysis: runs-on: ubuntu-latest - needs: [tests, test-integration, test-e2e] + # needs: [tests, test-integration, test-e2e] + needs: [ tests, test-e2e ] steps: - uses: actions/checkout@v3 - uses: technote-space/get-diff-action@v6.1.2 @@ -178,11 +179,11 @@ jobs: # if: env.GIT_DIFF # with: # name: "${{ github.sha }}-integration-coverage" - # - uses: actions/download-artifact@v3 - # if: env.GIT_DIFF - # with: - # name: "${{ github.sha }}-e2e-coverage" - # continue-on-error: true + - uses: actions/download-artifact@v3 + if: env.GIT_DIFF + with: + name: "${{ github.sha }}-e2e-coverage" + continue-on-error: true - name: sonarcloud if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }} uses: SonarSource/sonarcloud-github-action@master @@ -276,11 +277,6 @@ jobs: run: | cd simapp go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... - - name: tests simapp v1 - if: env.GIT_DIFF - run: | - cd simapp - go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock rocksdb_build' ./... - name: sonarcloud if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} uses: SonarSource/sonarcloud-github-action@master @@ -297,6 +293,37 @@ jobs: # NOTE: The following jobs are used to test the Finschia SDK Go submodules present under x/{module}. # They run when there is a diff in their respective directories. + test-x-foundation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + check-latest: true + cache: true + cache-dependency-path: x/foundation/go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + x/foundation/**/*.go + x/foundation/go.mod + x/foundation/go.sum + - name: tests + if: env.GIT_DIFF + run: | + cd x/foundation + go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + - name: sonarcloud + if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + projectBaseDir: x/foundation/ + test-x-bankplus: runs-on: ubuntu-latest steps: diff --git a/.golangci.yml b/.golangci.yml index 889399c42b..37d5c4b41d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,6 +52,10 @@ issues: - text: "SA1019: codec.NewAminoCodec is deprecated" # TODO remove once migration path is set out linters: - staticcheck + - path: "client/cli" # TODO(@0Tech): remove after foundation exec proposal removed + text: "SA1019: govcli.FlagDescription is deprecated" + linters: + - staticcheck - text: "leading space" linters: - nolintlint diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf2ec3f1a..36d5ef8bf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,10 +40,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased](https://github.com/Finschia/finschia-sdk/compare/v0.48.0...HEAD) ### Features + +* (x/foundation) [\#1198](https://github.com/Finschia/finschia-sdk/pull/1198) update x/foundation to use + Finschia/cosmos-sdk * (all) [\#1205](https://github.com/Finschia/finschia-sdk/pull/1205) delegate native logics to Finschia/cosmos-sdk * (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24 * (x/bankplus) [\#1223](https://github.com/Finschia/finschia-sdk/pull/1223) update x/bankplus to use Finschia/cosmos-sdk -* ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md diff --git a/api/go.mod b/api/go.mod index 8501553307..0f85d2c1e8 100644 --- a/api/go.mod +++ b/api/go.mod @@ -5,6 +5,7 @@ go 1.21 toolchain go1.21.5 require ( + cosmossdk.io/api v0.7.2 github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.50.2 github.com/cosmos/gogoproto v1.4.11 @@ -14,7 +15,6 @@ require ( ) require ( - cosmossdk.io/api v0.7.2 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect diff --git a/go.work.example b/go.work.example index 38f66d6d69..caf3ca901e 100644 --- a/go.work.example +++ b/go.work.example @@ -6,5 +6,7 @@ use ( . ./api ./simapp + ./tests + ./x/foundation ./x/bankplus ) diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml index e5f3a32143..e6fa7d3eff 100644 --- a/proto/buf.gen.pulsar.yaml +++ b/proto/buf.gen.pulsar.yaml @@ -12,10 +12,10 @@ managed: plugins: - name: go-pulsar out: ../api - opt: paths=source_relative + opt: paths=source_relative,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1 - name: go-grpc out: ../api - opt: paths=source_relative + opt: paths=source_relative,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1 - name: go-cosmos-orm out: ../api - opt: paths=source_relative + opt: paths=source_relative,Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1 diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index cda998093a..452c97319f 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -1,30 +1,4 @@ #!/usr/bin/env bash mockgen_cmd="mockgen" -$mockgen_cmd -source=baseapp/abci_utils.go -package mock -destination baseapp/testutil/mock/mocks.go -$mockgen_cmd -source=client/account_retriever.go -package mock -destination testutil/mock/account_retriever.go -$mockgen_cmd -package mock -destination store/mock/cosmos_cosmos_db_DB.go github.com/cosmos/cosmos-db DB -$mockgen_cmd -source=types/module/module.go -package mock -destination testutil/mock/types_module_module.go -$mockgen_cmd -source=types/module/mock_appmodule_test.go -package mock -destination testutil/mock/types_mock_appmodule.go -$mockgen_cmd -source=types/invariant.go -package mock -destination testutil/mock/types_invariant.go -$mockgen_cmd -package mock -destination testutil/mock/grpc_server.go github.com/cosmos/gogoproto/grpc Server -$mockgen_cmd -package mock -destination testutil/mock/logger.go cosmossdk.io/log Logger -$mockgen_cmd -source=orm/model/ormtable/hooks.go -package ormmocks -destination orm/testing/ormmocks/hooks.go -$mockgen_cmd -source=x/nft/expected_keepers.go -package testutil -destination x/nft/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/feegrant/expected_keepers.go -package testutil -destination x/feegrant/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/mint/types/expected_keepers.go -package testutil -destination x/mint/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/params/proposal_handler_test.go -package testutil -destination x/params/testutil/staking_keeper_mock.go -$mockgen_cmd -source=x/crisis/types/expected_keepers.go -package testutil -destination x/crisis/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/tx/config/expected_keepers.go -package testutil -destination x/auth/tx/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/ante/expected_keepers.go -package testutil -destination x/auth/ante/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/group/testutil/expected_keepers.go -package testutil -destination x/group/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/evidence/types/expected_keepers.go -package testutil -destination x/evidence/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/distribution/types/expected_keepers.go -package testutil -destination x/distribution/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/slashing/types/expected_keepers.go -package testutil -destination x/slashing/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/genutil/types/expected_keepers.go -package testutil -destination x/genutil/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/gov/testutil/expected_keepers.go -package testutil -destination x/gov/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/staking/types/expected_keepers.go -package testutil -destination x/staking/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/vesting/types/expected_keepers.go -package testutil -destination x/auth/vesting/testutil/expected_keepers_mocks.go +$mockgen_cmd -source=x/foundation/expected_keepers.go -package testutil -destination x/foundation/testutil/expected_keepers_mocks.go diff --git a/simapp/app.go b/simapp/app.go deleted file mode 100644 index 68654666b0..0000000000 --- a/simapp/app.go +++ /dev/null @@ -1,796 +0,0 @@ -//go:build app_v1 - -package simapp - -import ( - "encoding/json" - "fmt" - "io" - "os" - "path/filepath" - - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/client/v2/autocli" - "cosmossdk.io/core/appmodule" - "cosmossdk.io/log" - storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/circuit" - circuitkeeper "cosmossdk.io/x/circuit/keeper" - circuittypes "cosmossdk.io/x/circuit/types" - "cosmossdk.io/x/evidence" - evidencekeeper "cosmossdk.io/x/evidence/keeper" - evidencetypes "cosmossdk.io/x/evidence/types" - "cosmossdk.io/x/feegrant" - feegrantkeeper "cosmossdk.io/x/feegrant/keeper" - feegrantmodule "cosmossdk.io/x/feegrant/module" - "cosmossdk.io/x/nft" - nftkeeper "cosmossdk.io/x/nft/keeper" - nftmodule "cosmossdk.io/x/nft/module" - "cosmossdk.io/x/tx/signing" - "cosmossdk.io/x/upgrade" - upgradekeeper "cosmossdk.io/x/upgrade/keeper" - upgradetypes "cosmossdk.io/x/upgrade/types" - abci "github.com/cometbft/cometbft/abci/types" - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/gogoproto/proto" - "github.com/spf13/cast" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" - nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/runtime" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/std" - testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/types/msgservice" - sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" - "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - "github.com/cosmos/cosmos-sdk/x/auth/posthandler" - authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - consensus "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - 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" - "github.com/cosmos/cosmos-sdk/x/mint" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/params" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - 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" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -const appName = "SimApp" - -var ( - // DefaultNodeHome default home directories for the application daemon - DefaultNodeHome string - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - nft.ModuleName: nil, - } -) - -var ( - _ runtime.AppI = (*SimApp)(nil) - _ servertypes.Application = (*SimApp)(nil) -) - -// SimApp extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. -type SimApp struct { - *baseapp.BaseApp - legacyAmino *codec.LegacyAmino - appCodec codec.Codec - txConfig client.TxConfig - interfaceRegistry types.InterfaceRegistry - - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - - // keepers - AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.BaseKeeper - StakingKeeper *stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - AuthzKeeper authzkeeper.Keeper - EvidenceKeeper evidencekeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper - GroupKeeper groupkeeper.Keeper - NFTKeeper nftkeeper.Keeper - ConsensusParamsKeeper consensusparamkeeper.Keeper - CircuitKeeper circuitkeeper.Keeper - - // the module manager - ModuleManager *module.Manager - BasicModuleManager module.BasicManager - - // simulation manager - sm *module.SimulationManager - - // module configurator - configurator module.Configurator -} - -func init() { - userHomeDir, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - DefaultNodeHome = filepath.Join(userHomeDir, ".simapp") -} - -// NewSimApp returns a reference to an initialized SimApp. -func NewSimApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - loadLatest bool, - appOpts servertypes.AppOptions, - baseAppOptions ...func(*baseapp.BaseApp), -) *SimApp { - interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ - ProtoFiles: proto.HybridResolver, - SigningOptions: signing.Options{ - AddressCodec: address.Bech32Codec{ - Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), - }, - ValidatorAddressCodec: address.Bech32Codec{ - Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), - }, - }, - }) - appCodec := codec.NewProtoCodec(interfaceRegistry) - legacyAmino := codec.NewLegacyAmino() - txConfig := tx.NewTxConfig(appCodec, tx.DefaultSignModes) - - std.RegisterLegacyAminoCodec(legacyAmino) - std.RegisterInterfaces(interfaceRegistry) - - // Below we could construct and set an application specific mempool and - // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are - // already set in the SDK's BaseApp, this shows an example of how to override - // them. - // - // Example: - // - // bApp := baseapp.NewBaseApp(...) - // nonceMempool := mempool.NewSenderNonceMempool() - // abciPropHandler := NewDefaultProposalHandler(nonceMempool, bApp) - // - // bApp.SetMempool(nonceMempool) - // bApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) - // bApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) - // - // Alternatively, you can construct BaseApp options, append those to - // baseAppOptions and pass them to NewBaseApp. - // - // Example: - // - // prepareOpt = func(app *baseapp.BaseApp) { - // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) - // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) - // } - // baseAppOptions = append(baseAppOptions, prepareOpt) - - // create and set dummy vote extension handler - voteExtOp := func(bApp *baseapp.BaseApp) { - voteExtHandler := NewVoteExtensionHandler() - voteExtHandler.SetHandlers(bApp) - } - baseAppOptions = append(baseAppOptions, voteExtOp, baseapp.SetOptimisticExecution()) - - bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) - bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetVersion(version.Version) - bApp.SetInterfaceRegistry(interfaceRegistry) - bApp.SetTxEncoder(txConfig.TxEncoder()) - - keys := storetypes.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, - minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, circuittypes.StoreKey, - authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, - ) - - // register streaming services - if err := bApp.RegisterStreamingServices(appOpts, keys); err != nil { - panic(err) - } - - tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - app := &SimApp{ - BaseApp: bApp, - legacyAmino: legacyAmino, - appCodec: appCodec, - txConfig: txConfig, - interfaceRegistry: interfaceRegistry, - keys: keys, - tkeys: tkeys, - } - - app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) - - // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) - bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - - // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - app.BankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), - app.AccountKeeper, - BlockedAddresses(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - logger, - ) - - // optional: enable sign mode textual by overwriting the default tx config (after setting the bank keeper) - enabledSignModes := append(tx.DefaultSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) - txConfigOpts := tx.ConfigOptions{ - EnabledSignModes: enabledSignModes, - TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper), - } - txConfig, err := tx.NewTxConfigWithOptions( - appCodec, - txConfigOpts, - ) - if err != nil { - panic(err) - } - app.txConfig = txConfig - - app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr), authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), - ) - app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, legacyAmino, runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) - app.CrisisKeeper = crisiskeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[crisistypes.StoreKey]), invCheckPeriod, - app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AccountKeeper.AddressCodec()) - - app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[feegrant.StoreKey]), app.AccountKeeper) - - // register the staking hooks - // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), - ) - - app.CircuitKeeper = circuitkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[circuittypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AccountKeeper.AddressCodec()) - app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper) - - app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.MsgServiceRouter(), app.AccountKeeper) - - groupConfig := group.DefaultConfig() - /* - Example of setting group params: - groupConfig.MaxMetadataLen = 1000 - */ - app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig) - - // get skipUpgradeHeights from the app options - skipUpgradeHeights := map[int64]bool{} - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - homePath := cast.ToString(appOpts.Get(flags.FlagHome)) - // set the governance module account as the authority for conducting upgrades - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) - govConfig := govtypes.DefaultConfig() - /* - Example of setting gov params: - govConfig.MaxMetadataLen = 10000 - */ - govKeeper := govkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, - app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - // Set legacy router for backwards compatibility with gov v1beta1 - govKeeper.SetLegacyRouter(govRouter) - - app.GovKeeper = *govKeeper.SetHooks( - govtypes.NewMultiGovHooks( - // register the governance hooks - ), - ) - - app.NFTKeeper = nftkeeper.NewKeeper(runtime.NewKVStoreService(keys[nftkeeper.StoreKey]), appCodec, app.AccountKeeper, app.BankKeeper) - - // create evidence keeper with router - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, app.AccountKeeper.AddressCodec(), runtime.ProvideCometInfoService(), - ) - // If evidence needs to be handled for the app, set routes in router here and seal - app.EvidenceKeeper = *evidenceKeeper - - /**** Module Options ****/ - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - // NOTE: Any module instantiated in the module manager that is later modified - // must be passed by reference here. - app.ModuleManager = module.NewManager( - genutil.NewAppModule( - app.AccountKeeper, app.StakingKeeper, app, - txConfig, - ), - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), - vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), - feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), - upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), - evidence.NewAppModule(app.EvidenceKeeper), - params.NewAppModule(app.ParamsKeeper), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - circuit.NewAppModule(appCodec, app.CircuitKeeper), - ) - - // BasicModuleManager defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration and genesis verification. - // By default it is composed of all the module from the module manager. - // Additionally, app module basics can be overwritten by passing them as argument. - app.BasicModuleManager = module.NewBasicManagerFromManager( - app.ModuleManager, - map[string]module.AppModuleBasic{ - genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - govtypes.ModuleName: gov.NewAppModuleBasic( - []govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }, - ), - }) - app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) - app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) - - // NOTE: upgrade module is required to be prioritized - app.ModuleManager.SetOrderPreBlockers( - upgradetypes.ModuleName, - ) - // During begin block slashing happens after distr.BeginBlocker so that - // there is nothing left over in the validator fee pool, so as to keep the - // CanWithdrawInvariant invariant. - // NOTE: staking module is required if HistoricalEntries param > 0 - app.ModuleManager.SetOrderBeginBlockers( - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - ) - app.ModuleManager.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - genutiltypes.ModuleName, - feegrant.ModuleName, - group.ModuleName, - ) - - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - genesisModuleOrder := []string{ - authtypes.ModuleName, banktypes.ModuleName, - distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, - minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, - feegrant.ModuleName, nft.ModuleName, group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, - } - app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) - app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) - - // Uncomment if you want to set a custom migration order here. - // app.ModuleManager.SetOrderMigrations(custom order) - - app.ModuleManager.RegisterInvariants(app.CrisisKeeper) - app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - err = app.ModuleManager.RegisterServices(app.configurator) - if err != nil { - panic(err) - } - - // RegisterUpgradeHandlers is used for registering any on-chain upgrades. - // Make sure it's called after `app.ModuleManager` and `app.configurator` are set. - app.RegisterUpgradeHandlers() - - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) - - reflectionSvc, err := runtimeservices.NewReflectionService() - if err != nil { - panic(err) - } - reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) - - // add test gRPC service for testing gRPC queries in isolation - testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) - - // create the simulation manager and define the order of the modules for deterministic simulations - // - // NOTE: this is not required apps that don't use the simulator for fuzz testing - // transactions - overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), - } - app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) - - app.sm.RegisterStoreDecoders() - - // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - - // initialize BaseApp - app.SetInitChainer(app.InitChainer) - app.SetPreBlocker(app.PreBlocker) - app.SetBeginBlocker(app.BeginBlocker) - app.SetEndBlocker(app.EndBlocker) - app.setAnteHandler(txConfig) - - // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like - // antehandlers, but are run _after_ the `runMsgs` execution. They are also - // defined as a chain, and have the same signature as antehandlers. - // - // In baseapp, postHandlers are run in the same store branch as `runMsgs`, - // meaning that both `runMsgs` and `postHandler` state will be committed if - // both are successful, and both will be reverted if any of the two fails. - // - // The SDK exposes a default postHandlers chain - // - // Please note that changing any of the anteHandler or postHandler chain is - // likely to be a state-machine breaking change, which needs a coordinated - // upgrade. - app.setPostHandler() - - // At startup, after all modules have been registered, check that all prot - // annotations are correct. - protoFiles, err := proto.MergedRegistry() - if err != nil { - panic(err) - } - err = msgservice.ValidateProtoAnnotations(protoFiles) - if err != nil { - // Once we switch to using protoreflect-based antehandlers, we might - // want to panic here instead of logging a warning. - fmt.Fprintln(os.Stderr, err.Error()) - } - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - panic(fmt.Errorf("error loading last version: %w", err)) - } - } - - return app -} - -func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { - anteHandler, err := NewAnteHandler( - HandlerOptions{ - ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: txConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - }, - &app.CircuitKeeper, - }, - ) - if err != nil { - panic(err) - } - - // Set the AnteHandler for the app - app.SetAnteHandler(anteHandler) -} - -func (app *SimApp) setPostHandler() { - postHandler, err := posthandler.NewPostHandler( - posthandler.HandlerOptions{}, - ) - if err != nil { - panic(err) - } - - app.SetPostHandler(postHandler) -} - -// Name returns the name of the App -func (app *SimApp) Name() string { return app.BaseApp.Name() } - -// PreBlocker application updates every pre block -func (app *SimApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { - return app.ModuleManager.PreBlock(ctx) -} - -// BeginBlocker application updates every begin block -func (app *SimApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { - return app.ModuleManager.BeginBlock(ctx) -} - -// EndBlocker application updates every end block -func (app *SimApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { - return app.ModuleManager.EndBlock(ctx) -} - -func (a *SimApp) Configurator() module.Configurator { - return a.configurator -} - -// InitChainer application update at chain initialization -func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { - var genesisState GenesisState - if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { - panic(err) - } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) - return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) -} - -// LoadHeight loads a particular height -func (app *SimApp) LoadHeight(height int64) error { - return app.LoadVersion(height) -} - -// LegacyAmino returns SimApp's amino codec. -// -// NOTE: This is solely to be used for testing purposes as it may be desirable -// for modules to register their own custom testing types. -func (app *SimApp) LegacyAmino() *codec.LegacyAmino { - return app.legacyAmino -} - -// AppCodec returns SimApp's app codec. -// -// NOTE: This is solely to be used for testing purposes as it may be desirable -// for modules to register their own custom testing types. -func (app *SimApp) AppCodec() codec.Codec { - return app.appCodec -} - -// InterfaceRegistry returns SimApp's InterfaceRegistry -func (app *SimApp) InterfaceRegistry() types.InterfaceRegistry { - return app.interfaceRegistry -} - -// TxConfig returns SimApp's TxConfig -func (app *SimApp) TxConfig() client.TxConfig { - return app.txConfig -} - -// AutoCliOpts returns the autocli options for the app. -func (app *SimApp) AutoCliOpts() autocli.AppOptions { - modules := make(map[string]appmodule.AppModule, 0) - for _, m := range app.ModuleManager.Modules { - if moduleWithName, ok := m.(module.HasName); ok { - moduleName := moduleWithName.Name() - if appModule, ok := moduleWithName.(appmodule.AppModule); ok { - modules[moduleName] = appModule - } - } - } - - return autocli.AppOptions{ - Modules: modules, - ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules), - AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), - ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), - ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), - } -} - -// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { - return a.BasicModuleManager.DefaultGenesis(a.appCodec) -} - -// GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. -func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey { - return app.keys[storeKey] -} - -// GetStoreKeys returns all the stored store keys. -func (app *SimApp) GetStoreKeys() []storetypes.StoreKey { - keys := make([]storetypes.StoreKey, len(app.keys)) - for _, key := range app.keys { - keys = append(keys, key) - } - - return keys -} - -// GetSubspace returns a param subspace for a given module name. -// -// NOTE: This is solely to be used for testing purposes. -func (app *SimApp) GetSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) - return subspace -} - -// SimulationManager implements the SimulationApp interface -func (app *SimApp) SimulationManager() *module.SimulationManager { - return app.sm -} - -// RegisterAPIRoutes registers all application module routes with the provided -// API server. -func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - // Register new tx routes from grpc-gateway. - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register new CometBFT queries routes from grpc-gateway. - cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register node gRPC service for grpc-gateway. - nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register grpc-gateway routes for all modules. - app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // register swagger API from root so that other applications can override easily - if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { - panic(err) - } -} - -// RegisterTxService implements the Application.RegisterTxService method. -func (app *SimApp) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) -} - -// RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *SimApp) RegisterTendermintService(clientCtx client.Context) { - cmtApp := server.NewCometABCIWrapper(app) - cmtservice.RegisterTendermintService( - clientCtx, - app.BaseApp.GRPCQueryRouter(), - app.interfaceRegistry, - cmtApp.Query, - ) -} - -func (app *SimApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) -} - -// GetMaccPerms returns a copy of the module account permissions -// -// NOTE: This is solely to be used for testing purposes. -func GetMaccPerms() map[string][]string { - dupMaccPerms := make(map[string][]string) - for k, v := range maccPerms { - dupMaccPerms[k] = v - } - - return dupMaccPerms -} - -// BlockedAddresses returns all the app's blocked account addresses. -func BlockedAddresses() map[string]bool { - modAccAddrs := make(map[string]bool) - for acc := range GetMaccPerms() { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true - } - - // allow the following addresses to receive funds - delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - return modAccAddrs -} - -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName) - paramsKeeper.Subspace(crisistypes.ModuleName) - - return paramsKeeper -} diff --git a/simapp/app_config.go b/simapp/app_config.go index dad4a957b0..26a47a8024 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -72,6 +72,10 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + foundationmodulev1 "github.com/Finschia/finschia-sdk/api/lbm/foundation/module/v1" + "github.com/Finschia/finschia-sdk/x/foundation" + _ "github.com/Finschia/finschia-sdk/x/foundation/module" // import for side-effects + _ "github.com/Finschia/finschia-sdk/x/bankplus/module" // import for side-effects ) @@ -85,6 +89,8 @@ var ( {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, {Account: nft.ModuleName}, + {Account: foundation.ModuleName}, + {Account: foundation.TreasuryName}, } // blocked account addresses @@ -95,6 +101,8 @@ var ( stakingtypes.BondedPoolName, stakingtypes.NotBondedPoolName, nft.ModuleName, + foundation.ModuleName, + foundation.TreasuryName, // We allow the following module accounts to receive funds: // govtypes.ModuleName } @@ -116,6 +124,7 @@ var ( // NOTE: staking module is required if HistoricalEntries param > 0 BeginBlockers: []string{ minttypes.ModuleName, + foundation.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, @@ -128,6 +137,7 @@ var ( stakingtypes.ModuleName, feegrant.ModuleName, group.ModuleName, + foundation.ModuleName, }, OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ { @@ -146,6 +156,7 @@ var ( slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, + foundation.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, @@ -261,6 +272,14 @@ var ( Name: circuittypes.ModuleName, Config: appconfig.WrapAny(&circuitmodulev1.Module{}), }, + { + Name: foundation.ModuleName, + Config: appconfig.WrapAny(&foundationmodulev1.Module{ + Authority: foundation.ModuleName, + MaxExecutionPeriod: durationpb.New(time.Hour * 24 * 7 * 2), + MaxMetadataLen: 255, + }), + }, }, }), depinject.Supply( diff --git a/simapp/app_test.go b/simapp/app_test.go index e5c0aca5e9..93cba59ca0 100644 --- a/simapp/app_test.go +++ b/simapp/app_test.go @@ -8,7 +8,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/gogoproto/proto" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -35,6 +34,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/vesting" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" "github.com/cosmos/cosmos-sdk/x/distribution" @@ -45,6 +45,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/staking" + + foundationmodule "github.com/Finschia/finschia-sdk/x/foundation/module" ) func TestSimAppExportAndBlockedAddrs(t *testing.T) { @@ -204,6 +206,7 @@ func TestRunMigrations(t *testing.T) { "evidence": evidence.AppModule{}.ConsensusVersion(), "crisis": crisis.AppModule{}.ConsensusVersion(), "genutil": genutil.AppModule{}.ConsensusVersion(), + "foundation": foundationmodule.AppModule{}.ConsensusVersion(), }, ) if tc.expRunErr { diff --git a/simapp/app_v2.go b/simapp/app_v2.go index ec96a2cbd4..c695441e03 100644 --- a/simapp/app_v2.go +++ b/simapp/app_v2.go @@ -46,6 +46,8 @@ import ( paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + + foundationkeeper "github.com/Finschia/finschia-sdk/x/foundation/keeper" ) // DefaultNodeHome default home directories for the application daemon @@ -84,6 +86,7 @@ type SimApp struct { NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensuskeeper.Keeper CircuitBreakerKeeper circuitkeeper.Keeper + FoundationKeeper foundationkeeper.Keeper // simulation manager sm *module.SimulationManager @@ -195,6 +198,7 @@ func NewSimApp( &app.NFTKeeper, &app.ConsensusParamsKeeper, &app.CircuitBreakerKeeper, + &app.FoundationKeeper, ); err != nil { panic(err) } diff --git a/simapp/go.mod b/simapp/go.mod index 93d9f56cdb..d2e7e37f2c 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -10,37 +10,38 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/log v1.2.1 cosmossdk.io/math v1.2.0 - cosmossdk.io/store v1.0.2 + cosmossdk.io/store v1.0.1 cosmossdk.io/tools/confix v0.1.1 cosmossdk.io/x/circuit v0.1.0 cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/nft v0.1.0 - cosmossdk.io/x/tx v0.12.0 + cosmossdk.io/x/tx v0.12.0 // indirect cosmossdk.io/x/upgrade v0.1.1 - github.com/cometbft/cometbft v0.38.3 + github.com/Finschia/finschia-sdk/api v0.0.0-20231227090232-78fde403b78c + github.com/Finschia/finschia-sdk/x/bankplus v0.0.0-00010101000000-000000000000 + github.com/Finschia/finschia-sdk/x/foundation v0.0.0-00010101000000-000000000000 + github.com/cometbft/cometbft v0.38.2 github.com/cosmos/cosmos-db v1.0.0 // this version is not used as it is always replaced by the latest Cosmos SDK version github.com/cosmos/cosmos-sdk v0.50.2 github.com/cosmos/gogoproto v1.4.11 github.com/golang/mock v1.6.0 - github.com/spf13/cast v1.5.1 + github.com/spf13/cast v1.5.1 // indirect github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.31.0 ) -require github.com/Finschia/finschia-sdk/x/bankplus v0.0.0-00010101000000-000000000000 - require ( cloud.google.com/go v0.110.10 // indirect cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.35.1 // indirect - cosmossdk.io/errors v1.0.1 // indirect + cosmossdk.io/errors v1.0.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -205,7 +206,9 @@ replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the finschia-sdk - github.com/Finschia/finschia-sdk => ../. + github.com/Finschia/finschia-sdk/api => ../api + github.com/Finschia/finschia-sdk/x/bankplus => ../x/bankplus + github.com/Finschia/finschia-sdk/x/foundation => ../x/foundation // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 @@ -214,7 +217,6 @@ replace ( ) replace ( - github.com/Finschia/finschia-sdk/x/bankplus => ../x/bankplus github.com/cometbft/cometbft => github.com/Finschia/cometbft v0.0.0-20231127181424-2aacfbe9832d github.com/cosmos/cosmos-sdk => github.com/Finschia/cosmos-sdk v0.0.0-20231211060251-d8fb76d4c267 ) diff --git a/simapp/go.sum b/simapp/go.sum index 84f640fdda..006f221d48 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -194,14 +194,14 @@ cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= +cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= -cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= +cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= @@ -1665,8 +1665,8 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go deleted file mode 100644 index 42876588fd..0000000000 --- a/simapp/simd/cmd/root.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build app_v1 - -package cmd - -import ( - "os" - - "cosmossdk.io/log" - dbm "github.com/cosmos/cosmos-db" - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/server" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/Finschia/finschia-sdk/simapp" - "github.com/Finschia/finschia-sdk/simapp/params" -) - -// NewRootCmd creates a new root command for simd. It is called once in the -// main function. -func NewRootCmd() *cobra.Command { - // 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) - tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(tempDir())) - encodingConfig := params.EncodingConfig{ - InterfaceRegistry: tempApp.InterfaceRegistry(), - Codec: tempApp.AppCodec(), - TxConfig: tempApp.TxConfig(), - Amino: tempApp.LegacyAmino(), - } - - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(simapp.DefaultNodeHome). - WithViper("") // In simapp, we don't use any prefix for env variables. - - rootCmd := &cobra.Command{ - Use: "simd", - Short: "simulation app", - SilenceErrors: true, - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // set the default command outputs - cmd.SetOut(cmd.OutOrStdout()) - cmd.SetErr(cmd.ErrOrStderr()) - - initClientCtx = initClientCtx.WithCmdContext(cmd.Context()) - initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) - if err != nil { - return err - } - - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) - if err != nil { - return err - } - - // This needs to go after ReadFromClientConfig, as that function - // 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) - txConfigOpts := tx.ConfigOptions{ - EnabledSignModes: enabledSignModes, - TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), - } - txConfig, err := tx.NewTxConfigWithOptions( - initClientCtx.Codec, - txConfigOpts, - ) - if err != nil { - return err - } - - initClientCtx = initClientCtx.WithTxConfig(txConfig) - } - - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - customAppTemplate, customAppConfig := initAppConfig() - customCMTConfig := initCometBFTConfig() - - return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) - }, - } - - initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager) - - // add keyring to autocli opts - autoCliOpts := tempApp.AutoCliOpts() - initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) - autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) - autoCliOpts.ClientCtx = initClientCtx - - if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { - panic(err) - } - - return rootCmd -} diff --git a/x/bankplus/go.mod b/x/bankplus/go.mod index 0710bc61f4..8c328f3ddd 100644 --- a/x/bankplus/go.mod +++ b/x/bankplus/go.mod @@ -6,10 +6,10 @@ require ( cosmossdk.io/api v0.7.2 cosmossdk.io/core v0.11.0 cosmossdk.io/depinject v1.0.0-alpha.4 - cosmossdk.io/errors v1.0.1 + cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 - cosmossdk.io/store v1.0.2 - github.com/cometbft/cometbft v0.38.3 + cosmossdk.io/store v1.0.1 + github.com/cometbft/cometbft v0.38.2 github.com/cosmos/cosmos-sdk v0.50.2 github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 @@ -143,7 +143,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/grpc v1.60.1 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -154,6 +154,6 @@ require ( ) replace ( + github.com/cometbft/cometbft => github.com/Finschia/cometbft v0.0.0-20231127181424-2aacfbe9832d github.com/cosmos/cosmos-sdk v0.50.2 => github.com/Finschia/cosmos-sdk v0.0.0-20231211060251-d8fb76d4c267 - github.com/cometbft/cometbft v0.38.3 => github.com/Finschia/cometbft v0.0.0-20231127181424-2aacfbe9832d ) diff --git a/x/bankplus/go.sum b/x/bankplus/go.sum index 2046e9bcc2..c05b4122bd 100644 --- a/x/bankplus/go.sum +++ b/x/bankplus/go.sum @@ -8,14 +8,14 @@ cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= +cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= -cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= +cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/tx v0.12.0 h1:Ry2btjQdrfrje9qZ3iZeZSmDArjgxUJMMcLMrX4wj5U= cosmossdk.io/x/tx v0.12.0/go.mod h1:qTth2coAGkwCwOCjqQ8EAQg+9udXNRzcnSbMgGKGEI0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -968,8 +968,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=