From 3d4fd33bab7b1078ee59d7669e0f2783873d321d Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Mon, 22 Jan 2024 18:35:23 +0300 Subject: [PATCH 01/71] revert go --- Dockerfile | 2 +- Dockerfile.dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2c129d821..db1742944 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION="1.20" +ARG GO_VERSION="1.19" ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11" # -------------------------------------------------------- diff --git a/Dockerfile.dev b/Dockerfile.dev index cd9684b2f..48d8bdff1 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION="1.20" +ARG GO_VERSION="1.19" ARG RUNNER_IMAGE="alpine:3.16" # -------------------------------------------------------- From 8e3e89cdee98e6d80e51198fc971a3a5dcd58571 Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 22 Jan 2024 20:33:40 +0100 Subject: [PATCH 02/71] replace notional-labs with composablefi --- .github/workflows/interchaintest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/interchaintest.yml b/.github/workflows/interchaintest.yml index 4529d0fed..e0a1f7d2d 100644 --- a/.github/workflows/interchaintest.yml +++ b/.github/workflows/interchaintest.yml @@ -33,7 +33,7 @@ jobs: push: true platforms: linux/amd64 tags: | - ghcr.io/notional-labs/centauri-ictest:latest + ghcr.io/composablefi/centauri-ictest:latest test-start-cosmos-chain: runs-on: ubuntu-latest needs: build-and-push-image From 0e070ba1cfee2e01dd938c954204e3b74743056f Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Mon, 29 Jan 2024 14:43:52 +0300 Subject: [PATCH 03/71] 1.20 --- .github/workflows/build.yml | 12 +++--- .github/workflows/build_docker.yml | 2 +- .github/workflows/codeql.yml | 6 +-- .github/workflows/interchaintest.yml | 50 +++++++++++----------- .github/workflows/lint.yml | 6 +-- .github/workflows/push_docker_images.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 6 +-- Dockerfile | 4 +- Dockerfile.dev | 2 +- README.md | 2 +- go.work.example | 2 +- tests/interchaintest/go.mod | 2 +- tests/interchaintest/go.sum | 6 +-- tests/interchaintest/setup.go | 4 +- tests/interchaintest/upgrade_chain_test.go | 4 +- 16 files changed, 56 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6f4bac4f..a621353f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,22 +19,22 @@ jobs: runs-on: ubuntu-latest name: build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - run: go build ./... tidy: runs-on: ubuntu-latest name: tidy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - run: | go mod tidy CHANGES_IN_REPO=$(git status --porcelain) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 1be551252..96d5a34f5 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1a631167a..04a790f94 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -23,10 +23,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + uses: actions/checkout@v4 + - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/interchaintest.yml b/.github/workflows/interchaintest.yml index e0a1f7d2d..56010c742 100644 --- a/.github/workflows/interchaintest.yml +++ b/.github/workflows/interchaintest.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to GitHub Container Registry @@ -38,13 +38,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-start-cosmos env: @@ -54,13 +54,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-upgrade env: @@ -70,13 +70,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-start-polkadot env: @@ -86,13 +86,13 @@ jobs: runs-on: ubuntu-latest needs: build-and-push-image steps: - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go 1.20 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: make ictest-validator env: @@ -102,13 +102,13 @@ jobs: # runs-on: ubuntu-latest # needs: build-and-push-image # steps: - # - name: Set up Go 1.19 - # uses: actions/setup-go@v3 + # - name: Set up Go 1.20 + # uses: actions/setup-go@v4 # with: - # go-version: 1.19 + # go-version: 1.20 # - name: checkout code - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - run: make ictest-ibc # env: @@ -118,13 +118,13 @@ jobs: # runs-on: ubuntu-latest # needs: build-and-push-image # steps: - # - name: Set up Go 1.19 - # uses: actions/setup-go@v3 + # - name: Set up Go 1.20 + # uses: actions/setup-go@v4 # with: - # go-version: 1.19 + # go-version: 1.20 # - name: checkout code - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - run: make ictest-push-wasm # env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3188ae602..0c27618f5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,10 +15,10 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: 1.19 - - uses: actions/checkout@v3 + go-version: '1.20' + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/push_docker_images.yml b/.github/workflows/push_docker_images.yml index 74a6f871a..9ee8b8b76 100644 --- a/.github/workflows/push_docker_images.yml +++ b/.github/workflows/push_docker_images.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe3f3c597..756cc1eec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b78394d8b..55a2a0b76 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,10 +12,10 @@ jobs: name: test steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '1.20' - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Test run: go test ./... \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index db1742944..6598b8e1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION="1.19" +ARG GO_VERSION="1.20" ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11" # -------------------------------------------------------- # Builder # -------------------------------------------------------- -FROM golang:${GO_VERSION}-alpine as builder +FROM golang:${GO_VERSION}-alpine3.18 as builder ARG GIT_VERSION ARG GIT_COMMIT diff --git a/Dockerfile.dev b/Dockerfile.dev index 48d8bdff1..cd9684b2f 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION="1.19" +ARG GO_VERSION="1.20" ARG RUNNER_IMAGE="alpine:3.16" # -------------------------------------------------------- diff --git a/README.md b/README.md index d2e721e98..9b8415a16 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Cosmos blockchain with IBC-v7 and wasm client enable. ## Quick start -Requires [Go 1.19](https://go.dev/doc/install) or higher. +Requires [Go 1.20](https://go.dev/doc/install) or higher. ```bash make install diff --git a/go.work.example b/go.work.example index 46219ac3b..9d174bce0 100644 --- a/go.work.example +++ b/go.work.example @@ -1,4 +1,4 @@ -go 1.19 +go 1.20 use ( ./ diff --git a/tests/interchaintest/go.mod b/tests/interchaintest/go.mod index dffbe962d..6d80d135e 100644 --- a/tests/interchaintest/go.mod +++ b/tests/interchaintest/go.mod @@ -1,6 +1,6 @@ module github.com/notional-labs/composable-testnet/tests/interchaintest -go 1.19 +go 1.20 require ( github.com/cosmos/ibc-go/v7 v7.0.0 diff --git a/tests/interchaintest/go.sum b/tests/interchaintest/go.sum index 24b3b43e9..8c60906fb 100644 --- a/tests/interchaintest/go.sum +++ b/tests/interchaintest/go.sum @@ -229,7 +229,7 @@ github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2B github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/sarama v1.20.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StirlingMarketingGroup/go-namecase v1.0.0 h1:2CzaNtCzc4iNHirR+5ru9OzGg8rQp860gqLBFqRI02Y= @@ -839,7 +839,7 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= @@ -1597,7 +1597,7 @@ google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnp google.golang.org/genproto v0.0.0-20230301171018-9ab4bdc49ad5 h1:/cadn7taPtPlCgiWNetEPsle7jgnlad2R7gR5MXB6dM= google.golang.org/genproto v0.0.0-20230301171018-9ab4bdc49ad5/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 74e6b338c..78fe8b92a 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -8,8 +8,8 @@ import ( ) var ( - CentauriMainRepo = "ghcr.io/notional-labs/centauri" - CentauriICTestRepo = "ghcr.io/notional-labs/centauri-ictest" + CentauriMainRepo = "ghcr.io/composablefi/composable-cosmos" + CentauriICTestRepo = "ghcr.io/composablefi/centauri-ictest" repo, version = GetDockerImageInfo() diff --git a/tests/interchaintest/upgrade_chain_test.go b/tests/interchaintest/upgrade_chain_test.go index acd90d172..c3f597e9f 100644 --- a/tests/interchaintest/upgrade_chain_test.go +++ b/tests/interchaintest/upgrade_chain_test.go @@ -38,8 +38,8 @@ func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, ChainID: "centaurid", Images: []ibc.DockerImage{ { - Repository: "ghcr.io/notional-labs/centauri", - Version: "6.0", + Repository: "ghcr.io/composablefi/composable-cosmos", + Version: "6.3.7", UidGid: "1025:1025", }, }, From 94b2ffcd13462c0c1d2f87b8da9e901296e3c44f Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Mon, 29 Jan 2024 16:43:27 +0300 Subject: [PATCH 04/71] t --- tests/interchaintest/upgrade_chain_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interchaintest/upgrade_chain_test.go b/tests/interchaintest/upgrade_chain_test.go index c3f597e9f..05ef584d9 100644 --- a/tests/interchaintest/upgrade_chain_test.go +++ b/tests/interchaintest/upgrade_chain_test.go @@ -20,7 +20,7 @@ const ( func TestCentauriUpgrade(t *testing.T) { repo, version := GetDockerImageInfo() - CosmosChainUpgradeTest(t, repo, version, "v6") + CosmosChainUpgradeTest(t, repo, version, "v7") } func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, upgradeName string) { From 5ddacffdc439164d1411d68b56ffd7d255ddcd3b Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Mon, 29 Jan 2024 20:22:28 +0300 Subject: [PATCH 05/71] t --- tests/interchaintest/upgrade_chain_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interchaintest/upgrade_chain_test.go b/tests/interchaintest/upgrade_chain_test.go index 05ef584d9..ea2973bc7 100644 --- a/tests/interchaintest/upgrade_chain_test.go +++ b/tests/interchaintest/upgrade_chain_test.go @@ -20,7 +20,7 @@ const ( func TestCentauriUpgrade(t *testing.T) { repo, version := GetDockerImageInfo() - CosmosChainUpgradeTest(t, repo, version, "v7") + CosmosChainUpgradeTest(t, repo, version, "v6_4") } func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, upgradeName string) { From 66b44f7a5be5f96967273068385a8b8fc6a2302f Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Tue, 30 Jan 2024 02:09:05 +0300 Subject: [PATCH 06/71] remove add-revenue tx --- app/keepers/keepers.go | 3 +- .../stakingmiddleware/v1beta1/tx.proto | 15 - x/stakingmiddleware/client/cli/tx.go | 35 +- x/stakingmiddleware/keeper/keeper.go | 29 +- x/stakingmiddleware/keeper/msg_server.go | 28 -- x/stakingmiddleware/types/errors.go | 7 - x/stakingmiddleware/types/expected_keepers.go | 17 - x/stakingmiddleware/types/keys.go | 3 +- x/stakingmiddleware/types/msgs.go | 20 - x/stakingmiddleware/types/tx.pb.go | 447 +----------------- 10 files changed, 32 insertions(+), 572 deletions(-) delete mode 100644 x/stakingmiddleware/types/errors.go delete mode 100644 x/stakingmiddleware/types/expected_keepers.go diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 34df21b0f..f56a9bcbb 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -188,7 +188,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.AccountKeeper, ) - appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) appKeepers.StakingKeeper = customstaking.NewKeeper( appCodec, appKeepers.keys[stakingtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), &appKeepers.StakingMiddlewareKeeper, @@ -238,7 +238,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) appKeepers.BankKeeper.RegisterKeepers(appKeepers.AllianceKeeper, appKeepers.StakingKeeper) - appKeepers.StakingMiddlewareKeeper.RegisterKeepers(appKeepers.StakingKeeper) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks appKeepers.StakingKeeper.SetHooks( diff --git a/proto/composable/stakingmiddleware/v1beta1/tx.proto b/proto/composable/stakingmiddleware/v1beta1/tx.proto index 9e1c20f3e..ff1431f74 100644 --- a/proto/composable/stakingmiddleware/v1beta1/tx.proto +++ b/proto/composable/stakingmiddleware/v1beta1/tx.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package composable.stakingmiddleware.v1beta1; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; @@ -15,7 +14,6 @@ service Msg { option (cosmos.msg.v1.service) = true; rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); - rpc AddRevenueFundsToStaking(MsgAddRevenueFundsToStakingParams) returns (MsgAddRevenueFundsToStakingResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -41,16 +39,3 @@ message MsgUpdateEpochParams { // // Since: cosmos-sdk 0.47 message MsgUpdateParamsEpochResponse {} - -message MsgAddRevenueFundsToStakingParams { - option (cosmos.msg.v1.signer) = "from_address"; - - string from_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - repeated cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -message MsgAddRevenueFundsToStakingResponse {} diff --git a/x/stakingmiddleware/client/cli/tx.go b/x/stakingmiddleware/client/cli/tx.go index 093158519..04b162b50 100644 --- a/x/stakingmiddleware/client/cli/tx.go +++ b/x/stakingmiddleware/client/cli/tx.go @@ -2,9 +2,6 @@ package cli import ( "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" "github.com/spf13/cobra" ) @@ -19,37 +16,7 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - txCmd.AddCommand( - GetCmdAddRevenueFundsToStaking(), - ) + txCmd.AddCommand() return txCmd } - -func GetCmdAddRevenueFundsToStaking() *cobra.Command { - cmd := &cobra.Command{ - Use: "add-revenue [amount]", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - coins, err := sdk.ParseCoinsNormalized(args[0]) - if err != nil { - return err - } - - msg := &types.MsgAddRevenueFundsToStakingParams{ - FromAddress: clientCtx.GetFromAddress().String(), - Amount: coins, - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/stakingmiddleware/keeper/keeper.go b/x/stakingmiddleware/keeper/keeper.go index 83660b572..4580cb017 100644 --- a/x/stakingmiddleware/keeper/keeper.go +++ b/x/stakingmiddleware/keeper/keeper.go @@ -9,17 +9,12 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - banktypes "github.com/notional-labs/composable/v6/custom/bank/types" ) // Keeper of the staking middleware store type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - stakingKeeper banktypes.StakingKeeper + cdc codec.BinaryCodec + storeKey storetypes.StoreKey // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string @@ -29,24 +24,15 @@ type Keeper struct { func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, - ak types.AccountKeeper, - bk types.BankKeeper, authority string, ) Keeper { return Keeper{ - cdc: cdc, - storeKey: key, - accountKeeper: ak, - bankKeeper: bk, - stakingKeeper: stakingkeeper.Keeper{}, - authority: authority, + cdc: cdc, + storeKey: key, + authority: authority, } } -func (k *Keeper) RegisterKeepers(sk banktypes.StakingKeeper) { - k.stakingKeeper = sk -} - // GetAuthority returns the x/stakingmiddleware module's authority. func (k Keeper) GetAuthority() string { return k.authority @@ -88,8 +74,3 @@ func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { k.cdc.MustUnmarshal(bz, &p) return p } - -func (k Keeper) GetModuleAccountAccAddress(ctx sdk.Context) sdk.AccAddress { - moduleAccount := k.accountKeeper.GetModuleAccount(ctx, types.RewardModuleName) - return moduleAccount.GetAddress() -} diff --git a/x/stakingmiddleware/keeper/msg_server.go b/x/stakingmiddleware/keeper/msg_server.go index 47f3e2509..95de74ad9 100644 --- a/x/stakingmiddleware/keeper/msg_server.go +++ b/x/stakingmiddleware/keeper/msg_server.go @@ -36,31 +36,3 @@ func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdat return &types.MsgUpdateParamsEpochResponse{}, nil } - -// UpdateParams updates the params. -func (ms msgServer) AddRevenueFundsToStaking(goCtx context.Context, req *types.MsgAddRevenueFundsToStakingParams) (*types.MsgAddRevenueFundsToStakingResponse, error) { - // Unwrap context - ctx := sdk.UnwrapSDKContext(goCtx) - - // Check sender address - sender, err := sdk.AccAddressFromBech32(req.FromAddress) - if err != nil { - return nil, err - } - - rewardDenom := ms.Keeper.stakingKeeper.BondDenom(ctx) - - // Check that reward is 1 coin rewardDenom - if len(req.Amount.Denoms()) != 1 || req.Amount[0].Denom != rewardDenom { - return nil, errorsmod.Wrapf(types.ErrInvalidCoin, "Invalid coin") - } - - // Send Fund to account module - moduleAccountAccAddress := ms.GetModuleAccountAccAddress(ctx) - err = ms.bankKeeper.SendCoins(ctx, sender, moduleAccountAccAddress, req.Amount) - if err != nil { - return nil, err - } - - return &types.MsgAddRevenueFundsToStakingResponse{}, nil -} diff --git a/x/stakingmiddleware/types/errors.go b/x/stakingmiddleware/types/errors.go deleted file mode 100644 index c2b334aab..000000000 --- a/x/stakingmiddleware/types/errors.go +++ /dev/null @@ -1,7 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" -) - -var ErrInvalidCoin = errorsmod.Register(ModuleName, 1, "invalid coin") diff --git a/x/stakingmiddleware/types/expected_keepers.go b/x/stakingmiddleware/types/expected_keepers.go deleted file mode 100644 index 382d678dd..000000000 --- a/x/stakingmiddleware/types/expected_keepers.go +++ /dev/null @@ -1,17 +0,0 @@ -package types // noalias - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the contract required for account APIs. -type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI -} - -// BankKeeper defines the contract needed to be fulfilled for banking and supply -// dependencies. -type BankKeeper interface { - SendCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error -} diff --git a/x/stakingmiddleware/types/keys.go b/x/stakingmiddleware/types/keys.go index 28f5b9aba..a4f667e69 100644 --- a/x/stakingmiddleware/types/keys.go +++ b/x/stakingmiddleware/types/keys.go @@ -7,8 +7,7 @@ var ( const ( // module name - ModuleName = "stakingmiddleware" - RewardModuleName = "fee_collector" + ModuleName = "stakingmiddleware" // StoreKey is the default store key for stakingmiddleware module that store params when apply validator set changes and when allow to unbond/redelegate diff --git a/x/stakingmiddleware/types/msgs.go b/x/stakingmiddleware/types/msgs.go index a2ea12a5a..4418aa784 100644 --- a/x/stakingmiddleware/types/msgs.go +++ b/x/stakingmiddleware/types/msgs.go @@ -26,23 +26,3 @@ func (m *MsgUpdateEpochParams) ValidateBasic() error { return nil } - -// GetSignBytes implements the LegacyMsg interface. -func (m MsgAddRevenueFundsToStakingParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgAddRevenueFundsToStakingParams) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(m.FromAddress) - return []sdk.AccAddress{addr} -} - -// ValidateBasic does a sanity check on the provided data. -func (m *MsgAddRevenueFundsToStakingParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { - return errorsmod.Wrapf(err, "invalid address") - } - - return nil -} diff --git a/x/stakingmiddleware/types/tx.pb.go b/x/stakingmiddleware/types/tx.pb.go index fb5d7e8f6..5bf477a33 100644 --- a/x/stakingmiddleware/types/tx.pb.go +++ b/x/stakingmiddleware/types/tx.pb.go @@ -7,8 +7,6 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -133,99 +131,9 @@ func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo -type MsgAddRevenueFundsToStakingParams struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` -} - -func (m *MsgAddRevenueFundsToStakingParams) Reset() { *m = MsgAddRevenueFundsToStakingParams{} } -func (m *MsgAddRevenueFundsToStakingParams) String() string { return proto.CompactTextString(m) } -func (*MsgAddRevenueFundsToStakingParams) ProtoMessage() {} -func (*MsgAddRevenueFundsToStakingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_4ef8bcd16d104cd6, []int{2} -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddRevenueFundsToStakingParams.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddRevenueFundsToStakingParams.Merge(m, src) -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_Size() int { - return m.Size() -} -func (m *MsgAddRevenueFundsToStakingParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddRevenueFundsToStakingParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddRevenueFundsToStakingParams proto.InternalMessageInfo - -func (m *MsgAddRevenueFundsToStakingParams) GetFromAddress() string { - if m != nil { - return m.FromAddress - } - return "" -} - -func (m *MsgAddRevenueFundsToStakingParams) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -type MsgAddRevenueFundsToStakingResponse struct { -} - -func (m *MsgAddRevenueFundsToStakingResponse) Reset() { *m = MsgAddRevenueFundsToStakingResponse{} } -func (m *MsgAddRevenueFundsToStakingResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddRevenueFundsToStakingResponse) ProtoMessage() {} -func (*MsgAddRevenueFundsToStakingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4ef8bcd16d104cd6, []int{3} -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddRevenueFundsToStakingResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddRevenueFundsToStakingResponse.Merge(m, src) -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddRevenueFundsToStakingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddRevenueFundsToStakingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddRevenueFundsToStakingResponse proto.InternalMessageInfo - func init() { proto.RegisterType((*MsgUpdateEpochParams)(nil), "composable.stakingmiddleware.v1beta1.MsgUpdateEpochParams") proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "composable.stakingmiddleware.v1beta1.MsgUpdateParamsEpochResponse") - proto.RegisterType((*MsgAddRevenueFundsToStakingParams)(nil), "composable.stakingmiddleware.v1beta1.MsgAddRevenueFundsToStakingParams") - proto.RegisterType((*MsgAddRevenueFundsToStakingResponse)(nil), "composable.stakingmiddleware.v1beta1.MsgAddRevenueFundsToStakingResponse") } func init() { @@ -233,40 +141,30 @@ func init() { } var fileDescriptor_4ef8bcd16d104cd6 = []byte{ - // 522 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4d, 0x8f, 0xd2, 0x40, - 0x18, 0x66, 0x96, 0x48, 0xc2, 0xe0, 0x85, 0x86, 0xc4, 0xd2, 0x98, 0x2e, 0xa2, 0x26, 0x84, 0x48, - 0x1b, 0xd8, 0xe8, 0x01, 0xbd, 0x50, 0xa3, 0xc6, 0x03, 0xd1, 0xb0, 0x7a, 0xf1, 0xb2, 0x99, 0xd2, - 0xb1, 0x34, 0xbb, 0x9d, 0x69, 0xfa, 0x4e, 0x71, 0xf7, 0x66, 0x3c, 0x7a, 0x32, 0xf1, 0x4f, 0x18, - 0x0f, 0x86, 0x83, 0x3f, 0x62, 0x8f, 0x1b, 0xbd, 0x78, 0xf1, 0x23, 0x70, 0xe0, 0x6f, 0x98, 0x76, - 0x66, 0x17, 0x15, 0x44, 0xcc, 0x5e, 0x98, 0xe1, 0xfd, 0x78, 0xde, 0x79, 0x9e, 0xe7, 0x2d, 0x6e, - 0x0d, 0x79, 0x18, 0x71, 0x20, 0xee, 0x01, 0xb5, 0x41, 0x90, 0xfd, 0x80, 0xf9, 0x61, 0xe0, 0x79, - 0x07, 0xf4, 0x05, 0x89, 0xa9, 0x3d, 0x6e, 0xbb, 0x54, 0x90, 0xb6, 0x2d, 0x0e, 0xad, 0x28, 0xe6, - 0x82, 0x6b, 0xd7, 0x16, 0xe5, 0xd6, 0x52, 0xb9, 0xa5, 0xca, 0x0d, 0x73, 0xc8, 0x21, 0xe4, 0x60, - 0xbb, 0x04, 0x16, 0x18, 0x43, 0x1e, 0x30, 0x89, 0x62, 0x5c, 0x52, 0xf9, 0x10, 0x7c, 0x7b, 0xdc, - 0x4e, 0x0f, 0x95, 0x28, 0x93, 0x30, 0x60, 0xdc, 0xce, 0x7e, 0x55, 0xa8, 0xe2, 0x73, 0x9f, 0x67, - 0x57, 0x3b, 0xbd, 0xa9, 0x68, 0x55, 0x22, 0xec, 0xc9, 0x84, 0xfc, 0xa3, 0x52, 0x77, 0x36, 0x62, - 0xb4, 0xfc, 0xf8, 0xac, 0xbb, 0x3e, 0x45, 0xb8, 0xd2, 0x07, 0xff, 0x69, 0xe4, 0x11, 0x41, 0xef, - 0x45, 0x7c, 0x38, 0x7a, 0x4c, 0x62, 0x12, 0x82, 0x76, 0x0b, 0x17, 0x49, 0x22, 0x46, 0x3c, 0x0e, - 0xc4, 0x91, 0x8e, 0x6a, 0xa8, 0x51, 0x74, 0xf4, 0x4f, 0x1f, 0x5b, 0x15, 0x35, 0xbb, 0xe7, 0x79, - 0x31, 0x05, 0xd8, 0x15, 0x71, 0xc0, 0xfc, 0xc1, 0xa2, 0x54, 0x7b, 0x84, 0x0b, 0x51, 0x86, 0xa0, - 0x6f, 0xd5, 0x50, 0xa3, 0xd4, 0xb9, 0x61, 0x6d, 0x22, 0xa1, 0x25, 0xa7, 0x3a, 0xc5, 0xe3, 0x6f, - 0xdb, 0xb9, 0x77, 0xf3, 0x49, 0x13, 0x0d, 0x14, 0x4c, 0xb7, 0xf7, 0x6a, 0x3e, 0x69, 0x2e, 0x06, - 0xbc, 0x9e, 0x4f, 0x9a, 0xbf, 0x40, 0xda, 0x87, 0x2b, 0x48, 0x9f, 0x11, 0x92, 0xa8, 0x75, 0x13, - 0x5f, 0xfe, 0x23, 0x94, 0x31, 0x1d, 0x50, 0x88, 0x38, 0x03, 0x5a, 0xff, 0x8a, 0xf0, 0x95, 0x3e, - 0xf8, 0x3d, 0xcf, 0x1b, 0xd0, 0x31, 0x65, 0x09, 0xbd, 0x9f, 0x30, 0x0f, 0x9e, 0xf0, 0x5d, 0x89, - 0xac, 0x14, 0xb9, 0x8d, 0x2f, 0x3e, 0x8f, 0x79, 0xb8, 0x47, 0x24, 0xf5, 0x7f, 0x8a, 0x52, 0x4a, - 0xab, 0x55, 0x48, 0x1b, 0xe1, 0x02, 0x09, 0x79, 0xc2, 0x84, 0x9e, 0xaf, 0xe5, 0x1b, 0xa5, 0x4e, - 0xd5, 0x52, 0x3d, 0xe9, 0xce, 0x9c, 0xa9, 0x70, 0x97, 0x07, 0xcc, 0xb9, 0x99, 0x6a, 0xf0, 0xfe, - 0xfb, 0x76, 0xc3, 0x0f, 0xc4, 0x28, 0x71, 0x53, 0xb2, 0xca, 0x71, 0x75, 0xb4, 0xc0, 0xdb, 0xb7, - 0xc5, 0x51, 0x44, 0x21, 0x6b, 0x00, 0xa5, 0x97, 0xc4, 0xef, 0x96, 0x53, 0xbd, 0x7e, 0x7b, 0x69, - 0xfd, 0x3a, 0xbe, 0xba, 0x86, 0xde, 0xa9, 0x0c, 0x9d, 0xcf, 0x5b, 0x38, 0xdf, 0x07, 0x5f, 0x7b, - 0x8b, 0x70, 0x79, 0x79, 0x21, 0xba, 0x9b, 0x19, 0xb9, 0x6a, 0x99, 0x0c, 0xe7, 0x3f, 0x7b, 0x57, - 0x98, 0xa4, 0x7d, 0x40, 0x58, 0xff, 0x1b, 0x05, 0xed, 0xc1, 0xc6, 0x03, 0xd6, 0x9b, 0x6c, 0x3c, - 0x3c, 0x37, 0xd0, 0xe9, 0x83, 0x8d, 0x0b, 0x2f, 0x53, 0x5f, 0x9c, 0x9d, 0xe3, 0xa9, 0x89, 0x4e, - 0xa6, 0x26, 0xfa, 0x31, 0x35, 0xd1, 0x9b, 0x99, 0x99, 0x3b, 0x99, 0x99, 0xb9, 0x2f, 0x33, 0x33, - 0xf7, 0xac, 0xba, 0x6a, 0x77, 0x33, 0x5f, 0xdd, 0x42, 0xf6, 0x75, 0xee, 0xfc, 0x0c, 0x00, 0x00, - 0xff, 0xff, 0x00, 0xe0, 0x13, 0xf7, 0xaf, 0x04, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4d, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0x2f, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0xcf, 0xcd, + 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x41, 0x28, 0xd7, 0xc3, 0x50, + 0xae, 0x07, 0x55, 0x2e, 0x25, 0x9e, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x5b, 0x9c, 0xae, + 0x5f, 0x66, 0x08, 0xa2, 0x20, 0xda, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, + 0x54, 0x48, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, 0xb1, 0xa0, 0xa2, 0x92, 0x10, 0x13, + 0xe2, 0x21, 0x12, 0x10, 0x0e, 0x54, 0xca, 0x86, 0x28, 0x17, 0x63, 0x3a, 0x0e, 0xac, 0x5b, 0xe9, + 0x11, 0x23, 0x97, 0x88, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0xaa, 0x6b, 0x41, 0x7e, + 0x72, 0x46, 0x40, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x90, 0x19, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, + 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, + 0x22, 0x50, 0xbb, 0x1d, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, + 0x83, 0x10, 0x4a, 0x85, 0xfc, 0xb9, 0xd8, 0x0a, 0xc0, 0x26, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, + 0x1b, 0xe9, 0xe8, 0x11, 0x13, 0x44, 0x7a, 0x10, 0x5b, 0x9d, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, + 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, 0xd4, 0x18, 0x2b, 0xc7, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0x16, + 0x74, 0x3d, 0xdf, 0xa0, 0x85, 0x64, 0xa4, 0x7e, 0x05, 0x16, 0x4f, 0xc3, 0x3d, 0x04, 0x31, 0x55, + 0x49, 0x8e, 0x4b, 0x06, 0x4d, 0x08, 0xec, 0xd3, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, + 0xa3, 0x45, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x93, 0x19, 0xb9, 0x04, 0x31, 0x43, 0xc2, + 0x8a, 0x38, 0x1f, 0x60, 0x0b, 0x45, 0x29, 0x27, 0x12, 0xf5, 0x62, 0x71, 0x9d, 0x14, 0x6b, 0x03, + 0x28, 0x3c, 0x9c, 0x8c, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, + 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x12, + 0x5b, 0x18, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x63, 0xd9, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0xc4, 0xc6, 0x61, 0xc6, 0xd7, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -282,7 +180,6 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) - AddRevenueFundsToStaking(ctx context.Context, in *MsgAddRevenueFundsToStakingParams, opts ...grpc.CallOption) (*MsgAddRevenueFundsToStakingResponse, error) } type msgClient struct { @@ -302,19 +199,9 @@ func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochPar return out, nil } -func (c *msgClient) AddRevenueFundsToStaking(ctx context.Context, in *MsgAddRevenueFundsToStakingParams, opts ...grpc.CallOption) (*MsgAddRevenueFundsToStakingResponse, error) { - out := new(MsgAddRevenueFundsToStakingResponse) - err := c.cc.Invoke(ctx, "/composable.stakingmiddleware.v1beta1.Msg/AddRevenueFundsToStaking", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServer is the server API for Msg service. type MsgServer interface { UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) - AddRevenueFundsToStaking(context.Context, *MsgAddRevenueFundsToStakingParams) (*MsgAddRevenueFundsToStakingResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -324,9 +211,6 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") } -func (*UnimplementedMsgServer) AddRevenueFundsToStaking(ctx context.Context, req *MsgAddRevenueFundsToStakingParams) (*MsgAddRevenueFundsToStakingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddRevenueFundsToStaking not implemented") -} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -350,24 +234,6 @@ func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Msg_AddRevenueFundsToStaking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddRevenueFundsToStakingParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddRevenueFundsToStaking(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/composable.stakingmiddleware.v1beta1.Msg/AddRevenueFundsToStaking", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddRevenueFundsToStaking(ctx, req.(*MsgAddRevenueFundsToStakingParams)) - } - return interceptor(ctx, in, info, handler) -} - var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "composable.stakingmiddleware.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -376,10 +242,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateEpochParams", Handler: _Msg_UpdateEpochParams_Handler, }, - { - MethodName: "AddRevenueFundsToStaking", - Handler: _Msg_AddRevenueFundsToStaking_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "composable/stakingmiddleware/v1beta1/tx.proto", @@ -448,73 +310,6 @@ func (m *MsgUpdateParamsEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *MsgAddRevenueFundsToStakingParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgAddRevenueFundsToStakingParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddRevenueFundsToStakingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgAddRevenueFundsToStakingResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgAddRevenueFundsToStakingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddRevenueFundsToStakingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -550,34 +345,6 @@ func (m *MsgUpdateParamsEpochResponse) Size() (n int) { return n } -func (m *MsgAddRevenueFundsToStakingParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgAddRevenueFundsToStakingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -749,172 +516,6 @@ func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddRevenueFundsToStakingParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAddRevenueFundsToStakingResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddRevenueFundsToStakingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From d841b1fbcf268ea68782e55ed3920d44070bf1ed Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Tue, 30 Jan 2024 02:09:24 +0300 Subject: [PATCH 07/71] remove fee_collector from blacklist --- app/keepers/keepers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index f56a9bcbb..b850c042f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -492,7 +492,9 @@ func (appKeepers *AppKeepers) BlacklistedModuleAccountAddrs(maccPerms map[string modAccAddrs := make(map[string]bool) // DO NOT REMOVE: StringMapKeys fixes non-deterministic map iteration for acc := range maccPerms { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + if acc != authtypes.FeeCollectorName { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } } return modAccAddrs } From b20f11368dca3024b66c8999f4b02f07ddcb31bb Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Wed, 31 Jan 2024 12:18:22 +0300 Subject: [PATCH 08/71] double wasm size --- app/keepers/keepers.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index b850c042f..be5bb4282 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -95,10 +95,11 @@ import ( minttypes "github.com/notional-labs/composable/v6/x/mint/types" "github.com/CosmWasm/wasmd/x/wasm" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" wasm08Keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper" - wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" + wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types" ibc_hooks "github.com/notional-labs/composable/v6/x/ibc-hooks" ibchookskeeper "github.com/notional-labs/composable/v6/x/ibc-hooks/keeper" @@ -251,7 +252,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[ibchost.StoreKey], appKeepers.GetSubspace(ibchost.ModuleName), appKeepers.StakingKeeper, appKeepers.UpgradeKeeper, appKeepers.ScopedIBCKeeper, ) - appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasmtypes.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper) + appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper) // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( @@ -371,12 +372,15 @@ func (appKeepers *AppKeepers) InitNormalKeepers( panic(fmt.Sprintf("error while reading wasm config: %s", err)) } + // increase default wasm size in all wasmd related codes (as on Neutorn/Osmosis) + wasmtypes.MaxWasmSize *= 2 + // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks availableCapabilities := strings.Join(AllCapabilities(), ",") appKeepers.WasmKeeper = wasm.NewKeeper( appCodec, - appKeepers.keys[wasm.StoreKey], + appKeepers.keys[wasmtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, From 9d6a2f76a372c8eb4aaf3724d375bb0dc105a218 Mon Sep 17 00:00:00 2001 From: Kostya Kastsevich Date: Wed, 31 Jan 2024 15:33:24 +0300 Subject: [PATCH 09/71] new upgrade --- app/app.go | 4 ++-- app/upgrades/v6_4_4/constants.go | 15 +++++++++++++++ app/upgrades/v6_4_4/upgrade.go | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v6_4_4/constants.go create mode 100644 app/upgrades/v6_4_4/upgrade.go diff --git a/app/app.go b/app/app.go index 067fe7ca1..fee41b0b5 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - v6_4 "github.com/notional-labs/composable/v6/app/upgrades/v6_4" + v6_4_4 "github.com/notional-labs/composable/v6/app/upgrades/v6_4_4" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -144,7 +144,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_4.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_4/constants.go b/app/upgrades/v6_4_4/constants.go new file mode 100644 index 000000000..237da7777 --- /dev/null +++ b/app/upgrades/v6_4_4/constants.go @@ -0,0 +1,15 @@ +package v6_4_4 + +import ( + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_4" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v6_4_4/upgrade.go b/app/upgrades/v6_4_4/upgrade.go new file mode 100644 index 000000000..b3273193a --- /dev/null +++ b/app/upgrades/v6_4_4/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} From adf4face2ef304ae0f9d537cb88f5e888b7d4a7d Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 11 Mar 2024 16:57:54 +0000 Subject: [PATCH 10/71] change upgrade name to v6_4_7 --- app/upgrades/v6_4_4/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades/v6_4_4/constants.go b/app/upgrades/v6_4_4/constants.go index 237da7777..510232575 100644 --- a/app/upgrades/v6_4_4/constants.go +++ b/app/upgrades/v6_4_4/constants.go @@ -6,7 +6,7 @@ import ( const ( // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_4" + UpgradeName = "v6_4_7" ) var Upgrade = upgrades.Upgrade{ From dbf175ff9955b047decd1a176f81fe77f4bb4bf0 Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 11 Mar 2024 17:02:45 +0000 Subject: [PATCH 11/71] rename v6_4_47 --- app/upgrades/v6_4_4/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades/v6_4_4/constants.go b/app/upgrades/v6_4_4/constants.go index 510232575..dac6950a1 100644 --- a/app/upgrades/v6_4_4/constants.go +++ b/app/upgrades/v6_4_4/constants.go @@ -6,7 +6,7 @@ import ( const ( // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_7" + UpgradeName = "v6_4_47" ) var Upgrade = upgrades.Upgrade{ From 2a4660392c11ec8b4c550504252db33e3c86f8e8 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 7 Feb 2024 02:42:41 +0300 Subject: [PATCH 12/71] delete proposal #6 --- app/app.go | 4 ++-- app/upgrades/v6_4_5/constants.go | 16 +++++++++++++++ app/upgrades/v6_4_5/upgrade.go | 24 ++++++++++++++++++++++ tests/interchaintest/upgrade_chain_test.go | 4 ++-- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 app/upgrades/v6_4_5/constants.go create mode 100644 app/upgrades/v6_4_5/upgrade.go diff --git a/app/app.go b/app/app.go index fee41b0b5..0c7c45fb6 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - v6_4_4 "github.com/notional-labs/composable/v6/app/upgrades/v6_4_4" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_5" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -144,7 +144,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_4.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_5.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go new file mode 100644 index 000000000..f95ad3875 --- /dev/null +++ b/app/upgrades/v6_4_5/constants.go @@ -0,0 +1,16 @@ +package v6_4_5 + +import ( + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_5" + BrokenProposal = 6 +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go new file mode 100644 index 000000000..29e4fb2a7 --- /dev/null +++ b/app/upgrades/v6_4_5/upgrade.go @@ -0,0 +1,24 @@ +package v6_4_5 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + keepers.GovKeeper.DeleteProposal(ctx, BrokenProposal) + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/tests/interchaintest/upgrade_chain_test.go b/tests/interchaintest/upgrade_chain_test.go index ea2973bc7..a71e92bbe 100644 --- a/tests/interchaintest/upgrade_chain_test.go +++ b/tests/interchaintest/upgrade_chain_test.go @@ -20,7 +20,7 @@ const ( func TestCentauriUpgrade(t *testing.T) { repo, version := GetDockerImageInfo() - CosmosChainUpgradeTest(t, repo, version, "v6_4") + CosmosChainUpgradeTest(t, repo, version, "v6_4_5") } func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, upgradeName string) { @@ -39,7 +39,7 @@ func CosmosChainUpgradeTest(t *testing.T, upgradeContainerRepo, upgradeVersion, Images: []ibc.DockerImage{ { Repository: "ghcr.io/composablefi/composable-cosmos", - Version: "6.3.7", + Version: "6.4.4", UidGid: "1025:1025", }, }, From 562674a79f1865ec77a4e20fec33692cc1e0e05a Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 7 Feb 2024 02:58:56 +0300 Subject: [PATCH 13/71] use develop branch for ci --- .github/workflows/interchaintest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/interchaintest.yml b/.github/workflows/interchaintest.yml index 56010c742..2febd9bdd 100644 --- a/.github/workflows/interchaintest.yml +++ b/.github/workflows/interchaintest.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - main + - develop permissions: contents: read From 0503474eafd32126cdfb90f659ae422c442bb7d4 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 7 Feb 2024 03:09:35 +0300 Subject: [PATCH 14/71] use another image --- tests/interchaintest/setup.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 78fe8b92a..384f31cb5 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -2,7 +2,6 @@ package interchaintest import ( "os" - "strings" "github.com/strangelove-ventures/interchaintest/v7/ibc" ) @@ -50,6 +49,7 @@ func GetDockerImageInfo() (repo, version string) { } // github converts / to - for pushed docker images - branchVersion = strings.ReplaceAll(branchVersion, "/", "-") + // branchVersion = strings.ReplaceAll(branchVersion, "/", "-") + branchVersion = "latest" return repo, branchVersion } From 3c4f2d60010d684aa7b2008ab74e557083329c19 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 7 Feb 2024 04:48:00 +0300 Subject: [PATCH 15/71] test --- app/upgrades/v6_4_5/upgrade.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go index 29e4fb2a7..41d3b55c3 100644 --- a/app/upgrades/v6_4_5/upgrade.go +++ b/app/upgrades/v6_4_5/upgrade.go @@ -18,7 +18,7 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - keepers.GovKeeper.DeleteProposal(ctx, BrokenProposal) + return mm.RunMigrations(ctx, configurator, vm) } } From 22e484a4b124a4e70dc75f0b96bdcab3364da861 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 7 Feb 2024 05:01:06 +0300 Subject: [PATCH 16/71] removing more broken proposals --- app/upgrades/v6_4_5/constants.go | 3 +-- app/upgrades/v6_4_5/upgrade.go | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go index f95ad3875..27afc17b0 100644 --- a/app/upgrades/v6_4_5/constants.go +++ b/app/upgrades/v6_4_5/constants.go @@ -6,8 +6,7 @@ import ( const ( // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_5" - BrokenProposal = 6 + UpgradeName = "v6_4_5" ) var Upgrade = upgrades.Upgrade{ diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go index 41d3b55c3..72dbebe02 100644 --- a/app/upgrades/v6_4_5/upgrade.go +++ b/app/upgrades/v6_4_5/upgrade.go @@ -18,7 +18,10 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - + BrokenProposals := [3]uint64{2, 6, 11} + for _, proposal := range BrokenProposals { + keepers.GovKeeper.DeleteProposal(ctx, proposal) + } return mm.RunMigrations(ctx, configurator, vm) } } From 448efe56d671a220a6a6834479d8924cea1c2afc Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 14:52:31 +0100 Subject: [PATCH 17/71] introduce goreleaser --- .github/workflows/goreleaser-latest.yml | 49 +++++++++++++ .github/workflows/goreleaser.yml | 52 ++++++++++++++ .github/workflows/release.yml | 45 ------------ .gitignore | 3 + .goreleaser.yml | 92 +++++++++++++++++++++++++ Makefile | 2 + contrib/docker/goreleaser.Dockerfile | 20 ++++++ contrib/make/release.mk | 32 +++++++++ scripts/release_pre_darwin.sh | 15 ++++ scripts/release_pre_linux.sh | 29 ++++++++ 10 files changed, 294 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/goreleaser-latest.yml create mode 100644 .github/workflows/goreleaser.yml delete mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml create mode 100644 contrib/docker/goreleaser.Dockerfile create mode 100644 contrib/make/release.mk create mode 100644 scripts/release_pre_darwin.sh create mode 100644 scripts/release_pre_linux.sh diff --git a/.github/workflows/goreleaser-latest.yml b/.github/workflows/goreleaser-latest.yml new file mode 100644 index 000000000..60b71433d --- /dev/null +++ b/.github/workflows/goreleaser-latest.yml @@ -0,0 +1,49 @@ +name: goreleaser-latest + +on: + push: + branches: + - main + - develop + +permissions: + contents: write + packages: write + +jobs: + goreleaser-latest: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --force --tags + + - name: Release (snapshot) + run: make release-snapshot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to GHCR container register + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push versioned image + uses: docker/build-push-action@v5 + with: + file: contrib/docker/goreleaser.Dockerfile + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ghcr.io/rjonczy/composable-cosmos:latest diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 000000000..ea64b2d54 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,52 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --force --tags + + - name: Release + run: make release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get version + id: get_version + uses: battila7/get-version-action@v2 + + - name: Login to GHCR container register + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push versioned image + uses: docker/build-push-action@v5 + with: + file: contrib/docker/goreleaser.Dockerfile + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ghcr.io/rjonczy/composable-cosmos:${{ steps.get_version.outputs.version-without-v }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 756cc1eec..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- - name: Release Binary - - on: - release: - types: [created] - - permissions: - contents: read - packages: write - - jobs: - release: - permissions: write-all - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Docker compose - run: docker-compose up -d - - - name: Copy binary - run: docker cp composable-centauri_node_1:/bin/centaurid ./centaurid - - - name: Save sha256 sum - run: sha256sum ./centaurid > ./centaurid_sha256.txt - - - name: Release - uses: softprops/action-gh-release@v1 - with: - token: ${{ github.token }} - files: | - centaurid - centaurid_sha256.txt - - - name: Dump docker logs on failure - if: failure() - uses: jwalton/gh-docker-logs@v2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 003f7ba8e..bd65a4ba1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,9 @@ scripts/temp.sh wasm_client* vue/* bin/* + +dist/ + # Test binary, built with `go test -c` *.test diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..98a48e9be --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,92 @@ +# .goreleaser.yml + +project_name: centaurid + +env: + - CGO_ENABLED=1 + +builds: + - id: linux + main: ./cmd/centaurid + binary: centaurid + hooks: + pre: + - cmd: bash scripts/release_pre_linux.sh + output: false # enable for debug + env: + - TARGET={{ .Target }} + goos: + - linux + goarch: + - amd64 + - arm64 + env: + - CC_linux_amd64=x86_64-linux-gnu-gcc + - CC_linux_arm64=aarch64-linux-gnu-gcc + - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' + flags: + - -mod=readonly + - -trimpath + ldflags: + - -X github.com/cosmos/cosmos-sdk/version.Name=centauri + - -X github.com/cosmos/cosmos-sdk/version.AppName=centaurid + - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} + - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} + - -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc" + - -w -s + - -linkmode=external + - -extldflags '-static -lm -lbz2' + tags: + - netgo + - ledger + - muslc + - static + - static_wasm + + # - id: darwin + # main: ./cmd/centaurid + # binary: centaurid + # hooks: + # pre: + # - cmd: bash scripts/release_pre_darwin.sh + # output: false # enable for debug + # env: + # - TARGET={{ .Target }} + # goos: + # - darwin + # goarch: + # - amd64 + # - arm64 + # env: + # - CC_darwin_amd64=o64-clang + # - CC_darwin_arm64=oa64-clang + # - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}' + # flags: + # - -mod=readonly + # - -trimpath + # ldflags: + # - -X github.com/cosmos/cosmos-sdk/version.Name=centauri + # - -X github.com/cosmos/cosmos-sdk/version.AppName=centaurid + # - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} + # - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} + # - -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc" + # - -w -s + # - -linkmode=external + # - -extldflags '-static -lm -lbz2' + # tags: + # - netgo + # - ledger + # - muslc + # - static + # - static_wasm + +# dockers: +# - dockerfile: "goreleaser.Dockerfile" +# image_templates: +# - "ghcr.io/rjonczy/goapp:{{ .Tag }}" +# build_flag_templates: +# - "--label=org.opencontainers.image.created={{.Date}}" +# - "--label=org.opencontainers.image.name={{.ProjectName}}" +# - "--label=org.opencontainers.image.revision={{.FullCommit}}" +# - "--label=org.opencontainers.image.version={{.Version}}" +# use: buildx \ No newline at end of file diff --git a/Makefile b/Makefile index cde284ab7..26d1cf2b2 100644 --- a/Makefile +++ b/Makefile @@ -158,3 +158,5 @@ ictest-push-wasm: cd tests/interchaintest && go test -race -v -run TestPushWasmClientCode . .PHONY: ictest-start-cosmos ictest-start-polkadot ictest-ibc ictest-push-wasm ictest-all + +include contrib/make/release.mk \ No newline at end of file diff --git a/contrib/docker/goreleaser.Dockerfile b/contrib/docker/goreleaser.Dockerfile new file mode 100644 index 000000000..b38b43a6b --- /dev/null +++ b/contrib/docker/goreleaser.Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.20 AS builder + +WORKDIR /root +COPY ./dist/ /root/ + +ARG TARGETARCH +RUN if [ "${TARGETARCH}" = "arm64" ]; then \ + cp linux_linux_arm64/centaurid /root/centaurid; \ + else \ + cp linux_linux_amd64_v1/centaurid /root/centaurid; \ + fi + +FROM alpine:latest + +WORKDIR /root +RUN apk --no-cache add ca-certificates +COPY --from=builder /root/centaurid /usr/local/bin/centaurid + +ENTRYPOINT ["centaurid"] +CMD [ "start" ] diff --git a/contrib/make/release.mk b/contrib/make/release.mk new file mode 100644 index 000000000..4a384f321 --- /dev/null +++ b/contrib/make/release.mk @@ -0,0 +1,32 @@ +############################################################################### +### Release ### +############################################################################### + +PACKAGE_NAME := github.com/rjonczy/composable-cosmos +GOLANG_CROSS_VERSION ?= v1.20 + +# The `make release` command is running a Docker container with the image +# `gorelease/goreleaser-cross:${GOLANG_CROSS_VERSION}`. This command: +# `-v "$(CURDIR)":/go/src/$(PACKAGE_NAME)`: mounts the current directory +# `release --clean`: executes the release inside the directory +release: + docker run \ + --rm \ + --platform linux/amd64 \ + -v "$(CURDIR)":/go/src/$(PACKAGE_NAME) \ + -w /go/src/$(PACKAGE_NAME) \ + -e CGO_ENABLED=1 \ + -e GITHUB_TOKEN=${GITHUB_TOKEN} \ + goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --clean + +release-snapshot: + docker run \ + --rm \ + --platform linux/amd64 \ + -v /tmp:/tmp \ + -v "$(CURDIR)":/go/src/$(PACKAGE_NAME) \ + -w /go/src/$(PACKAGE_NAME) \ + -e CGO_ENABLED=1 \ + goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --clean --snapshot \ No newline at end of file diff --git a/scripts/release_pre_darwin.sh b/scripts/release_pre_darwin.sh new file mode 100644 index 000000000..8e85ce826 --- /dev/null +++ b/scripts/release_pre_darwin.sh @@ -0,0 +1,15 @@ +#!/usr/env/bin bash +# +# This runs in the "hooks.pre" block of .goreleaser.yml. +# We do this because it enables us to dynamically set the $WASMVM_VERSION based +# on go.mod. +# +# It's intended to be used with: +# ```bash +# make release-snapshot +# ``` +set -e + +WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}') + +flock -x /tmp/wasmvm-lock -c "wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvmstatic_darwin.a -O /tmp/libwasmvmstatic_darwin.a && [ ! -f /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a ] && cp /tmp/libwasmvmstatic_darwin.a /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a; echo 'libwasmvm installed'" diff --git a/scripts/release_pre_linux.sh b/scripts/release_pre_linux.sh new file mode 100644 index 000000000..f9d39d397 --- /dev/null +++ b/scripts/release_pre_linux.sh @@ -0,0 +1,29 @@ +#!/usr/env/bin bash +# +# This runs in the "hooks.pre" block of .goreleaser.yml. +# We do this because it enables us to dynamically set the $WASMVM_VERSION based +# on go.mod. +# +# It's intended to be used with: +# ```bash +# make release-snapshot +# ``` +set -e + +WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}') + +flock -x /tmp/apt-lock -c "[ \"$(ls -A /var/lib/apt/lists)\" ] || apt-get update" + +if [ "$TARGET" == "linux_amd64_v1" ]; then + echo "executing ${TARGET}" + apt-get -o DPkg::Lock::Timeout=60 install --no-install-recommends -y libzstd-dev:amd64 libsnappy-dev:amd64 liblz4-dev:amd64 libbz2-dev:amd64 zlib1g-dev:amd64 + + wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a -O /tmp/libwasmvm_muslc.x86_64.a + cp /tmp/libwasmvm_muslc.x86_64.a /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a +else + echo "executing ${TARGET}" + apt-get -o DPkg::Lock::Timeout=60 install --no-install-recommends -y libzstd-dev:arm64 libsnappy-dev:arm64 liblz4-dev:arm64 libbz2-dev:arm64 zlib1g-dev:arm64 + + wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a -O /tmp/libwasmvm_muslc.aarch64.a + cp /tmp/libwasmvm_muslc.aarch64.a /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a +fi \ No newline at end of file From 7a0cbd35f5970ed28cbd51ef6cbdcfd05576d3e4 Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 15:40:58 +0100 Subject: [PATCH 18/71] remove separate gha for building docker images --- .github/workflows/build_docker.yml | 27 ---------- .github/workflows/push_docker_images.yml | 65 ------------------------ 2 files changed, 92 deletions(-) delete mode 100644 .github/workflows/build_docker.yml delete mode 100644 .github/workflows/push_docker_images.yml diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml deleted file mode 100644 index 96d5a34f5..000000000 --- a/.github/workflows/build_docker.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Build Docker Image on PR - -on: - push: - paths: - - "**docker**" - - "**.sh" - - "**.bash" - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build without push - uses: docker/build-push-action@v4 - with: - context: . - platforms: linux/amd64 - push: false - build-args: arch=x86_64 \ No newline at end of file diff --git a/.github/workflows/push_docker_images.yml b/.github/workflows/push_docker_images.yml deleted file mode 100644 index 9ee8b8b76..000000000 --- a/.github/workflows/push_docker_images.yml +++ /dev/null @@ -1,65 +0,0 @@ -# This workflow pushes new centauri docker images on every new tag. -# -# On every new `vX.Y.Z` tag the following images are pushed: -# -# composablefi/composable-cosmos:X.Y.Z # is pushed -# composablefi/composable-cosmos:X.Y # is updated to X.Y.Z -# composablefi/composable-cosmos:X # is updated to X.Y.Z -# -# All the images above have support for linux/amd64 and linux/arm64. -# -# Due to QEMU virtualization used to build multi-platform docker images -# this workflow might take a while to complete. - -name: Push Docker Images - -on: - release: - types: [published, created, edited] - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc - -permissions: - contents: read - packages: write - -jobs: - feeapp-images: - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Parse tag - id: tag - run: | - VERSION=$(echo ${{ github.ref_name }} | sed "s/v//") - MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1) - MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2) - PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3) - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV - echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV - echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV - - name: Build and push - id: build_push_image - uses: docker/build-push-action@v3 - with: - file: Dockerfile - context: . - push: true - platforms: linux/amd64,linux/arm64 - tags: | - ghcr.io/composablefi/composable-cosmos:${{ env.MAJOR_VERSION }} - ghcr.io/composablefi/composable-cosmos:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }} - ghcr.io/composablefi/composable-cosmos:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} \ No newline at end of file From 64edb69b3d51c151b458a7b0d1cb277f8181b71f Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 15:43:09 +0100 Subject: [PATCH 19/71] rename registry owner --- .github/workflows/goreleaser-latest.yml | 2 +- .github/workflows/goreleaser.yml | 2 +- .goreleaser.yml | 2 +- contrib/make/release.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/goreleaser-latest.yml b/.github/workflows/goreleaser-latest.yml index 60b71433d..8e53522ba 100644 --- a/.github/workflows/goreleaser-latest.yml +++ b/.github/workflows/goreleaser-latest.yml @@ -46,4 +46,4 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64 - tags: ghcr.io/rjonczy/composable-cosmos:latest + tags: ghcr.io/composable-cosmos/composable-cosmos:latest diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index ea64b2d54..5ff2ec1ef 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -49,4 +49,4 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64 - tags: ghcr.io/rjonczy/composable-cosmos:${{ steps.get_version.outputs.version-without-v }} + tags: ghcr.io/composable-cosmos/composable-cosmos:${{ steps.get_version.outputs.version-without-v }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 98a48e9be..3a453bff4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -83,7 +83,7 @@ builds: # dockers: # - dockerfile: "goreleaser.Dockerfile" # image_templates: -# - "ghcr.io/rjonczy/goapp:{{ .Tag }}" +# - "ghcr.io/composable-cosmos/goapp:{{ .Tag }}" # build_flag_templates: # - "--label=org.opencontainers.image.created={{.Date}}" # - "--label=org.opencontainers.image.name={{.ProjectName}}" diff --git a/contrib/make/release.mk b/contrib/make/release.mk index 4a384f321..1ce0ee899 100644 --- a/contrib/make/release.mk +++ b/contrib/make/release.mk @@ -2,7 +2,7 @@ ### Release ### ############################################################################### -PACKAGE_NAME := github.com/rjonczy/composable-cosmos +PACKAGE_NAME := github.com/composable-cosmos/composable-cosmos GOLANG_CROSS_VERSION ?= v1.20 # The `make release` command is running a Docker container with the image From 976423e16b6c473a2b31a35feaf2cbed8cbd0224 Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 16:00:42 +0100 Subject: [PATCH 20/71] clean comments --- .goreleaser.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 3a453bff4..181b7e9ea 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -79,14 +79,3 @@ builds: # - muslc # - static # - static_wasm - -# dockers: -# - dockerfile: "goreleaser.Dockerfile" -# image_templates: -# - "ghcr.io/composable-cosmos/goapp:{{ .Tag }}" -# build_flag_templates: -# - "--label=org.opencontainers.image.created={{.Date}}" -# - "--label=org.opencontainers.image.name={{.ProjectName}}" -# - "--label=org.opencontainers.image.revision={{.FullCommit}}" -# - "--label=org.opencontainers.image.version={{.Version}}" -# use: buildx \ No newline at end of file From c51b8d37c5fa0a52e813d6aa4af3db7b0d15aef6 Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 16:00:55 +0100 Subject: [PATCH 21/71] use version with v --- .github/workflows/goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 5ff2ec1ef..f338718c0 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -49,4 +49,4 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64 - tags: ghcr.io/composable-cosmos/composable-cosmos:${{ steps.get_version.outputs.version-without-v }} + tags: ghcr.io/composable-cosmos/composable-cosmos:${{ steps.get_version.outputs.version }} From c1d647ebc22a7cada6daf3b99c1308a6dac96910 Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 16:46:28 +0100 Subject: [PATCH 22/71] add additional tags --- .github/workflows/goreleaser.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index f338718c0..c2f8f1f2e 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -49,4 +49,7 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64 - tags: ghcr.io/composable-cosmos/composable-cosmos:${{ steps.get_version.outputs.version }} + tags: | + ghcr.io/composable-cosmos/composable-cosmos:${{ steps.get_version.outputs.version }} + ghcr.io/composable-cosmos/composable-cosmos:v${{ steps.get_version.outputs.major }} + ghcr.io/composable-cosmos/composable-cosmos:v${{ steps.get_version.outputs.major }}.${{ steps.get_version.outputs.minor }} From bc93276a961a0eb027a8321bdb0f64d4cfb39040 Mon Sep 17 00:00:00 2001 From: rjonczy Date: Mon, 19 Feb 2024 16:56:33 +0100 Subject: [PATCH 23/71] fix org --- .github/workflows/goreleaser-latest.yml | 2 +- .github/workflows/goreleaser.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/goreleaser-latest.yml b/.github/workflows/goreleaser-latest.yml index 8e53522ba..584185881 100644 --- a/.github/workflows/goreleaser-latest.yml +++ b/.github/workflows/goreleaser-latest.yml @@ -46,4 +46,4 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64 - tags: ghcr.io/composable-cosmos/composable-cosmos:latest + tags: ghcr.io/composablefi/composable-cosmos:latest diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index c2f8f1f2e..89257a838 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -50,6 +50,6 @@ jobs: push: true platforms: linux/amd64,linux/arm64 tags: | - ghcr.io/composable-cosmos/composable-cosmos:${{ steps.get_version.outputs.version }} - ghcr.io/composable-cosmos/composable-cosmos:v${{ steps.get_version.outputs.major }} - ghcr.io/composable-cosmos/composable-cosmos:v${{ steps.get_version.outputs.major }}.${{ steps.get_version.outputs.minor }} + ghcr.io/composablefi/composable-cosmos:${{ steps.get_version.outputs.version }} + ghcr.io/composablefi/composable-cosmos:v${{ steps.get_version.outputs.major }} + ghcr.io/composablefi/composable-cosmos:v${{ steps.get_version.outputs.major }}.${{ steps.get_version.outputs.minor }} From aa9a360bfe3099bce63627f89b8d9ec9e05b5adc Mon Sep 17 00:00:00 2001 From: rjonczy Date: Tue, 20 Feb 2024 16:35:38 +0100 Subject: [PATCH 24/71] update docker image --- contrib/docker/goreleaser.Dockerfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/contrib/docker/goreleaser.Dockerfile b/contrib/docker/goreleaser.Dockerfile index b38b43a6b..4f5832b42 100644 --- a/contrib/docker/goreleaser.Dockerfile +++ b/contrib/docker/goreleaser.Dockerfile @@ -12,9 +12,22 @@ RUN if [ "${TARGETARCH}" = "arm64" ]; then \ FROM alpine:latest -WORKDIR /root RUN apk --no-cache add ca-certificates COPY --from=builder /root/centaurid /usr/local/bin/centaurid +RUN addgroup --gid 1025 -S composable && adduser --uid 1025 -S composable -G composable + +WORKDIR /home/composable +USER composable + +# rest server +EXPOSE 1317 +# tendermint p2p +EXPOSE 26656 +# tendermint rpc +EXPOSE 26657 +# grpc +EXPOSE 9090 + ENTRYPOINT ["centaurid"] CMD [ "start" ] From 9c878a89ea6157350c7c545fee65747d7d69358a Mon Sep 17 00:00:00 2001 From: rjonczy Date: Tue, 20 Feb 2024 17:03:00 +0100 Subject: [PATCH 25/71] added jq --- contrib/docker/goreleaser.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker/goreleaser.Dockerfile b/contrib/docker/goreleaser.Dockerfile index 4f5832b42..1793b262a 100644 --- a/contrib/docker/goreleaser.Dockerfile +++ b/contrib/docker/goreleaser.Dockerfile @@ -12,7 +12,7 @@ RUN if [ "${TARGETARCH}" = "arm64" ]; then \ FROM alpine:latest -RUN apk --no-cache add ca-certificates +RUN apk --no-cache add ca-certificates jq COPY --from=builder /root/centaurid /usr/local/bin/centaurid RUN addgroup --gid 1025 -S composable && adduser --uid 1025 -S composable -G composable From 118b79c43e140ea2fedb350d785fbbbcc4653384 Mon Sep 17 00:00:00 2001 From: kkast Date: Fri, 23 Feb 2024 03:31:04 +0300 Subject: [PATCH 26/71] slashing fixes --- app/keepers/keepers.go | 2 ++ app/upgrades/v6_4_5/upgrade.go | 10 +++++++++ custom/bank/keeper/keeper.go | 21 ------------------- custom/staking/keeper/keeper.go | 36 ++++++++++++++++++++++++++++++--- x/mint/abci.go | 7 ++----- x/mint/types/events.go | 1 + 6 files changed, 48 insertions(+), 29 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index be5bb4282..ae2780a7a 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -204,6 +204,8 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[distrtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + appKeepers.StakingKeeper.RegisterKeepers(appKeepers.DistrKeeper, appKeepers.BankKeeper) + appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, cdc, appKeepers.keys[slashingtypes.StoreKey], appKeepers.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go index 72dbebe02..d3fd3a2e0 100644 --- a/app/upgrades/v6_4_5/upgrade.go +++ b/app/upgrades/v6_4_5/upgrade.go @@ -18,10 +18,20 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // remove broken proposals BrokenProposals := [3]uint64{2, 6, 11} for _, proposal := range BrokenProposals { keepers.GovKeeper.DeleteProposal(ctx, proposal) } + + // burn extra ppica in escrow account + amount, ok := sdk.NewIntFromString("1066669217167120000000") + if ok { + coins := sdk.Coins{sdk.NewCoin("ppica", amount)} + keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins) + keepers.BankKeeper.BurnCoins(ctx, "gov", coins) + } + return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index a7c312c6d..899b69868 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -18,7 +18,6 @@ import ( transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancetypes "github.com/terra-money/alliance/x/alliance/types" ) type Keeper struct { @@ -68,16 +67,6 @@ func (k Keeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*t ctx := sdk.UnwrapSDKContext(c) supply := k.GetSupply(ctx, req.Denom) - if req.Denom == k.sk.BondDenom(ctx) { - assets := k.ak.GetAllAssets(ctx) - totalRewardWeights := sdk.ZeroDec() - for _, asset := range assets { - totalRewardWeights = totalRewardWeights.Add(asset.RewardWeight) - } - allianceBonded := k.ak.GetAllianceBondedAmount(ctx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - supply.Amount = supply.Amount.Sub(allianceBonded) - } - return &types.QuerySupplyOfResponse{Amount: sdk.NewCoin(req.Denom, supply.Amount)}, nil } @@ -89,15 +78,5 @@ func (k Keeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequ return nil, status.Error(codes.Internal, err.Error()) } - // Get duplicate token from transfermiddeware - duplicateCoins := k.tfmk.GetTotalEscrowedToken(sdkCtx) - totalSupply = totalSupply.Sub(duplicateCoins...) - - allianceBonded := k.ak.GetAllianceBondedAmount(sdkCtx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - bondDenom := k.sk.BondDenom(sdkCtx) - if totalSupply.AmountOf(bondDenom).IsPositive() { - totalSupply = totalSupply.Sub(sdk.NewCoin(bondDenom, allianceBonded)) - } - return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 2c5b6a5dd..3aee09ab6 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -1,13 +1,15 @@ package keeper import ( + "cosmossdk.io/math" abcicometbft "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/staking/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + distkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/cosmos/cosmos-sdk/x/staking/types" + minttypes "github.com/notional-labs/composable/v6/x/mint/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) @@ -16,6 +18,9 @@ type Keeper struct { cdc codec.BinaryCodec Stakingmiddleware *stakingmiddleware.Keeper authority string + mintKeeper minttypes.BankKeeper + distrKeeper distkeeper.Keeper + authKeeper minttypes.AccountKeeper } func (k Keeper) BlockValidatorUpdates(ctx sdk.Context, height int64) []abcicometbft.ValidatorUpdate { @@ -117,6 +122,31 @@ func NewKeeper( authority: authority, Stakingmiddleware: stakingmiddleware, cdc: cdc, + mintKeeper: nil, + distrKeeper: distkeeper.Keeper{}, + authKeeper: ak, } return &keeper } + +func (k *Keeper) RegisterKeepers(dk distkeeper.Keeper, mk minttypes.BankKeeper) { + k.distrKeeper = dk + k.mintKeeper = mk +} + +// SlashWithInfractionReason send coins to community pool +func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec, _ types.Infraction) math.Int { + // keep slashing logic the same + amountBurned := k.Slash(ctx, consAddr, infractionHeight, power, slashFactor) + // after usual slashing and burning is done, mint burned coinds into community pool + coins := sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), amountBurned)) + k.mintKeeper.MintCoins(ctx, types.ModuleName, coins) + k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(types.ModuleName)) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + minttypes.EventTypeMint, + sdk.NewAttribute(sdk.AttributeKeyAmount, amountBurned.String()), + ), + ) + return amountBurned +} diff --git a/x/mint/abci.go b/x/mint/abci.go index c24f80747..42964667d 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -25,7 +25,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalStakingSupply) k.SetMinter(ctx, minter) - // mint coins, update supply + // calculate how many we would mint, but we dont mint them, we take them from the prefunded account mintedCoin := minter.BlockProvision(params) mintedCoins := sdk.NewCoins(mintedCoin) @@ -41,10 +41,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeMint, - sdk.NewAttribute(types.AttributeKeyBondedRatio, bondedRatio.String()), - sdk.NewAttribute(types.AttributeKeyInflation, minter.Inflation.String()), - sdk.NewAttribute(types.AttributeKeyAnnualProvisions, minter.AnnualProvisions.String()), + types.EventTypeReward, sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), ), ) diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 891f50768..4f572b4b5 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -3,6 +3,7 @@ package types // Minting module event types const ( EventTypeMint = ModuleName + EventTypeReward = "reward_distributed" EventAddAllowedFundAddress = "add_allowed_fund" AttributeKeyBondedRatio = "bonded_ratio" From e6149edc1dd807af219a5ad036c1d168adc4fa40 Mon Sep 17 00:00:00 2001 From: kkast Date: Tue, 27 Feb 2024 23:32:47 +0300 Subject: [PATCH 27/71] review fixes --- app/upgrades/v6_4_5/upgrade.go | 3 +++ custom/staking/keeper/keeper.go | 26 ++++++++++++++++++-------- x/mint/types/events.go | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go index d3fd3a2e0..6318f114a 100644 --- a/app/upgrades/v6_4_5/upgrade.go +++ b/app/upgrades/v6_4_5/upgrade.go @@ -25,6 +25,9 @@ func CreateUpgradeHandler( } // burn extra ppica in escrow account + // this ppica is unused because it is a native token stored in escrow account + // it was unnecessarily minted to match pica escrowed on picasso to ppica minted + // in genesis, to make initial native ppica transferrable to picasso amount, ok := sdk.NewIntFromString("1066669217167120000000") if ok { coins := sdk.Coins{sdk.NewCoin("ppica", amount)} diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 3aee09ab6..c5a2fcbc3 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -1,6 +1,8 @@ package keeper import ( + "fmt" + "cosmossdk.io/math" abcicometbft "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" @@ -140,13 +142,21 @@ func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddr amountBurned := k.Slash(ctx, consAddr, infractionHeight, power, slashFactor) // after usual slashing and burning is done, mint burned coinds into community pool coins := sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), amountBurned)) - k.mintKeeper.MintCoins(ctx, types.ModuleName, coins) - k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(types.ModuleName)) - ctx.EventManager().EmitEvent( - sdk.NewEvent( - minttypes.EventTypeMint, - sdk.NewAttribute(sdk.AttributeKeyAmount, amountBurned.String()), - ), - ) + err := k.mintKeeper.MintCoins(ctx, types.ModuleName, coins) + if err != nil { + k.Logger(ctx).Error("Failed to mint slashed coins: ", amountBurned) + } else { + err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(types.ModuleName)) + if err != nil { + k.Logger(ctx).Error(fmt.Sprintf("Failed to fund community pool. Tokens minted to the staking module account: %d. ", amountBurned)) + } else { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + minttypes.EventTypeMintSlashed, + sdk.NewAttribute(sdk.AttributeKeyAmount, amountBurned.String()), + ), + ) + } + } return amountBurned } diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 4f572b4b5..92d52efac 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -4,6 +4,7 @@ package types const ( EventTypeMint = ModuleName EventTypeReward = "reward_distributed" + EventTypeMintSlashed = "mint_slashed_into_comminity_pool" EventAddAllowedFundAddress = "add_allowed_fund" AttributeKeyBondedRatio = "bonded_ratio" From da8d687391652eb4f502ad515065662bea81d217 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 28 Feb 2024 16:18:15 +0300 Subject: [PATCH 28/71] fix tests --- custom/bank/keeper/keeper.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index 899b69868..4b6d87e03 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -77,6 +77,8 @@ func (k Keeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequ if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - + // Get duplicate token from transfermiddeware + duplicateCoins := k.tfmk.GetTotalEscrowedToken(sdkCtx) + totalSupply = totalSupply.Sub(duplicateCoins...) return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } From 8d539fca42ca994af61bdeaf0f59feab0d28d9e3 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 28 Feb 2024 16:35:26 +0300 Subject: [PATCH 29/71] local setup --- Makefile | 2 +- tests/interchaintest/setup.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 26d1cf2b2..d2191acdc 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ build: go build $(BUILD_FLAGS) -o bin/centaurid ./cmd/centaurid docker-build-debug: - @DOCKER_BUILDKIT=1 docker build -t centauri:debug -f Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t centauri:local -f Dockerfile . lint: @find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run mvdan.cc/gofumpt -w . diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 384f31cb5..28a2fcbed 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -45,11 +45,10 @@ func GetDockerImageInfo() (repo, version string) { if !found { // make local-image repo = "centauri" - branchVersion = "debug" + branchVersion = "local" } // github converts / to - for pushed docker images // branchVersion = strings.ReplaceAll(branchVersion, "/", "-") - branchVersion = "latest" return repo, branchVersion } From 07573bd04781add3eaf44180ef5fac142fe8ae7f Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 20 Feb 2024 23:24:00 +0000 Subject: [PATCH 30/71] introduce ibc transfer custom module --- custom/ibc-transfer/keeper/keeper.go | 45 ++++++++++++++++++ custom/ibc-transfer/keeper/msg_server.go | 23 ++++++++++ custom/ibc-transfer/module.go | 58 ++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 custom/ibc-transfer/keeper/keeper.go create mode 100644 custom/ibc-transfer/keeper/msg_server.go create mode 100644 custom/ibc-transfer/module.go diff --git a/custom/ibc-transfer/keeper/keeper.go b/custom/ibc-transfer/keeper/keeper.go new file mode 100644 index 000000000..7328b94c9 --- /dev/null +++ b/custom/ibc-transfer/keeper/keeper.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" + "github.com/cosmos/ibc-go/v7/modules/core/exported" + stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" +) + +type Keeper struct { + ibctransferkeeper.Keeper + cdc codec.BinaryCodec + Stakingmiddleware *stakingmiddleware.Keeper + authority string +} + +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + paramSpace paramtypes.Subspace, + ics4Wrapper porttypes.ICS4Wrapper, + channelKeeper types.ChannelKeeper, + portKeeper types.PortKeeper, + authKeeper types.AccountKeeper, + ak types.AccountKeeper, + bk types.BankKeeper, + scopedKeeper exported.ScopedKeeper, + authority string, + stakingmiddleware *stakingmiddleware.Keeper, + //return type from this function is different from the staking keeper. + //todo double check if this is correct +) Keeper { + keeper := Keeper{ + Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), + authority: authority, + Stakingmiddleware: stakingmiddleware, + cdc: cdc, + } + return keeper +} diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go new file mode 100644 index 000000000..36f31b25a --- /dev/null +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" +) + +type msgServer struct { + Keeper + msgServer types.MsgServer +} + +var _ types.MsgServer = msgServer{} + +// TODO - Add the stakingkeeper.Keeper as a parameter to the NewMsgServerImpl function +// func NewMsgServerImpl(stakingKeeper stakingkeeper.Keeper, customstakingkeeper Keeper) types.MsgServer { +// return &msgServer{Keeper: customstakingkeeper, msgServer: stakingkeeper.NewMsgServerImpl(&stakingKeeper)} +// } + +func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { + return k.msgServer.Transfer(goCtx, msg) +} diff --git a/custom/ibc-transfer/module.go b/custom/ibc-transfer/module.go new file mode 100644 index 000000000..c6ae52121 --- /dev/null +++ b/custom/ibc-transfer/module.go @@ -0,0 +1,58 @@ +// package bank + +// import ( +// "fmt" + +// "github.com/cosmos/cosmos-sdk/codec" +// "github.com/cosmos/cosmos-sdk/types/module" +// stakingmodule "github.com/cosmos/cosmos-sdk/x/staking" +// "github.com/cosmos/cosmos-sdk/x/staking/exported" +// stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" +// stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + +// // custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" + +// customstakingkeeper "github.com/notional-labs/composable/v6/custom/staking/keeper" +// ) + +// // AppModule wraps around the bank module and the bank keeper to return the right total supply +// type AppModule struct { +// stakingmodule.AppModule +// keeper customstakingkeeper.Keeper +// subspace exported.Subspace +// msgServer stakingtypes.MsgServer +// } + +// // NewAppModule creates a new AppModule object +// func NewAppModule(cdc codec.Codec, keeper customstakingkeeper.Keeper, accountKeeper stakingtypes.AccountKeeper, bankKeeper stakingtypes.BankKeeper, ss exported.Subspace) AppModule { +// stakingModule := stakingmodule.NewAppModule(cdc, &keeper.Keeper, accountKeeper, bankKeeper, ss) +// return AppModule{ +// AppModule: stakingModule, +// keeper: keeper, +// subspace: ss, +// msgServer: stakingkeeper.NewMsgServerImpl(&keeper.Keeper), +// } +// } + +// // RegisterServices registers module services. +// // NOTE: Overriding this method as not doing so will cause a panic +// // when trying to force this custom keeper into a bankkeeper.BaseKeeper +// func (am AppModule) RegisterServices(cfg module.Configurator) { +// // types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper)) +// stakingtypes.RegisterMsgServer(cfg.MsgServer(), customstakingkeeper.NewMsgServerImpl(am.keeper.Keeper, am.keeper)) +// querier := stakingkeeper.Querier{Keeper: &am.keeper.Keeper} +// stakingtypes.RegisterQueryServer(cfg.QueryServer(), querier) + +// m := stakingkeeper.NewMigrator(&am.keeper.Keeper, am.subspace) +// if err := cfg.RegisterMigration(stakingtypes.ModuleName, 1, m.Migrate1to2); err != nil { +// panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err)) +// } + +// if err := cfg.RegisterMigration(stakingtypes.ModuleName, 2, m.Migrate2to3); err != nil { +// panic(fmt.Sprintf("failed to migrate x/staking from version 2 to 3: %v", err)) +// } + +// if err := cfg.RegisterMigration(stakingtypes.ModuleName, 3, m.Migrate3to4); err != nil { +// panic(fmt.Sprintf("failed to migrate x/staking from version 3 to 4: %v", err)) +// } +// } From 98d1a4402b9a34f74939d2db8f9be1ebfa3da5dc Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 13:40:19 +0000 Subject: [PATCH 31/71] custom ibc transfer module ready to replace for testing. --- custom/ibc-transfer/keeper/msg_server.go | 2 +- custom/ibc-transfer/module.go | 105 ++++++++++------------- 2 files changed, 48 insertions(+), 59 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index 36f31b25a..cbb3a3147 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -13,7 +13,7 @@ type msgServer struct { var _ types.MsgServer = msgServer{} -// TODO - Add the stakingkeeper.Keeper as a parameter to the NewMsgServerImpl function +// // TODO - Add the stakingkeeper.Keeper as a parameter to the NewMsgServerImpl function // func NewMsgServerImpl(stakingKeeper stakingkeeper.Keeper, customstakingkeeper Keeper) types.MsgServer { // return &msgServer{Keeper: customstakingkeeper, msgServer: stakingkeeper.NewMsgServerImpl(&stakingKeeper)} // } diff --git a/custom/ibc-transfer/module.go b/custom/ibc-transfer/module.go index c6ae52121..fbda0e7b4 100644 --- a/custom/ibc-transfer/module.go +++ b/custom/ibc-transfer/module.go @@ -1,58 +1,47 @@ -// package bank - -// import ( -// "fmt" - -// "github.com/cosmos/cosmos-sdk/codec" -// "github.com/cosmos/cosmos-sdk/types/module" -// stakingmodule "github.com/cosmos/cosmos-sdk/x/staking" -// "github.com/cosmos/cosmos-sdk/x/staking/exported" -// stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" -// stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - -// // custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" - -// customstakingkeeper "github.com/notional-labs/composable/v6/custom/staking/keeper" -// ) - -// // AppModule wraps around the bank module and the bank keeper to return the right total supply -// type AppModule struct { -// stakingmodule.AppModule -// keeper customstakingkeeper.Keeper -// subspace exported.Subspace -// msgServer stakingtypes.MsgServer -// } - -// // NewAppModule creates a new AppModule object -// func NewAppModule(cdc codec.Codec, keeper customstakingkeeper.Keeper, accountKeeper stakingtypes.AccountKeeper, bankKeeper stakingtypes.BankKeeper, ss exported.Subspace) AppModule { -// stakingModule := stakingmodule.NewAppModule(cdc, &keeper.Keeper, accountKeeper, bankKeeper, ss) -// return AppModule{ -// AppModule: stakingModule, -// keeper: keeper, -// subspace: ss, -// msgServer: stakingkeeper.NewMsgServerImpl(&keeper.Keeper), -// } -// } - -// // RegisterServices registers module services. -// // NOTE: Overriding this method as not doing so will cause a panic -// // when trying to force this custom keeper into a bankkeeper.BaseKeeper -// func (am AppModule) RegisterServices(cfg module.Configurator) { -// // types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper)) -// stakingtypes.RegisterMsgServer(cfg.MsgServer(), customstakingkeeper.NewMsgServerImpl(am.keeper.Keeper, am.keeper)) -// querier := stakingkeeper.Querier{Keeper: &am.keeper.Keeper} -// stakingtypes.RegisterQueryServer(cfg.QueryServer(), querier) - -// m := stakingkeeper.NewMigrator(&am.keeper.Keeper, am.subspace) -// if err := cfg.RegisterMigration(stakingtypes.ModuleName, 1, m.Migrate1to2); err != nil { -// panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err)) -// } - -// if err := cfg.RegisterMigration(stakingtypes.ModuleName, 2, m.Migrate2to3); err != nil { -// panic(fmt.Sprintf("failed to migrate x/staking from version 2 to 3: %v", err)) -// } - -// if err := cfg.RegisterMigration(stakingtypes.ModuleName, 3, m.Migrate3to4); err != nil { -// panic(fmt.Sprintf("failed to migrate x/staking from version 3 to 4: %v", err)) -// } -// } +package bank + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/module" + + ibctransfermodule "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper" +) + +// AppModule wraps around the bank module and the bank keeper to return the right total supply +type AppModule struct { + ibctransfermodule.AppModule + keeper customibctransferkeeper.Keeper + // subspace exported.Subspace + msgServer types.MsgServer +} + +// NewAppModule creates a new AppModule object +func NewAppModule(cdc codec.Codec, keeper customibctransferkeeper.Keeper) AppModule { + stakingModule := ibctransfermodule.NewAppModule(keeper.Keeper) + return AppModule{ + AppModule: stakingModule, + keeper: keeper, + // subspace: ss, + msgServer: keeper.Keeper, + } +} + +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), am.keeper.Keeper) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper.Keeper) + + m := ibctransferkeeper.NewMigrator(am.keeper.Keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.MigrateTraces); err != nil { + panic(fmt.Sprintf("failed to migrate transfer app from version 1 to 2: %v", err)) + } + + if err := cfg.RegisterMigration(types.ModuleName, 2, m.MigrateTotalEscrowForDenom); err != nil { + panic(fmt.Sprintf("failed to migrate transfer app from version 2 to 3: %v", err)) + } +} From 23cf7cc334eba36fd6c6f356da4e2392bdf8f1a3 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 14:55:18 +0000 Subject: [PATCH 32/71] activate custom ibc module for cosmos chain. chain works. --- app/app.go | 6 ++++-- app/keepers/keepers.go | 17 +++++++++++------ app/test_access.go | 2 +- custom/ibc-transfer/keeper/keeper.go | 22 +++++++++++----------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/app.go b/app/app.go index 0c7c45fb6..d91982be7 100644 --- a/app/app.go +++ b/app/app.go @@ -87,6 +87,7 @@ import ( ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + customibctransfer "github.com/notional-labs/composable/v6/custom/ibc-transfer" customstaking "github.com/notional-labs/composable/v6/custom/staking" "github.com/spf13/cast" icq "github.com/strangelove-ventures/async-icq/v7" @@ -334,7 +335,8 @@ func NewComposableApp( enabledProposals, ) - transferModule := transfer.NewAppModule(app.TransferKeeper) + // transferModule := transfer.NewAppModule(app.TransferKeeper) + transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper) routerModule := router.NewAppModule(app.RouterKeeper) transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper) txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper) @@ -589,7 +591,7 @@ func (app *ComposableApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { // GetIBCKeeper implements the TestingApp interface. func (app *ComposableApp) GetTransferKeeper() *ibctransferkeeper.Keeper { - return &app.TransferKeeper + return &app.TransferKeeper.Keeper } // GetIBCKeeper implements the TestingApp interface. diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index ae2780a7a..209b20500 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -57,12 +57,16 @@ import ( icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + + // ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + + // ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper" icq "github.com/strangelove-ventures/async-icq/v7" icqkeeper "github.com/strangelove-ventures/async-icq/v7/keeper" icqtypes "github.com/strangelove-ventures/async-icq/v7/types" @@ -133,7 +137,7 @@ type AppKeepers struct { ParamsKeeper paramskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly EvidenceKeeper evidencekeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper + TransferKeeper customibctransferkeeper.Keeper ICQKeeper icqkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper @@ -290,7 +294,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.GetSubspace(transfermiddlewaretypes.ModuleName), appCodec, &appKeepers.RatelimitKeeper, - &appKeepers.TransferKeeper, + &appKeepers.TransferKeeper.Keeper, appKeepers.BankKeeper, authorityAddress, ) @@ -301,7 +305,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( authorityAddress, ) - appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper( + appKeepers.TransferKeeper = customibctransferkeeper.NewKeeper( appCodec, appKeepers.keys[ibctransfertypes.StoreKey], appKeepers.GetSubspace(ibctransfertypes.ModuleName), &appKeepers.TransferMiddlewareKeeper, // ICS4Wrapper @@ -310,13 +314,14 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.ScopedTransferKeeper, + // &appKeepers.StakingMiddlewareKeeper,x ) appKeepers.RouterKeeper = routerkeeper.NewKeeper( appCodec, appKeepers.keys[routertypes.StoreKey], appKeepers.GetSubspace(routertypes.ModuleName), - appKeepers.TransferKeeper, + appKeepers.TransferKeeper.Keeper, appKeepers.IBCKeeper.ChannelKeeper, &appKeepers.DistrKeeper, appKeepers.BankKeeper, @@ -336,7 +341,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - transferIBCModule := transfer.NewIBCModule(appKeepers.TransferKeeper) + transferIBCModule := transfer.NewIBCModule(appKeepers.TransferKeeper.Keeper) scopedICQKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName) appKeepers.ICQKeeper = icqkeeper.NewKeeper( diff --git a/app/test_access.go b/app/test_access.go index 88fb03c52..a97c63b34 100644 --- a/app/test_access.go +++ b/app/test_access.go @@ -63,7 +63,7 @@ func (s TestSupport) GovKeeper() govkeeper.Keeper { } func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper { - return s.app.TransferKeeper + return s.app.TransferKeeper.Keeper } func (s TestSupport) Wasm08Keeper() wasm08.Keeper { diff --git a/custom/ibc-transfer/keeper/keeper.go b/custom/ibc-transfer/keeper/keeper.go index 7328b94c9..e357906a5 100644 --- a/custom/ibc-transfer/keeper/keeper.go +++ b/custom/ibc-transfer/keeper/keeper.go @@ -9,14 +9,14 @@ import ( "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" - stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" + // stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) type Keeper struct { ibctransferkeeper.Keeper - cdc codec.BinaryCodec - Stakingmiddleware *stakingmiddleware.Keeper - authority string + cdc codec.BinaryCodec + // Stakingmiddleware *stakingmiddleware.Keeper + // authority string } func NewKeeper( @@ -27,19 +27,19 @@ func NewKeeper( channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, authKeeper types.AccountKeeper, - ak types.AccountKeeper, + // ak types.AccountKeeper, bk types.BankKeeper, scopedKeeper exported.ScopedKeeper, - authority string, - stakingmiddleware *stakingmiddleware.Keeper, + // authority string, + // stakingmiddleware *stakingmiddleware.Keeper, //return type from this function is different from the staking keeper. //todo double check if this is correct ) Keeper { keeper := Keeper{ - Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), - authority: authority, - Stakingmiddleware: stakingmiddleware, - cdc: cdc, + Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), + // authority: authority, + // Stakingmiddleware: stakingmiddleware, + cdc: cdc, } return keeper } From ec78315c174360198808e54aaa4f4ea4ed193844 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 16:11:53 +0000 Subject: [PATCH 33/71] added ibc transfer module that is going to store all params for eth fees --- app/app.go | 7 + app/keepers/keepers.go | 20 +- app/keepers/keys.go | 4 +- .../v1beta1/genesis.proto | 14 + .../v1beta1/ibctransfermiddleware.proto | 81 + .../ibctransfermiddleware/v1beta1/query.proto | 25 + .../ibctransfermiddleware/v1beta1/tx.proto | 41 + x/ibctransfermiddleware/client/cli/query.go | 55 + x/ibctransfermiddleware/client/cli/tx.go | 22 + x/ibctransfermiddleware/keeper/genesis.go | 19 + x/ibctransfermiddleware/keeper/grpc_query.go | 19 + x/ibctransfermiddleware/keeper/keeper.go | 76 + x/ibctransfermiddleware/keeper/msg_server.go | 38 + x/ibctransfermiddleware/module.go | 156 ++ x/ibctransfermiddleware/types/codec.go | 45 + x/ibctransfermiddleware/types/genesis.go | 21 + x/ibctransfermiddleware/types/genesis.pb.go | 325 ++++ .../types/ibctransfermiddleware.pb.go | 1462 +++++++++++++++++ x/ibctransfermiddleware/types/keys.go | 15 + x/ibctransfermiddleware/types/msgs.go | 28 + x/ibctransfermiddleware/types/query.pb.go | 537 ++++++ x/ibctransfermiddleware/types/query.pb.gw.go | 153 ++ x/ibctransfermiddleware/types/tx.pb.go | 602 +++++++ 23 files changed, 3757 insertions(+), 8 deletions(-) create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/genesis.proto create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/query.proto create mode 100644 proto/composable/ibctransfermiddleware/v1beta1/tx.proto create mode 100644 x/ibctransfermiddleware/client/cli/query.go create mode 100644 x/ibctransfermiddleware/client/cli/tx.go create mode 100644 x/ibctransfermiddleware/keeper/genesis.go create mode 100644 x/ibctransfermiddleware/keeper/grpc_query.go create mode 100644 x/ibctransfermiddleware/keeper/keeper.go create mode 100644 x/ibctransfermiddleware/keeper/msg_server.go create mode 100644 x/ibctransfermiddleware/module.go create mode 100644 x/ibctransfermiddleware/types/codec.go create mode 100644 x/ibctransfermiddleware/types/genesis.go create mode 100644 x/ibctransfermiddleware/types/genesis.pb.go create mode 100644 x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go create mode 100644 x/ibctransfermiddleware/types/keys.go create mode 100644 x/ibctransfermiddleware/types/msgs.go create mode 100644 x/ibctransfermiddleware/types/query.pb.go create mode 100644 x/ibctransfermiddleware/types/query.pb.gw.go create mode 100644 x/ibctransfermiddleware/types/tx.pb.go diff --git a/app/app.go b/app/app.go index d91982be7..ed3f3b7a7 100644 --- a/app/app.go +++ b/app/app.go @@ -102,6 +102,7 @@ import ( custombankmodule "github.com/notional-labs/composable/v6/custom/bank" "github.com/notional-labs/composable/v6/app/ante" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware" "github.com/notional-labs/composable/v6/x/stakingmiddleware" transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware" transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types" @@ -127,6 +128,7 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" upgrades "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" ) @@ -227,6 +229,7 @@ var ( consensus.AppModuleBasic{}, alliancemodule.AppModuleBasic{}, stakingmiddleware.AppModuleBasic{}, + ibctransfermiddleware.AppModuleBasic{}, // this line is used by starport scaffolding # stargate/app/moduleBasic ) @@ -371,6 +374,7 @@ func NewComposableApp( distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), customstaking.NewAppModule(appCodec, *app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), stakingmiddleware.NewAppModule(appCodec, app.StakingMiddlewareKeeper), + ibctransfermiddleware.NewAppModule(appCodec, app.IbcTransferMiddlewareKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), @@ -427,6 +431,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers ) @@ -462,6 +467,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -501,6 +507,7 @@ func NewComposableApp( wasm.ModuleName, alliancemoduletypes.ModuleName, stakingmiddlewaretypes.ModuleName, + ibctransfermiddlewaretypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 209b20500..58b73ced5 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -110,6 +110,9 @@ import ( ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" stakingmiddlewaretypes "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" + + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) const ( @@ -156,12 +159,13 @@ type AppKeepers struct { ScopedRateLimitKeeper capabilitykeeper.ScopedKeeper ConsensusParamsKeeper consensusparamkeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration - TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper - TxBoundaryKeepper txBoundaryKeeper.Keeper - RouterKeeper *routerkeeper.Keeper - RatelimitKeeper ratelimitmodulekeeper.Keeper - AllianceKeeper alliancemodulekeeper.Keeper - StakingMiddlewareKeeper stakingmiddleware.Keeper + TransferMiddlewareKeeper transfermiddlewarekeeper.Keeper + TxBoundaryKeepper txBoundaryKeeper.Keeper + RouterKeeper *routerkeeper.Keeper + RatelimitKeeper ratelimitmodulekeeper.Keeper + AllianceKeeper alliancemodulekeeper.Keeper + StakingMiddlewareKeeper stakingmiddleware.Keeper + IbcTransferMiddlewareKeeper ibctransfermiddleware.Keeper } // InitNormalKeepers initializes all 'normal' keepers. @@ -194,6 +198,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) appKeepers.StakingKeeper = customstaking.NewKeeper( appCodec, appKeepers.keys[stakingtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), &appKeepers.StakingMiddlewareKeeper, @@ -396,7 +401,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.IBCKeeper.ChannelKeeper, &appKeepers.IBCKeeper.PortKeeper, appKeepers.ScopedWasmKeeper, - appKeepers.TransferKeeper, + appKeepers.TransferKeeper.Keeper, bApp.MsgServiceRouter(), bApp.GRPCQueryRouter(), wasmDir, @@ -494,6 +499,7 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac paramsKeeper.Subspace(wasm.ModuleName) paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName) paramsKeeper.Subspace(stakingmiddlewaretypes.ModuleName) + paramsKeeper.Subspace(ibctransfermiddlewaretypes.ModuleName) return paramsKeeper } diff --git a/app/keepers/keys.go b/app/keepers/keys.go index a0dc2e358..606b8f21d 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -45,6 +45,8 @@ import ( // customstakingtypes "github.com/notional-labs/composable/v6/custom/staking/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/types" + + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) // GenerateKeys generates new keys (KV Store, Transient store, and memory store). @@ -55,7 +57,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icqtypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey, wasm08types.StoreKey, - authzkeeper.StoreKey, stakingmiddleware.StoreKey, + authzkeeper.StoreKey, stakingmiddleware.StoreKey, ibctransfermiddleware.StoreKey, crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey, minttypes.StoreKey, alliancemoduletypes.StoreKey, wasm.StoreKey, ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey, txBoundaryTypes.StoreKey, ) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto b/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto new file mode 100644 index 000000000..20f491b2c --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "gogoproto/gogo.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; +import "amino/amino.proto"; + + +option go_package = "x/ibctransfermiddleware/types"; + +// GenesisState defines the ibctransfermiddleware module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto new file mode 100644 index 000000000..d8621e42d --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +option go_package = "x/ibctransfermiddleware/types"; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; + + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message Delegation { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgDelegate"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// BeginRedelegate defines a SDK message for performing a begin redelegation of coins +// from a delegator to a validator. +message BeginRedelegate{ + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgBeginRedelegate"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message Undelegate { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgUndelegate"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +message CancelUnbondingDelegation { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgCancelUnbondingDelegation"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + int64 creation_height = 4; +} + + + +// Params holds parameters for the ibctransfermiddleware module. +message Params { + // expected blocks per year + uint64 blocks_per_epoch = 1; + // max block allowed before validator set update + uint64 allow_unbond_after_epoch_progress_block_number = 2; +} + diff --git a/proto/composable/ibctransfermiddleware/v1beta1/query.proto b/proto/composable/ibctransfermiddleware/v1beta1/query.proto new file mode 100644 index 000000000..7f0f5c45c --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/query.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; + +option go_package = "x/ibctransfermiddleware/types"; + +// Query provides defines the gRPC querier service. +service Query { + // Params returns the total set of minting parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/composable/ibctransfermiddleware/params"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto new file mode 100644 index 000000000..781979b09 --- /dev/null +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package composable.ibctransfermiddleware.v1beta1; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto"; + +option go_package = "x/ibctransfermiddleware/types"; + +// Msg defines the x/ibctransfermiddleware Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateEpochParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "composable/x/ibctransfermiddleware/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/ibctransfermiddleware parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsEpochResponse {} diff --git a/x/ibctransfermiddleware/client/cli/query.go b/x/ibctransfermiddleware/client/cli/query.go new file mode 100644 index 000000000..119694e64 --- /dev/null +++ b/x/ibctransfermiddleware/client/cli/query.go @@ -0,0 +1,55 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +// GetQueryCmd returns the cli query commands for the staking middleware module. +func GetQueryCmd() *cobra.Command { + ibctransfermiddlewareParamsQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the staking middleware module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + ibctransfermiddlewareParamsQueryCmd.AddCommand( + GetCmdQueryParams(), + ) + + return ibctransfermiddlewareParamsQueryCmd +} + +// GetCmdQueryParams implements a command to return the current staking middleware's params +// parameters. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the current staking middleware parameters", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryParamsRequest{} + res, err := queryClient.Params(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ibctransfermiddleware/client/cli/tx.go b/x/ibctransfermiddleware/client/cli/tx.go new file mode 100644 index 000000000..95ab3dd0e --- /dev/null +++ b/x/ibctransfermiddleware/client/cli/tx.go @@ -0,0 +1,22 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" + "github.com/spf13/cobra" +) + +// GetTxCmd returns the tx commands for staking middleware module. +func GetTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Exp transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand() + + return txCmd +} diff --git a/x/ibctransfermiddleware/keeper/genesis.go b/x/ibctransfermiddleware/keeper/genesis.go new file mode 100644 index 000000000..82b22a6f9 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/genesis.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +// InitGenesis new stake middleware genesis +func (keeper Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { + if err := keeper.SetParams(ctx, data.Params); err != nil { + panic(err) + } +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func (keeper Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + params := keeper.GetParams(ctx) + return types.NewGenesisState(params) +} diff --git a/x/ibctransfermiddleware/keeper/grpc_query.go b/x/ibctransfermiddleware/keeper/grpc_query.go new file mode 100644 index 000000000..b95c1d2f6 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/grpc_query.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var _ types.QueryServer = Keeper{} + +// Params returns params of the staking middleware module. +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/ibctransfermiddleware/keeper/keeper.go b/x/ibctransfermiddleware/keeper/keeper.go new file mode 100644 index 000000000..0dafdacee --- /dev/null +++ b/x/ibctransfermiddleware/keeper/keeper.go @@ -0,0 +1,76 @@ +package keeper + +import ( + "fmt" + + "github.com/cometbft/cometbft/libs/log" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Keeper of the staking middleware store +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string +} + +// NewKeeper creates a new middleware Keeper instance +func NewKeeper( + cdc codec.BinaryCodec, + key storetypes.StoreKey, + authority string, +) Keeper { + return Keeper{ + cdc: cdc, + storeKey: key, + authority: authority, + } +} + +// GetAuthority returns the x/ibctransfermiddleware module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", "x/"+types.ModuleName) +} + +// SetParams sets the x/ibctransfermiddleware module parameters. +func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { + if p.BlocksPerEpoch < 5 { + return fmt.Errorf( + "BlocksPerEpoch must be greater than or equal to 5", + ) + } + if p.AllowUnbondAfterEpochProgressBlockNumber > p.BlocksPerEpoch { + return fmt.Errorf( + "AllowUnbondAfterEpochProgressBlockNumber must be less than or equal to BlocksPerEpoch", + ) + } + + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&p) + store.Set(types.ParamsKey, bz) + + return nil +} + +// GetParams returns the current x/ibctransfermiddleware module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return p + } + + k.cdc.MustUnmarshal(bz, &p) + return p +} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go new file mode 100644 index 000000000..e9d5a6e77 --- /dev/null +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -0,0 +1,38 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var _ types.MsgServer = msgServer{} + +// msgServer is a wrapper of Keeper. +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the x/ibctransfermiddleware MsgServer interface. +func NewMsgServerImpl(k Keeper) types.MsgServer { + return &msgServer{ + Keeper: k, + } +} + +// UpdateParams updates the params. +func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateEpochParams) (*types.MsgUpdateParamsEpochResponse, error) { + if ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := ms.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsEpochResponse{}, nil +} diff --git a/x/ibctransfermiddleware/module.go b/x/ibctransfermiddleware/module.go new file mode 100644 index 000000000..1f46d6364 --- /dev/null +++ b/x/ibctransfermiddleware/module.go @@ -0,0 +1,156 @@ +package ibctransfermiddleware + +import ( + "context" + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/client/cli" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" + "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the staking middleware module. +type AppModuleBasic struct { + cdc codec.Codec +} + +var _ module.AppModuleBasic = AppModuleBasic{} + +// Name returns the staking middleware module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the staking middleware module's types on the given LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module interface +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns default genesis state as raw bytes for the staking middleware +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the staking middleware module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return types.ValidateGenesis(data) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the staking middleware module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns no root tx command for the staking middleware module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the staking middleware module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// AppModule implements an application module for the staking middleware module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule object. If the InflationCalculationFn +// argument is nil, then the SDK's default inflation function will be used. +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + } +} + +// Name returns the staking middleware module's name. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterInvariants registers the staking middleware module invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// RegisterServices registers a gRPC query service to respond to the +// module-specific gRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) +} + +// InitGenesis performs genesis initialization for the staking middleware module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + + am.keeper.InitGenesis(ctx, &genesisState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the staking middleware +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(gs) +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock returns the begin blocker for the staking middleware module. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + // BeginBlocker(ctx, am.keeper) ??? +} + +// AppModuleSimulation functions +// GenerateGenesisState creates a randomized GenState of the staking middleware module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { + return nil +} + +// RegisterStoreDecoder registers a decoder for staking middleware module's types. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// WeightedOperations doesn't return any staking middleware module operation. +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return nil +} diff --git a/x/ibctransfermiddleware/types/codec.go b/x/ibctransfermiddleware/types/codec.go new file mode 100644 index 000000000..c8986807f --- /dev/null +++ b/x/ibctransfermiddleware/types/codec.go @@ -0,0 +1,45 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" + groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterLegacyAminoCodec registers the account interfaces and concrete types on the +// provided LegacyAmino codec. These types are used for Amino JSON serialization +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgUpdateEpochParams{}, "composable/MsgUpdateEpochParams") +} + +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateEpochParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + sdk.RegisterLegacyAminoCodec(amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances + RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(groupcodec.Amino) +} diff --git a/x/ibctransfermiddleware/types/genesis.go b/x/ibctransfermiddleware/types/genesis.go new file mode 100644 index 000000000..d9cf35fad --- /dev/null +++ b/x/ibctransfermiddleware/types/genesis.go @@ -0,0 +1,21 @@ +package types + +// NewGenesisState creates a new GenesisState object +func NewGenesisState(params Params) *GenesisState { + return &GenesisState{ + Params: params, + } +} + +// DefaultGenesisState creates a default GenesisState object +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: Params{BlocksPerEpoch: 360, AllowUnbondAfterEpochProgressBlockNumber: 0}, + } +} + +// ValidateGenesis validates the provided genesis state to ensure the +// expected invariants holds. +func ValidateGenesis(data GenesisState) error { + return nil +} diff --git a/x/ibctransfermiddleware/types/genesis.pb.go b/x/ibctransfermiddleware/types/genesis.pb.go new file mode 100644 index 000000000..d75c5c1bd --- /dev/null +++ b/x/ibctransfermiddleware/types/genesis.pb.go @@ -0,0 +1,325 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the ibctransfermiddleware module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_ab9a6edd8a683ba6, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "composable.ibctransfermiddleware.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/genesis.proto", fileDescriptor_ab9a6edd8a683ba6) +} + +var fileDescriptor_ab9a6edd8a683ba6 = []byte{ + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4b, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xd2, 0x40, 0xe8, 0xd3, 0xc3, 0xaa, 0x4f, 0x0f, 0xaa, 0x4f, 0x4a, 0x24, 0x3d, + 0x3f, 0x3d, 0x1f, 0xac, 0x49, 0x1f, 0xc4, 0x82, 0xe8, 0x97, 0x72, 0x21, 0xda, 0x5e, 0xec, 0xa6, + 0x43, 0x4c, 0x11, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x21, 0xa5, 0x38, 0x2e, + 0x1e, 0x77, 0x88, 0x4b, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xfc, 0xb8, 0xd8, 0x0a, 0x12, 0x8b, + 0x12, 0x73, 0x8b, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x0c, 0xf4, 0x88, 0x75, 0xb9, 0x5e, + 0x00, 0x58, 0x9f, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0x53, 0x9c, 0xcc, 0x4f, 0x3c, + 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, + 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0xb6, 0x02, 0x87, 0x4f, 0x4a, 0x2a, 0x0b, + 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xee, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x64, 0x36, + 0x5f, 0x72, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go new file mode 100644 index 000000000..8061d3d76 --- /dev/null +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -0,0 +1,1462 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type Delegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *Delegation) Reset() { *m = Delegation{} } +func (m *Delegation) String() string { return proto.CompactTextString(m) } +func (*Delegation) ProtoMessage() {} +func (*Delegation) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{0} +} +func (m *Delegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Delegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Delegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Delegation.Merge(m, src) +} +func (m *Delegation) XXX_Size() int { + return m.Size() +} +func (m *Delegation) XXX_DiscardUnknown() { + xxx_messageInfo_Delegation.DiscardUnknown(m) +} + +var xxx_messageInfo_Delegation proto.InternalMessageInfo + +// BeginRedelegate defines a SDK message for performing a begin redelegation of coins +// from a delegator to a validator. +type BeginRedelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` + Amount types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` +} + +func (m *BeginRedelegate) Reset() { *m = BeginRedelegate{} } +func (m *BeginRedelegate) String() string { return proto.CompactTextString(m) } +func (*BeginRedelegate) ProtoMessage() {} +func (*BeginRedelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{1} +} +func (m *BeginRedelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BeginRedelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BeginRedelegate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BeginRedelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_BeginRedelegate.Merge(m, src) +} +func (m *BeginRedelegate) XXX_Size() int { + return m.Size() +} +func (m *BeginRedelegate) XXX_DiscardUnknown() { + xxx_messageInfo_BeginRedelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_BeginRedelegate proto.InternalMessageInfo + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type Undelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *Undelegate) Reset() { *m = Undelegate{} } +func (m *Undelegate) String() string { return proto.CompactTextString(m) } +func (*Undelegate) ProtoMessage() {} +func (*Undelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{2} +} +func (m *Undelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Undelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Undelegate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Undelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_Undelegate.Merge(m, src) +} +func (m *Undelegate) XXX_Size() int { + return m.Size() +} +func (m *Undelegate) XXX_DiscardUnknown() { + xxx_messageInfo_Undelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_Undelegate proto.InternalMessageInfo + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type CancelUnbondingDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` +} + +func (m *CancelUnbondingDelegation) Reset() { *m = CancelUnbondingDelegation{} } +func (m *CancelUnbondingDelegation) String() string { return proto.CompactTextString(m) } +func (*CancelUnbondingDelegation) ProtoMessage() {} +func (*CancelUnbondingDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{3} +} +func (m *CancelUnbondingDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CancelUnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CancelUnbondingDelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CancelUnbondingDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_CancelUnbondingDelegation.Merge(m, src) +} +func (m *CancelUnbondingDelegation) XXX_Size() int { + return m.Size() +} +func (m *CancelUnbondingDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_CancelUnbondingDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_CancelUnbondingDelegation proto.InternalMessageInfo + +// Params holds parameters for the ibctransfermiddleware module. +type Params struct { + // expected blocks per year + BlocksPerEpoch uint64 `protobuf:"varint,1,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` + // max block allowed before validator set update + AllowUnbondAfterEpochProgressBlockNumber uint64 `protobuf:"varint,2,opt,name=allow_unbond_after_epoch_progress_block_number,json=allowUnbondAfterEpochProgressBlockNumber,proto3" json:"allow_unbond_after_epoch_progress_block_number,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{4} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBlocksPerEpoch() uint64 { + if m != nil { + return m.BlocksPerEpoch + } + return 0 +} + +func (m *Params) GetAllowUnbondAfterEpochProgressBlockNumber() uint64 { + if m != nil { + return m.AllowUnbondAfterEpochProgressBlockNumber + } + return 0 +} + +func init() { + proto.RegisterType((*Delegation)(nil), "composable.ibctransfermiddleware.v1beta1.Delegation") + proto.RegisterType((*BeginRedelegate)(nil), "composable.ibctransfermiddleware.v1beta1.BeginRedelegate") + proto.RegisterType((*Undelegate)(nil), "composable.ibctransfermiddleware.v1beta1.Undelegate") + proto.RegisterType((*CancelUnbondingDelegation)(nil), "composable.ibctransfermiddleware.v1beta1.CancelUnbondingDelegation") + proto.RegisterType((*Params)(nil), "composable.ibctransfermiddleware.v1beta1.Params") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto", fileDescriptor_1193893bc248bc1b) +} + +var fileDescriptor_1193893bc248bc1b = []byte{ + // 584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0x4f, 0x6b, 0x13, 0x41, + 0x18, 0x87, 0x77, 0x93, 0x10, 0xe8, 0x08, 0xfd, 0x13, 0xab, 0x26, 0x85, 0x6e, 0x4a, 0x2e, 0x0d, + 0x81, 0x66, 0x89, 0x1e, 0xc4, 0xea, 0xc1, 0xa6, 0x29, 0x88, 0xa8, 0x84, 0x2d, 0xbd, 0x78, 0x59, + 0x67, 0x77, 0xa7, 0x9b, 0xa1, 0xbb, 0x33, 0x61, 0x66, 0x92, 0xea, 0xd5, 0x93, 0x78, 0x12, 0xd4, + 0x7b, 0x8f, 0x1e, 0x73, 0xf0, 0x43, 0xf4, 0x58, 0x3c, 0x79, 0x10, 0x91, 0xe4, 0x10, 0x3f, 0x80, + 0x1f, 0x40, 0x76, 0x66, 0x92, 0x10, 0x9b, 0x92, 0x22, 0x3d, 0x88, 0x97, 0x24, 0xf3, 0xbe, 0xfb, + 0xfc, 0x78, 0xe7, 0x61, 0x32, 0x0b, 0x1a, 0x3e, 0x8d, 0xdb, 0x94, 0x43, 0x2f, 0x42, 0x36, 0xf6, + 0x7c, 0xc1, 0x20, 0xe1, 0x87, 0x88, 0xc5, 0x38, 0x08, 0x22, 0x74, 0x0c, 0x19, 0xb2, 0xbb, 0x35, + 0x0f, 0x09, 0x58, 0x9b, 0xdd, 0xad, 0xb6, 0x19, 0x15, 0x34, 0x57, 0x9e, 0xa4, 0x54, 0x67, 0x3f, + 0xa7, 0x53, 0xd6, 0x56, 0x43, 0x1a, 0x52, 0x09, 0xd9, 0xc9, 0x2f, 0xc5, 0xaf, 0x15, 0x7c, 0xca, + 0x63, 0xca, 0x5d, 0xd5, 0x50, 0x0b, 0xdd, 0xb2, 0xd4, 0xca, 0xf6, 0x20, 0x9f, 0xcc, 0xe2, 0x53, + 0x4c, 0x74, 0x7f, 0x05, 0xc6, 0x98, 0x50, 0x5b, 0x7e, 0xea, 0xd2, 0x2d, 0x8d, 0xc4, 0x3c, 0xb4, + 0xbb, 0xb5, 0xe4, 0x4b, 0x35, 0x4a, 0xef, 0x53, 0x00, 0x34, 0x50, 0x84, 0x42, 0x28, 0x30, 0x25, + 0xb9, 0x3d, 0xb0, 0x12, 0xa8, 0x15, 0x65, 0x2e, 0x0c, 0x02, 0x86, 0x38, 0xcf, 0x9b, 0x1b, 0x66, + 0x79, 0xa1, 0x9e, 0xff, 0xf2, 0x79, 0x6b, 0x55, 0xcf, 0xb1, 0xa3, 0x3a, 0xfb, 0x82, 0x61, 0x12, + 0x3a, 0xcb, 0x63, 0x44, 0xd7, 0x93, 0x98, 0x2e, 0x8c, 0x70, 0x30, 0x15, 0x93, 0x9a, 0x17, 0x33, + 0x46, 0x46, 0x31, 0x0f, 0x40, 0x16, 0xc6, 0xb4, 0x43, 0x44, 0x3e, 0xbd, 0x61, 0x96, 0xaf, 0xdd, + 0x2e, 0x54, 0x35, 0x98, 0xec, 0x7c, 0xe4, 0xaf, 0xba, 0x4b, 0x31, 0xa9, 0x2f, 0x9c, 0x7e, 0x2f, + 0x1a, 0x9f, 0x86, 0xbd, 0x8a, 0xe9, 0x68, 0x66, 0xfb, 0xde, 0x9b, 0x93, 0xa2, 0xf1, 0xf3, 0xa4, + 0x68, 0xbc, 0x1e, 0xf6, 0x2a, 0xe7, 0xb7, 0xf5, 0x76, 0xd8, 0xab, 0xdc, 0x54, 0x79, 0x5b, 0x3c, + 0x38, 0xb2, 0x9f, 0xf2, 0x50, 0x8b, 0x40, 0xa5, 0x5f, 0x29, 0xb0, 0x54, 0x47, 0x21, 0x26, 0x0e, + 0xd2, 0x1c, 0xba, 0x2a, 0x35, 0x4f, 0xc0, 0x8d, 0x89, 0x1a, 0xce, 0xfc, 0x4b, 0xeb, 0xb9, 0x3e, + 0xc6, 0xf6, 0x99, 0x3f, 0x33, 0x2d, 0xe0, 0x62, 0x9c, 0x96, 0xbe, 0x74, 0x5a, 0x83, 0x8b, 0xf3, + 0xbe, 0x33, 0x7f, 0xe1, 0xfb, 0xe1, 0x7c, 0xdf, 0xeb, 0xd3, 0xbe, 0xff, 0x50, 0x5c, 0xfa, 0x98, + 0x02, 0xe0, 0x80, 0x5c, 0xb5, 0xf1, 0x7f, 0xe2, 0x30, 0xde, 0x9f, 0x2f, 0x27, 0x3f, 0x2d, 0x67, + 0x22, 0xa2, 0xf4, 0x2d, 0x05, 0x0a, 0xbb, 0x90, 0xf8, 0x28, 0x3a, 0x20, 0x1e, 0x25, 0x01, 0x26, + 0xe1, 0xff, 0xf9, 0x9f, 0xcd, 0x6d, 0x82, 0x25, 0x9f, 0x21, 0xb9, 0x2f, 0xb7, 0x85, 0x70, 0xd8, + 0x52, 0x47, 0x31, 0xed, 0x2c, 0x8e, 0xca, 0x8f, 0x64, 0x75, 0xfb, 0xf1, 0x7c, 0x9f, 0x9b, 0xd3, + 0x3e, 0x2f, 0x14, 0x58, 0xfa, 0x60, 0x82, 0x6c, 0x13, 0x32, 0x18, 0xf3, 0x5c, 0x19, 0x2c, 0x7b, + 0x11, 0xf5, 0x8f, 0xb8, 0xdb, 0x46, 0xcc, 0x45, 0x6d, 0xea, 0xb7, 0xa4, 0xca, 0x8c, 0xb3, 0xa8, + 0xea, 0x4d, 0xc4, 0xf6, 0x92, 0x6a, 0xee, 0x05, 0xa8, 0xc2, 0x28, 0xa2, 0xc7, 0x6e, 0x47, 0x26, + 0xba, 0xf0, 0x50, 0x8c, 0x88, 0xe4, 0xce, 0x0e, 0x93, 0x29, 0x5c, 0xc9, 0xb8, 0xa4, 0x13, 0x7b, + 0x88, 0x49, 0x97, 0x19, 0xa7, 0x2c, 0x29, 0x35, 0xc6, 0x4e, 0xc2, 0xc8, 0xb8, 0xa6, 0x26, 0xea, + 0x09, 0xf0, 0x4c, 0x3e, 0x5f, 0xbf, 0x7b, 0xda, 0xb7, 0xcc, 0xb3, 0xbe, 0x65, 0xfe, 0xe8, 0x5b, + 0xe6, 0xbb, 0x81, 0x65, 0x9c, 0x0d, 0x2c, 0xe3, 0xeb, 0xc0, 0x32, 0x9e, 0xaf, 0xbf, 0xbc, 0xe0, + 0xc5, 0x24, 0x5e, 0xb5, 0x11, 0xf7, 0xb2, 0xf2, 0x6a, 0xbf, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, + 0x6b, 0xd0, 0x58, 0xce, 0xc9, 0x06, 0x00, 0x00, +} + +func (m *Delegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Delegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BeginRedelegate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BeginRedelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Undelegate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Undelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Undelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CancelUnbondingDelegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CancelUnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) + i-- + dAtA[i] = 0x10 + } + if m.BlocksPerEpoch != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.BlocksPerEpoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintIbctransfermiddleware(dAtA []byte, offset int, v uint64) int { + offset -= sovIbctransfermiddleware(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Delegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + return n +} + +func (m *BeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + return n +} + +func (m *Undelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + return n +} + +func (m *CancelUnbondingDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + if m.CreationHeight != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.CreationHeight)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlocksPerEpoch != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.BlocksPerEpoch)) + } + if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) + } + return n +} + +func sovIbctransfermiddleware(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozIbctransfermiddleware(x uint64) (n int) { + return sovIbctransfermiddleware(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Delegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Delegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BeginRedelegate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BeginRedelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Undelegate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Undelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Undelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CancelUnbondingDelegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CancelUnbondingDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CancelUnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerEpoch", wireType) + } + m.BlocksPerEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowUnbondAfterEpochProgressBlockNumber", wireType) + } + m.AllowUnbondAfterEpochProgressBlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AllowUnbondAfterEpochProgressBlockNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipIbctransfermiddleware(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthIbctransfermiddleware + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupIbctransfermiddleware + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthIbctransfermiddleware + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthIbctransfermiddleware = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowIbctransfermiddleware = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupIbctransfermiddleware = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/keys.go b/x/ibctransfermiddleware/types/keys.go new file mode 100644 index 000000000..e349116db --- /dev/null +++ b/x/ibctransfermiddleware/types/keys.go @@ -0,0 +1,15 @@ +package types + +// ParamsKey is the key to use for the keeper store. +var ( + ParamsKey = []byte{0x01} // key for global staking middleware params in the keeper store +) + +const ( + // module name + ModuleName = "ibctransfermiddleware" + + // StoreKey is the default store key for ibctransfermiddleware module that store params when apply validator set changes and when allow to unbond/redelegate + + StoreKey = "customibctransferparams" // not using the module name because of collisions with key "staking" +) diff --git a/x/ibctransfermiddleware/types/msgs.go b/x/ibctransfermiddleware/types/msgs.go new file mode 100644 index 000000000..4418aa784 --- /dev/null +++ b/x/ibctransfermiddleware/types/msgs.go @@ -0,0 +1,28 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateEpochParams{} + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgUpdateEpochParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateEpochParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateEpochParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrapf(err, "invalid authority address") + } + + return nil +} diff --git a/x/ibctransfermiddleware/types/query.pb.go b/x/ibctransfermiddleware/types/query.pb.go new file mode 100644 index 000000000..3781ce2b7 --- /dev/null +++ b/x/ibctransfermiddleware/types/query.pb.go @@ -0,0 +1,537 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_488b65e78926913a, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_488b65e78926913a, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "composable.ibctransfermiddleware.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "composable.ibctransfermiddleware.v1beta1.QueryParamsResponse") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/query.proto", fileDescriptor_488b65e78926913a) +} + +var fileDescriptor_488b65e78926913a = []byte{ + // 286 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x49, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0xd2, 0x40, 0xe8, 0xd2, 0xc3, 0xaa, 0x4b, 0x0f, 0xaa, 0x4b, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, + 0x1f, 0xac, 0x49, 0x1f, 0xc4, 0x82, 0xe8, 0x97, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, + 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, + 0xca, 0xba, 0x10, 0xed, 0x26, 0xec, 0x76, 0x83, 0x4d, 0x51, 0x12, 0xe1, 0x12, 0x0a, 0x04, 0x39, + 0x39, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x38, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x29, 0x95, + 0x4b, 0x18, 0x45, 0xb4, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x8f, 0x8b, 0xad, 0x00, 0x2c, + 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0x64, 0xa0, 0x47, 0xac, 0x0f, 0xf5, 0x20, 0x26, 0x39, + 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x35, 0xc5, 0xe8, 0x20, 0x23, 0x17, 0x2b, 0xd8, 0x1e, + 0xa1, 0xed, 0x8c, 0x5c, 0x6c, 0x10, 0x25, 0x42, 0x36, 0xc4, 0x1b, 0x8a, 0xe9, 0x72, 0x29, 0x5b, + 0x32, 0x75, 0x43, 0x7c, 0xa8, 0x64, 0xd0, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x2d, 0x21, 0x0d, 0x7d, + 0x82, 0xa1, 0x0b, 0xf1, 0x83, 0x93, 0xf9, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0xc9, 0x56, 0xe0, 0xd0, 0x59, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x00, 0x63, + 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, 0x06, 0x43, 0xc4, 0x5c, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params returns the total set of minting parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params returns the total set of minting parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "composable.ibctransfermiddleware.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "composable/ibctransfermiddleware/v1beta1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ibctransfermiddleware/types/query.pb.gw.go b/x/ibctransfermiddleware/types/query.pb.gw.go new file mode 100644 index 000000000..fcde2bfcb --- /dev/null +++ b/x/ibctransfermiddleware/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"composable", "ibctransfermiddleware", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go new file mode 100644 index 000000000..ae3aab62a --- /dev/null +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -0,0 +1,602 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: composable/ibctransfermiddleware/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateEpochParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/ibctransfermiddleware parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateEpochParams) Reset() { *m = MsgUpdateEpochParams{} } +func (m *MsgUpdateEpochParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateEpochParams) ProtoMessage() {} +func (*MsgUpdateEpochParams) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{0} +} +func (m *MsgUpdateEpochParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateEpochParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateEpochParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateEpochParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateEpochParams.Merge(m, src) +} +func (m *MsgUpdateEpochParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateEpochParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateEpochParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateEpochParams proto.InternalMessageInfo + +func (m *MsgUpdateEpochParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateEpochParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsEpochResponse struct { +} + +func (m *MsgUpdateParamsEpochResponse) Reset() { *m = MsgUpdateParamsEpochResponse{} } +func (m *MsgUpdateParamsEpochResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsEpochResponse) ProtoMessage() {} +func (*MsgUpdateParamsEpochResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{1} +} +func (m *MsgUpdateParamsEpochResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsEpochResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsEpochResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsEpochResponse.Merge(m, src) +} +func (m *MsgUpdateParamsEpochResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsEpochResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateEpochParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateEpochParams") + proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsEpochResponse") +} + +func init() { + proto.RegisterFile("composable/ibctransfermiddleware/v1beta1/tx.proto", fileDescriptor_bf5c053de6965bca) +} + +var fileDescriptor_bf5c053de6965bca = []byte{ + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0xcf, 0x2d, + 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, + 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x40, + 0x68, 0xd1, 0xc3, 0xaa, 0x45, 0x0f, 0xaa, 0x45, 0x4a, 0x3c, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, + 0x3f, 0xb7, 0x38, 0x5d, 0xbf, 0xcc, 0x10, 0x44, 0x41, 0x8c, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, + 0xcb, 0xd7, 0x07, 0x93, 0x50, 0x21, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, + 0x8a, 0x4a, 0x42, 0x4c, 0x88, 0x87, 0x48, 0x40, 0x38, 0x50, 0x29, 0x17, 0xa2, 0x5d, 0x8e, 0xdd, + 0x91, 0x60, 0x53, 0x94, 0x5e, 0x31, 0x72, 0x89, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, + 0xa4, 0xba, 0x16, 0xe4, 0x27, 0x67, 0x04, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x0b, 0x99, 0x71, 0x71, + 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, + 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x83, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, + 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, 0x01, 0xd8, 0x04, 0x09, + 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4b, 0x0f, 0x62, 0xb3, 0x13, 0xe7, + 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, 0x65, 0xe5, 0xda, 0xf4, + 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0xbc, 0x5f, 0x81, 0x23, 0x00, + 0xe0, 0x1e, 0x83, 0x98, 0xac, 0x24, 0xc7, 0x25, 0x83, 0x26, 0x04, 0xf6, 0x71, 0x50, 0x6a, 0x71, + 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd1, 0x2a, 0x46, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0xd9, 0x8c, + 0x5c, 0x82, 0x98, 0x21, 0x62, 0x47, 0xbc, 0x4f, 0xb0, 0x85, 0xa8, 0x94, 0x1b, 0x19, 0xfa, 0xb1, + 0xb8, 0x52, 0x8a, 0xb5, 0x01, 0x14, 0x36, 0x4e, 0xe6, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, + 0x2c, 0xc7, 0x10, 0x25, 0x8b, 0x2b, 0x3c, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x31, + 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x35, 0x13, 0xa7, 0xfb, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) { + out := new(MsgUpdateParamsEpochResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateEpochParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateEpochParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateEpochParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "composable.ibctransfermiddleware.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateEpochParams", + Handler: _Msg_UpdateEpochParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", +} + +func (m *MsgUpdateEpochParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateEpochParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateEpochParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsEpochResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsEpochResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateEpochParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsEpochResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateEpochParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateEpochParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From 25dc69de0eb19429da749f727972229730277a5a Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 16:20:24 +0000 Subject: [PATCH 34/71] resolve conflict with a same name for MsgUpdateEpochParams from staking. --- .../ibctransfermiddleware/v1beta1/tx.proto | 6 +- x/ibctransfermiddleware/keeper/msg_server.go | 4 +- x/ibctransfermiddleware/types/codec.go | 4 +- x/ibctransfermiddleware/types/msgs.go | 8 +- x/ibctransfermiddleware/types/tx.pb.go | 139 +++++++++--------- 5 files changed, 81 insertions(+), 80 deletions(-) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto index 781979b09..c695e2daf 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -13,13 +13,13 @@ option go_package = "x/ibctransfermiddleware/types"; service Msg { option (cosmos.msg.v1.service) = true; - rpc UpdateEpochParams(MsgUpdateEpochParams) returns (MsgUpdateParamsEpochResponse); + rpc UpdateEpochParams(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 -message MsgUpdateEpochParams { +message MsgUpdateCustomIbcParams { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "composable/x/ibctransfermiddleware/MsgUpdateParams"; @@ -38,4 +38,4 @@ message MsgUpdateEpochParams { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -message MsgUpdateParamsEpochResponse {} +message MsgUpdateParamsCustomIbcResponse {} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index e9d5a6e77..806ecde36 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -24,7 +24,7 @@ func NewMsgServerImpl(k Keeper) types.MsgServer { } // UpdateParams updates the params. -func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateEpochParams) (*types.MsgUpdateParamsEpochResponse, error) { +func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateCustomIbcParams) (*types.MsgUpdateParamsCustomIbcResponse, error) { if ms.authority != req.Authority { return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) } @@ -34,5 +34,5 @@ func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdat return nil, err } - return &types.MsgUpdateParamsEpochResponse{}, nil + return &types.MsgUpdateParamsCustomIbcResponse{}, nil } diff --git a/x/ibctransfermiddleware/types/codec.go b/x/ibctransfermiddleware/types/codec.go index c8986807f..e22a34195 100644 --- a/x/ibctransfermiddleware/types/codec.go +++ b/x/ibctransfermiddleware/types/codec.go @@ -16,13 +16,13 @@ import ( // RegisterLegacyAminoCodec registers the account interfaces and concrete types on the // provided LegacyAmino codec. These types are used for Amino JSON serialization func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgUpdateEpochParams{}, "composable/MsgUpdateEpochParams") + legacy.RegisterAminoMsg(cdc, &MsgUpdateCustomIbcParams{}, "composable/MsgUpdateCustomIbcParams") } func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgUpdateEpochParams{}, + &MsgUpdateCustomIbcParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ibctransfermiddleware/types/msgs.go b/x/ibctransfermiddleware/types/msgs.go index 4418aa784..c4ceec79a 100644 --- a/x/ibctransfermiddleware/types/msgs.go +++ b/x/ibctransfermiddleware/types/msgs.go @@ -5,21 +5,21 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUpdateEpochParams{} +var _ sdk.Msg = &MsgUpdateCustomIbcParams{} // GetSignBytes implements the LegacyMsg interface. -func (m MsgUpdateEpochParams) GetSignBytes() []byte { +func (m MsgUpdateCustomIbcParams) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } // GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgUpdateEpochParams) GetSigners() []sdk.AccAddress { +func (m *MsgUpdateCustomIbcParams) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Authority) return []sdk.AccAddress{addr} } // ValidateBasic does a sanity check on the provided data. -func (m *MsgUpdateEpochParams) ValidateBasic() error { +func (m *MsgUpdateCustomIbcParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { return errorsmod.Wrapf(err, "invalid authority address") } diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go index ae3aab62a..7235fb024 100644 --- a/x/ibctransfermiddleware/types/tx.pb.go +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -34,7 +34,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgUpdateParams is the Msg/UpdateParams request type. // // Since: cosmos-sdk 0.47 -type MsgUpdateEpochParams struct { +type MsgUpdateCustomIbcParams struct { // authority is the address that controls the module (defaults to x/gov unless // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` @@ -44,18 +44,18 @@ type MsgUpdateEpochParams struct { Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } -func (m *MsgUpdateEpochParams) Reset() { *m = MsgUpdateEpochParams{} } -func (m *MsgUpdateEpochParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateEpochParams) ProtoMessage() {} -func (*MsgUpdateEpochParams) Descriptor() ([]byte, []int) { +func (m *MsgUpdateCustomIbcParams) Reset() { *m = MsgUpdateCustomIbcParams{} } +func (m *MsgUpdateCustomIbcParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCustomIbcParams) ProtoMessage() {} +func (*MsgUpdateCustomIbcParams) Descriptor() ([]byte, []int) { return fileDescriptor_bf5c053de6965bca, []int{0} } -func (m *MsgUpdateEpochParams) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateCustomIbcParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateEpochParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateCustomIbcParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateEpochParams.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateCustomIbcParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -65,26 +65,26 @@ func (m *MsgUpdateEpochParams) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *MsgUpdateEpochParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateEpochParams.Merge(m, src) +func (m *MsgUpdateCustomIbcParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCustomIbcParams.Merge(m, src) } -func (m *MsgUpdateEpochParams) XXX_Size() int { +func (m *MsgUpdateCustomIbcParams) XXX_Size() int { return m.Size() } -func (m *MsgUpdateEpochParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateEpochParams.DiscardUnknown(m) +func (m *MsgUpdateCustomIbcParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCustomIbcParams.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateEpochParams proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateCustomIbcParams proto.InternalMessageInfo -func (m *MsgUpdateEpochParams) GetAuthority() string { +func (m *MsgUpdateCustomIbcParams) GetAuthority() string { if m != nil { return m.Authority } return "" } -func (m *MsgUpdateEpochParams) GetParams() Params { +func (m *MsgUpdateCustomIbcParams) GetParams() Params { if m != nil { return m.Params } @@ -95,21 +95,21 @@ func (m *MsgUpdateEpochParams) GetParams() Params { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -type MsgUpdateParamsEpochResponse struct { +type MsgUpdateParamsCustomIbcResponse struct { } -func (m *MsgUpdateParamsEpochResponse) Reset() { *m = MsgUpdateParamsEpochResponse{} } -func (m *MsgUpdateParamsEpochResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsEpochResponse) ProtoMessage() {} -func (*MsgUpdateParamsEpochResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParamsCustomIbcResponse) Reset() { *m = MsgUpdateParamsCustomIbcResponse{} } +func (m *MsgUpdateParamsCustomIbcResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsCustomIbcResponse) ProtoMessage() {} +func (*MsgUpdateParamsCustomIbcResponse) Descriptor() ([]byte, []int) { return fileDescriptor_bf5c053de6965bca, []int{1} } -func (m *MsgUpdateParamsEpochResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateParamsEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateParamsEpochResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -119,21 +119,21 @@ func (m *MsgUpdateParamsEpochResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgUpdateParamsEpochResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsEpochResponse.Merge(m, src) +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.Merge(m, src) } -func (m *MsgUpdateParamsEpochResponse) XXX_Size() int { +func (m *MsgUpdateParamsCustomIbcResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateParamsEpochResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsEpochResponse.DiscardUnknown(m) +func (m *MsgUpdateParamsCustomIbcResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsCustomIbcResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateParamsEpochResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsCustomIbcResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgUpdateEpochParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateEpochParams") - proto.RegisterType((*MsgUpdateParamsEpochResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsEpochResponse") + proto.RegisterType((*MsgUpdateCustomIbcParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateCustomIbcParams") + proto.RegisterType((*MsgUpdateParamsCustomIbcResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsCustomIbcResponse") } func init() { @@ -141,7 +141,7 @@ func init() { } var fileDescriptor_bf5c053de6965bca = []byte{ - // 367 bytes of a gzipped FileDescriptorProto + // 378 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0xcf, 0x2d, 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, @@ -150,21 +150,22 @@ var fileDescriptor_bf5c053de6965bca = []byte{ 0x3f, 0xb7, 0x38, 0x5d, 0xbf, 0xcc, 0x10, 0x44, 0x41, 0x8c, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x50, 0x21, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, 0x8a, 0x4a, 0x42, 0x4c, 0x88, 0x87, 0x48, 0x40, 0x38, 0x50, 0x29, 0x17, 0xa2, 0x5d, 0x8e, 0xdd, - 0x91, 0x60, 0x53, 0x94, 0x5e, 0x31, 0x72, 0x89, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, - 0xa4, 0xba, 0x16, 0xe4, 0x27, 0x67, 0x04, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x0b, 0x99, 0x71, 0x71, - 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, - 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x83, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, - 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, 0x01, 0xd8, 0x04, 0x09, - 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4b, 0x0f, 0x62, 0xb3, 0x13, 0xe7, - 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, 0x65, 0xe5, 0xda, 0xf4, - 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0xbc, 0x5f, 0x81, 0x23, 0x00, - 0xe0, 0x1e, 0x83, 0x98, 0xac, 0x24, 0xc7, 0x25, 0x83, 0x26, 0x04, 0xf6, 0x71, 0x50, 0x6a, 0x71, - 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd1, 0x2a, 0x46, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0xd9, 0x8c, - 0x5c, 0x82, 0x98, 0x21, 0x62, 0x47, 0xbc, 0x4f, 0xb0, 0x85, 0xa8, 0x94, 0x1b, 0x19, 0xfa, 0xb1, - 0xb8, 0x52, 0x8a, 0xb5, 0x01, 0x14, 0x36, 0x4e, 0xe6, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, - 0x2c, 0xc7, 0x10, 0x25, 0x8b, 0x2b, 0x3c, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x31, - 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x35, 0x13, 0xa7, 0xfb, 0x02, 0x00, 0x00, + 0x91, 0x60, 0x53, 0x94, 0xde, 0x31, 0x72, 0x49, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, + 0xa4, 0x3a, 0x97, 0x16, 0x97, 0xe4, 0xe7, 0x7a, 0x26, 0x25, 0x07, 0x24, 0x16, 0x25, 0xe6, 0x16, + 0x0b, 0x99, 0x71, 0x71, 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, + 0x30, 0x6a, 0x70, 0x3a, 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x87, 0x63, 0x4a, 0x4a, 0x51, + 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, + 0x01, 0xd8, 0x04, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4c, 0x0f, + 0x62, 0xb3, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, + 0x65, 0xe5, 0xda, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0x82, + 0xa0, 0x02, 0x47, 0x20, 0xc0, 0x3d, 0x07, 0x31, 0x59, 0x49, 0x89, 0x4b, 0x01, 0x4d, 0x08, 0xee, + 0xeb, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x4d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, + 0xe9, 0x42, 0x8b, 0x19, 0xb9, 0x04, 0x21, 0x2a, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0xa0, 0xa1, 0xe2, + 0x44, 0xbc, 0x6f, 0x70, 0x85, 0xac, 0x94, 0x17, 0x19, 0x66, 0xe0, 0x70, 0xad, 0x14, 0x6b, 0x03, + 0x28, 0x9c, 0x9c, 0xcc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, + 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x16, + 0x57, 0xd8, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x53, 0x82, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0x6a, 0x14, 0xf9, 0x95, 0x0b, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -179,7 +180,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) + UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) } type msgClient struct { @@ -190,8 +191,8 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochParams, opts ...grpc.CallOption) (*MsgUpdateParamsEpochResponse, error) { - out := new(MsgUpdateParamsEpochResponse) +func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) { + out := new(MsgUpdateParamsCustomIbcResponse) err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", in, out, opts...) if err != nil { return nil, err @@ -201,14 +202,14 @@ func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateEpochPar // MsgServer is the server API for Msg service. type MsgServer interface { - UpdateEpochParams(context.Context, *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) + UpdateEpochParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateEpochParams) (*MsgUpdateParamsEpochResponse, error) { +func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") } @@ -217,7 +218,7 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { } func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateEpochParams) + in := new(MsgUpdateCustomIbcParams) if err := dec(in); err != nil { return nil, err } @@ -229,7 +230,7 @@ func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec fu FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateEpochParams)) + return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateCustomIbcParams)) } return interceptor(ctx, in, info, handler) } @@ -247,7 +248,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", } -func (m *MsgUpdateEpochParams) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateCustomIbcParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -257,12 +258,12 @@ func (m *MsgUpdateEpochParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateEpochParams) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateCustomIbcParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateEpochParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateCustomIbcParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -287,7 +288,7 @@ func (m *MsgUpdateEpochParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParamsEpochResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParamsCustomIbcResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -297,12 +298,12 @@ func (m *MsgUpdateParamsEpochResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateParamsEpochResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsCustomIbcResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParamsEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsCustomIbcResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -321,7 +322,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgUpdateEpochParams) Size() (n int) { +func (m *MsgUpdateCustomIbcParams) Size() (n int) { if m == nil { return 0 } @@ -336,7 +337,7 @@ func (m *MsgUpdateEpochParams) Size() (n int) { return n } -func (m *MsgUpdateParamsEpochResponse) Size() (n int) { +func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { if m == nil { return 0 } @@ -351,7 +352,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -374,10 +375,10 @@ func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateEpochParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateEpochParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -466,7 +467,7 @@ func (m *MsgUpdateEpochParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -489,10 +490,10 @@ func (m *MsgUpdateParamsEpochResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From 0166205f242ded8ff8cfbb5dbb6aa9ef9487d012 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 16:39:48 +0000 Subject: [PATCH 35/71] add dependency to transfer keeper from ibc transfer middleware/params --- app/keepers/keepers.go | 2 +- custom/ibc-transfer/keeper/keeper.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 58b73ced5..bf0d33378 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -319,7 +319,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.ScopedTransferKeeper, - // &appKeepers.StakingMiddlewareKeeper,x + &appKeepers.IbcTransferMiddlewareKeeper, ) appKeepers.RouterKeeper = routerkeeper.NewKeeper( diff --git a/custom/ibc-transfer/keeper/keeper.go b/custom/ibc-transfer/keeper/keeper.go index e357906a5..253184b4d 100644 --- a/custom/ibc-transfer/keeper/keeper.go +++ b/custom/ibc-transfer/keeper/keeper.go @@ -9,13 +9,13 @@ import ( "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" - // stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/keeper" ) type Keeper struct { ibctransferkeeper.Keeper - cdc codec.BinaryCodec - // Stakingmiddleware *stakingmiddleware.Keeper + cdc codec.BinaryCodec + IbcTransfermiddleware *ibctransfermiddleware.Keeper // authority string } @@ -31,7 +31,7 @@ func NewKeeper( bk types.BankKeeper, scopedKeeper exported.ScopedKeeper, // authority string, - // stakingmiddleware *stakingmiddleware.Keeper, + ibcTransfermiddleware *ibctransfermiddleware.Keeper, //return type from this function is different from the staking keeper. //todo double check if this is correct ) Keeper { @@ -39,7 +39,8 @@ func NewKeeper( Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), // authority: authority, // Stakingmiddleware: stakingmiddleware, - cdc: cdc, + IbcTransfermiddleware: ibcTransfermiddleware, + cdc: cdc, } return keeper } From 5683e1b73271fe23917faa22e46372d68b0b7365 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 21:25:28 +0000 Subject: [PATCH 36/71] added repeated FeeItem into Params + MVP logic in transfer msg server --- custom/ibc-transfer/keeper/msg_server.go | 56 ++ .../v1beta1/ibctransfermiddleware.proto | 12 + .../types/ibctransfermiddleware.pb.go | 585 ++++++++++++++++-- 3 files changed, 615 insertions(+), 38 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index cbb3a3147..d769ebc29 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -3,7 +3,9 @@ package keeper import ( "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) type msgServer struct { @@ -19,5 +21,59 @@ var _ types.MsgServer = msgServer{} // } func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := k.Keeper.IbcTransfermiddleware.GetParams(ctx) + if params.ChannelFees != nil && len(params.ChannelFees) > 0 { + channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel) + //find the channel fee with a matching channel + if channelFee != nil { + //find the coin with a matching denom + coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) + if coin != nil { + //token not allowed by this channel. should ignore the transfer + return &types.MsgTransferResponse{}, nil + } + minFee := coin.MinFee.Amount + charge := minFee + if charge.GT(msg.Token.Amount) { + charge = msg.Token.Amount + } + + newAmount := msg.Token.Amount.Sub(charge) + + if newAmount.IsPositive() { + //if Percentage = 100 it means we charge 1 % of the amount + percentageCharge := newAmount.QuoRaw(coin.Percentage) + newAmount = newAmount.Sub(percentageCharge) + charge = charge.Add(percentageCharge) + } + + //TODO call bank transfer to transfer the charge to the fee address + if newAmount.IsZero() { + //if the new amount is zero, then the transfer should be ignored + return &types.MsgTransferResponse{}, nil + } + msg.Token.Amount = newAmount + } + + } + return k.msgServer.Transfer(goCtx, msg) } + +func findChannelParams(channelFees []*ibctransfermiddlewaretypes.ChannelFee, targetChannelID string) *ibctransfermiddlewaretypes.ChannelFee { + for _, fee := range channelFees { + if fee.Channel == targetChannelID { + return fee + } + } + return nil // If the channel is not found +} +func findCoinByDenom(allowedTokens []*ibctransfermiddlewaretypes.CoinItem, denom string) *ibctransfermiddlewaretypes.CoinItem { + for _, coin := range allowedTokens { + if coin.MinFee.Denom == denom { + return coin + } + } + return nil // If the denom is not found +} diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto index d8621e42d..0b171474f 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -77,5 +77,17 @@ message Params { uint64 blocks_per_epoch = 1; // max block allowed before validator set update uint64 allow_unbond_after_epoch_progress_block_number = 2; +// channel fees settings that charge extra + repeated ChannelFee channel_fees = 3; +} + +message ChannelFee{ + string channel = 1; + repeated CoinItem allowed_tokens = 2; +} + +message CoinItem{ + cosmos.base.v1beta1.Coin min_fee = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + int64 percentage = 2; } diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go index 8061d3d76..2ef146168 100644 --- a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -199,6 +199,8 @@ type Params struct { BlocksPerEpoch uint64 `protobuf:"varint,1,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` // max block allowed before validator set update AllowUnbondAfterEpochProgressBlockNumber uint64 `protobuf:"varint,2,opt,name=allow_unbond_after_epoch_progress_block_number,json=allowUnbondAfterEpochProgressBlockNumber,proto3" json:"allow_unbond_after_epoch_progress_block_number,omitempty"` + // channel fees settings that charge extra + ChannelFees []*ChannelFee `protobuf:"bytes,3,rep,name=channel_fees,json=channelFees,proto3" json:"channel_fees,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -248,12 +250,125 @@ func (m *Params) GetAllowUnbondAfterEpochProgressBlockNumber() uint64 { return 0 } +func (m *Params) GetChannelFees() []*ChannelFee { + if m != nil { + return m.ChannelFees + } + return nil +} + +type ChannelFee struct { + Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` + AllowedTokens []*CoinItem `protobuf:"bytes,2,rep,name=allowed_tokens,json=allowedTokens,proto3" json:"allowed_tokens,omitempty"` +} + +func (m *ChannelFee) Reset() { *m = ChannelFee{} } +func (m *ChannelFee) String() string { return proto.CompactTextString(m) } +func (*ChannelFee) ProtoMessage() {} +func (*ChannelFee) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{5} +} +func (m *ChannelFee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChannelFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChannelFee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ChannelFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelFee.Merge(m, src) +} +func (m *ChannelFee) XXX_Size() int { + return m.Size() +} +func (m *ChannelFee) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelFee.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelFee proto.InternalMessageInfo + +func (m *ChannelFee) GetChannel() string { + if m != nil { + return m.Channel + } + return "" +} + +func (m *ChannelFee) GetAllowedTokens() []*CoinItem { + if m != nil { + return m.AllowedTokens + } + return nil +} + +type CoinItem struct { + MinFee types.Coin `protobuf:"bytes,1,opt,name=min_fee,json=minFee,proto3" json:"min_fee"` + Percentage int64 `protobuf:"varint,2,opt,name=percentage,proto3" json:"percentage,omitempty"` +} + +func (m *CoinItem) Reset() { *m = CoinItem{} } +func (m *CoinItem) String() string { return proto.CompactTextString(m) } +func (*CoinItem) ProtoMessage() {} +func (*CoinItem) Descriptor() ([]byte, []int) { + return fileDescriptor_1193893bc248bc1b, []int{6} +} +func (m *CoinItem) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CoinItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CoinItem.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CoinItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_CoinItem.Merge(m, src) +} +func (m *CoinItem) XXX_Size() int { + return m.Size() +} +func (m *CoinItem) XXX_DiscardUnknown() { + xxx_messageInfo_CoinItem.DiscardUnknown(m) +} + +var xxx_messageInfo_CoinItem proto.InternalMessageInfo + +func (m *CoinItem) GetMinFee() types.Coin { + if m != nil { + return m.MinFee + } + return types.Coin{} +} + +func (m *CoinItem) GetPercentage() int64 { + if m != nil { + return m.Percentage + } + return 0 +} + func init() { proto.RegisterType((*Delegation)(nil), "composable.ibctransfermiddleware.v1beta1.Delegation") proto.RegisterType((*BeginRedelegate)(nil), "composable.ibctransfermiddleware.v1beta1.BeginRedelegate") proto.RegisterType((*Undelegate)(nil), "composable.ibctransfermiddleware.v1beta1.Undelegate") proto.RegisterType((*CancelUnbondingDelegation)(nil), "composable.ibctransfermiddleware.v1beta1.CancelUnbondingDelegation") proto.RegisterType((*Params)(nil), "composable.ibctransfermiddleware.v1beta1.Params") + proto.RegisterType((*ChannelFee)(nil), "composable.ibctransfermiddleware.v1beta1.ChannelFee") + proto.RegisterType((*CoinItem)(nil), "composable.ibctransfermiddleware.v1beta1.CoinItem") } func init() { @@ -261,44 +376,51 @@ func init() { } var fileDescriptor_1193893bc248bc1b = []byte{ - // 584 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0x4f, 0x6b, 0x13, 0x41, - 0x18, 0x87, 0x77, 0x93, 0x10, 0xe8, 0x08, 0xfd, 0x13, 0xab, 0x26, 0x85, 0x6e, 0x4a, 0x2e, 0x0d, - 0x81, 0x66, 0x89, 0x1e, 0xc4, 0xea, 0xc1, 0xa6, 0x29, 0x88, 0xa8, 0x84, 0x2d, 0xbd, 0x78, 0x59, - 0x67, 0x77, 0xa7, 0x9b, 0xa1, 0xbb, 0x33, 0x61, 0x66, 0x92, 0xea, 0xd5, 0x93, 0x78, 0x12, 0xd4, - 0x7b, 0x8f, 0x1e, 0x73, 0xf0, 0x43, 0xf4, 0x58, 0x3c, 0x79, 0x10, 0x91, 0xe4, 0x10, 0x3f, 0x80, - 0x1f, 0x40, 0x76, 0x66, 0x92, 0x10, 0x9b, 0x92, 0x22, 0x3d, 0x88, 0x97, 0x24, 0xf3, 0xbe, 0xfb, - 0xfc, 0x78, 0xe7, 0x61, 0x32, 0x0b, 0x1a, 0x3e, 0x8d, 0xdb, 0x94, 0x43, 0x2f, 0x42, 0x36, 0xf6, - 0x7c, 0xc1, 0x20, 0xe1, 0x87, 0x88, 0xc5, 0x38, 0x08, 0x22, 0x74, 0x0c, 0x19, 0xb2, 0xbb, 0x35, - 0x0f, 0x09, 0x58, 0x9b, 0xdd, 0xad, 0xb6, 0x19, 0x15, 0x34, 0x57, 0x9e, 0xa4, 0x54, 0x67, 0x3f, - 0xa7, 0x53, 0xd6, 0x56, 0x43, 0x1a, 0x52, 0x09, 0xd9, 0xc9, 0x2f, 0xc5, 0xaf, 0x15, 0x7c, 0xca, - 0x63, 0xca, 0x5d, 0xd5, 0x50, 0x0b, 0xdd, 0xb2, 0xd4, 0xca, 0xf6, 0x20, 0x9f, 0xcc, 0xe2, 0x53, - 0x4c, 0x74, 0x7f, 0x05, 0xc6, 0x98, 0x50, 0x5b, 0x7e, 0xea, 0xd2, 0x2d, 0x8d, 0xc4, 0x3c, 0xb4, - 0xbb, 0xb5, 0xe4, 0x4b, 0x35, 0x4a, 0xef, 0x53, 0x00, 0x34, 0x50, 0x84, 0x42, 0x28, 0x30, 0x25, - 0xb9, 0x3d, 0xb0, 0x12, 0xa8, 0x15, 0x65, 0x2e, 0x0c, 0x02, 0x86, 0x38, 0xcf, 0x9b, 0x1b, 0x66, - 0x79, 0xa1, 0x9e, 0xff, 0xf2, 0x79, 0x6b, 0x55, 0xcf, 0xb1, 0xa3, 0x3a, 0xfb, 0x82, 0x61, 0x12, - 0x3a, 0xcb, 0x63, 0x44, 0xd7, 0x93, 0x98, 0x2e, 0x8c, 0x70, 0x30, 0x15, 0x93, 0x9a, 0x17, 0x33, - 0x46, 0x46, 0x31, 0x0f, 0x40, 0x16, 0xc6, 0xb4, 0x43, 0x44, 0x3e, 0xbd, 0x61, 0x96, 0xaf, 0xdd, - 0x2e, 0x54, 0x35, 0x98, 0xec, 0x7c, 0xe4, 0xaf, 0xba, 0x4b, 0x31, 0xa9, 0x2f, 0x9c, 0x7e, 0x2f, - 0x1a, 0x9f, 0x86, 0xbd, 0x8a, 0xe9, 0x68, 0x66, 0xfb, 0xde, 0x9b, 0x93, 0xa2, 0xf1, 0xf3, 0xa4, - 0x68, 0xbc, 0x1e, 0xf6, 0x2a, 0xe7, 0xb7, 0xf5, 0x76, 0xd8, 0xab, 0xdc, 0x54, 0x79, 0x5b, 0x3c, - 0x38, 0xb2, 0x9f, 0xf2, 0x50, 0x8b, 0x40, 0xa5, 0x5f, 0x29, 0xb0, 0x54, 0x47, 0x21, 0x26, 0x0e, - 0xd2, 0x1c, 0xba, 0x2a, 0x35, 0x4f, 0xc0, 0x8d, 0x89, 0x1a, 0xce, 0xfc, 0x4b, 0xeb, 0xb9, 0x3e, - 0xc6, 0xf6, 0x99, 0x3f, 0x33, 0x2d, 0xe0, 0x62, 0x9c, 0x96, 0xbe, 0x74, 0x5a, 0x83, 0x8b, 0xf3, - 0xbe, 0x33, 0x7f, 0xe1, 0xfb, 0xe1, 0x7c, 0xdf, 0xeb, 0xd3, 0xbe, 0xff, 0x50, 0x5c, 0xfa, 0x98, - 0x02, 0xe0, 0x80, 0x5c, 0xb5, 0xf1, 0x7f, 0xe2, 0x30, 0xde, 0x9f, 0x2f, 0x27, 0x3f, 0x2d, 0x67, - 0x22, 0xa2, 0xf4, 0x2d, 0x05, 0x0a, 0xbb, 0x90, 0xf8, 0x28, 0x3a, 0x20, 0x1e, 0x25, 0x01, 0x26, - 0xe1, 0xff, 0xf9, 0x9f, 0xcd, 0x6d, 0x82, 0x25, 0x9f, 0x21, 0xb9, 0x2f, 0xb7, 0x85, 0x70, 0xd8, - 0x52, 0x47, 0x31, 0xed, 0x2c, 0x8e, 0xca, 0x8f, 0x64, 0x75, 0xfb, 0xf1, 0x7c, 0x9f, 0x9b, 0xd3, - 0x3e, 0x2f, 0x14, 0x58, 0xfa, 0x60, 0x82, 0x6c, 0x13, 0x32, 0x18, 0xf3, 0x5c, 0x19, 0x2c, 0x7b, - 0x11, 0xf5, 0x8f, 0xb8, 0xdb, 0x46, 0xcc, 0x45, 0x6d, 0xea, 0xb7, 0xa4, 0xca, 0x8c, 0xb3, 0xa8, - 0xea, 0x4d, 0xc4, 0xf6, 0x92, 0x6a, 0xee, 0x05, 0xa8, 0xc2, 0x28, 0xa2, 0xc7, 0x6e, 0x47, 0x26, - 0xba, 0xf0, 0x50, 0x8c, 0x88, 0xe4, 0xce, 0x0e, 0x93, 0x29, 0x5c, 0xc9, 0xb8, 0xa4, 0x13, 0x7b, - 0x88, 0x49, 0x97, 0x19, 0xa7, 0x2c, 0x29, 0x35, 0xc6, 0x4e, 0xc2, 0xc8, 0xb8, 0xa6, 0x26, 0xea, - 0x09, 0xf0, 0x4c, 0x3e, 0x5f, 0xbf, 0x7b, 0xda, 0xb7, 0xcc, 0xb3, 0xbe, 0x65, 0xfe, 0xe8, 0x5b, - 0xe6, 0xbb, 0x81, 0x65, 0x9c, 0x0d, 0x2c, 0xe3, 0xeb, 0xc0, 0x32, 0x9e, 0xaf, 0xbf, 0xbc, 0xe0, - 0xc5, 0x24, 0x5e, 0xb5, 0x11, 0xf7, 0xb2, 0xf2, 0x6a, 0xbf, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0x6b, 0xd0, 0x58, 0xce, 0xc9, 0x06, 0x00, 0x00, + // 703 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0xcf, 0x4f, 0xd4, 0x4e, + 0x18, 0xc6, 0xb7, 0xbb, 0x04, 0xbe, 0x0c, 0x5f, 0xf9, 0x51, 0x51, 0x17, 0x12, 0x0a, 0xd9, 0x0b, + 0x1b, 0x12, 0xda, 0x80, 0x26, 0x46, 0xd4, 0x44, 0x16, 0x30, 0x6a, 0xd4, 0x90, 0x22, 0x31, 0x7a, + 0xa9, 0xd3, 0xf6, 0xa5, 0x3b, 0xa1, 0x9d, 0xd9, 0xcc, 0x14, 0xd0, 0xa3, 0x9e, 0x8c, 0x27, 0x13, + 0xe3, 0x9d, 0xa3, 0x47, 0x0e, 0xfe, 0x11, 0x1c, 0x89, 0x27, 0x0f, 0xc6, 0x18, 0x38, 0xe0, 0xc5, + 0x9b, 0x7f, 0x80, 0x99, 0xe9, 0xec, 0xae, 0x2b, 0x90, 0x5d, 0x0d, 0x07, 0xe3, 0x65, 0xb7, 0xf3, + 0xbe, 0x7d, 0x9e, 0x3c, 0xf3, 0xc9, 0x3b, 0x1d, 0xb4, 0x18, 0xb0, 0xa4, 0xc6, 0x04, 0xf6, 0x63, + 0x70, 0x88, 0x1f, 0xa4, 0x1c, 0x53, 0xb1, 0x06, 0x3c, 0x21, 0x61, 0x18, 0xc3, 0x16, 0xe6, 0xe0, + 0x6c, 0xce, 0xf8, 0x90, 0xe2, 0x99, 0xe3, 0xbb, 0x76, 0x8d, 0xb3, 0x94, 0x99, 0xe5, 0xa6, 0x8b, + 0x7d, 0xfc, 0x7b, 0xda, 0x65, 0x74, 0x38, 0x62, 0x11, 0x53, 0x22, 0x47, 0x3e, 0x65, 0xfa, 0xd1, + 0x91, 0x80, 0x89, 0x84, 0x09, 0x2f, 0x6b, 0x64, 0x0b, 0xdd, 0xb2, 0xb2, 0x95, 0xe3, 0x63, 0xd1, + 0xcc, 0x12, 0x30, 0x42, 0x75, 0x7f, 0x08, 0x27, 0x84, 0x32, 0x47, 0xfd, 0xea, 0xd2, 0x05, 0x2d, + 0x49, 0x44, 0xe4, 0x6c, 0xce, 0xc8, 0xbf, 0xac, 0x51, 0x7a, 0x93, 0x47, 0x68, 0x11, 0x62, 0x88, + 0x70, 0x4a, 0x18, 0x35, 0x97, 0xd0, 0x50, 0x98, 0xad, 0x18, 0xf7, 0x70, 0x18, 0x72, 0x10, 0xa2, + 0x68, 0x4c, 0x18, 0xe5, 0xde, 0x4a, 0xf1, 0xc3, 0xfb, 0xe9, 0x61, 0x9d, 0x63, 0x3e, 0xeb, 0xac, + 0xa4, 0x9c, 0xd0, 0xc8, 0x1d, 0x6c, 0x48, 0x74, 0x5d, 0xda, 0x6c, 0xe2, 0x98, 0x84, 0x2d, 0x36, + 0xf9, 0x76, 0x36, 0x0d, 0x49, 0xdd, 0xe6, 0x1a, 0xea, 0xc6, 0x09, 0xdb, 0xa0, 0x69, 0xb1, 0x30, + 0x61, 0x94, 0xfb, 0x66, 0x47, 0x6c, 0x2d, 0x94, 0x3b, 0xaf, 0xf3, 0xb3, 0x17, 0x18, 0xa1, 0x95, + 0xde, 0xdd, 0xcf, 0xe3, 0xb9, 0x77, 0x87, 0x3b, 0x53, 0x86, 0xab, 0x35, 0x73, 0x57, 0x5e, 0x6e, + 0x8f, 0xe7, 0xbe, 0x6e, 0x8f, 0xe7, 0x5e, 0x1c, 0xee, 0x4c, 0x1d, 0xdd, 0xd6, 0xab, 0xc3, 0x9d, + 0xa9, 0xf3, 0x99, 0xdf, 0xb4, 0x08, 0xd7, 0x9d, 0x7b, 0x22, 0xd2, 0x20, 0xa0, 0xf4, 0x3d, 0x8f, + 0x06, 0x2a, 0x10, 0x11, 0xea, 0x82, 0xd6, 0xc1, 0x69, 0xa1, 0xb9, 0x8b, 0xce, 0x35, 0xd1, 0x08, + 0x1e, 0x74, 0x8c, 0xe7, 0x6c, 0x43, 0xb6, 0xc2, 0x83, 0x63, 0xdd, 0x42, 0x91, 0x36, 0xdc, 0x0a, + 0x1d, 0xbb, 0x2d, 0x8a, 0xf4, 0x28, 0xef, 0xae, 0x3f, 0xe0, 0x7d, 0xa3, 0x3d, 0xef, 0xb1, 0x56, + 0xde, 0xbf, 0x20, 0x2e, 0xbd, 0xcd, 0x23, 0xb4, 0x4a, 0x4f, 0x9b, 0xf8, 0x5f, 0x31, 0x8c, 0x57, + 0xdb, 0xc3, 0x29, 0xb6, 0xc2, 0x69, 0x82, 0x28, 0x7d, 0xca, 0xa3, 0x91, 0x05, 0x4c, 0x03, 0x88, + 0x57, 0xa9, 0xcf, 0x68, 0x48, 0x68, 0xf4, 0x6f, 0x9e, 0x59, 0x73, 0x12, 0x0d, 0x04, 0x1c, 0xd4, + 0xbe, 0xbc, 0x2a, 0x90, 0xa8, 0x9a, 0x8d, 0x62, 0xc1, 0xed, 0xaf, 0x97, 0x6f, 0xa9, 0xea, 0xdc, + 0x9d, 0xf6, 0x3c, 0x27, 0x5b, 0x79, 0x9e, 0x08, 0xb0, 0xf4, 0xcd, 0x40, 0xdd, 0xcb, 0x98, 0xe3, + 0x44, 0x98, 0x65, 0x34, 0xe8, 0xc7, 0x2c, 0x58, 0x17, 0x5e, 0x0d, 0xb8, 0x07, 0x35, 0x16, 0x54, + 0x15, 0xca, 0x2e, 0xb7, 0x3f, 0xab, 0x2f, 0x03, 0x5f, 0x92, 0x55, 0xf3, 0x09, 0xb2, 0x71, 0x1c, + 0xb3, 0x2d, 0x6f, 0x43, 0x39, 0x7a, 0x78, 0x2d, 0xad, 0x2b, 0xe4, 0x37, 0x3b, 0x92, 0x29, 0x3c, + 0xa5, 0xf1, 0xe8, 0x46, 0xe2, 0x03, 0x57, 0x2c, 0xbb, 0xdc, 0xb2, 0x52, 0x65, 0x31, 0xe6, 0xa5, + 0x46, 0xd9, 0x2d, 0x6b, 0x45, 0x45, 0x0a, 0xee, 0xab, 0xf7, 0xcd, 0x87, 0xe8, 0xff, 0xa0, 0x8a, + 0x29, 0x85, 0xd8, 0x5b, 0x03, 0x90, 0x47, 0xba, 0x50, 0xee, 0x9b, 0xbd, 0x64, 0x77, 0x7a, 0xb1, + 0xd8, 0x0b, 0x99, 0xfa, 0x26, 0x80, 0xdb, 0x17, 0x34, 0x9e, 0x45, 0xe9, 0xb9, 0x81, 0x50, 0xb3, + 0x67, 0x16, 0x51, 0x8f, 0xee, 0x66, 0x53, 0xe3, 0xd6, 0x97, 0xe6, 0x23, 0xd4, 0xaf, 0xd2, 0x42, + 0xe8, 0xa5, 0x6c, 0x1d, 0xa8, 0x9c, 0x07, 0x99, 0x61, 0xf6, 0x37, 0x32, 0x30, 0x42, 0x6f, 0xa7, + 0x90, 0xb8, 0x67, 0xb4, 0xd3, 0x03, 0x65, 0x54, 0x22, 0xe8, 0xbf, 0x7a, 0xcb, 0xbc, 0x8e, 0x7a, + 0x12, 0x42, 0xe5, 0x26, 0x55, 0x80, 0x8e, 0x67, 0x26, 0x21, 0x54, 0xe6, 0xb7, 0x10, 0xaa, 0x01, + 0x0f, 0x80, 0xa6, 0x38, 0x02, 0x45, 0xb9, 0xe0, 0xfe, 0x54, 0xa9, 0x5c, 0xde, 0xdd, 0xb7, 0x8c, + 0xbd, 0x7d, 0xcb, 0xf8, 0xb2, 0x6f, 0x19, 0xaf, 0x0f, 0xac, 0xdc, 0xde, 0x81, 0x95, 0xfb, 0x78, + 0x60, 0xe5, 0x1e, 0x8f, 0x3d, 0x3d, 0xe1, 0x82, 0x4f, 0x9f, 0xd5, 0x40, 0xf8, 0xdd, 0xea, 0x8a, + 0xbc, 0xf8, 0x23, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x3d, 0x91, 0xd8, 0x11, 0x08, 0x00, 0x00, } func (m *Delegation) Marshal() (dAtA []byte, err error) { @@ -521,6 +643,20 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ChannelFees) > 0 { + for iNdEx := len(m.ChannelFees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChannelFees[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) i-- @@ -534,6 +670,88 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ChannelFee) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChannelFee) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChannelFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AllowedTokens) > 0 { + for iNdEx := len(m.AllowedTokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllowedTokens[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Channel) > 0 { + i -= len(m.Channel) + copy(dAtA[i:], m.Channel) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.Channel))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CoinItem) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CoinItem) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CoinItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Percentage != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.Percentage)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.MinFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintIbctransfermiddleware(dAtA []byte, offset int, v uint64) int { offset -= sovIbctransfermiddleware(v) base := offset @@ -640,6 +858,45 @@ func (m *Params) Size() (n int) { if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { n += 1 + sovIbctransfermiddleware(uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) } + if len(m.ChannelFees) > 0 { + for _, e := range m.ChannelFees { + l = e.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + } + return n +} + +func (m *ChannelFee) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Channel) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + if len(m.AllowedTokens) > 0 { + for _, e := range m.AllowedTokens { + l = e.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } + } + return n +} + +func (m *CoinItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MinFee.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + if m.Percentage != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.Percentage)) + } return n } @@ -1355,6 +1612,258 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelFees", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelFees = append(m.ChannelFees, &ChannelFee{}) + if err := m.ChannelFees[len(m.ChannelFees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChannelFee) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChannelFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChannelFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Channel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedTokens", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedTokens = append(m.AllowedTokens, &CoinItem{}) + if err := m.AllowedTokens[len(m.AllowedTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CoinItem) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CoinItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CoinItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType) + } + m.Percentage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Percentage |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) From 28d5504092d5ec9a60dfc188c658dd2657d4e25e Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 21:39:49 +0000 Subject: [PATCH 37/71] finalized the Transfer method. send fee to fee. build. chain works. --- custom/ibc-transfer/keeper/msg_server.go | 20 ++- .../v1beta1/ibctransfermiddleware.proto | 1 + .../types/ibctransfermiddleware.pb.go | 142 ++++++++++++------ 3 files changed, 112 insertions(+), 51 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index d769ebc29..4367a75f8 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -10,16 +10,12 @@ import ( type msgServer struct { Keeper + bank types.BankKeeper msgServer types.MsgServer } var _ types.MsgServer = msgServer{} -// // TODO - Add the stakingkeeper.Keeper as a parameter to the NewMsgServerImpl function -// func NewMsgServerImpl(stakingKeeper stakingkeeper.Keeper, customstakingkeeper Keeper) types.MsgServer { -// return &msgServer{Keeper: customstakingkeeper, msgServer: stakingkeeper.NewMsgServerImpl(&stakingKeeper)} -// } - func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) params := k.Keeper.IbcTransfermiddleware.GetParams(ctx) @@ -48,7 +44,19 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ charge = charge.Add(percentageCharge) } - //TODO call bank transfer to transfer the charge to the fee address + //address from string + msgSender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + feeAddress, err := sdk.AccAddressFromBech32(channelFee.FeeAddress) + if err != nil { + return nil, err + } + + k.bank.SendCoins(ctx, msgSender, feeAddress, sdk.NewCoins(sdk.NewCoin(msg.Token.Denom, charge))) + if newAmount.IsZero() { //if the new amount is zero, then the transfer should be ignored return &types.MsgTransferResponse{}, nil diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto index 0b171474f..d0e707ba3 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -84,6 +84,7 @@ message Params { message ChannelFee{ string channel = 1; repeated CoinItem allowed_tokens = 2; + string fee_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message CoinItem{ diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go index 2ef146168..b7f737374 100644 --- a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -260,6 +260,7 @@ func (m *Params) GetChannelFees() []*ChannelFee { type ChannelFee struct { Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` AllowedTokens []*CoinItem `protobuf:"bytes,2,rep,name=allowed_tokens,json=allowedTokens,proto3" json:"allowed_tokens,omitempty"` + FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty"` } func (m *ChannelFee) Reset() { *m = ChannelFee{} } @@ -309,6 +310,13 @@ func (m *ChannelFee) GetAllowedTokens() []*CoinItem { return nil } +func (m *ChannelFee) GetFeeAddress() string { + if m != nil { + return m.FeeAddress + } + return "" +} + type CoinItem struct { MinFee types.Coin `protobuf:"bytes,1,opt,name=min_fee,json=minFee,proto3" json:"min_fee"` Percentage int64 `protobuf:"varint,2,opt,name=percentage,proto3" json:"percentage,omitempty"` @@ -376,51 +384,52 @@ func init() { } var fileDescriptor_1193893bc248bc1b = []byte{ - // 703 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0xcf, 0x4f, 0xd4, 0x4e, - 0x18, 0xc6, 0xb7, 0xbb, 0x04, 0xbe, 0x0c, 0x5f, 0xf9, 0x51, 0x51, 0x17, 0x12, 0x0a, 0xd9, 0x0b, - 0x1b, 0x12, 0xda, 0x80, 0x26, 0x46, 0xd4, 0x44, 0x16, 0x30, 0x6a, 0xd4, 0x90, 0x22, 0x31, 0x7a, - 0xa9, 0xd3, 0xf6, 0xa5, 0x3b, 0xa1, 0x9d, 0xd9, 0xcc, 0x14, 0xd0, 0xa3, 0x9e, 0x8c, 0x27, 0x13, - 0xe3, 0x9d, 0xa3, 0x47, 0x0e, 0xfe, 0x11, 0x1c, 0x89, 0x27, 0x0f, 0xc6, 0x18, 0x38, 0xe0, 0xc5, - 0x9b, 0x7f, 0x80, 0x99, 0xe9, 0xec, 0xae, 0x2b, 0x90, 0x5d, 0x0d, 0x07, 0xe3, 0x65, 0xb7, 0xf3, - 0xbe, 0x7d, 0x9e, 0x3c, 0xf3, 0xc9, 0x3b, 0x1d, 0xb4, 0x18, 0xb0, 0xa4, 0xc6, 0x04, 0xf6, 0x63, - 0x70, 0x88, 0x1f, 0xa4, 0x1c, 0x53, 0xb1, 0x06, 0x3c, 0x21, 0x61, 0x18, 0xc3, 0x16, 0xe6, 0xe0, - 0x6c, 0xce, 0xf8, 0x90, 0xe2, 0x99, 0xe3, 0xbb, 0x76, 0x8d, 0xb3, 0x94, 0x99, 0xe5, 0xa6, 0x8b, - 0x7d, 0xfc, 0x7b, 0xda, 0x65, 0x74, 0x38, 0x62, 0x11, 0x53, 0x22, 0x47, 0x3e, 0x65, 0xfa, 0xd1, - 0x91, 0x80, 0x89, 0x84, 0x09, 0x2f, 0x6b, 0x64, 0x0b, 0xdd, 0xb2, 0xb2, 0x95, 0xe3, 0x63, 0xd1, - 0xcc, 0x12, 0x30, 0x42, 0x75, 0x7f, 0x08, 0x27, 0x84, 0x32, 0x47, 0xfd, 0xea, 0xd2, 0x05, 0x2d, - 0x49, 0x44, 0xe4, 0x6c, 0xce, 0xc8, 0xbf, 0xac, 0x51, 0x7a, 0x93, 0x47, 0x68, 0x11, 0x62, 0x88, - 0x70, 0x4a, 0x18, 0x35, 0x97, 0xd0, 0x50, 0x98, 0xad, 0x18, 0xf7, 0x70, 0x18, 0x72, 0x10, 0xa2, - 0x68, 0x4c, 0x18, 0xe5, 0xde, 0x4a, 0xf1, 0xc3, 0xfb, 0xe9, 0x61, 0x9d, 0x63, 0x3e, 0xeb, 0xac, - 0xa4, 0x9c, 0xd0, 0xc8, 0x1d, 0x6c, 0x48, 0x74, 0x5d, 0xda, 0x6c, 0xe2, 0x98, 0x84, 0x2d, 0x36, - 0xf9, 0x76, 0x36, 0x0d, 0x49, 0xdd, 0xe6, 0x1a, 0xea, 0xc6, 0x09, 0xdb, 0xa0, 0x69, 0xb1, 0x30, - 0x61, 0x94, 0xfb, 0x66, 0x47, 0x6c, 0x2d, 0x94, 0x3b, 0xaf, 0xf3, 0xb3, 0x17, 0x18, 0xa1, 0x95, - 0xde, 0xdd, 0xcf, 0xe3, 0xb9, 0x77, 0x87, 0x3b, 0x53, 0x86, 0xab, 0x35, 0x73, 0x57, 0x5e, 0x6e, - 0x8f, 0xe7, 0xbe, 0x6e, 0x8f, 0xe7, 0x5e, 0x1c, 0xee, 0x4c, 0x1d, 0xdd, 0xd6, 0xab, 0xc3, 0x9d, - 0xa9, 0xf3, 0x99, 0xdf, 0xb4, 0x08, 0xd7, 0x9d, 0x7b, 0x22, 0xd2, 0x20, 0xa0, 0xf4, 0x3d, 0x8f, - 0x06, 0x2a, 0x10, 0x11, 0xea, 0x82, 0xd6, 0xc1, 0x69, 0xa1, 0xb9, 0x8b, 0xce, 0x35, 0xd1, 0x08, - 0x1e, 0x74, 0x8c, 0xe7, 0x6c, 0x43, 0xb6, 0xc2, 0x83, 0x63, 0xdd, 0x42, 0x91, 0x36, 0xdc, 0x0a, - 0x1d, 0xbb, 0x2d, 0x8a, 0xf4, 0x28, 0xef, 0xae, 0x3f, 0xe0, 0x7d, 0xa3, 0x3d, 0xef, 0xb1, 0x56, - 0xde, 0xbf, 0x20, 0x2e, 0xbd, 0xcd, 0x23, 0xb4, 0x4a, 0x4f, 0x9b, 0xf8, 0x5f, 0x31, 0x8c, 0x57, - 0xdb, 0xc3, 0x29, 0xb6, 0xc2, 0x69, 0x82, 0x28, 0x7d, 0xca, 0xa3, 0x91, 0x05, 0x4c, 0x03, 0x88, - 0x57, 0xa9, 0xcf, 0x68, 0x48, 0x68, 0xf4, 0x6f, 0x9e, 0x59, 0x73, 0x12, 0x0d, 0x04, 0x1c, 0xd4, - 0xbe, 0xbc, 0x2a, 0x90, 0xa8, 0x9a, 0x8d, 0x62, 0xc1, 0xed, 0xaf, 0x97, 0x6f, 0xa9, 0xea, 0xdc, - 0x9d, 0xf6, 0x3c, 0x27, 0x5b, 0x79, 0x9e, 0x08, 0xb0, 0xf4, 0xcd, 0x40, 0xdd, 0xcb, 0x98, 0xe3, - 0x44, 0x98, 0x65, 0x34, 0xe8, 0xc7, 0x2c, 0x58, 0x17, 0x5e, 0x0d, 0xb8, 0x07, 0x35, 0x16, 0x54, - 0x15, 0xca, 0x2e, 0xb7, 0x3f, 0xab, 0x2f, 0x03, 0x5f, 0x92, 0x55, 0xf3, 0x09, 0xb2, 0x71, 0x1c, - 0xb3, 0x2d, 0x6f, 0x43, 0x39, 0x7a, 0x78, 0x2d, 0xad, 0x2b, 0xe4, 0x37, 0x3b, 0x92, 0x29, 0x3c, - 0xa5, 0xf1, 0xe8, 0x46, 0xe2, 0x03, 0x57, 0x2c, 0xbb, 0xdc, 0xb2, 0x52, 0x65, 0x31, 0xe6, 0xa5, - 0x46, 0xd9, 0x2d, 0x6b, 0x45, 0x45, 0x0a, 0xee, 0xab, 0xf7, 0xcd, 0x87, 0xe8, 0xff, 0xa0, 0x8a, - 0x29, 0x85, 0xd8, 0x5b, 0x03, 0x90, 0x47, 0xba, 0x50, 0xee, 0x9b, 0xbd, 0x64, 0x77, 0x7a, 0xb1, - 0xd8, 0x0b, 0x99, 0xfa, 0x26, 0x80, 0xdb, 0x17, 0x34, 0x9e, 0x45, 0xe9, 0xb9, 0x81, 0x50, 0xb3, - 0x67, 0x16, 0x51, 0x8f, 0xee, 0x66, 0x53, 0xe3, 0xd6, 0x97, 0xe6, 0x23, 0xd4, 0xaf, 0xd2, 0x42, - 0xe8, 0xa5, 0x6c, 0x1d, 0xa8, 0x9c, 0x07, 0x99, 0x61, 0xf6, 0x37, 0x32, 0x30, 0x42, 0x6f, 0xa7, - 0x90, 0xb8, 0x67, 0xb4, 0xd3, 0x03, 0x65, 0x54, 0x22, 0xe8, 0xbf, 0x7a, 0xcb, 0xbc, 0x8e, 0x7a, - 0x12, 0x42, 0xe5, 0x26, 0x55, 0x80, 0x8e, 0x67, 0x26, 0x21, 0x54, 0xe6, 0xb7, 0x10, 0xaa, 0x01, - 0x0f, 0x80, 0xa6, 0x38, 0x02, 0x45, 0xb9, 0xe0, 0xfe, 0x54, 0xa9, 0x5c, 0xde, 0xdd, 0xb7, 0x8c, - 0xbd, 0x7d, 0xcb, 0xf8, 0xb2, 0x6f, 0x19, 0xaf, 0x0f, 0xac, 0xdc, 0xde, 0x81, 0x95, 0xfb, 0x78, - 0x60, 0xe5, 0x1e, 0x8f, 0x3d, 0x3d, 0xe1, 0x82, 0x4f, 0x9f, 0xd5, 0x40, 0xf8, 0xdd, 0xea, 0x8a, - 0xbc, 0xf8, 0x23, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x3d, 0x91, 0xd8, 0x11, 0x08, 0x00, 0x00, + // 720 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0xcf, 0x4f, 0x13, 0x4d, + 0x18, 0xc7, 0xbb, 0x2d, 0x81, 0x97, 0xe9, 0xfb, 0xf2, 0x63, 0x5f, 0xd4, 0x42, 0xc2, 0x42, 0x7a, + 0xa1, 0x21, 0xa1, 0x1b, 0xd0, 0xc4, 0x80, 0x9a, 0x48, 0x01, 0xa3, 0x46, 0x0d, 0x59, 0x24, 0x46, + 0x2f, 0xeb, 0xec, 0xee, 0xd3, 0xed, 0x84, 0xdd, 0x99, 0x66, 0x66, 0x01, 0xbd, 0x7a, 0x32, 0x9e, + 0x4c, 0x8c, 0x77, 0x8e, 0x1e, 0x39, 0x78, 0xf4, 0x0f, 0xe0, 0x48, 0x3c, 0x79, 0x30, 0xc6, 0xc0, + 0x01, 0x2f, 0xde, 0xfc, 0x03, 0xcc, 0xcc, 0x4e, 0x5b, 0x2b, 0x90, 0x56, 0xc3, 0xc1, 0x78, 0x69, + 0x77, 0x9e, 0x67, 0xbf, 0xdf, 0x7c, 0xe7, 0xd3, 0x67, 0x77, 0x8a, 0x96, 0x7d, 0x16, 0xd7, 0x99, + 0xc0, 0x5e, 0x04, 0x36, 0xf1, 0xfc, 0x84, 0x63, 0x2a, 0xaa, 0xc0, 0x63, 0x12, 0x04, 0x11, 0x6c, + 0x63, 0x0e, 0xf6, 0xd6, 0xac, 0x07, 0x09, 0x9e, 0x3d, 0xb9, 0x5b, 0xae, 0x73, 0x96, 0x30, 0xb3, + 0xd4, 0x72, 0x29, 0x9f, 0x7c, 0x9f, 0x76, 0x19, 0x1b, 0x09, 0x59, 0xc8, 0x94, 0xc8, 0x96, 0x57, + 0xa9, 0x7e, 0x6c, 0xd4, 0x67, 0x22, 0x66, 0xc2, 0x4d, 0x1b, 0xe9, 0x42, 0xb7, 0xac, 0x74, 0x65, + 0x7b, 0x58, 0xb4, 0xb2, 0xf8, 0x8c, 0x50, 0xdd, 0x1f, 0xc6, 0x31, 0xa1, 0xcc, 0x56, 0x9f, 0xba, + 0x74, 0x41, 0x4b, 0x62, 0x11, 0xda, 0x5b, 0xb3, 0xf2, 0x2b, 0x6d, 0x14, 0x5f, 0x65, 0x11, 0x5a, + 0x86, 0x08, 0x42, 0x9c, 0x10, 0x46, 0xcd, 0x15, 0x34, 0x1c, 0xa4, 0x2b, 0xc6, 0x5d, 0x1c, 0x04, + 0x1c, 0x84, 0x28, 0x18, 0x93, 0x46, 0xa9, 0xbf, 0x52, 0x78, 0xff, 0x76, 0x66, 0x44, 0xe7, 0x58, + 0x4c, 0x3b, 0x6b, 0x09, 0x27, 0x34, 0x74, 0x86, 0x9a, 0x12, 0x5d, 0x97, 0x36, 0x5b, 0x38, 0x22, + 0x41, 0x9b, 0x4d, 0xb6, 0x93, 0x4d, 0x53, 0xd2, 0xb0, 0xb9, 0x8a, 0x7a, 0x71, 0xcc, 0x36, 0x69, + 0x52, 0xc8, 0x4d, 0x1a, 0xa5, 0xfc, 0xdc, 0x68, 0x59, 0x0b, 0xe5, 0xce, 0x1b, 0xfc, 0xca, 0x4b, + 0x8c, 0xd0, 0x4a, 0xff, 0xde, 0xa7, 0x89, 0xcc, 0x9b, 0xa3, 0xdd, 0x69, 0xc3, 0xd1, 0x9a, 0x85, + 0xf9, 0xe7, 0x3b, 0x13, 0x99, 0x2f, 0x3b, 0x13, 0x99, 0x67, 0x47, 0xbb, 0xd3, 0xc7, 0xb7, 0xf5, + 0xe2, 0x68, 0x77, 0xfa, 0x7c, 0xea, 0x37, 0x23, 0x82, 0x0d, 0xfb, 0xae, 0x08, 0x35, 0x08, 0x28, + 0x7e, 0xcb, 0xa2, 0xc1, 0x0a, 0x84, 0x84, 0x3a, 0xa0, 0x75, 0x70, 0x56, 0x68, 0xee, 0xa0, 0x73, + 0x2d, 0x34, 0x82, 0xfb, 0x5d, 0xe3, 0xf9, 0xbf, 0x29, 0x5b, 0xe3, 0xfe, 0x89, 0x6e, 0x81, 0x48, + 0x9a, 0x6e, 0xb9, 0xae, 0xdd, 0x96, 0x45, 0x72, 0x9c, 0x77, 0xcf, 0x6f, 0xf0, 0xbe, 0xde, 0x99, + 0xf7, 0x78, 0x3b, 0xef, 0x9f, 0x10, 0x17, 0x5f, 0x67, 0x11, 0x5a, 0xa7, 0x67, 0x4d, 0xfc, 0x8f, + 0x18, 0xc6, 0x2b, 0x9d, 0xe1, 0x14, 0xda, 0xe1, 0xb4, 0x40, 0x14, 0x3f, 0x66, 0xd1, 0xe8, 0x12, + 0xa6, 0x3e, 0x44, 0xeb, 0xd4, 0x63, 0x34, 0x20, 0x34, 0xfc, 0x3b, 0x9f, 0x59, 0x73, 0x0a, 0x0d, + 0xfa, 0x1c, 0xd4, 0xbe, 0xdc, 0x1a, 0x90, 0xb0, 0x96, 0x8e, 0x62, 0xce, 0x19, 0x68, 0x94, 0x6f, + 0xaa, 0xea, 0xc2, 0xed, 0xce, 0x3c, 0xa7, 0xda, 0x79, 0x9e, 0x0a, 0xb0, 0xf8, 0xd5, 0x40, 0xbd, + 0xab, 0x98, 0xe3, 0x58, 0x98, 0x25, 0x34, 0xe4, 0x45, 0xcc, 0xdf, 0x10, 0x6e, 0x1d, 0xb8, 0x0b, + 0x75, 0xe6, 0xd7, 0x14, 0xca, 0x1e, 0x67, 0x20, 0xad, 0xaf, 0x02, 0x5f, 0x91, 0x55, 0xf3, 0x31, + 0x2a, 0xe3, 0x28, 0x62, 0xdb, 0xee, 0xa6, 0x72, 0x74, 0x71, 0x35, 0x69, 0x28, 0xe4, 0x3b, 0x3b, + 0x94, 0x29, 0x5c, 0xa5, 0x71, 0xe9, 0x66, 0xec, 0x01, 0x57, 0x2c, 0x7b, 0x9c, 0x92, 0x52, 0xa5, + 0x31, 0x16, 0xa5, 0x46, 0xd9, 0xad, 0x6a, 0x45, 0x45, 0x0a, 0xee, 0xa9, 0xfb, 0xcd, 0x07, 0xe8, + 0x5f, 0xbf, 0x86, 0x29, 0x85, 0xc8, 0xad, 0x02, 0xc8, 0x47, 0x3a, 0x57, 0xca, 0xcf, 0x5d, 0x2a, + 0x77, 0x7b, 0xb0, 0x94, 0x97, 0x52, 0xf5, 0x0d, 0x00, 0x27, 0xef, 0x37, 0xaf, 0x45, 0xf1, 0x9d, + 0x81, 0x50, 0xab, 0x67, 0x16, 0x50, 0x9f, 0xee, 0xa6, 0x53, 0xe3, 0x34, 0x96, 0xe6, 0x43, 0x34, + 0xa0, 0xd2, 0x42, 0xe0, 0x26, 0x6c, 0x03, 0xa8, 0x9c, 0x07, 0x99, 0x61, 0xee, 0x17, 0x32, 0x30, + 0x42, 0x6f, 0x25, 0x10, 0x3b, 0xff, 0x69, 0xa7, 0xfb, 0xca, 0xc8, 0x9c, 0x47, 0xf9, 0x2a, 0x40, + 0xd7, 0xaf, 0x2b, 0x54, 0x05, 0xd0, 0x95, 0x22, 0x41, 0xff, 0x34, 0x5c, 0xcd, 0x6b, 0xa8, 0x2f, + 0x26, 0x54, 0xf2, 0x51, 0xd9, 0xbb, 0x1e, 0xb7, 0x98, 0x50, 0xb9, 0x75, 0x0b, 0xa1, 0x3a, 0x70, + 0x1f, 0x68, 0x82, 0x43, 0x50, 0x3f, 0x50, 0xce, 0xf9, 0xa1, 0x52, 0xb9, 0xbc, 0x77, 0x60, 0x19, + 0xfb, 0x07, 0x96, 0xf1, 0xf9, 0xc0, 0x32, 0x5e, 0x1e, 0x5a, 0x99, 0xfd, 0x43, 0x2b, 0xf3, 0xe1, + 0xd0, 0xca, 0x3c, 0x1a, 0x7f, 0x72, 0xca, 0x7f, 0x83, 0xe4, 0x69, 0x1d, 0x84, 0xd7, 0xab, 0x4e, + 0xd7, 0x8b, 0xdf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xef, 0xdc, 0xf9, 0x22, 0x4c, 0x08, 0x00, 0x00, } func (m *Delegation) Marshal() (dAtA []byte, err error) { @@ -690,6 +699,13 @@ func (m *ChannelFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.FeeAddress) > 0 { + i -= len(m.FeeAddress) + copy(dAtA[i:], m.FeeAddress) + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.FeeAddress))) + i-- + dAtA[i] = 0x1a + } if len(m.AllowedTokens) > 0 { for iNdEx := len(m.AllowedTokens) - 1; iNdEx >= 0; iNdEx-- { { @@ -883,6 +899,10 @@ func (m *ChannelFee) Size() (n int) { n += 1 + l + sovIbctransfermiddleware(uint64(l)) } } + l = len(m.FeeAddress) + if l > 0 { + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } return n } @@ -1762,6 +1782,38 @@ func (m *ChannelFee) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIbctransfermiddleware + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) From be3097d1adccde715543dc54ba2ab08cd16e0c9c Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 22:02:28 +0000 Subject: [PATCH 38/71] only useful params in genesis for ibc transfer module. Works --- .../v1beta1/ibctransfermiddleware.proto | 7 +- x/ibctransfermiddleware/keeper/keeper.go | 12 -- x/ibctransfermiddleware/types/genesis.go | 2 +- .../types/ibctransfermiddleware.pb.go | 165 +++++------------- 4 files changed, 46 insertions(+), 140 deletions(-) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto index d0e707ba3..185630ed7 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -73,12 +73,7 @@ message CancelUnbondingDelegation { // Params holds parameters for the ibctransfermiddleware module. message Params { - // expected blocks per year - uint64 blocks_per_epoch = 1; - // max block allowed before validator set update - uint64 allow_unbond_after_epoch_progress_block_number = 2; -// channel fees settings that charge extra - repeated ChannelFee channel_fees = 3; + repeated ChannelFee channel_fees = 1; } message ChannelFee{ diff --git a/x/ibctransfermiddleware/keeper/keeper.go b/x/ibctransfermiddleware/keeper/keeper.go index 0dafdacee..106493f37 100644 --- a/x/ibctransfermiddleware/keeper/keeper.go +++ b/x/ibctransfermiddleware/keeper/keeper.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - "github.com/cometbft/cometbft/libs/log" "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" @@ -45,16 +43,6 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // SetParams sets the x/ibctransfermiddleware module parameters. func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { - if p.BlocksPerEpoch < 5 { - return fmt.Errorf( - "BlocksPerEpoch must be greater than or equal to 5", - ) - } - if p.AllowUnbondAfterEpochProgressBlockNumber > p.BlocksPerEpoch { - return fmt.Errorf( - "AllowUnbondAfterEpochProgressBlockNumber must be less than or equal to BlocksPerEpoch", - ) - } store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&p) diff --git a/x/ibctransfermiddleware/types/genesis.go b/x/ibctransfermiddleware/types/genesis.go index d9cf35fad..6abd71d14 100644 --- a/x/ibctransfermiddleware/types/genesis.go +++ b/x/ibctransfermiddleware/types/genesis.go @@ -10,7 +10,7 @@ func NewGenesisState(params Params) *GenesisState { // DefaultGenesisState creates a default GenesisState object func DefaultGenesisState() *GenesisState { return &GenesisState{ - Params: Params{BlocksPerEpoch: 360, AllowUnbondAfterEpochProgressBlockNumber: 0}, + Params: Params{ChannelFees: []*ChannelFee{}}, } } diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go index b7f737374..897d2c56e 100644 --- a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -195,12 +195,7 @@ var xxx_messageInfo_CancelUnbondingDelegation proto.InternalMessageInfo // Params holds parameters for the ibctransfermiddleware module. type Params struct { - // expected blocks per year - BlocksPerEpoch uint64 `protobuf:"varint,1,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` - // max block allowed before validator set update - AllowUnbondAfterEpochProgressBlockNumber uint64 `protobuf:"varint,2,opt,name=allow_unbond_after_epoch_progress_block_number,json=allowUnbondAfterEpochProgressBlockNumber,proto3" json:"allow_unbond_after_epoch_progress_block_number,omitempty"` - // channel fees settings that charge extra - ChannelFees []*ChannelFee `protobuf:"bytes,3,rep,name=channel_fees,json=channelFees,proto3" json:"channel_fees,omitempty"` + ChannelFees []*ChannelFee `protobuf:"bytes,1,rep,name=channel_fees,json=channelFees,proto3" json:"channel_fees,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -236,20 +231,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetBlocksPerEpoch() uint64 { - if m != nil { - return m.BlocksPerEpoch - } - return 0 -} - -func (m *Params) GetAllowUnbondAfterEpochProgressBlockNumber() uint64 { - if m != nil { - return m.AllowUnbondAfterEpochProgressBlockNumber - } - return 0 -} - func (m *Params) GetChannelFees() []*ChannelFee { if m != nil { return m.ChannelFees @@ -384,52 +365,48 @@ func init() { } var fileDescriptor_1193893bc248bc1b = []byte{ - // 720 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xc7, 0xbb, 0x2d, 0x81, 0x97, 0xe9, 0xfb, 0xf2, 0x63, 0x5f, 0xd4, 0x42, 0xc2, 0x42, 0x7a, - 0xa1, 0x21, 0xa1, 0x1b, 0xd0, 0xc4, 0x80, 0x9a, 0x48, 0x01, 0xa3, 0x46, 0x0d, 0x59, 0x24, 0x46, - 0x2f, 0xeb, 0xec, 0xee, 0xd3, 0xed, 0x84, 0xdd, 0x99, 0x66, 0x66, 0x01, 0xbd, 0x7a, 0x32, 0x9e, - 0x4c, 0x8c, 0x77, 0x8e, 0x1e, 0x39, 0x78, 0xf4, 0x0f, 0xe0, 0x48, 0x3c, 0x79, 0x30, 0xc6, 0xc0, - 0x01, 0x2f, 0xde, 0xfc, 0x03, 0xcc, 0xcc, 0x4e, 0x5b, 0x2b, 0x90, 0x56, 0xc3, 0xc1, 0x78, 0x69, - 0x77, 0x9e, 0x67, 0xbf, 0xdf, 0x7c, 0xe7, 0xd3, 0x67, 0x77, 0x8a, 0x96, 0x7d, 0x16, 0xd7, 0x99, - 0xc0, 0x5e, 0x04, 0x36, 0xf1, 0xfc, 0x84, 0x63, 0x2a, 0xaa, 0xc0, 0x63, 0x12, 0x04, 0x11, 0x6c, - 0x63, 0x0e, 0xf6, 0xd6, 0xac, 0x07, 0x09, 0x9e, 0x3d, 0xb9, 0x5b, 0xae, 0x73, 0x96, 0x30, 0xb3, - 0xd4, 0x72, 0x29, 0x9f, 0x7c, 0x9f, 0x76, 0x19, 0x1b, 0x09, 0x59, 0xc8, 0x94, 0xc8, 0x96, 0x57, - 0xa9, 0x7e, 0x6c, 0xd4, 0x67, 0x22, 0x66, 0xc2, 0x4d, 0x1b, 0xe9, 0x42, 0xb7, 0xac, 0x74, 0x65, - 0x7b, 0x58, 0xb4, 0xb2, 0xf8, 0x8c, 0x50, 0xdd, 0x1f, 0xc6, 0x31, 0xa1, 0xcc, 0x56, 0x9f, 0xba, - 0x74, 0x41, 0x4b, 0x62, 0x11, 0xda, 0x5b, 0xb3, 0xf2, 0x2b, 0x6d, 0x14, 0x5f, 0x65, 0x11, 0x5a, - 0x86, 0x08, 0x42, 0x9c, 0x10, 0x46, 0xcd, 0x15, 0x34, 0x1c, 0xa4, 0x2b, 0xc6, 0x5d, 0x1c, 0x04, - 0x1c, 0x84, 0x28, 0x18, 0x93, 0x46, 0xa9, 0xbf, 0x52, 0x78, 0xff, 0x76, 0x66, 0x44, 0xe7, 0x58, - 0x4c, 0x3b, 0x6b, 0x09, 0x27, 0x34, 0x74, 0x86, 0x9a, 0x12, 0x5d, 0x97, 0x36, 0x5b, 0x38, 0x22, - 0x41, 0x9b, 0x4d, 0xb6, 0x93, 0x4d, 0x53, 0xd2, 0xb0, 0xb9, 0x8a, 0x7a, 0x71, 0xcc, 0x36, 0x69, - 0x52, 0xc8, 0x4d, 0x1a, 0xa5, 0xfc, 0xdc, 0x68, 0x59, 0x0b, 0xe5, 0xce, 0x1b, 0xfc, 0xca, 0x4b, - 0x8c, 0xd0, 0x4a, 0xff, 0xde, 0xa7, 0x89, 0xcc, 0x9b, 0xa3, 0xdd, 0x69, 0xc3, 0xd1, 0x9a, 0x85, - 0xf9, 0xe7, 0x3b, 0x13, 0x99, 0x2f, 0x3b, 0x13, 0x99, 0x67, 0x47, 0xbb, 0xd3, 0xc7, 0xb7, 0xf5, - 0xe2, 0x68, 0x77, 0xfa, 0x7c, 0xea, 0x37, 0x23, 0x82, 0x0d, 0xfb, 0xae, 0x08, 0x35, 0x08, 0x28, - 0x7e, 0xcb, 0xa2, 0xc1, 0x0a, 0x84, 0x84, 0x3a, 0xa0, 0x75, 0x70, 0x56, 0x68, 0xee, 0xa0, 0x73, - 0x2d, 0x34, 0x82, 0xfb, 0x5d, 0xe3, 0xf9, 0xbf, 0x29, 0x5b, 0xe3, 0xfe, 0x89, 0x6e, 0x81, 0x48, - 0x9a, 0x6e, 0xb9, 0xae, 0xdd, 0x96, 0x45, 0x72, 0x9c, 0x77, 0xcf, 0x6f, 0xf0, 0xbe, 0xde, 0x99, - 0xf7, 0x78, 0x3b, 0xef, 0x9f, 0x10, 0x17, 0x5f, 0x67, 0x11, 0x5a, 0xa7, 0x67, 0x4d, 0xfc, 0x8f, - 0x18, 0xc6, 0x2b, 0x9d, 0xe1, 0x14, 0xda, 0xe1, 0xb4, 0x40, 0x14, 0x3f, 0x66, 0xd1, 0xe8, 0x12, - 0xa6, 0x3e, 0x44, 0xeb, 0xd4, 0x63, 0x34, 0x20, 0x34, 0xfc, 0x3b, 0x9f, 0x59, 0x73, 0x0a, 0x0d, - 0xfa, 0x1c, 0xd4, 0xbe, 0xdc, 0x1a, 0x90, 0xb0, 0x96, 0x8e, 0x62, 0xce, 0x19, 0x68, 0x94, 0x6f, - 0xaa, 0xea, 0xc2, 0xed, 0xce, 0x3c, 0xa7, 0xda, 0x79, 0x9e, 0x0a, 0xb0, 0xf8, 0xd5, 0x40, 0xbd, - 0xab, 0x98, 0xe3, 0x58, 0x98, 0x25, 0x34, 0xe4, 0x45, 0xcc, 0xdf, 0x10, 0x6e, 0x1d, 0xb8, 0x0b, - 0x75, 0xe6, 0xd7, 0x14, 0xca, 0x1e, 0x67, 0x20, 0xad, 0xaf, 0x02, 0x5f, 0x91, 0x55, 0xf3, 0x31, - 0x2a, 0xe3, 0x28, 0x62, 0xdb, 0xee, 0xa6, 0x72, 0x74, 0x71, 0x35, 0x69, 0x28, 0xe4, 0x3b, 0x3b, - 0x94, 0x29, 0x5c, 0xa5, 0x71, 0xe9, 0x66, 0xec, 0x01, 0x57, 0x2c, 0x7b, 0x9c, 0x92, 0x52, 0xa5, - 0x31, 0x16, 0xa5, 0x46, 0xd9, 0xad, 0x6a, 0x45, 0x45, 0x0a, 0xee, 0xa9, 0xfb, 0xcd, 0x07, 0xe8, - 0x5f, 0xbf, 0x86, 0x29, 0x85, 0xc8, 0xad, 0x02, 0xc8, 0x47, 0x3a, 0x57, 0xca, 0xcf, 0x5d, 0x2a, - 0x77, 0x7b, 0xb0, 0x94, 0x97, 0x52, 0xf5, 0x0d, 0x00, 0x27, 0xef, 0x37, 0xaf, 0x45, 0xf1, 0x9d, - 0x81, 0x50, 0xab, 0x67, 0x16, 0x50, 0x9f, 0xee, 0xa6, 0x53, 0xe3, 0x34, 0x96, 0xe6, 0x43, 0x34, - 0xa0, 0xd2, 0x42, 0xe0, 0x26, 0x6c, 0x03, 0xa8, 0x9c, 0x07, 0x99, 0x61, 0xee, 0x17, 0x32, 0x30, - 0x42, 0x6f, 0x25, 0x10, 0x3b, 0xff, 0x69, 0xa7, 0xfb, 0xca, 0xc8, 0x9c, 0x47, 0xf9, 0x2a, 0x40, - 0xd7, 0xaf, 0x2b, 0x54, 0x05, 0xd0, 0x95, 0x22, 0x41, 0xff, 0x34, 0x5c, 0xcd, 0x6b, 0xa8, 0x2f, - 0x26, 0x54, 0xf2, 0x51, 0xd9, 0xbb, 0x1e, 0xb7, 0x98, 0x50, 0xb9, 0x75, 0x0b, 0xa1, 0x3a, 0x70, - 0x1f, 0x68, 0x82, 0x43, 0x50, 0x3f, 0x50, 0xce, 0xf9, 0xa1, 0x52, 0xb9, 0xbc, 0x77, 0x60, 0x19, - 0xfb, 0x07, 0x96, 0xf1, 0xf9, 0xc0, 0x32, 0x5e, 0x1e, 0x5a, 0x99, 0xfd, 0x43, 0x2b, 0xf3, 0xe1, - 0xd0, 0xca, 0x3c, 0x1a, 0x7f, 0x72, 0xca, 0x7f, 0x83, 0xe4, 0x69, 0x1d, 0x84, 0xd7, 0xab, 0x4e, - 0xd7, 0x8b, 0xdf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xef, 0xdc, 0xf9, 0x22, 0x4c, 0x08, 0x00, 0x00, + // 642 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0x41, 0x6b, 0x13, 0x4f, + 0x18, 0xc6, 0x77, 0x93, 0x3f, 0xed, 0xbf, 0x13, 0x6d, 0xed, 0x5a, 0x35, 0x2d, 0x74, 0x5b, 0xf6, + 0xd2, 0x50, 0xe8, 0x2e, 0xad, 0x82, 0xb4, 0x2a, 0x68, 0x5a, 0x45, 0x45, 0x41, 0xb6, 0x16, 0xd1, + 0x4b, 0x98, 0xdd, 0x7d, 0xb3, 0x1d, 0xba, 0x3b, 0x13, 0x66, 0xc6, 0x56, 0xaf, 0x9e, 0xc4, 0x93, + 0x20, 0xde, 0x7b, 0xf4, 0x98, 0x83, 0x47, 0x3f, 0x40, 0x8f, 0xc5, 0x93, 0x07, 0x11, 0x49, 0x0e, + 0xf1, 0x03, 0xf8, 0x01, 0x64, 0x77, 0x27, 0x89, 0xb1, 0x29, 0x89, 0xd2, 0x83, 0x78, 0x49, 0x76, + 0xde, 0x27, 0xcf, 0xc3, 0xfb, 0xfe, 0x66, 0xb2, 0x83, 0x36, 0x7c, 0x16, 0xd7, 0x98, 0xc0, 0x5e, + 0x04, 0x0e, 0xf1, 0x7c, 0xc9, 0x31, 0x15, 0x55, 0xe0, 0x31, 0x09, 0x82, 0x08, 0xf6, 0x30, 0x07, + 0x67, 0x77, 0xd9, 0x03, 0x89, 0x97, 0xfb, 0xab, 0x76, 0x8d, 0x33, 0xc9, 0x8c, 0x52, 0x37, 0xc5, + 0xee, 0xff, 0x3b, 0x95, 0x32, 0x33, 0x15, 0xb2, 0x90, 0xa5, 0x26, 0x27, 0x79, 0xca, 0xfc, 0x33, + 0xd3, 0x3e, 0x13, 0x31, 0x13, 0x95, 0x4c, 0xc8, 0x16, 0x4a, 0x32, 0xb3, 0x95, 0xe3, 0x61, 0xd1, + 0xed, 0xc5, 0x67, 0x84, 0x2a, 0x7d, 0x12, 0xc7, 0x84, 0x32, 0x27, 0xfd, 0x54, 0xa5, 0x0b, 0xca, + 0x12, 0x8b, 0xd0, 0xd9, 0x5d, 0x4e, 0xbe, 0x32, 0xc1, 0x7a, 0x93, 0x43, 0x68, 0x03, 0x22, 0x08, + 0xb1, 0x24, 0x8c, 0x1a, 0x37, 0xd1, 0x64, 0x90, 0xad, 0x18, 0xaf, 0xe0, 0x20, 0xe0, 0x20, 0x44, + 0x51, 0x9f, 0xd7, 0x4b, 0x63, 0xe5, 0xe2, 0xc7, 0xf7, 0x4b, 0x53, 0xaa, 0x8f, 0x1b, 0x99, 0xb2, + 0x29, 0x39, 0xa1, 0xa1, 0x7b, 0xa6, 0x63, 0x51, 0xf5, 0x24, 0x66, 0x17, 0x47, 0x24, 0xe8, 0x89, + 0xc9, 0x0d, 0x8a, 0xe9, 0x58, 0xda, 0x31, 0x57, 0xd1, 0x08, 0x8e, 0xd9, 0x53, 0x2a, 0x8b, 0xf9, + 0x79, 0xbd, 0x54, 0x58, 0x99, 0xb6, 0x95, 0x31, 0x99, 0xbc, 0xcd, 0xcf, 0x5e, 0x67, 0x84, 0x96, + 0xc7, 0x0e, 0xbe, 0xcc, 0x69, 0xef, 0x5a, 0xf5, 0x45, 0xdd, 0x55, 0x9e, 0xb5, 0xd5, 0x97, 0xfb, + 0x73, 0xda, 0xb7, 0xfd, 0x39, 0xed, 0x45, 0xab, 0xbe, 0x78, 0x74, 0xac, 0x57, 0xad, 0xfa, 0xe2, + 0xf9, 0x2c, 0x6f, 0x49, 0x04, 0x3b, 0xce, 0x7d, 0x11, 0x2a, 0x10, 0x60, 0x7d, 0xcf, 0xa1, 0x89, + 0x32, 0x84, 0x84, 0xba, 0xa0, 0x7c, 0x70, 0x52, 0x68, 0xee, 0xa1, 0x73, 0x5d, 0x34, 0x82, 0xfb, + 0x43, 0xe3, 0x39, 0xdb, 0xb1, 0x6d, 0x72, 0xbf, 0x6f, 0x5a, 0x20, 0x64, 0x27, 0x2d, 0x3f, 0x74, + 0xda, 0x86, 0x90, 0x47, 0x79, 0xff, 0xf7, 0x07, 0xbc, 0xaf, 0x0f, 0xe6, 0x3d, 0xdb, 0xcb, 0xfb, + 0x17, 0xc4, 0xd6, 0xdb, 0x1c, 0x42, 0x5b, 0xf4, 0xa4, 0x89, 0xff, 0x15, 0x87, 0xf1, 0xca, 0x60, + 0x38, 0xc5, 0x5e, 0x38, 0x5d, 0x10, 0xd6, 0xe7, 0x1c, 0x9a, 0x5e, 0xc7, 0xd4, 0x87, 0x68, 0x8b, + 0x7a, 0x8c, 0x06, 0x84, 0x86, 0xff, 0xe6, 0x7f, 0xd6, 0x58, 0x40, 0x13, 0x3e, 0x87, 0x74, 0xae, + 0xca, 0x36, 0x90, 0x70, 0x3b, 0x3b, 0x8a, 0x79, 0x77, 0xbc, 0x5d, 0xbe, 0x9d, 0x56, 0xd7, 0xee, + 0x0e, 0xe6, 0xb9, 0xd0, 0xcb, 0xf3, 0x58, 0x80, 0x16, 0x46, 0x23, 0x0f, 0x30, 0xc7, 0xb1, 0x30, + 0x1e, 0xa1, 0x53, 0xfe, 0x36, 0xa6, 0x14, 0xa2, 0x4a, 0x15, 0x20, 0xa1, 0x98, 0x2f, 0x15, 0x56, + 0x2e, 0xd9, 0xc3, 0xbe, 0xcb, 0xed, 0xf5, 0xcc, 0x7d, 0x0b, 0xc0, 0x2d, 0xf8, 0x9d, 0x67, 0x61, + 0x7d, 0xd0, 0x11, 0xea, 0x6a, 0x46, 0x11, 0x8d, 0x2a, 0x35, 0xdb, 0x28, 0xb7, 0xbd, 0x34, 0x1e, + 0xa3, 0x71, 0x1c, 0x45, 0x6c, 0x0f, 0x82, 0x8a, 0x64, 0x3b, 0x40, 0x93, 0x2d, 0x48, 0x7a, 0x58, + 0xf9, 0x8d, 0x1e, 0x18, 0xa1, 0x77, 0x24, 0xc4, 0xee, 0x69, 0x95, 0xf4, 0x30, 0x0d, 0x32, 0x56, + 0x51, 0xa1, 0x0a, 0x30, 0xf4, 0x1b, 0x02, 0x55, 0x01, 0x54, 0xc5, 0x22, 0xe8, 0xff, 0x76, 0xaa, + 0x71, 0x0d, 0x8d, 0xc6, 0x84, 0x26, 0x7c, 0xd2, 0xde, 0x87, 0xde, 0xe1, 0x98, 0xd0, 0x64, 0x74, + 0x13, 0xa1, 0x1a, 0x70, 0x1f, 0xa8, 0xc4, 0x21, 0xa4, 0xe7, 0x2b, 0xef, 0xfe, 0x54, 0x29, 0x5f, + 0x3e, 0x68, 0x98, 0xfa, 0x61, 0xc3, 0xd4, 0xbf, 0x36, 0x4c, 0xfd, 0x75, 0xd3, 0xd4, 0x0e, 0x9b, + 0xa6, 0xf6, 0xa9, 0x69, 0x6a, 0x4f, 0x66, 0x9f, 0x1d, 0x73, 0x1d, 0xcb, 0xe7, 0x35, 0x10, 0xde, + 0x48, 0x7a, 0xa1, 0x5d, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x08, 0x30, 0x05, 0x29, 0xbf, 0x07, + 0x00, 0x00, } func (m *Delegation) Marshal() (dAtA []byte, err error) { @@ -663,19 +640,9 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0xa } } - if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) - i-- - dAtA[i] = 0x10 - } - if m.BlocksPerEpoch != 0 { - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.BlocksPerEpoch)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -868,12 +835,6 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.BlocksPerEpoch != 0 { - n += 1 + sovIbctransfermiddleware(uint64(m.BlocksPerEpoch)) - } - if m.AllowUnbondAfterEpochProgressBlockNumber != 0 { - n += 1 + sovIbctransfermiddleware(uint64(m.AllowUnbondAfterEpochProgressBlockNumber)) - } if len(m.ChannelFees) > 0 { for _, e := range m.ChannelFees { l = e.Size() @@ -1595,44 +1556,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerEpoch", wireType) - } - m.BlocksPerEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlocksPerEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowUnbondAfterEpochProgressBlockNumber", wireType) - } - m.AllowUnbondAfterEpochProgressBlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AllowUnbondAfterEpochProgressBlockNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ChannelFees", wireType) } From 8d7eb681de5e93692d5ba6f0c51d95b918e0c781 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 21 Feb 2024 22:10:46 +0000 Subject: [PATCH 39/71] golangci-lint run --- custom/ibc-transfer/keeper/keeper.go | 8 +------- custom/ibc-transfer/keeper/msg_server.go | 7 +------ x/ibctransfermiddleware/keeper/keeper.go | 2 -- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/custom/ibc-transfer/keeper/keeper.go b/custom/ibc-transfer/keeper/keeper.go index 253184b4d..19f4153e8 100644 --- a/custom/ibc-transfer/keeper/keeper.go +++ b/custom/ibc-transfer/keeper/keeper.go @@ -27,18 +27,12 @@ func NewKeeper( channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, authKeeper types.AccountKeeper, - // ak types.AccountKeeper, bk types.BankKeeper, scopedKeeper exported.ScopedKeeper, - // authority string, ibcTransfermiddleware *ibctransfermiddleware.Keeper, - //return type from this function is different from the staking keeper. - //todo double check if this is correct ) Keeper { keeper := Keeper{ - Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), - // authority: authority, - // Stakingmiddleware: stakingmiddleware, + Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper), IbcTransfermiddleware: ibcTransfermiddleware, cdc: cdc, } diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index 4367a75f8..5a6095329 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -21,12 +21,9 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ params := k.Keeper.IbcTransfermiddleware.GetParams(ctx) if params.ChannelFees != nil && len(params.ChannelFees) > 0 { channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel) - //find the channel fee with a matching channel if channelFee != nil { - //find the coin with a matching denom coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) if coin != nil { - //token not allowed by this channel. should ignore the transfer return &types.MsgTransferResponse{}, nil } minFee := coin.MinFee.Amount @@ -38,13 +35,11 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ newAmount := msg.Token.Amount.Sub(charge) if newAmount.IsPositive() { - //if Percentage = 100 it means we charge 1 % of the amount percentageCharge := newAmount.QuoRaw(coin.Percentage) newAmount = newAmount.Sub(percentageCharge) charge = charge.Add(percentageCharge) } - //address from string msgSender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err @@ -58,7 +53,6 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ k.bank.SendCoins(ctx, msgSender, feeAddress, sdk.NewCoins(sdk.NewCoin(msg.Token.Denom, charge))) if newAmount.IsZero() { - //if the new amount is zero, then the transfer should be ignored return &types.MsgTransferResponse{}, nil } msg.Token.Amount = newAmount @@ -77,6 +71,7 @@ func findChannelParams(channelFees []*ibctransfermiddlewaretypes.ChannelFee, tar } return nil // If the channel is not found } + func findCoinByDenom(allowedTokens []*ibctransfermiddlewaretypes.CoinItem, denom string) *ibctransfermiddlewaretypes.CoinItem { for _, coin := range allowedTokens { if coin.MinFee.Denom == denom { diff --git a/x/ibctransfermiddleware/keeper/keeper.go b/x/ibctransfermiddleware/keeper/keeper.go index 106493f37..7de752baa 100644 --- a/x/ibctransfermiddleware/keeper/keeper.go +++ b/x/ibctransfermiddleware/keeper/keeper.go @@ -43,11 +43,9 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // SetParams sets the x/ibctransfermiddleware module parameters. func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { - store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&p) store.Set(types.ParamsKey, bz) - return nil } From 675ae5e71c7bb3f51ebc5e9772c818d88a171a3d Mon Sep 17 00:00:00 2001 From: rustdev Date: Fri, 23 Feb 2024 13:44:48 +0000 Subject: [PATCH 40/71] remove unused types in proto --- .../v1beta1/ibctransfermiddleware.proto | 61 - .../types/ibctransfermiddleware.pb.go | 1197 +---------------- 2 files changed, 45 insertions(+), 1213 deletions(-) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto index 185630ed7..007daf732 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -10,67 +10,6 @@ import "cosmos/base/v1beta1/coin.proto"; import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; - -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -message Delegation { - option (cosmos.msg.v1.signer) = "delegator_address"; - option (amino.name) = "cosmos-sdk/MsgDelegate"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} - -// BeginRedelegate defines a SDK message for performing a begin redelegation of coins -// from a delegator to a validator. -message BeginRedelegate{ - option (cosmos.msg.v1.signer) = "delegator_address"; - option (amino.name) = "cosmos-sdk/MsgBeginRedelegate"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} - -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -message Undelegate { - option (cosmos.msg.v1.signer) = "delegator_address"; - option (amino.name) = "cosmos-sdk/MsgUndelegate"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} - -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -message CancelUnbondingDelegation { - option (cosmos.msg.v1.signer) = "delegator_address"; - option (amino.name) = "cosmos-sdk/MsgCancelUnbondingDelegation"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - int64 creation_height = 4; -} - - - // Params holds parameters for the ibctransfermiddleware module. message Params { repeated ChannelFee channel_fees = 1; diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go index 897d2c56e..2d0ea9016 100644 --- a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -27,172 +27,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -type Delegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *Delegation) Reset() { *m = Delegation{} } -func (m *Delegation) String() string { return proto.CompactTextString(m) } -func (*Delegation) ProtoMessage() {} -func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{0} -} -func (m *Delegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Delegation.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Delegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Delegation.Merge(m, src) -} -func (m *Delegation) XXX_Size() int { - return m.Size() -} -func (m *Delegation) XXX_DiscardUnknown() { - xxx_messageInfo_Delegation.DiscardUnknown(m) -} - -var xxx_messageInfo_Delegation proto.InternalMessageInfo - -// BeginRedelegate defines a SDK message for performing a begin redelegation of coins -// from a delegator to a validator. -type BeginRedelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty"` - Amount types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` -} - -func (m *BeginRedelegate) Reset() { *m = BeginRedelegate{} } -func (m *BeginRedelegate) String() string { return proto.CompactTextString(m) } -func (*BeginRedelegate) ProtoMessage() {} -func (*BeginRedelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{1} -} -func (m *BeginRedelegate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BeginRedelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BeginRedelegate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *BeginRedelegate) XXX_Merge(src proto.Message) { - xxx_messageInfo_BeginRedelegate.Merge(m, src) -} -func (m *BeginRedelegate) XXX_Size() int { - return m.Size() -} -func (m *BeginRedelegate) XXX_DiscardUnknown() { - xxx_messageInfo_BeginRedelegate.DiscardUnknown(m) -} - -var xxx_messageInfo_BeginRedelegate proto.InternalMessageInfo - -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -type Undelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *Undelegate) Reset() { *m = Undelegate{} } -func (m *Undelegate) String() string { return proto.CompactTextString(m) } -func (*Undelegate) ProtoMessage() {} -func (*Undelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{2} -} -func (m *Undelegate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Undelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Undelegate.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Undelegate) XXX_Merge(src proto.Message) { - xxx_messageInfo_Undelegate.Merge(m, src) -} -func (m *Undelegate) XXX_Size() int { - return m.Size() -} -func (m *Undelegate) XXX_DiscardUnknown() { - xxx_messageInfo_Undelegate.DiscardUnknown(m) -} - -var xxx_messageInfo_Undelegate proto.InternalMessageInfo - -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -type CancelUnbondingDelegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - CreationHeight int64 `protobuf:"varint,4,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` -} - -func (m *CancelUnbondingDelegation) Reset() { *m = CancelUnbondingDelegation{} } -func (m *CancelUnbondingDelegation) String() string { return proto.CompactTextString(m) } -func (*CancelUnbondingDelegation) ProtoMessage() {} -func (*CancelUnbondingDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{3} -} -func (m *CancelUnbondingDelegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CancelUnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CancelUnbondingDelegation.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CancelUnbondingDelegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_CancelUnbondingDelegation.Merge(m, src) -} -func (m *CancelUnbondingDelegation) XXX_Size() int { - return m.Size() -} -func (m *CancelUnbondingDelegation) XXX_DiscardUnknown() { - xxx_messageInfo_CancelUnbondingDelegation.DiscardUnknown(m) -} - -var xxx_messageInfo_CancelUnbondingDelegation proto.InternalMessageInfo - // Params holds parameters for the ibctransfermiddleware module. type Params struct { ChannelFees []*ChannelFee `protobuf:"bytes,1,rep,name=channel_fees,json=channelFees,proto3" json:"channel_fees,omitempty"` @@ -202,7 +36,7 @@ func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{4} + return fileDescriptor_1193893bc248bc1b, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,7 +82,7 @@ func (m *ChannelFee) Reset() { *m = ChannelFee{} } func (m *ChannelFee) String() string { return proto.CompactTextString(m) } func (*ChannelFee) ProtoMessage() {} func (*ChannelFee) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{5} + return fileDescriptor_1193893bc248bc1b, []int{1} } func (m *ChannelFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -307,7 +141,7 @@ func (m *CoinItem) Reset() { *m = CoinItem{} } func (m *CoinItem) String() string { return proto.CompactTextString(m) } func (*CoinItem) ProtoMessage() {} func (*CoinItem) Descriptor() ([]byte, []int) { - return fileDescriptor_1193893bc248bc1b, []int{6} + return fileDescriptor_1193893bc248bc1b, []int{2} } func (m *CoinItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -351,10 +185,6 @@ func (m *CoinItem) GetPercentage() int64 { } func init() { - proto.RegisterType((*Delegation)(nil), "composable.ibctransfermiddleware.v1beta1.Delegation") - proto.RegisterType((*BeginRedelegate)(nil), "composable.ibctransfermiddleware.v1beta1.BeginRedelegate") - proto.RegisterType((*Undelegate)(nil), "composable.ibctransfermiddleware.v1beta1.Undelegate") - proto.RegisterType((*CancelUnbondingDelegation)(nil), "composable.ibctransfermiddleware.v1beta1.CancelUnbondingDelegation") proto.RegisterType((*Params)(nil), "composable.ibctransfermiddleware.v1beta1.Params") proto.RegisterType((*ChannelFee)(nil), "composable.ibctransfermiddleware.v1beta1.ChannelFee") proto.RegisterType((*CoinItem)(nil), "composable.ibctransfermiddleware.v1beta1.CoinItem") @@ -365,248 +195,33 @@ func init() { } var fileDescriptor_1193893bc248bc1b = []byte{ - // 642 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x95, 0x41, 0x6b, 0x13, 0x4f, - 0x18, 0xc6, 0x77, 0x93, 0x3f, 0xed, 0xbf, 0x13, 0x6d, 0xed, 0x5a, 0x35, 0x2d, 0x74, 0x5b, 0xf6, - 0xd2, 0x50, 0xe8, 0x2e, 0xad, 0x82, 0xb4, 0x2a, 0x68, 0x5a, 0x45, 0x45, 0x41, 0xb6, 0x16, 0xd1, - 0x4b, 0x98, 0xdd, 0x7d, 0xb3, 0x1d, 0xba, 0x3b, 0x13, 0x66, 0xc6, 0x56, 0xaf, 0x9e, 0xc4, 0x93, - 0x20, 0xde, 0x7b, 0xf4, 0x98, 0x83, 0x47, 0x3f, 0x40, 0x8f, 0xc5, 0x93, 0x07, 0x11, 0x49, 0x0e, - 0xf1, 0x03, 0xf8, 0x01, 0x64, 0x77, 0x27, 0x89, 0xb1, 0x29, 0x89, 0xd2, 0x83, 0x78, 0x49, 0x76, - 0xde, 0x27, 0xcf, 0xc3, 0xfb, 0xfe, 0x66, 0xb2, 0x83, 0x36, 0x7c, 0x16, 0xd7, 0x98, 0xc0, 0x5e, - 0x04, 0x0e, 0xf1, 0x7c, 0xc9, 0x31, 0x15, 0x55, 0xe0, 0x31, 0x09, 0x82, 0x08, 0xf6, 0x30, 0x07, - 0x67, 0x77, 0xd9, 0x03, 0x89, 0x97, 0xfb, 0xab, 0x76, 0x8d, 0x33, 0xc9, 0x8c, 0x52, 0x37, 0xc5, - 0xee, 0xff, 0x3b, 0x95, 0x32, 0x33, 0x15, 0xb2, 0x90, 0xa5, 0x26, 0x27, 0x79, 0xca, 0xfc, 0x33, - 0xd3, 0x3e, 0x13, 0x31, 0x13, 0x95, 0x4c, 0xc8, 0x16, 0x4a, 0x32, 0xb3, 0x95, 0xe3, 0x61, 0xd1, - 0xed, 0xc5, 0x67, 0x84, 0x2a, 0x7d, 0x12, 0xc7, 0x84, 0x32, 0x27, 0xfd, 0x54, 0xa5, 0x0b, 0xca, - 0x12, 0x8b, 0xd0, 0xd9, 0x5d, 0x4e, 0xbe, 0x32, 0xc1, 0x7a, 0x93, 0x43, 0x68, 0x03, 0x22, 0x08, - 0xb1, 0x24, 0x8c, 0x1a, 0x37, 0xd1, 0x64, 0x90, 0xad, 0x18, 0xaf, 0xe0, 0x20, 0xe0, 0x20, 0x44, - 0x51, 0x9f, 0xd7, 0x4b, 0x63, 0xe5, 0xe2, 0xc7, 0xf7, 0x4b, 0x53, 0xaa, 0x8f, 0x1b, 0x99, 0xb2, - 0x29, 0x39, 0xa1, 0xa1, 0x7b, 0xa6, 0x63, 0x51, 0xf5, 0x24, 0x66, 0x17, 0x47, 0x24, 0xe8, 0x89, - 0xc9, 0x0d, 0x8a, 0xe9, 0x58, 0xda, 0x31, 0x57, 0xd1, 0x08, 0x8e, 0xd9, 0x53, 0x2a, 0x8b, 0xf9, - 0x79, 0xbd, 0x54, 0x58, 0x99, 0xb6, 0x95, 0x31, 0x99, 0xbc, 0xcd, 0xcf, 0x5e, 0x67, 0x84, 0x96, - 0xc7, 0x0e, 0xbe, 0xcc, 0x69, 0xef, 0x5a, 0xf5, 0x45, 0xdd, 0x55, 0x9e, 0xb5, 0xd5, 0x97, 0xfb, - 0x73, 0xda, 0xb7, 0xfd, 0x39, 0xed, 0x45, 0xab, 0xbe, 0x78, 0x74, 0xac, 0x57, 0xad, 0xfa, 0xe2, - 0xf9, 0x2c, 0x6f, 0x49, 0x04, 0x3b, 0xce, 0x7d, 0x11, 0x2a, 0x10, 0x60, 0x7d, 0xcf, 0xa1, 0x89, - 0x32, 0x84, 0x84, 0xba, 0xa0, 0x7c, 0x70, 0x52, 0x68, 0xee, 0xa1, 0x73, 0x5d, 0x34, 0x82, 0xfb, - 0x43, 0xe3, 0x39, 0xdb, 0xb1, 0x6d, 0x72, 0xbf, 0x6f, 0x5a, 0x20, 0x64, 0x27, 0x2d, 0x3f, 0x74, - 0xda, 0x86, 0x90, 0x47, 0x79, 0xff, 0xf7, 0x07, 0xbc, 0xaf, 0x0f, 0xe6, 0x3d, 0xdb, 0xcb, 0xfb, - 0x17, 0xc4, 0xd6, 0xdb, 0x1c, 0x42, 0x5b, 0xf4, 0xa4, 0x89, 0xff, 0x15, 0x87, 0xf1, 0xca, 0x60, - 0x38, 0xc5, 0x5e, 0x38, 0x5d, 0x10, 0xd6, 0xe7, 0x1c, 0x9a, 0x5e, 0xc7, 0xd4, 0x87, 0x68, 0x8b, - 0x7a, 0x8c, 0x06, 0x84, 0x86, 0xff, 0xe6, 0x7f, 0xd6, 0x58, 0x40, 0x13, 0x3e, 0x87, 0x74, 0xae, - 0xca, 0x36, 0x90, 0x70, 0x3b, 0x3b, 0x8a, 0x79, 0x77, 0xbc, 0x5d, 0xbe, 0x9d, 0x56, 0xd7, 0xee, - 0x0e, 0xe6, 0xb9, 0xd0, 0xcb, 0xf3, 0x58, 0x80, 0x16, 0x46, 0x23, 0x0f, 0x30, 0xc7, 0xb1, 0x30, - 0x1e, 0xa1, 0x53, 0xfe, 0x36, 0xa6, 0x14, 0xa2, 0x4a, 0x15, 0x20, 0xa1, 0x98, 0x2f, 0x15, 0x56, - 0x2e, 0xd9, 0xc3, 0xbe, 0xcb, 0xed, 0xf5, 0xcc, 0x7d, 0x0b, 0xc0, 0x2d, 0xf8, 0x9d, 0x67, 0x61, - 0x7d, 0xd0, 0x11, 0xea, 0x6a, 0x46, 0x11, 0x8d, 0x2a, 0x35, 0xdb, 0x28, 0xb7, 0xbd, 0x34, 0x1e, - 0xa3, 0x71, 0x1c, 0x45, 0x6c, 0x0f, 0x82, 0x8a, 0x64, 0x3b, 0x40, 0x93, 0x2d, 0x48, 0x7a, 0x58, - 0xf9, 0x8d, 0x1e, 0x18, 0xa1, 0x77, 0x24, 0xc4, 0xee, 0x69, 0x95, 0xf4, 0x30, 0x0d, 0x32, 0x56, - 0x51, 0xa1, 0x0a, 0x30, 0xf4, 0x1b, 0x02, 0x55, 0x01, 0x54, 0xc5, 0x22, 0xe8, 0xff, 0x76, 0xaa, - 0x71, 0x0d, 0x8d, 0xc6, 0x84, 0x26, 0x7c, 0xd2, 0xde, 0x87, 0xde, 0xe1, 0x98, 0xd0, 0x64, 0x74, - 0x13, 0xa1, 0x1a, 0x70, 0x1f, 0xa8, 0xc4, 0x21, 0xa4, 0xe7, 0x2b, 0xef, 0xfe, 0x54, 0x29, 0x5f, - 0x3e, 0x68, 0x98, 0xfa, 0x61, 0xc3, 0xd4, 0xbf, 0x36, 0x4c, 0xfd, 0x75, 0xd3, 0xd4, 0x0e, 0x9b, - 0xa6, 0xf6, 0xa9, 0x69, 0x6a, 0x4f, 0x66, 0x9f, 0x1d, 0x73, 0x1d, 0xcb, 0xe7, 0x35, 0x10, 0xde, - 0x48, 0x7a, 0xa1, 0x5d, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x08, 0x30, 0x05, 0x29, 0xbf, 0x07, - 0x00, 0x00, -} - -func (m *Delegation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Delegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BeginRedelegate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BeginRedelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Undelegate) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Undelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Undelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CancelUnbondingDelegation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CancelUnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CancelUnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CreationHeight != 0 { - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.CreationHeight)) - i-- - dAtA[i] = 0x20 - } - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + // 406 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0xeb, 0xd3, 0x30, + 0x18, 0xc6, 0x9b, 0x0d, 0x36, 0x97, 0xaa, 0x60, 0x19, 0xd8, 0x0d, 0x8c, 0x63, 0xa7, 0x22, 0xd8, + 0xb2, 0x29, 0x88, 0x07, 0x0f, 0x4e, 0x11, 0xbc, 0x49, 0x15, 0x44, 0x2f, 0x25, 0x6d, 0xdf, 0xd6, + 0x60, 0x93, 0x94, 0x24, 0x6c, 0xfa, 0x2d, 0xfc, 0x18, 0x1e, 0x3d, 0x78, 0xf4, 0x03, 0xec, 0x38, + 0x3c, 0x79, 0x12, 0xd9, 0x0e, 0x7e, 0x0d, 0x69, 0x9b, 0x39, 0x85, 0x09, 0xfe, 0x2f, 0x6d, 0xde, + 0xf7, 0xd7, 0xe7, 0xe9, 0x93, 0xbc, 0xc1, 0x8f, 0x33, 0xc9, 0x6b, 0xa9, 0x69, 0x5a, 0x41, 0xc4, + 0xd2, 0xcc, 0x28, 0x2a, 0x74, 0x01, 0x8a, 0xb3, 0x3c, 0xaf, 0x60, 0x43, 0x15, 0x44, 0xeb, 0x45, + 0x0a, 0x86, 0x2e, 0xce, 0xd3, 0xb0, 0x56, 0xd2, 0x48, 0x2f, 0x38, 0xb9, 0x84, 0xe7, 0xbf, 0xb3, + 0x2e, 0xd3, 0x71, 0x29, 0x4b, 0xd9, 0x8a, 0xa2, 0x66, 0xd5, 0xe9, 0xa7, 0x93, 0x4c, 0x6a, 0x2e, + 0x75, 0xd2, 0x81, 0xae, 0xb0, 0x88, 0x74, 0x55, 0x94, 0x52, 0x7d, 0xca, 0x92, 0x49, 0x26, 0x2c, + 0xbf, 0x46, 0x39, 0x13, 0x32, 0x6a, 0x9f, 0xb6, 0x75, 0xdd, 0x4a, 0xb8, 0x2e, 0xa3, 0xf5, 0xa2, + 0x79, 0x75, 0x60, 0x4e, 0xf1, 0xe0, 0x19, 0x55, 0x94, 0x6b, 0xef, 0x25, 0xbe, 0x9c, 0xbd, 0xa1, + 0x42, 0x40, 0x95, 0x14, 0x00, 0xda, 0x47, 0xb3, 0x7e, 0xe0, 0x2e, 0xef, 0x86, 0xff, 0xbb, 0x8f, + 0xf0, 0x51, 0xa7, 0x7e, 0x02, 0x10, 0xbb, 0xd9, 0xef, 0xb5, 0x9e, 0x7f, 0x41, 0x18, 0x9f, 0x98, + 0xe7, 0xe3, 0xa1, 0xa5, 0x3e, 0x9a, 0xa1, 0x60, 0x14, 0x1f, 0x4b, 0xef, 0x15, 0xbe, 0x4a, 0xab, + 0x4a, 0x6e, 0x20, 0x4f, 0x8c, 0x7c, 0x0b, 0x42, 0xfb, 0xbd, 0x36, 0xc3, 0xf2, 0x02, 0x19, 0x24, + 0x13, 0x4f, 0x0d, 0xf0, 0xf8, 0x8a, 0x75, 0x7a, 0xd1, 0x1a, 0x79, 0xf7, 0xb1, 0x5b, 0x00, 0x24, + 0x34, 0xcf, 0x15, 0x68, 0xed, 0xf7, 0x9b, 0x1f, 0xaf, 0xfc, 0xaf, 0x9f, 0x6f, 0x8f, 0xed, 0xc9, + 0x3e, 0xec, 0xc8, 0x73, 0xa3, 0x98, 0x28, 0x63, 0x5c, 0x00, 0xd8, 0xce, 0x9c, 0xe1, 0x4b, 0x47, + 0x57, 0xef, 0x01, 0x1e, 0x72, 0x26, 0x9a, 0xf3, 0x69, 0xb3, 0xbb, 0xcb, 0x49, 0x68, 0xf5, 0xcd, + 0x2c, 0xfe, 0x4a, 0xb1, 0x1a, 0x6d, 0xbf, 0xdf, 0x74, 0x3e, 0xfe, 0xfc, 0x74, 0x0b, 0xc5, 0x03, + 0xce, 0x44, 0xb3, 0x75, 0x82, 0x71, 0x0d, 0x2a, 0x03, 0x61, 0x68, 0x09, 0x7e, 0x6f, 0x86, 0x82, + 0x7e, 0xfc, 0x47, 0x67, 0x75, 0x6f, 0xbb, 0x27, 0x68, 0xb7, 0x27, 0xe8, 0xc7, 0x9e, 0xa0, 0x0f, + 0x07, 0xe2, 0xec, 0x0e, 0xc4, 0xf9, 0x76, 0x20, 0xce, 0xeb, 0x1b, 0xef, 0xfe, 0x71, 0x15, 0xcd, + 0xfb, 0x1a, 0x74, 0x3a, 0x68, 0x87, 0x79, 0xe7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xef, + 0x13, 0x3a, 0xbb, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -746,128 +361,45 @@ func encodeVarintIbctransfermiddleware(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *Delegation) Size() (n int) { +func (m *Params) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) + if len(m.ChannelFees) > 0 { + for _, e := range m.ChannelFees { + l = e.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } } - l = m.Amount.Size() - n += 1 + l + sovIbctransfermiddleware(uint64(l)) return n } -func (m *BeginRedelegate) Size() (n int) { +func (m *ChannelFee) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.DelegatorAddress) + l = len(m.Channel) if l > 0 { n += 1 + l + sovIbctransfermiddleware(uint64(l)) } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) + if len(m.AllowedTokens) > 0 { + for _, e := range m.AllowedTokens { + l = e.Size() + n += 1 + l + sovIbctransfermiddleware(uint64(l)) + } } - l = len(m.ValidatorDstAddress) + l = len(m.FeeAddress) if l > 0 { n += 1 + l + sovIbctransfermiddleware(uint64(l)) } - l = m.Amount.Size() - n += 1 + l + sovIbctransfermiddleware(uint64(l)) return n } -func (m *Undelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - return n -} - -func (m *CancelUnbondingDelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - if m.CreationHeight != 0 { - n += 1 + sovIbctransfermiddleware(uint64(m.CreationHeight)) - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ChannelFees) > 0 { - for _, e := range m.ChannelFees { - l = e.Size() - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - } - return n -} - -func (m *ChannelFee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Channel) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - if len(m.AllowedTokens) > 0 { - for _, e := range m.AllowedTokens { - l = e.Size() - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - } - l = len(m.FeeAddress) - if l > 0 { - n += 1 + l + sovIbctransfermiddleware(uint64(l)) - } - return n -} - -func (m *CoinItem) Size() (n int) { +func (m *CoinItem) Size() (n int) { if m == nil { return 0 } @@ -887,645 +419,6 @@ func sovIbctransfermiddleware(x uint64) (n int) { func sozIbctransfermiddleware(x uint64) (n int) { return sovIbctransfermiddleware(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *Delegation) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Delegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BeginRedelegate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BeginRedelegate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Undelegate) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Undelegate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Undelegate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CancelUnbondingDelegation) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CancelUnbondingDelegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CancelUnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) - } - m.CreationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIbctransfermiddleware - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIbctransfermiddleware - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From cb60b1f60828cda3b5b346d542ce0886de4733e3 Mon Sep 17 00:00:00 2001 From: rustdev Date: Fri, 23 Feb 2024 22:35:12 +0000 Subject: [PATCH 41/71] add docs and fix all requested changes by reviewers --- custom/ibc-transfer/keeper/msg_server.go | 16 ++++++-- .../ibctransfermiddleware/v1beta1/tx.proto | 2 +- x/ibctransfermiddleware/client/cli/query.go | 2 +- x/ibctransfermiddleware/keeper/msg_server.go | 2 +- x/ibctransfermiddleware/types/tx.pb.go | 40 +++++++++---------- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index 5a6095329..12cf61fd7 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -16,6 +16,13 @@ type msgServer struct { var _ types.MsgServer = msgServer{} +// Transfer is the server API around the Transfer method of the IBC transfer module. +// It checks if the sender is allowed to transfer the token and if the channel has fees. +// If the channel has fees, it will charge the sender and send the fees to the fee address. +// If the sender is not allowed to transfer the token because this tokens does not exists in the allowed tokens list, it just return without doing anything. +// If the sender is allowed to transfer the token, it will call the original transfer method. +// If the transfer amount is less than the minimum fee, it will charge the full transfer amount. +// If the transfer amount is greater than the minimum fee, it will charge the minimum fee and the percentage fee. func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) params := k.Keeper.IbcTransfermiddleware.GetParams(ctx) @@ -50,16 +57,17 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ return nil, err } - k.bank.SendCoins(ctx, msgSender, feeAddress, sdk.NewCoins(sdk.NewCoin(msg.Token.Denom, charge))) + send_err := k.bank.SendCoins(ctx, msgSender, feeAddress, sdk.NewCoins(sdk.NewCoin(msg.Token.Denom, charge))) + if send_err != nil { + return nil, send_err + } - if newAmount.IsZero() { + if newAmount.LTE(sdk.ZeroInt()) { return &types.MsgTransferResponse{}, nil } msg.Token.Amount = newAmount } - } - return k.msgServer.Transfer(goCtx, msg) } diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto index c695e2daf..14cf391ae 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -13,7 +13,7 @@ option go_package = "x/ibctransfermiddleware/types"; service Msg { option (cosmos.msg.v1.service) = true; - rpc UpdateEpochParams(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); + rpc UpdateCustomIbcParams(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. diff --git a/x/ibctransfermiddleware/client/cli/query.go b/x/ibctransfermiddleware/client/cli/query.go index 119694e64..7edb40544 100644 --- a/x/ibctransfermiddleware/client/cli/query.go +++ b/x/ibctransfermiddleware/client/cli/query.go @@ -30,7 +30,7 @@ func GetQueryCmd() *cobra.Command { func GetCmdQueryParams() *cobra.Command { cmd := &cobra.Command{ Use: "params", - Short: "Query the current staking middleware parameters", + Short: "Query the current ibc middleware parameters", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index 806ecde36..99fb81b7c 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -24,7 +24,7 @@ func NewMsgServerImpl(k Keeper) types.MsgServer { } // UpdateParams updates the params. -func (ms msgServer) UpdateEpochParams(goCtx context.Context, req *types.MsgUpdateCustomIbcParams) (*types.MsgUpdateParamsCustomIbcResponse, error) { +func (ms msgServer) UpdateCustomIbcParams(goCtx context.Context, req *types.MsgUpdateCustomIbcParams) (*types.MsgUpdateParamsCustomIbcResponse, error) { if ms.authority != req.Authority { return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) } diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go index 7235fb024..055172e52 100644 --- a/x/ibctransfermiddleware/types/tx.pb.go +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -141,7 +141,7 @@ func init() { } var fileDescriptor_bf5c053de6965bca = []byte{ - // 378 bytes of a gzipped FileDescriptorProto + // 372 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0xcf, 0x2d, 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, @@ -159,13 +159,13 @@ var fileDescriptor_bf5c053de6965bca = []byte{ 0x62, 0xb3, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, 0x65, 0xe5, 0xda, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0x82, 0xa0, 0x02, 0x47, 0x20, 0xc0, 0x3d, 0x07, 0x31, 0x59, 0x49, 0x89, 0x4b, 0x01, 0x4d, 0x08, 0xee, - 0xeb, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x4d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, - 0xe9, 0x42, 0x8b, 0x19, 0xb9, 0x04, 0x21, 0x2a, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0xa0, 0xa1, 0xe2, - 0x44, 0xbc, 0x6f, 0x70, 0x85, 0xac, 0x94, 0x17, 0x19, 0x66, 0xe0, 0x70, 0xad, 0x14, 0x6b, 0x03, - 0x28, 0x9c, 0x9c, 0xcc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, - 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x16, - 0x57, 0xd8, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x53, 0x82, 0x31, 0x20, 0x00, 0x00, - 0xff, 0xff, 0x6a, 0x14, 0xf9, 0x95, 0x0b, 0x03, 0x00, 0x00, + 0xeb, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x6d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, + 0xe9, 0x42, 0xcb, 0x19, 0xb9, 0x44, 0xb1, 0x87, 0x8c, 0x13, 0xf1, 0x3e, 0xc2, 0x15, 0xba, 0x52, + 0x5e, 0x64, 0x98, 0x81, 0xc3, 0xc5, 0x52, 0xac, 0x0d, 0xa0, 0xb0, 0x72, 0x32, 0x3f, 0xf1, 0x48, + 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, + 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x59, 0x5c, 0xe1, 0x53, 0x52, 0x59, 0x90, 0x5a, + 0x9c, 0xc4, 0x06, 0x4e, 0x0d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x4e, 0xf0, 0x3b, + 0x0f, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -180,7 +180,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) + UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) } type msgClient struct { @@ -191,9 +191,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) { +func (c *msgClient) UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) { out := new(MsgUpdateParamsCustomIbcResponse) - err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", in, out, opts...) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateCustomIbcParams", in, out, opts...) if err != nil { return nil, err } @@ -202,35 +202,35 @@ func (c *msgClient) UpdateEpochParams(ctx context.Context, in *MsgUpdateCustomIb // MsgServer is the server API for Msg service. type MsgServer interface { - UpdateEpochParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) + UpdateCustomIbcParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) UpdateEpochParams(ctx context.Context, req *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateEpochParams not implemented") +func (*UnimplementedMsgServer) UpdateCustomIbcParams(ctx context.Context, req *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCustomIbcParams not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_UpdateEpochParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Msg_UpdateCustomIbcParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateCustomIbcParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateEpochParams(ctx, in) + return srv.(MsgServer).UpdateCustomIbcParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateEpochParams", + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/UpdateCustomIbcParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateEpochParams(ctx, req.(*MsgUpdateCustomIbcParams)) + return srv.(MsgServer).UpdateCustomIbcParams(ctx, req.(*MsgUpdateCustomIbcParams)) } return interceptor(ctx, in, info, handler) } @@ -240,8 +240,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UpdateEpochParams", - Handler: _Msg_UpdateEpochParams_Handler, + MethodName: "UpdateCustomIbcParams", + Handler: _Msg_UpdateCustomIbcParams_Handler, }, }, Streams: []grpc.StreamDesc{}, From 7720595826537964e95a29b95f5925b9fb17643b Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 5 Mar 2024 13:53:41 +0000 Subject: [PATCH 42/71] refactoring. --- app/keepers/keepers.go | 3 --- custom/ibc-transfer/keeper/keeper.go | 1 - custom/ibc-transfer/module.go | 4 ++-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index bf0d33378..7c06d0a78 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -58,9 +58,6 @@ import ( icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - // ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - - // ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" diff --git a/custom/ibc-transfer/keeper/keeper.go b/custom/ibc-transfer/keeper/keeper.go index 19f4153e8..cc4bc6773 100644 --- a/custom/ibc-transfer/keeper/keeper.go +++ b/custom/ibc-transfer/keeper/keeper.go @@ -16,7 +16,6 @@ type Keeper struct { ibctransferkeeper.Keeper cdc codec.BinaryCodec IbcTransfermiddleware *ibctransfermiddleware.Keeper - // authority string } func NewKeeper( diff --git a/custom/ibc-transfer/module.go b/custom/ibc-transfer/module.go index fbda0e7b4..9580c34ef 100644 --- a/custom/ibc-transfer/module.go +++ b/custom/ibc-transfer/module.go @@ -22,9 +22,9 @@ type AppModule struct { // NewAppModule creates a new AppModule object func NewAppModule(cdc codec.Codec, keeper customibctransferkeeper.Keeper) AppModule { - stakingModule := ibctransfermodule.NewAppModule(keeper.Keeper) + ibctransferModule := ibctransfermodule.NewAppModule(keeper.Keeper) return AppModule{ - AppModule: stakingModule, + AppModule: ibctransferModule, keeper: keeper, // subspace: ss, msgServer: keeper.Keeper, From 79e03f35a826ddc742050db7012877d00cef7994 Mon Sep 17 00:00:00 2001 From: dzmitry-lahoda Date: Wed, 28 Feb 2024 12:10:22 +0000 Subject: [PATCH 43/71] allow devnet with custom key gov --- app/app.go | 2 + app/helpers/test_helpers.go | 1 + app/keepers/keepers.go | 10 +- app/test_helpers.go | 1 + cmd/centaurid/cmd/root.go | 19 +- flake.lock | 1548 +++++++++++++++++++++++++++++++++++ flake.nix | 88 ++ 7 files changed, 1664 insertions(+), 5 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/app/app.go b/app/app.go index ed3f3b7a7..ab02f2a2e 100644 --- a/app/app.go +++ b/app/app.go @@ -296,6 +296,7 @@ func NewComposableApp( encodingConfig EncodingConfig, appOpts servertypes.AppOptions, wasmOpts []wasm.Option, + devnetGov *string, baseAppOptions ...func(*baseapp.BaseApp), ) *ComposableApp { appCodec := encodingConfig.Marshaler @@ -336,6 +337,7 @@ func NewComposableApp( appOpts, wasmOpts, enabledProposals, + devnetGov, ) // transferModule := transfer.NewAppModule(app.TransferKeeper) diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index 1646262fa..ede708692 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -102,6 +102,7 @@ func setup(withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*composa encCdc, EmptyAppOptions{}, opts, + nil, ) if withGenesis { return app, composable.NewDefaultGenesisState() diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 7c06d0a78..a0a6f810f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -177,6 +177,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appOpts servertypes.AppOptions, wasmOpts []wasm.Option, enabledProposals []wasm.ProposalType, + devnetGov *string, ) { // add keepers appKeepers.AccountKeeper = authkeeper.NewAccountKeeper( @@ -260,7 +261,12 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[ibchost.StoreKey], appKeepers.GetSubspace(ibchost.ModuleName), appKeepers.StakingKeeper, appKeepers.UpgradeKeeper, appKeepers.ScopedIBCKeeper, ) - appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper) + govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + if devnetGov != nil { + govModuleAuthority = *devnetGov + } + + appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper) // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( @@ -404,7 +410,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( wasmDir, wasmConfig, availableCapabilities, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + govModuleAuthority, wasmOpts..., ) diff --git a/app/test_helpers.go b/app/test_helpers.go index 97f5df118..536630458 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -84,6 +84,7 @@ func setup(tb testing.TB, withGenesis bool, invCheckPeriod uint) (*ComposableApp MakeEncodingConfig(), EmptyBaseAppOptions{}, wasmOpts, + nil, baseAppOpts...) if withGenesis { return app, NewDefaultGenesisState() diff --git a/cmd/centaurid/cmd/root.go b/cmd/centaurid/cmd/root.go index 007663989..6b32ca9f5 100644 --- a/cmd/centaurid/cmd/root.go +++ b/cmd/centaurid/cmd/root.go @@ -38,6 +38,11 @@ import ( // this line is used by starport scaffolding # stargate/root/import ) +const ( + // if set, than uses specific key for governance instead of default (default is production; this override for local devtest) + flagDevnetGov = "devnet-gov" +) + var ChainID string // NewRootCmd creates a new root command for simd. It is called once in the @@ -75,7 +80,6 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) { if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { return err } - customAppTemplate, customAppConfig := initAppConfig() customTMConfig := initTendermintConfig() @@ -184,8 +188,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { // this line is used by starport scaffolding # stargate/root/commands ) - a := appCreator{encodingConfig} - server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags) + appCreator := appCreator{encodingConfig} + server.AddCommands(rootCmd, app.DefaultNodeHome, appCreator.newApp, appCreator.appExport, addModuleInitFlags) // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( @@ -198,6 +202,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) + startCmd.Flags().String(flagDevnetGov, "", "Sets the devnet governance key (if not set, uses the default production key)") // this line is used by starport scaffolding # stargate/root/initFlags } @@ -267,6 +272,11 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a skipUpgradeHeights[h] = true } + var devnetGov *string + devnetGovOption, _ := appOpts.Get(flagDevnetGov).(string) + if devnetGovOption != "" { + devnetGov = &devnetGovOption + } baseappOptions := server.DefaultBaseappOptions(appOpts) var emptyWasmOpts []wasm.Option @@ -280,6 +290,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a // this line is used by starport scaffolding # stargate/root/appArgument appOpts, emptyWasmOpts, + devnetGov, baseappOptions..., ) @@ -312,6 +323,7 @@ func (a appCreator) appExport( a.encCfg, appOpts, emptyWasmOpts, + nil, ) if err := anApp.LoadHeight(height); err != nil { @@ -330,6 +342,7 @@ func (a appCreator) appExport( a.encCfg, appOpts, emptyWasmOpts, + nil, ) } diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..7052e3fc2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,1548 @@ +{ + "nodes": { + "akash-src": { + "flake": false, + "locked": { + "lastModified": 1648485085, + "narHash": "sha256-33FPy0dn6QuqneEqZYkFoCRm9agG7PE+9C/pYH9Gwx4=", + "owner": "ovrclk", + "repo": "akash", + "rev": "5b8b6bbede6c9fbb2df1ca536b8edfcf5652adf8", + "type": "github" + }, + "original": { + "owner": "ovrclk", + "ref": "v0.15.0-rc17", + "repo": "akash", + "type": "github" + } + }, + "apalache-src": { + "flake": false, + "locked": { + "lastModified": 1692625213, + "narHash": "sha256-Z/tmBMv+QshFJLo2kBgBdkqfKwF93CgURVIbYF3dwJE=", + "owner": "informalsystems", + "repo": "apalache", + "rev": "ec979d4554360faf9d73ddf72dccf350614076d5", + "type": "github" + }, + "original": { + "owner": "informalsystems", + "ref": "v0.42.0", + "repo": "apalache", + "type": "github" + } + }, + "beaker-src": { + "flake": false, + "locked": { + "lastModified": 1686823358, + "narHash": "sha256-bQiN5Q7RV4Uupc7rk1rGurRvCTy+5EiiB4p3bHct7M0=", + "owner": "osmosis-labs", + "repo": "beaker", + "rev": "f3c7a9fc6886aa2b4e0d259f70058d6c23c225e5", + "type": "github" + }, + "original": { + "owner": "osmosis-labs", + "ref": "v0.1.6", + "repo": "beaker", + "type": "github" + } + }, + "celestia-src": { + "flake": false, + "locked": { + "lastModified": 1700494564, + "narHash": "sha256-O6KrCStrZLmWy3xybQUNsWEb3O7vIRCFDE9MsEtsFro=", + "owner": "celestiaorg", + "repo": "celestia-app", + "rev": "2dbfabf1849e166974c1287c35b43e5e07727643", + "type": "github" + }, + "original": { + "owner": "celestiaorg", + "ref": "v1.4.0", + "repo": "celestia-app", + "type": "github" + } + }, + "centauri-src": { + "flake": false, + "locked": { + "lastModified": 1701431373, + "narHash": "sha256-EpZ1CQN0gMU8W1u3CMbqlaHeeVpQO2i1GPg6pOyOQTc=", + "owner": "ComposableFi", + "repo": "composable-cosmos", + "rev": "387c96b434db9d96b0506aa7f14536d9bdec968c", + "type": "github" + }, + "original": { + "owner": "ComposableFi", + "repo": "composable-cosmos", + "rev": "387c96b434db9d96b0506aa7f14536d9bdec968c", + "type": "github" + } + }, + "cometbft-src": { + "flake": false, + "locked": { + "lastModified": 1694550324, + "narHash": "sha256-G5gchJMn/BFzwYx8/ikPDL5fS/TuFIBF4DKJbkalp/M=", + "owner": "cometbft", + "repo": "cometbft", + "rev": "66a5a9da9f7a3306f382eb9142ccb9c9f7997d3f", + "type": "github" + }, + "original": { + "owner": "cometbft", + "ref": "v0.38.0", + "repo": "cometbft", + "type": "github" + } + }, + "cosmos": { + "inputs": { + "akash-src": "akash-src", + "apalache-src": "apalache-src", + "beaker-src": "beaker-src", + "celestia-src": "celestia-src", + "centauri-src": "centauri-src", + "cometbft-src": "cometbft-src", + "cosmos-sdk-src": "cosmos-sdk-src", + "cosmwasm-src": "cosmwasm-src", + "crescent-src": "crescent-src", + "cw-plus-src": "cw-plus-src", + "evmos-src": "evmos-src", + "flake-parts": "flake-parts", + "gaia-main-src": "gaia-main-src", + "gaia10-src": "gaia10-src", + "gaia11-src": "gaia11-src", + "gaia12-src": "gaia12-src", + "gaia13-src": "gaia13-src", + "gaia14-src": "gaia14-src", + "gaia5-src": "gaia5-src", + "gaia6-ordered-src": "gaia6-ordered-src", + "gaia6-src": "gaia6-src", + "gaia7-src": "gaia7-src", + "gaia8-src": "gaia8-src", + "gaia9-src": "gaia9-src", + "gex-src": "gex-src", + "gomod2nix": "gomod2nix", + "hermes-src": "hermes-src", + "ibc-go-v2-src": "ibc-go-v2-src", + "ibc-go-v3-src": "ibc-go-v3-src", + "ibc-go-v4-src": "ibc-go-v4-src", + "ibc-go-v5-src": "ibc-go-v5-src", + "ibc-go-v6-src": "ibc-go-v6-src", + "ibc-go-v7-src": "ibc-go-v7-src", + "ibc-go-v8-channel-upgrade-src": "ibc-go-v8-channel-upgrade-src", + "ibc-go-v8-src": "ibc-go-v8-src", + "ibc-rs-src": "ibc-rs-src", + "ica-src": "ica-src", + "ignite-cli-src": "ignite-cli-src", + "interchain-security-src": "interchain-security-src", + "iris-src": "iris-src", + "ixo-src": "ixo-src", + "juno-src": "juno-src", + "migaloo-src": "migaloo-src", + "namada-src": "namada-src", + "neutron-src": "neutron-src", + "nix-std": "nix-std", + "nixpkgs": [ + "nixpkgs" + ], + "osmosis-src": "osmosis-src", + "provenance-src": "provenance-src", + "regen-src": "regen-src", + "relayer-src": "relayer-src", + "rust-overlay": "rust-overlay", + "sbt-derivation": "sbt-derivation", + "sconfig-src": "sconfig-src", + "sentinel-src": "sentinel-src", + "sifchain-src": "sifchain-src", + "stargaze-src": "stargaze-src", + "stoml-src": "stoml-src", + "stride-consumer-src": "stride-consumer-src", + "stride-src": "stride-src", + "umee-src": "umee-src", + "wasmd-src": "wasmd-src", + "wasmd_next-src": "wasmd_next-src", + "wasmvm_1-src": "wasmvm_1-src", + "wasmvm_1_1_1-src": "wasmvm_1_1_1-src", + "wasmvm_1_1_2-src": "wasmvm_1_1_2-src", + "wasmvm_1_2_3-src": "wasmvm_1_2_3-src", + "wasmvm_1_2_4-src": "wasmvm_1_2_4-src", + "wasmvm_1_3_0-src": "wasmvm_1_3_0-src", + "wasmvm_1_5_0-src": "wasmvm_1_5_0-src", + "wasmvm_1_beta7-src": "wasmvm_1_beta7-src" + }, + "locked": { + "lastModified": 1703683453, + "narHash": "sha256-uMgdhucQZTNFPa+5v3GXnhFEgXsIIytx16Lp+qI4/tI=", + "owner": "informalsystems", + "repo": "cosmos.nix", + "rev": "8429e606fa6b968f6f01752f702b7ba7ce9a9992", + "type": "github" + }, + "original": { + "owner": "informalsystems", + "repo": "cosmos.nix", + "type": "github" + } + }, + "cosmos-sdk-src": { + "flake": false, + "locked": { + "lastModified": 1658846655, + "narHash": "sha256-Xs83vbgt4+YH2LRJx7692nIjRBr5QCYoUHI17njsjlw=", + "owner": "cosmos", + "repo": "cosmos-sdk", + "rev": "a1143138716b64bc4fa0aa53c0f0fa59eb675bb7", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v0.46.0", + "repo": "cosmos-sdk", + "type": "github" + } + }, + "cosmwasm-src": { + "flake": false, + "locked": { + "lastModified": 1698745412, + "narHash": "sha256-41s5jLFzw9Jo+dirAVOad1dtUqCBY6rIz/6TRc0frMw=", + "owner": "CosmWasm", + "repo": "cosmwasm", + "rev": "89891f0bb2de2c83d00600208695d0d5e1b617ac", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.5.0", + "repo": "cosmwasm", + "type": "github" + } + }, + "crescent-src": { + "flake": false, + "locked": { + "lastModified": 1647869429, + "narHash": "sha256-c1xiTB/HgtQJSwD3ccFQIoSHPbJK6rf1nSjnM3r0oCE=", + "owner": "crescent-network", + "repo": "crescent", + "rev": "01980cfd06b06786109eaba78c154e6db1adc3d6", + "type": "github" + }, + "original": { + "owner": "crescent-network", + "ref": "v1.0.0-rc3", + "repo": "crescent", + "type": "github" + } + }, + "cw-plus-src": { + "flake": false, + "locked": { + "lastModified": 1700757493, + "narHash": "sha256-E5vkY+B4BDoTDtvuB+7Tm3k/5dCYPSjUujMWcgYsWf0=", + "owner": "CosmWasm", + "repo": "cw-plus", + "rev": "d33824679d5b91ca0b4615a8dede7e0028947486", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.1.2", + "repo": "cw-plus", + "type": "github" + } + }, + "evmos-src": { + "flake": false, + "locked": { + "lastModified": 1702504794, + "narHash": "sha256-ECXXQ0hx/MXascMP6aXf880zts/dNPpQM9jOCIHTLZQ=", + "owner": "evmos", + "repo": "evmos", + "rev": "6f94d2002c01b7f7908a69089ed6996ac2bb450c", + "type": "github" + }, + "original": { + "owner": "evmos", + "ref": "v16.0.0-rc4", + "repo": "evmos", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gaia-main-src": { + "flake": false, + "locked": { + "lastModified": 1702388853, + "narHash": "sha256-1O8ncSd0mUNEUHSTi2U9d21Dv1yszQKohjp/AS6IxcU=", + "owner": "cosmos", + "repo": "gaia", + "rev": "2dc2b82ea9da34b3c4823458919004f1a583a597", + "type": "github" + }, + "original": { + "owner": "cosmos", + "repo": "gaia", + "type": "github" + } + }, + "gaia10-src": { + "flake": false, + "locked": { + "lastModified": 1688401730, + "narHash": "sha256-F72AxDI1OdleE8If5s4HJbORqMsDVsdEO5q7nrK07E8=", + "owner": "cosmos", + "repo": "gaia", + "rev": "a2b14cdd568273e12b80579b4e22681df95b4cb9", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v10.0.2", + "repo": "gaia", + "type": "github" + } + }, + "gaia11-src": { + "flake": false, + "locked": { + "lastModified": 1690464504, + "narHash": "sha256-bIegGSPDdDRbznfgsrojsGCwCPSesNknpffTFskc7fE=", + "owner": "cosmos", + "repo": "gaia", + "rev": "541a8d86af28231c767d6db52eb88ba9496ad0c4", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v11.0.0", + "repo": "gaia", + "type": "github" + } + }, + "gaia12-src": { + "flake": false, + "locked": { + "lastModified": 1692870038, + "narHash": "sha256-KqpkazhGGQWzvHiiwCiE7ciA8+L2t2HgxN8270zuGd0=", + "owner": "cosmos", + "repo": "gaia", + "rev": "6f8067d76ce30996f83645862153ccfaf5f13dd1", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v12.0.0", + "repo": "gaia", + "type": "github" + } + }, + "gaia13-src": { + "flake": false, + "locked": { + "lastModified": 1699370179, + "narHash": "sha256-bvJ33JL1Fr7ilnnYEjrjnbS/dbFkyhZ2uq6u39CeTa0=", + "owner": "cosmos", + "repo": "gaia", + "rev": "2406abb61856b61904ff06c7be2a355babcc3dfc", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v13.0.2", + "repo": "gaia", + "type": "github" + } + }, + "gaia14-src": { + "flake": false, + "locked": { + "lastModified": 1700067649, + "narHash": "sha256-7AnaIy/SElf/Uj2xTbHzLSgPY68SgQqqJZ2BPmt6czo=", + "owner": "cosmos", + "repo": "gaia", + "rev": "189b57be735d64d0dbf0945717b49017a1beb11e", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v14.0.0", + "repo": "gaia", + "type": "github" + } + }, + "gaia5-src": { + "flake": false, + "locked": { + "lastModified": 1634231239, + "narHash": "sha256-NfR9GRBNBlm5hB3lFea+Vlf4dkapZIZg0sZuyOX2cn8=", + "owner": "cosmos", + "repo": "gaia", + "rev": "b72cc994f7156c8a8991e6beed2dde84ad274588", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v5.0.8", + "repo": "gaia", + "type": "github" + } + }, + "gaia6-ordered-src": { + "flake": false, + "locked": { + "lastModified": 1648034337, + "narHash": "sha256-yw3WUCLRvn46xlWAnk6nBmvc3T91aryvBcOOfJ2ocPA=", + "owner": "informalsystems", + "repo": "gaia", + "rev": "d9e61fb98308dea2e02e8c6c6a9ab969dc240cc7", + "type": "github" + }, + "original": { + "owner": "informalsystems", + "ref": "v6.0.4-ordered", + "repo": "gaia", + "type": "github" + } + }, + "gaia6-src": { + "flake": false, + "locked": { + "lastModified": 1646904235, + "narHash": "sha256-JdD0DTdMo05ggGvpHN5hugEEtGA0/WQ4bhbryDlfGXo=", + "owner": "cosmos", + "repo": "gaia", + "rev": "305668ab9d962431c79d718bb0ffdeec77a46439", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v6.0.4", + "repo": "gaia", + "type": "github" + } + }, + "gaia7-src": { + "flake": false, + "locked": { + "lastModified": 1665762684, + "narHash": "sha256-hsDqDASwTPIb1BGOqa9nu4C5Y5q3hBoXYhkAFY7B9Cs=", + "owner": "cosmos", + "repo": "gaia", + "rev": "5db8fcc9a229730f5115bed82d0f85b6db7184b4", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v7.1.0", + "repo": "gaia", + "type": "github" + } + }, + "gaia8-src": { + "flake": false, + "locked": { + "lastModified": 1676667875, + "narHash": "sha256-8XPcJRQEQDtTbGFg0pWexkNdWESn1FoKvz4T2Z8UPDw=", + "owner": "cosmos", + "repo": "gaia", + "rev": "890ab3aa2e5788537b0d2ebc9bafdc968340e0e5", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v8.0.1", + "repo": "gaia", + "type": "github" + } + }, + "gaia9-src": { + "flake": false, + "locked": { + "lastModified": 1681924944, + "narHash": "sha256-UIM6yfqs1yZZ2BO/bBB43pPYSW1IzaYsk2f500tDYzA=", + "owner": "cosmos", + "repo": "gaia", + "rev": "05b6b87d3c9121e933eab437772ea56f33ae268f", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v9.0.3", + "repo": "gaia", + "type": "github" + } + }, + "gex-src": { + "flake": false, + "locked": { + "lastModified": 1697704475, + "narHash": "sha256-lgJVxn7Q2I8TBdvbzyn7bl1MN5StEw3NvRzCvBFFuB8=", + "owner": "cosmos", + "repo": "gex", + "rev": "233d335dc9e8c89fb318d1081fae74435f6cac11", + "type": "github" + }, + "original": { + "owner": "cosmos", + "repo": "gex", + "rev": "233d335dc9e8c89fb318d1081fae74435f6cac11", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1702956934, + "narHash": "sha256-f1NuMA2mZ3Chw2CjlUkRAzNgDw0TYyj1i5YZJRByDdo=", + "owner": "JonathanLorimer", + "repo": "gomod2nix", + "rev": "6d2fce6003d08eee42648f2931de8449d3de1f5f", + "type": "github" + }, + "original": { + "owner": "JonathanLorimer", + "ref": "jonathan/update-go", + "repo": "gomod2nix", + "type": "github" + } + }, + "gomod2nix_2": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701687253, + "narHash": "sha256-qJCMxIKWXonJODPF2oV7mCd0xu7VYVenTucrY0bizto=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "001bbfa22e2adeb87c34c6015e5694e88721cabe", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, + "hermes-src": { + "flake": false, + "locked": { + "lastModified": 1702629809, + "narHash": "sha256-JTZMp4By/pGsMdKzfi4H1LQS1RKYQHBq5NEju5ADX/s=", + "owner": "informalsystems", + "repo": "hermes", + "rev": "ab732666fe35de129ada98731280d03411f6375f", + "type": "github" + }, + "original": { + "owner": "informalsystems", + "ref": "v1.7.4", + "repo": "hermes", + "type": "github" + } + }, + "ibc-go-v2-src": { + "flake": false, + "locked": { + "lastModified": 1663274791, + "narHash": "sha256-LuJvlXmGRyJAiM6+uk+NuamjIsEqMqF20twBmB0p8+k=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "e45fa32d1cf91c36807428f688d8e2ec88947940", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v2.4.1", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v3-src": { + "flake": false, + "locked": { + "lastModified": 1663683283, + "narHash": "sha256-Er24B1unLYR/gG4JSrV+vZ/cPD6t7OFvtqp7AJCtDSE=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "250157f3fd40abaf9f8f1452cd78bf3304c38c72", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v3.3.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v4-src": { + "flake": false, + "locked": { + "lastModified": 1667809128, + "narHash": "sha256-R1/AH6laXdaMftgwnV4t/pL3QoKnZ1UaBGoqOipOvQI=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "ecb845d5e43f53decf48f8ed88c7847a9a4375cb", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v4.2.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v5-src": { + "flake": false, + "locked": { + "lastModified": 1668024626, + "narHash": "sha256-+Z78PyGODLr2Y5G8evubsoQE3tyUcxCHJDsLXKTmdlI=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "c0acd5bd1778f2b7ecdf593006f56bd3e273bd49", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v5.1.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v6-src": { + "flake": false, + "locked": { + "lastModified": 1671525236, + "narHash": "sha256-V8kUNwgNfx1tZJazlnaTF6wBb7ztueh1KrAGgiP8hCM=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "d34cef7e075dda1a24a0a3e9b6d3eff406cc606c", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v6.1.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v7-src": { + "flake": false, + "locked": { + "lastModified": 1693509694, + "narHash": "sha256-umh/ckDALt0ugXwN8glcaCkGfAQvXY7S3Jd95Do2XeA=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "c75650a1a037a9fecba5a9005df380f707520ff7", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v7.3.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v8-channel-upgrade-src": { + "flake": false, + "locked": { + "lastModified": 1695726576, + "narHash": "sha256-mM6h1KAi8lQUrJakxI6f8WI+vpmBhCnAysk3hTZBI7M=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "63c30108f0ecf954108cf51f50f3d36ec58c7e51", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "04-channel-upgrades-alpha.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-go-v8-src": { + "flake": false, + "locked": { + "lastModified": 1699602904, + "narHash": "sha256-BcP3y874QviVsV+04p9CioolyvmWH82ORbb5EB2GyRI=", + "owner": "cosmos", + "repo": "ibc-go", + "rev": "2551dea41cd3c512845007ca895c8402afa9b79f", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v8.0.0", + "repo": "ibc-go", + "type": "github" + } + }, + "ibc-rs-src": { + "flake": false, + "locked": { + "lastModified": 1661171856, + "narHash": "sha256-M9KsPQdvyTArDe3sTi29+gfs69KHtpoNYLgI7IHYo9U=", + "owner": "informalsystems", + "repo": "ibc-rs", + "rev": "ed4dd8c8b4ebd695730de2a1c69f3011cb179352", + "type": "github" + }, + "original": { + "owner": "informalsystems", + "ref": "v1.0.0", + "repo": "ibc-rs", + "type": "github" + } + }, + "ica-src": { + "flake": false, + "locked": { + "lastModified": 1695202199, + "narHash": "sha256-8RwZSnqqZzVjQsSMTckNhmTy3VYyubVmgE/hU6ntq9M=", + "owner": "cosmos", + "repo": "interchain-accounts-demo", + "rev": "9d9ec3f4f7e37e9d2a1c7f4a199e7d18c17e14db", + "type": "github" + }, + "original": { + "owner": "cosmos", + "repo": "interchain-accounts-demo", + "type": "github" + } + }, + "ignite-cli-src": { + "flake": false, + "locked": { + "lastModified": 1662991379, + "narHash": "sha256-sVgIjecswxD8OBXRXoVk2BNsTXzUcYAb6QZk0rVrQqo=", + "owner": "ignite", + "repo": "cli", + "rev": "21c6430cfcc17c69885524990c448d4a3f56461c", + "type": "github" + }, + "original": { + "owner": "ignite", + "ref": "v0.24.0", + "repo": "cli", + "type": "github" + } + }, + "interchain-security-src": { + "flake": false, + "locked": { + "lastModified": 1700577019, + "narHash": "sha256-adBzn51PKoRsCL9gIzC5Tcqmu7u3GjxTcDj2jpZ/da8=", + "owner": "cosmos", + "repo": "interchain-security", + "rev": "03aada4af3243dbf739a12adfacc7b37232df694", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "feat/ics-misbehaviour-handling", + "repo": "interchain-security", + "type": "github" + } + }, + "iris-src": { + "flake": false, + "locked": { + "lastModified": 1618986686, + "narHash": "sha256-1nPJOuYeGjzBYFCS0IiC5j9TJd5KVa9IL0kROks328E=", + "owner": "irisnet", + "repo": "irishub", + "rev": "53e156b2ee7eeb0b9d5b263066d0d3c88a1af736", + "type": "github" + }, + "original": { + "owner": "irisnet", + "ref": "v1.1.1", + "repo": "irishub", + "type": "github" + } + }, + "ixo-src": { + "flake": false, + "locked": { + "lastModified": 1645476442, + "narHash": "sha256-Ewp9UyoH6z7YGrcXVpYJveRvDq02c1mNZj2hzlOoW8s=", + "owner": "ixofoundation", + "repo": "ixo-blockchain", + "rev": "2bef5d79205057be71677837dc1174be848e13e9", + "type": "github" + }, + "original": { + "owner": "ixofoundation", + "ref": "v0.18.0-rc1", + "repo": "ixo-blockchain", + "type": "github" + } + }, + "juno-src": { + "flake": false, + "locked": { + "lastModified": 1697166503, + "narHash": "sha256-z9TOeDyUnn1T8Z662XqQJ9ydVIKKB54YISt7ms4xvos=", + "owner": "CosmosContracts", + "repo": "juno", + "rev": "48507ed9b83511089cbf1fdc5bae54cae4a7f4b2", + "type": "github" + }, + "original": { + "owner": "CosmosContracts", + "ref": "v17.1.1", + "repo": "juno", + "type": "github" + } + }, + "migaloo-src": { + "flake": false, + "locked": { + "lastModified": 1699273936, + "narHash": "sha256-O+vGWFnV3+bvXinxl1QjVyDnQskp5H1VnlL+TaMfiSs=", + "owner": "White-Whale-Defi-Platform", + "repo": "migaloo-chain", + "rev": "de98de2dd96917ae1ab79161d573fc0b4ee1facf", + "type": "github" + }, + "original": { + "owner": "White-Whale-Defi-Platform", + "ref": "v3.0.2", + "repo": "migaloo-chain", + "type": "github" + } + }, + "namada-src": { + "flake": false, + "locked": { + "lastModified": 1702488720, + "narHash": "sha256-WyIVffqszY3rz3ClQJlpDaexLGQk8pVK+Y3k/D9Lvxg=", + "owner": "anoma", + "repo": "namada", + "rev": "468d3d3bcadd2bd11760855d2bbfcc0b4ce27e14", + "type": "github" + }, + "original": { + "owner": "anoma", + "ref": "v0.28.1", + "repo": "namada", + "type": "github" + } + }, + "neutron-src": { + "flake": false, + "locked": { + "lastModified": 1701174344, + "narHash": "sha256-NuoOlrciBeL2f/A7wlQBqYlYJhSYucXRhLgxdasfyhI=", + "owner": "neutron-org", + "repo": "neutron", + "rev": "e605ed3db4381994ee8185ba4a0ff0877d34e67f", + "type": "github" + }, + "original": { + "owner": "neutron-org", + "ref": "v2.0.0", + "repo": "neutron", + "type": "github" + } + }, + "nix-std": { + "locked": { + "lastModified": 1701658249, + "narHash": "sha256-KIt1TUuBvldhaVRta010MI5FeQlB8WadjqljybjesN0=", + "owner": "chessai", + "repo": "nix-std", + "rev": "715db541ffff4194620e48d210b76f73a74b5b5d", + "type": "github" + }, + "original": { + "owner": "chessai", + "repo": "nix-std", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1702272962, + "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1674990008, + "narHash": "sha256-4zOyp+hFW2Y7imxIpZqZGT8CEqKmDjwgfD6BzRUE0mQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d2bbcbe6c626d339b25a4995711f07625b508214", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1703438236, + "narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "osmosis-src": { + "flake": false, + "locked": { + "lastModified": 1702398856, + "narHash": "sha256-4uLO7izIZ8JvKTfUXbYkxQFpIjwMEcO81WvhklrzI9E=", + "owner": "osmosis-labs", + "repo": "osmosis", + "rev": "b0aee0006ce55d0851773084bd7880db7e32ad70", + "type": "github" + }, + "original": { + "owner": "osmosis-labs", + "ref": "v21.0.0", + "repo": "osmosis", + "type": "github" + } + }, + "provenance-src": { + "flake": false, + "locked": { + "lastModified": 1699901286, + "narHash": "sha256-dTX3kg2QUsC9SwsaommP4IFgIdQgWZrGQNtp/B+fzys=", + "owner": "provenance-io", + "repo": "provenance", + "rev": "91b0813de2f93d03cefe8efb226dc32f02690840", + "type": "github" + }, + "original": { + "owner": "provenance-io", + "ref": "v1.17.0", + "repo": "provenance", + "type": "github" + } + }, + "regen-src": { + "flake": false, + "locked": { + "lastModified": 1645832054, + "narHash": "sha256-lDb0/Bw4hAX71jsCQJUju1mKYNacWEVezx6+KdIdu6Q=", + "owner": "regen-network", + "repo": "regen-ledger", + "rev": "5fb6268ed18a488ab88fb3bfa4b84e10892a7562", + "type": "github" + }, + "original": { + "owner": "regen-network", + "ref": "v3.0.0", + "repo": "regen-ledger", + "type": "github" + } + }, + "relayer-src": { + "flake": false, + "locked": { + "lastModified": 1635197290, + "narHash": "sha256-xD+xZG4Gb6557y/jkXTGdbt8qJ6izMgC4H3uo2/j5vU=", + "owner": "cosmos", + "repo": "relayer", + "rev": "7797aa103af68faa4269af586fe6df1d30e91d4a", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v1.0.0", + "repo": "relayer", + "type": "github" + } + }, + "root": { + "inputs": { + "cosmos": "cosmos", + "flake-parts": "flake-parts_2", + "gomod2nix": "gomod2nix_2", + "nixpkgs": "nixpkgs_4" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1702347444, + "narHash": "sha256-ueDw7aQf4Xyk69XnDD0YNWDlFdlOgJGPeWFa7uu/cfw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "bc13176f27cf3be724d18924b4f6aa47686ca2e3", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "sbt-derivation": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1698464090, + "narHash": "sha256-Pnej7WZIPomYWg8f/CZ65sfW85IfIUjYhphMMg7/LT0=", + "owner": "zaninime", + "repo": "sbt-derivation", + "rev": "6762cf2c31de50efd9ff905cbcc87239995a4ef9", + "type": "github" + }, + "original": { + "owner": "zaninime", + "repo": "sbt-derivation", + "type": "github" + } + }, + "sconfig-src": { + "flake": false, + "locked": { + "lastModified": 1679585941, + "narHash": "sha256-ywh9IcqMWbRHqJkGJezcDCvfbBYNJH7ualKvPJQRcHA=", + "owner": "freshautomations", + "repo": "sconfig", + "rev": "41450b55f3b37b4b7a0fdf4a69c707619dbeb47c", + "type": "github" + }, + "original": { + "owner": "freshautomations", + "repo": "sconfig", + "type": "github" + } + }, + "sentinel-src": { + "flake": false, + "locked": { + "lastModified": 1647195309, + "narHash": "sha256-+ZobsjLNxVL3+zi6OEFQhff6Gbd9kng8B0haqcOoiP0=", + "owner": "sentinel-official", + "repo": "hub", + "rev": "7001dc8bc4517efa33cfcc83e8b127528b5bdf2e", + "type": "github" + }, + "original": { + "owner": "sentinel-official", + "ref": "v0.9.0-rc0", + "repo": "hub", + "type": "github" + } + }, + "sifchain-src": { + "flake": false, + "locked": { + "lastModified": 1648486445, + "narHash": "sha256-n5fmWtdrc0Rhs6Uo+zjcSXmyEFVIsA5L9dlrbRXGDmU=", + "owner": "Sifchain", + "repo": "sifnode", + "rev": "269cfadf6a4c08879247c2b8373323ae7239a425", + "type": "github" + }, + "original": { + "owner": "Sifchain", + "ref": "v0.12.1", + "repo": "sifnode", + "type": "github" + } + }, + "stargaze-src": { + "flake": false, + "locked": { + "lastModified": 1645539964, + "narHash": "sha256-5I5pdnBJHwNaI2Soet+zH3aH+pUbYdC9TgHBjOd1TmA=", + "owner": "public-awesome", + "repo": "stargaze", + "rev": "6ee57f18714a6d94cc6205afcd1af2ab655f8f0f", + "type": "github" + }, + "original": { + "owner": "public-awesome", + "ref": "v3.0.0", + "repo": "stargaze", + "type": "github" + } + }, + "stoml-src": { + "flake": false, + "locked": { + "lastModified": 1666796497, + "narHash": "sha256-Adjag1/Hd2wrar2/anD6jQEMDvUc2TOIG7DlEgxpTXc=", + "owner": "freshautomations", + "repo": "stoml", + "rev": "4b2cd09b5795a54fddc215f0d24e24071894b3cf", + "type": "github" + }, + "original": { + "owner": "freshautomations", + "repo": "stoml", + "type": "github" + } + }, + "stride-consumer-src": { + "flake": false, + "locked": { + "lastModified": 1689464372, + "narHash": "sha256-DByig9ISs9x9Kvakc8LFL558VKhM+UBiaESWgyVzI0w=", + "owner": "Stride-Labs", + "repo": "stride", + "rev": "bbf0bb7f52878f3205c76bb1e96662fe7bd7af8d", + "type": "github" + }, + "original": { + "owner": "Stride-Labs", + "ref": "v12.1.0", + "repo": "stride", + "type": "github" + } + }, + "stride-src": { + "flake": false, + "locked": { + "lastModified": 1679819302, + "narHash": "sha256-fdjnFHPBZNnhDyVoMuPfqNb6YUYRdcMO73FlZHjIuzA=", + "owner": "Stride-Labs", + "repo": "stride", + "rev": "3c69e7644859981b1fd9313eb1f0c5e5886e4a0d", + "type": "github" + }, + "original": { + "owner": "Stride-Labs", + "ref": "v8.0.0", + "repo": "stride", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "umee-src": { + "flake": false, + "locked": { + "lastModified": 1649261156, + "narHash": "sha256-hydRL/88fHCW/k7z7GoqAwvynZuvLEDLyA6A9Cm+6UY=", + "owner": "umee-network", + "repo": "umee", + "rev": "42f57545251ce5337dcc5fe4309520ead89183b9", + "type": "github" + }, + "original": { + "owner": "umee-network", + "ref": "v2.0.0", + "repo": "umee", + "type": "github" + } + }, + "wasmd-src": { + "flake": false, + "locked": { + "lastModified": 1669987561, + "narHash": "sha256-F0p555FEeA405tuLn82yUEbRZpJLs85GrUKvSrjTdjk=", + "owner": "CosmWasm", + "repo": "wasmd", + "rev": "a347ace2ff41539fe06c68168bc6f28d6ca9fa52", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v0.30.0", + "repo": "wasmd", + "type": "github" + } + }, + "wasmd_next-src": { + "flake": false, + "locked": { + "lastModified": 1682094944, + "narHash": "sha256-b+6XhBdKyQlrzsYxVRrDf4vHpv8GAJkGwHVfJ9sdf3U=", + "owner": "CosmWasm", + "repo": "wasmd", + "rev": "c2bb27d289f7f72f1471a4b33cb08fdfc8d66f63", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v0.40.0-rc.1", + "repo": "wasmd", + "type": "github" + } + }, + "wasmvm_1-src": { + "flake": false, + "locked": { + "lastModified": 1652698028, + "narHash": "sha256-4m64mPwFLz7aZEKVxM2lJQtX98BkhdKTZb3evpDOk/4=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "bc49a2f4842d023c0038798f343b56f3f0530646", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.0.0", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_1_1-src": { + "flake": false, + "locked": { + "lastModified": 1663600745, + "narHash": "sha256-9K/G7Wu/TfW4Z+lseEutXbdtr+A40nbVejBphegF5z4=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "3d791055751e428f93f54f64c2d20d20da2ff2a9", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.1.1", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_1_2-src": { + "flake": false, + "locked": { + "lastModified": 1681833975, + "narHash": "sha256-EbzMNkZUO94jEdX0WgAdy5qfhlCG3lpHpVHyT2FcSDw=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "4f84395b1c623483a3c7936c990c2f7e5dad70d8", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.1.2", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_2_3-src": { + "flake": false, + "locked": { + "lastModified": 1681831436, + "narHash": "sha256-GscUMJ0Tkg77S9IYA9komyKKoa1AyVXSSaU8hw3ZNwk=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "61e41ae2a80081224f469614a267b0ba2a2d305f", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.2.3", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_2_4-src": { + "flake": false, + "locked": { + "lastModified": 1685977963, + "narHash": "sha256-/GOvkKLQwsPms7h7yEZYLwbZn9Lzk5qQnBXXoZ/R6JM=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "ba491fe9a663e0b45728dd5f0c43f6a93c97f5fe", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.2.4", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_3_0-src": { + "flake": false, + "locked": { + "lastModified": 1689589428, + "narHash": "sha256-rsTYvbkYpDkUE4IvILdSL3hXMgAWxz5ltGotJB2t1e4=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "71a9c0dc0ecf9623148e82facb3564fbbf0a896f", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.3.0", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_5_0-src": { + "flake": false, + "locked": { + "lastModified": 1698746477, + "narHash": "sha256-l0cNF0YjviEl/JLJ4VdvDtIGuAYyFfncVo83ROfQFD8=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "2041b184c146f278157d195361bc6cc6b56cc9d4", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.5.0", + "repo": "wasmvm", + "type": "github" + } + }, + "wasmvm_1_beta7-src": { + "flake": false, + "locked": { + "lastModified": 1646675433, + "narHash": "sha256-tt9aAPLxtIRsG1VFM1YAIHSotuBl170EiBcHSWTtARI=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "f7015565a59255cd09ebfcbf9345f3c87666fedd", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v1.0.0-beta7", + "repo": "wasmvm", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} \ No newline at end of file diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..fd77c004f --- /dev/null +++ b/flake.nix @@ -0,0 +1,88 @@ +{ + description = "composable-cosmos"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + gomod2nix = { + url = github:nix-community/gomod2nix; + inputs.nixpkgs.follows = "nixpkgs"; + }; + cosmos = { + url = "github:informalsystems/cosmos.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = inputs @ { + flake-parts, + gomod2nix, + cosmos, + self, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { + imports = [ + ]; + systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + perSystem = { + config, + self', + inputs', + pkgs, + system, + ... + }: let + inherit (inputs.gomod2nix.legacyPackages.${system}) buildGoApplication mkGoEvn gomod2nix; + libwasmvm = cosmos.packages.${system}.libwasmvm_1_5_0; + cosmwasm-check = cosmos.packages.${system}.cosmwasm-check; + cosmosLib = cosmos.lib {inherit pkgs cosmwasm-check;}; + in { + formatter = pkgs.alejandra; + devShells = { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + bingo + gci + gnumake + go + delve + golangci-lint + gomod2nix + gotools + libwasmvm + ]; + }; + }; + + packages = rec { + centaurid = buildGoApplication rec { + pname = "centaurid"; + version = "v7.0.0"; + src = ./.; + subPackages = ["cmd/${pname}"]; + modules = ./gomod2nix.toml; + preFixup = '' + ${cosmosLib.wasmdPreFixupPhase libwasmvm pname} + ''; + checkPhase = "true"; + buildInputs = [libwasmvm]; + ldflags = '' + -X github.com/cosmos/cosmos-sdk/version.Name=centauri -X github.com/cosmos/cosmos-sdk/version.AppName=${pname} -X github.com/cosmos/cosmos-sdk/version.Version=${version} -X github.com/cosmos/cosmos-sdk/version.Commit=${self.rev or self.dirtyRev or "dirty"} -X github.com/cometbft/cometbft/version.TMCoreSemVer=v0.37.2 + ''; + }; + default = ci; + ci = pkgs.writeShellApplication { + name = "ci"; + text = '' + go get mvdan.cc/gofumpt + go get github.com/client9/misspell/cmd/misspell + go get golang.org/x/tools/cmd/goimports + make lint + nix fmt + go mod tidy + golangci-lint run --fix + gomod2nix + ''; + }; + }; + }; + }; +} From 7bc093e0cf36ac1c01fbe030b18cb860fa25b963 Mon Sep 17 00:00:00 2001 From: dzmitry-lahoda Date: Mon, 13 Nov 2023 11:12:29 +0000 Subject: [PATCH 44/71] relay from master --- x/transfermiddleware/types/parachain_token_info.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/transfermiddleware/types/parachain_token_info.pb.go b/x/transfermiddleware/types/parachain_token_info.pb.go index ea33c7e44..854ea11c0 100644 --- a/x/transfermiddleware/types/parachain_token_info.pb.go +++ b/x/transfermiddleware/types/parachain_token_info.pb.go @@ -28,7 +28,7 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ParachainIBCTokenInfo represents information about transferable IBC tokens -// from Parachain. +// from Parachain(Substrate based network). type ParachainIBCTokenInfo struct { // ibc_denom is the denomination of the ibced token transferred from the // dotsama chain. From 2adf5bd25d9c7a1ac9936a3ef2595bf70dae48e1 Mon Sep 17 00:00:00 2001 From: dzmitry-lahoda Date: Wed, 28 Feb 2024 16:28:37 +0000 Subject: [PATCH 45/71] porting fix from v7 --- x/transfermiddleware/ibc_ante_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/x/transfermiddleware/ibc_ante_test.go b/x/transfermiddleware/ibc_ante_test.go index 0ba0b9c33..da9aafd9f 100644 --- a/x/transfermiddleware/ibc_ante_test.go +++ b/x/transfermiddleware/ibc_ante_test.go @@ -15,7 +15,12 @@ import ( customibctesting "github.com/notional-labs/composable/v6/app/ibctesting" ) -var govAuthorityAddress = "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m" // convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m +// NOTE: This is the address of the gov authority on the chain that is being tested. +// This means that we need to check bech32 .... everywhere. +var govAuthorityAddress = "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + +// ORIGINAL NOTES: +// convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m type TransferTestSuite struct { suite.Suite @@ -55,7 +60,9 @@ func (suite *TransferTestSuite) SetupTest() { suite.wasmKeeper = suite.chainB.GetTestSupport().Wasm08Keeper() msg := wasmtypes.NewMsgPushNewWasmCode(govAuthorityAddress, wasmContract) + response, err := suite.wasmKeeper.PushNewWasmCode(suite.ctx, msg) + suite.Require().NoError(err) suite.Require().NotNil(response.CodeId) suite.coordinator.CodeID = response.CodeId From 0bdb8146765ee408d847acb68adec4e59d1b52c4 Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 5 Mar 2024 14:19:16 +0000 Subject: [PATCH 46/71] add runtime upgrade handler. for ibc fee feature. --- app/upgrades/v6_4_6/constants.go | 22 ++++++++++++++++++++++ app/upgrades/v6_4_6/upgrade.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 app/upgrades/v6_4_6/constants.go create mode 100644 app/upgrades/v6_4_6/upgrade.go diff --git a/app/upgrades/v6_4_6/constants.go b/app/upgrades/v6_4_6/constants.go new file mode 100644 index 000000000..981d04382 --- /dev/null +++ b/app/upgrades/v6_4_6/constants.go @@ -0,0 +1,22 @@ +package v6_4_6 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_6" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ibctransfermiddleware.StoreKey}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_6/upgrade.go b/app/upgrades/v6_4_6/upgrade.go new file mode 100644 index 000000000..183e63e80 --- /dev/null +++ b/app/upgrades/v6_4_6/upgrade.go @@ -0,0 +1,28 @@ +package v6_4_6 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // Add params for custom middleware + custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() + keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) + + return mm.RunMigrations(ctx, configurator, vm) + } +} From bb19b8974a970afdc0dbafd4b67248223eba75cf Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 5 Mar 2024 17:21:10 +0000 Subject: [PATCH 47/71] upgrade merged. BankKeeper + GovKeeper + IbcTransferMiddlewareKeeper --- app/upgrades/v6_4_5/constants.go | 6 ++++++ app/upgrades/v6_4_5/upgrade.go | 4 ++++ app/upgrades/v6_4_6/constants.go | 22 ---------------------- app/upgrades/v6_4_6/upgrade.go | 28 ---------------------------- 4 files changed, 10 insertions(+), 50 deletions(-) delete mode 100644 app/upgrades/v6_4_6/constants.go delete mode 100644 app/upgrades/v6_4_6/upgrade.go diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go index 27afc17b0..19a44a04c 100644 --- a/app/upgrades/v6_4_5/constants.go +++ b/app/upgrades/v6_4_5/constants.go @@ -1,7 +1,9 @@ package v6_4_5 import ( + store "github.com/cosmos/cosmos-sdk/store/types" "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) const ( @@ -12,4 +14,8 @@ const ( var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ibctransfermiddleware.StoreKey}, + Deleted: []string{}, + }, } diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go index 6318f114a..91b0cf81a 100644 --- a/app/upgrades/v6_4_5/upgrade.go +++ b/app/upgrades/v6_4_5/upgrade.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/notional-labs/composable/v6/app/keepers" "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) func CreateUpgradeHandler( @@ -35,6 +36,9 @@ func CreateUpgradeHandler( keepers.BankKeeper.BurnCoins(ctx, "gov", coins) } + custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() + keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) + return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/app/upgrades/v6_4_6/constants.go b/app/upgrades/v6_4_6/constants.go deleted file mode 100644 index 981d04382..000000000 --- a/app/upgrades/v6_4_6/constants.go +++ /dev/null @@ -1,22 +0,0 @@ -package v6_4_6 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -const ( - // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_6" -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ibctransfermiddleware.StoreKey}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6_4_6/upgrade.go b/app/upgrades/v6_4_6/upgrade.go deleted file mode 100644 index 183e63e80..000000000 --- a/app/upgrades/v6_4_6/upgrade.go +++ /dev/null @@ -1,28 +0,0 @@ -package v6_4_6 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ upgrades.BaseAppParamManager, - _ codec.Codec, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // Add params for custom middleware - custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() - keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) - - return mm.RunMigrations(ctx, configurator, vm) - } -} From 69cf6f2e9e48ac581f6c43bbc5f29e2698647ccf Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 6 Mar 2024 17:22:15 +0000 Subject: [PATCH 48/71] Revert "Merge pull request #451 from ComposableFi/slashing_fix" This reverts commit 1ad42931734cfe7a9021ea27c70a45f8e52ad5c6, reversing changes made to 85e2bf9d7dbda4bcbdc5fb0698479f98aa8453ec. --- Makefile | 2 +- app/keepers/keepers.go | 2 -- app/upgrades/v6_4_5/constants.go | 6 ----- app/upgrades/v6_4_5/upgrade.go | 17 ------------ app/upgrades/v6_4_6/constants.go | 22 +++++++++++++++ app/upgrades/v6_4_6/upgrade.go | 28 +++++++++++++++++++ custom/bank/keeper/keeper.go | 19 +++++++++++++ custom/staking/keeper/keeper.go | 46 +++----------------------------- tests/interchaintest/setup.go | 3 ++- x/mint/abci.go | 7 +++-- x/mint/types/events.go | 2 -- 11 files changed, 80 insertions(+), 74 deletions(-) create mode 100644 app/upgrades/v6_4_6/constants.go create mode 100644 app/upgrades/v6_4_6/upgrade.go diff --git a/Makefile b/Makefile index d2191acdc..26d1cf2b2 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ build: go build $(BUILD_FLAGS) -o bin/centaurid ./cmd/centaurid docker-build-debug: - @DOCKER_BUILDKIT=1 docker build -t centauri:local -f Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t centauri:debug -f Dockerfile . lint: @find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run mvdan.cc/gofumpt -w . diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index a0a6f810f..4d1af8e2f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -211,8 +211,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[distrtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - appKeepers.StakingKeeper.RegisterKeepers(appKeepers.DistrKeeper, appKeepers.BankKeeper) - appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, cdc, appKeepers.keys[slashingtypes.StoreKey], appKeepers.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go index 19a44a04c..27afc17b0 100644 --- a/app/upgrades/v6_4_5/constants.go +++ b/app/upgrades/v6_4_5/constants.go @@ -1,9 +1,7 @@ package v6_4_5 import ( - store "github.com/cosmos/cosmos-sdk/store/types" "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) const ( @@ -14,8 +12,4 @@ const ( var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ibctransfermiddleware.StoreKey}, - Deleted: []string{}, - }, } diff --git a/app/upgrades/v6_4_5/upgrade.go b/app/upgrades/v6_4_5/upgrade.go index 91b0cf81a..72dbebe02 100644 --- a/app/upgrades/v6_4_5/upgrade.go +++ b/app/upgrades/v6_4_5/upgrade.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/notional-labs/composable/v6/app/keepers" "github.com/notional-labs/composable/v6/app/upgrades" - ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) func CreateUpgradeHandler( @@ -19,26 +18,10 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - // remove broken proposals BrokenProposals := [3]uint64{2, 6, 11} for _, proposal := range BrokenProposals { keepers.GovKeeper.DeleteProposal(ctx, proposal) } - - // burn extra ppica in escrow account - // this ppica is unused because it is a native token stored in escrow account - // it was unnecessarily minted to match pica escrowed on picasso to ppica minted - // in genesis, to make initial native ppica transferrable to picasso - amount, ok := sdk.NewIntFromString("1066669217167120000000") - if ok { - coins := sdk.Coins{sdk.NewCoin("ppica", amount)} - keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins) - keepers.BankKeeper.BurnCoins(ctx, "gov", coins) - } - - custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() - keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) - return mm.RunMigrations(ctx, configurator, vm) } } diff --git a/app/upgrades/v6_4_6/constants.go b/app/upgrades/v6_4_6/constants.go new file mode 100644 index 000000000..981d04382 --- /dev/null +++ b/app/upgrades/v6_4_6/constants.go @@ -0,0 +1,22 @@ +package v6_4_6 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_6" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ibctransfermiddleware.StoreKey}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_6/upgrade.go b/app/upgrades/v6_4_6/upgrade.go new file mode 100644 index 000000000..183e63e80 --- /dev/null +++ b/app/upgrades/v6_4_6/upgrade.go @@ -0,0 +1,28 @@ +package v6_4_6 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // Add params for custom middleware + custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() + keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) + + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index 4b6d87e03..a7c312c6d 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -18,6 +18,7 @@ import ( transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper" + alliancetypes "github.com/terra-money/alliance/x/alliance/types" ) type Keeper struct { @@ -67,6 +68,16 @@ func (k Keeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*t ctx := sdk.UnwrapSDKContext(c) supply := k.GetSupply(ctx, req.Denom) + if req.Denom == k.sk.BondDenom(ctx) { + assets := k.ak.GetAllAssets(ctx) + totalRewardWeights := sdk.ZeroDec() + for _, asset := range assets { + totalRewardWeights = totalRewardWeights.Add(asset.RewardWeight) + } + allianceBonded := k.ak.GetAllianceBondedAmount(ctx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) + supply.Amount = supply.Amount.Sub(allianceBonded) + } + return &types.QuerySupplyOfResponse{Amount: sdk.NewCoin(req.Denom, supply.Amount)}, nil } @@ -77,8 +88,16 @@ func (k Keeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequ if err != nil { return nil, status.Error(codes.Internal, err.Error()) } + // Get duplicate token from transfermiddeware duplicateCoins := k.tfmk.GetTotalEscrowedToken(sdkCtx) totalSupply = totalSupply.Sub(duplicateCoins...) + + allianceBonded := k.ak.GetAllianceBondedAmount(sdkCtx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) + bondDenom := k.sk.BondDenom(sdkCtx) + if totalSupply.AmountOf(bondDenom).IsPositive() { + totalSupply = totalSupply.Sub(sdk.NewCoin(bondDenom, allianceBonded)) + } + return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index c5a2fcbc3..2c5b6a5dd 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -1,17 +1,13 @@ package keeper import ( - "fmt" - - "cosmossdk.io/math" abcicometbft "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - distkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" - minttypes "github.com/notional-labs/composable/v6/x/mint/types" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) @@ -20,9 +16,6 @@ type Keeper struct { cdc codec.BinaryCodec Stakingmiddleware *stakingmiddleware.Keeper authority string - mintKeeper minttypes.BankKeeper - distrKeeper distkeeper.Keeper - authKeeper minttypes.AccountKeeper } func (k Keeper) BlockValidatorUpdates(ctx sdk.Context, height int64) []abcicometbft.ValidatorUpdate { @@ -124,39 +117,6 @@ func NewKeeper( authority: authority, Stakingmiddleware: stakingmiddleware, cdc: cdc, - mintKeeper: nil, - distrKeeper: distkeeper.Keeper{}, - authKeeper: ak, } return &keeper } - -func (k *Keeper) RegisterKeepers(dk distkeeper.Keeper, mk minttypes.BankKeeper) { - k.distrKeeper = dk - k.mintKeeper = mk -} - -// SlashWithInfractionReason send coins to community pool -func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec, _ types.Infraction) math.Int { - // keep slashing logic the same - amountBurned := k.Slash(ctx, consAddr, infractionHeight, power, slashFactor) - // after usual slashing and burning is done, mint burned coinds into community pool - coins := sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), amountBurned)) - err := k.mintKeeper.MintCoins(ctx, types.ModuleName, coins) - if err != nil { - k.Logger(ctx).Error("Failed to mint slashed coins: ", amountBurned) - } else { - err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(types.ModuleName)) - if err != nil { - k.Logger(ctx).Error(fmt.Sprintf("Failed to fund community pool. Tokens minted to the staking module account: %d. ", amountBurned)) - } else { - ctx.EventManager().EmitEvent( - sdk.NewEvent( - minttypes.EventTypeMintSlashed, - sdk.NewAttribute(sdk.AttributeKeyAmount, amountBurned.String()), - ), - ) - } - } - return amountBurned -} diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 28a2fcbed..384f31cb5 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -45,10 +45,11 @@ func GetDockerImageInfo() (repo, version string) { if !found { // make local-image repo = "centauri" - branchVersion = "local" + branchVersion = "debug" } // github converts / to - for pushed docker images // branchVersion = strings.ReplaceAll(branchVersion, "/", "-") + branchVersion = "latest" return repo, branchVersion } diff --git a/x/mint/abci.go b/x/mint/abci.go index 42964667d..c24f80747 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -25,7 +25,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalStakingSupply) k.SetMinter(ctx, minter) - // calculate how many we would mint, but we dont mint them, we take them from the prefunded account + // mint coins, update supply mintedCoin := minter.BlockProvision(params) mintedCoins := sdk.NewCoins(mintedCoin) @@ -41,7 +41,10 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeReward, + types.EventTypeMint, + sdk.NewAttribute(types.AttributeKeyBondedRatio, bondedRatio.String()), + sdk.NewAttribute(types.AttributeKeyInflation, minter.Inflation.String()), + sdk.NewAttribute(types.AttributeKeyAnnualProvisions, minter.AnnualProvisions.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), ), ) diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 92d52efac..891f50768 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -3,8 +3,6 @@ package types // Minting module event types const ( EventTypeMint = ModuleName - EventTypeReward = "reward_distributed" - EventTypeMintSlashed = "mint_slashed_into_comminity_pool" EventAddAllowedFundAddress = "add_allowed_fund" AttributeKeyBondedRatio = "bonded_ratio" From 186f8e7fc99ee05db369bf608b9430cd6ecfa783 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 6 Mar 2024 17:29:38 +0000 Subject: [PATCH 49/71] revert banksy changes to resolve halted chain. --- app/app.go | 4 ++-- app/upgrades/v6_4_5/constants.go | 2 +- app/upgrades/v6_4_6/constants.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index ab02f2a2e..11fb56dd8 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades/v6_4_5" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_6" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -147,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_5.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_6.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_5/constants.go b/app/upgrades/v6_4_5/constants.go index 27afc17b0..55b602bb3 100644 --- a/app/upgrades/v6_4_5/constants.go +++ b/app/upgrades/v6_4_5/constants.go @@ -6,7 +6,7 @@ import ( const ( // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_5" + UpgradeName = "v6_4_55" ) var Upgrade = upgrades.Upgrade{ diff --git a/app/upgrades/v6_4_6/constants.go b/app/upgrades/v6_4_6/constants.go index 981d04382..cbb8a3658 100644 --- a/app/upgrades/v6_4_6/constants.go +++ b/app/upgrades/v6_4_6/constants.go @@ -9,7 +9,7 @@ import ( const ( // UpgradeName defines the on-chain upgrade name for the composable upgrade. - UpgradeName = "v6_4_6" + UpgradeName = "v6_4_5" ) var Upgrade = upgrades.Upgrade{ From a0e588c0521e7de9b760790e57561629691a7d99 Mon Sep 17 00:00:00 2001 From: rustdev Date: Thu, 7 Mar 2024 21:46:39 +0000 Subject: [PATCH 50/71] Revert "allow devnet with custom key gov" This reverts commit 2457d87a36a1eedc96b2e2fd5e93858b27dfe904. --- app/app.go | 2 - app/helpers/test_helpers.go | 1 - app/keepers/keepers.go | 10 +- app/test_helpers.go | 1 - cmd/centaurid/cmd/root.go | 19 +- flake.lock | 1548 ----------------------------------- flake.nix | 88 -- 7 files changed, 5 insertions(+), 1664 deletions(-) delete mode 100644 flake.lock delete mode 100644 flake.nix diff --git a/app/app.go b/app/app.go index 11fb56dd8..9f71e5bfe 100644 --- a/app/app.go +++ b/app/app.go @@ -296,7 +296,6 @@ func NewComposableApp( encodingConfig EncodingConfig, appOpts servertypes.AppOptions, wasmOpts []wasm.Option, - devnetGov *string, baseAppOptions ...func(*baseapp.BaseApp), ) *ComposableApp { appCodec := encodingConfig.Marshaler @@ -337,7 +336,6 @@ func NewComposableApp( appOpts, wasmOpts, enabledProposals, - devnetGov, ) // transferModule := transfer.NewAppModule(app.TransferKeeper) diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index ede708692..1646262fa 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -102,7 +102,6 @@ func setup(withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*composa encCdc, EmptyAppOptions{}, opts, - nil, ) if withGenesis { return app, composable.NewDefaultGenesisState() diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 4d1af8e2f..6db33ec70 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -177,7 +177,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appOpts servertypes.AppOptions, wasmOpts []wasm.Option, enabledProposals []wasm.ProposalType, - devnetGov *string, ) { // add keepers appKeepers.AccountKeeper = authkeeper.NewAccountKeeper( @@ -259,12 +258,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[ibchost.StoreKey], appKeepers.GetSubspace(ibchost.ModuleName), appKeepers.StakingKeeper, appKeepers.UpgradeKeeper, appKeepers.ScopedIBCKeeper, ) - govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String() - if devnetGov != nil { - govModuleAuthority = *devnetGov - } - - appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper) + appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], authorityAddress, homePath, &appKeepers.IBCKeeper.ClientKeeper) // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( @@ -408,7 +402,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( wasmDir, wasmConfig, availableCapabilities, - govModuleAuthority, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmOpts..., ) diff --git a/app/test_helpers.go b/app/test_helpers.go index 536630458..97f5df118 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -84,7 +84,6 @@ func setup(tb testing.TB, withGenesis bool, invCheckPeriod uint) (*ComposableApp MakeEncodingConfig(), EmptyBaseAppOptions{}, wasmOpts, - nil, baseAppOpts...) if withGenesis { return app, NewDefaultGenesisState() diff --git a/cmd/centaurid/cmd/root.go b/cmd/centaurid/cmd/root.go index 6b32ca9f5..007663989 100644 --- a/cmd/centaurid/cmd/root.go +++ b/cmd/centaurid/cmd/root.go @@ -38,11 +38,6 @@ import ( // this line is used by starport scaffolding # stargate/root/import ) -const ( - // if set, than uses specific key for governance instead of default (default is production; this override for local devtest) - flagDevnetGov = "devnet-gov" -) - var ChainID string // NewRootCmd creates a new root command for simd. It is called once in the @@ -80,6 +75,7 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) { if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { return err } + customAppTemplate, customAppConfig := initAppConfig() customTMConfig := initTendermintConfig() @@ -188,8 +184,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { // this line is used by starport scaffolding # stargate/root/commands ) - appCreator := appCreator{encodingConfig} - server.AddCommands(rootCmd, app.DefaultNodeHome, appCreator.newApp, appCreator.appExport, addModuleInitFlags) + a := appCreator{encodingConfig} + server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags) // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( @@ -202,7 +198,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) - startCmd.Flags().String(flagDevnetGov, "", "Sets the devnet governance key (if not set, uses the default production key)") // this line is used by starport scaffolding # stargate/root/initFlags } @@ -272,11 +267,6 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a skipUpgradeHeights[h] = true } - var devnetGov *string - devnetGovOption, _ := appOpts.Get(flagDevnetGov).(string) - if devnetGovOption != "" { - devnetGov = &devnetGovOption - } baseappOptions := server.DefaultBaseappOptions(appOpts) var emptyWasmOpts []wasm.Option @@ -290,7 +280,6 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a // this line is used by starport scaffolding # stargate/root/appArgument appOpts, emptyWasmOpts, - devnetGov, baseappOptions..., ) @@ -323,7 +312,6 @@ func (a appCreator) appExport( a.encCfg, appOpts, emptyWasmOpts, - nil, ) if err := anApp.LoadHeight(height); err != nil { @@ -342,7 +330,6 @@ func (a appCreator) appExport( a.encCfg, appOpts, emptyWasmOpts, - nil, ) } diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 7052e3fc2..000000000 --- a/flake.lock +++ /dev/null @@ -1,1548 +0,0 @@ -{ - "nodes": { - "akash-src": { - "flake": false, - "locked": { - "lastModified": 1648485085, - "narHash": "sha256-33FPy0dn6QuqneEqZYkFoCRm9agG7PE+9C/pYH9Gwx4=", - "owner": "ovrclk", - "repo": "akash", - "rev": "5b8b6bbede6c9fbb2df1ca536b8edfcf5652adf8", - "type": "github" - }, - "original": { - "owner": "ovrclk", - "ref": "v0.15.0-rc17", - "repo": "akash", - "type": "github" - } - }, - "apalache-src": { - "flake": false, - "locked": { - "lastModified": 1692625213, - "narHash": "sha256-Z/tmBMv+QshFJLo2kBgBdkqfKwF93CgURVIbYF3dwJE=", - "owner": "informalsystems", - "repo": "apalache", - "rev": "ec979d4554360faf9d73ddf72dccf350614076d5", - "type": "github" - }, - "original": { - "owner": "informalsystems", - "ref": "v0.42.0", - "repo": "apalache", - "type": "github" - } - }, - "beaker-src": { - "flake": false, - "locked": { - "lastModified": 1686823358, - "narHash": "sha256-bQiN5Q7RV4Uupc7rk1rGurRvCTy+5EiiB4p3bHct7M0=", - "owner": "osmosis-labs", - "repo": "beaker", - "rev": "f3c7a9fc6886aa2b4e0d259f70058d6c23c225e5", - "type": "github" - }, - "original": { - "owner": "osmosis-labs", - "ref": "v0.1.6", - "repo": "beaker", - "type": "github" - } - }, - "celestia-src": { - "flake": false, - "locked": { - "lastModified": 1700494564, - "narHash": "sha256-O6KrCStrZLmWy3xybQUNsWEb3O7vIRCFDE9MsEtsFro=", - "owner": "celestiaorg", - "repo": "celestia-app", - "rev": "2dbfabf1849e166974c1287c35b43e5e07727643", - "type": "github" - }, - "original": { - "owner": "celestiaorg", - "ref": "v1.4.0", - "repo": "celestia-app", - "type": "github" - } - }, - "centauri-src": { - "flake": false, - "locked": { - "lastModified": 1701431373, - "narHash": "sha256-EpZ1CQN0gMU8W1u3CMbqlaHeeVpQO2i1GPg6pOyOQTc=", - "owner": "ComposableFi", - "repo": "composable-cosmos", - "rev": "387c96b434db9d96b0506aa7f14536d9bdec968c", - "type": "github" - }, - "original": { - "owner": "ComposableFi", - "repo": "composable-cosmos", - "rev": "387c96b434db9d96b0506aa7f14536d9bdec968c", - "type": "github" - } - }, - "cometbft-src": { - "flake": false, - "locked": { - "lastModified": 1694550324, - "narHash": "sha256-G5gchJMn/BFzwYx8/ikPDL5fS/TuFIBF4DKJbkalp/M=", - "owner": "cometbft", - "repo": "cometbft", - "rev": "66a5a9da9f7a3306f382eb9142ccb9c9f7997d3f", - "type": "github" - }, - "original": { - "owner": "cometbft", - "ref": "v0.38.0", - "repo": "cometbft", - "type": "github" - } - }, - "cosmos": { - "inputs": { - "akash-src": "akash-src", - "apalache-src": "apalache-src", - "beaker-src": "beaker-src", - "celestia-src": "celestia-src", - "centauri-src": "centauri-src", - "cometbft-src": "cometbft-src", - "cosmos-sdk-src": "cosmos-sdk-src", - "cosmwasm-src": "cosmwasm-src", - "crescent-src": "crescent-src", - "cw-plus-src": "cw-plus-src", - "evmos-src": "evmos-src", - "flake-parts": "flake-parts", - "gaia-main-src": "gaia-main-src", - "gaia10-src": "gaia10-src", - "gaia11-src": "gaia11-src", - "gaia12-src": "gaia12-src", - "gaia13-src": "gaia13-src", - "gaia14-src": "gaia14-src", - "gaia5-src": "gaia5-src", - "gaia6-ordered-src": "gaia6-ordered-src", - "gaia6-src": "gaia6-src", - "gaia7-src": "gaia7-src", - "gaia8-src": "gaia8-src", - "gaia9-src": "gaia9-src", - "gex-src": "gex-src", - "gomod2nix": "gomod2nix", - "hermes-src": "hermes-src", - "ibc-go-v2-src": "ibc-go-v2-src", - "ibc-go-v3-src": "ibc-go-v3-src", - "ibc-go-v4-src": "ibc-go-v4-src", - "ibc-go-v5-src": "ibc-go-v5-src", - "ibc-go-v6-src": "ibc-go-v6-src", - "ibc-go-v7-src": "ibc-go-v7-src", - "ibc-go-v8-channel-upgrade-src": "ibc-go-v8-channel-upgrade-src", - "ibc-go-v8-src": "ibc-go-v8-src", - "ibc-rs-src": "ibc-rs-src", - "ica-src": "ica-src", - "ignite-cli-src": "ignite-cli-src", - "interchain-security-src": "interchain-security-src", - "iris-src": "iris-src", - "ixo-src": "ixo-src", - "juno-src": "juno-src", - "migaloo-src": "migaloo-src", - "namada-src": "namada-src", - "neutron-src": "neutron-src", - "nix-std": "nix-std", - "nixpkgs": [ - "nixpkgs" - ], - "osmosis-src": "osmosis-src", - "provenance-src": "provenance-src", - "regen-src": "regen-src", - "relayer-src": "relayer-src", - "rust-overlay": "rust-overlay", - "sbt-derivation": "sbt-derivation", - "sconfig-src": "sconfig-src", - "sentinel-src": "sentinel-src", - "sifchain-src": "sifchain-src", - "stargaze-src": "stargaze-src", - "stoml-src": "stoml-src", - "stride-consumer-src": "stride-consumer-src", - "stride-src": "stride-src", - "umee-src": "umee-src", - "wasmd-src": "wasmd-src", - "wasmd_next-src": "wasmd_next-src", - "wasmvm_1-src": "wasmvm_1-src", - "wasmvm_1_1_1-src": "wasmvm_1_1_1-src", - "wasmvm_1_1_2-src": "wasmvm_1_1_2-src", - "wasmvm_1_2_3-src": "wasmvm_1_2_3-src", - "wasmvm_1_2_4-src": "wasmvm_1_2_4-src", - "wasmvm_1_3_0-src": "wasmvm_1_3_0-src", - "wasmvm_1_5_0-src": "wasmvm_1_5_0-src", - "wasmvm_1_beta7-src": "wasmvm_1_beta7-src" - }, - "locked": { - "lastModified": 1703683453, - "narHash": "sha256-uMgdhucQZTNFPa+5v3GXnhFEgXsIIytx16Lp+qI4/tI=", - "owner": "informalsystems", - "repo": "cosmos.nix", - "rev": "8429e606fa6b968f6f01752f702b7ba7ce9a9992", - "type": "github" - }, - "original": { - "owner": "informalsystems", - "repo": "cosmos.nix", - "type": "github" - } - }, - "cosmos-sdk-src": { - "flake": false, - "locked": { - "lastModified": 1658846655, - "narHash": "sha256-Xs83vbgt4+YH2LRJx7692nIjRBr5QCYoUHI17njsjlw=", - "owner": "cosmos", - "repo": "cosmos-sdk", - "rev": "a1143138716b64bc4fa0aa53c0f0fa59eb675bb7", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v0.46.0", - "repo": "cosmos-sdk", - "type": "github" - } - }, - "cosmwasm-src": { - "flake": false, - "locked": { - "lastModified": 1698745412, - "narHash": "sha256-41s5jLFzw9Jo+dirAVOad1dtUqCBY6rIz/6TRc0frMw=", - "owner": "CosmWasm", - "repo": "cosmwasm", - "rev": "89891f0bb2de2c83d00600208695d0d5e1b617ac", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.5.0", - "repo": "cosmwasm", - "type": "github" - } - }, - "crescent-src": { - "flake": false, - "locked": { - "lastModified": 1647869429, - "narHash": "sha256-c1xiTB/HgtQJSwD3ccFQIoSHPbJK6rf1nSjnM3r0oCE=", - "owner": "crescent-network", - "repo": "crescent", - "rev": "01980cfd06b06786109eaba78c154e6db1adc3d6", - "type": "github" - }, - "original": { - "owner": "crescent-network", - "ref": "v1.0.0-rc3", - "repo": "crescent", - "type": "github" - } - }, - "cw-plus-src": { - "flake": false, - "locked": { - "lastModified": 1700757493, - "narHash": "sha256-E5vkY+B4BDoTDtvuB+7Tm3k/5dCYPSjUujMWcgYsWf0=", - "owner": "CosmWasm", - "repo": "cw-plus", - "rev": "d33824679d5b91ca0b4615a8dede7e0028947486", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.1.2", - "repo": "cw-plus", - "type": "github" - } - }, - "evmos-src": { - "flake": false, - "locked": { - "lastModified": 1702504794, - "narHash": "sha256-ECXXQ0hx/MXascMP6aXf880zts/dNPpQM9jOCIHTLZQ=", - "owner": "evmos", - "repo": "evmos", - "rev": "6f94d2002c01b7f7908a69089ed6996ac2bb450c", - "type": "github" - }, - "original": { - "owner": "evmos", - "ref": "v16.0.0-rc4", - "repo": "evmos", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" - }, - "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", - "type": "github" - }, - "original": { - "id": "flake-parts", - "type": "indirect" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gaia-main-src": { - "flake": false, - "locked": { - "lastModified": 1702388853, - "narHash": "sha256-1O8ncSd0mUNEUHSTi2U9d21Dv1yszQKohjp/AS6IxcU=", - "owner": "cosmos", - "repo": "gaia", - "rev": "2dc2b82ea9da34b3c4823458919004f1a583a597", - "type": "github" - }, - "original": { - "owner": "cosmos", - "repo": "gaia", - "type": "github" - } - }, - "gaia10-src": { - "flake": false, - "locked": { - "lastModified": 1688401730, - "narHash": "sha256-F72AxDI1OdleE8If5s4HJbORqMsDVsdEO5q7nrK07E8=", - "owner": "cosmos", - "repo": "gaia", - "rev": "a2b14cdd568273e12b80579b4e22681df95b4cb9", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v10.0.2", - "repo": "gaia", - "type": "github" - } - }, - "gaia11-src": { - "flake": false, - "locked": { - "lastModified": 1690464504, - "narHash": "sha256-bIegGSPDdDRbznfgsrojsGCwCPSesNknpffTFskc7fE=", - "owner": "cosmos", - "repo": "gaia", - "rev": "541a8d86af28231c767d6db52eb88ba9496ad0c4", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v11.0.0", - "repo": "gaia", - "type": "github" - } - }, - "gaia12-src": { - "flake": false, - "locked": { - "lastModified": 1692870038, - "narHash": "sha256-KqpkazhGGQWzvHiiwCiE7ciA8+L2t2HgxN8270zuGd0=", - "owner": "cosmos", - "repo": "gaia", - "rev": "6f8067d76ce30996f83645862153ccfaf5f13dd1", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v12.0.0", - "repo": "gaia", - "type": "github" - } - }, - "gaia13-src": { - "flake": false, - "locked": { - "lastModified": 1699370179, - "narHash": "sha256-bvJ33JL1Fr7ilnnYEjrjnbS/dbFkyhZ2uq6u39CeTa0=", - "owner": "cosmos", - "repo": "gaia", - "rev": "2406abb61856b61904ff06c7be2a355babcc3dfc", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v13.0.2", - "repo": "gaia", - "type": "github" - } - }, - "gaia14-src": { - "flake": false, - "locked": { - "lastModified": 1700067649, - "narHash": "sha256-7AnaIy/SElf/Uj2xTbHzLSgPY68SgQqqJZ2BPmt6czo=", - "owner": "cosmos", - "repo": "gaia", - "rev": "189b57be735d64d0dbf0945717b49017a1beb11e", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v14.0.0", - "repo": "gaia", - "type": "github" - } - }, - "gaia5-src": { - "flake": false, - "locked": { - "lastModified": 1634231239, - "narHash": "sha256-NfR9GRBNBlm5hB3lFea+Vlf4dkapZIZg0sZuyOX2cn8=", - "owner": "cosmos", - "repo": "gaia", - "rev": "b72cc994f7156c8a8991e6beed2dde84ad274588", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v5.0.8", - "repo": "gaia", - "type": "github" - } - }, - "gaia6-ordered-src": { - "flake": false, - "locked": { - "lastModified": 1648034337, - "narHash": "sha256-yw3WUCLRvn46xlWAnk6nBmvc3T91aryvBcOOfJ2ocPA=", - "owner": "informalsystems", - "repo": "gaia", - "rev": "d9e61fb98308dea2e02e8c6c6a9ab969dc240cc7", - "type": "github" - }, - "original": { - "owner": "informalsystems", - "ref": "v6.0.4-ordered", - "repo": "gaia", - "type": "github" - } - }, - "gaia6-src": { - "flake": false, - "locked": { - "lastModified": 1646904235, - "narHash": "sha256-JdD0DTdMo05ggGvpHN5hugEEtGA0/WQ4bhbryDlfGXo=", - "owner": "cosmos", - "repo": "gaia", - "rev": "305668ab9d962431c79d718bb0ffdeec77a46439", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v6.0.4", - "repo": "gaia", - "type": "github" - } - }, - "gaia7-src": { - "flake": false, - "locked": { - "lastModified": 1665762684, - "narHash": "sha256-hsDqDASwTPIb1BGOqa9nu4C5Y5q3hBoXYhkAFY7B9Cs=", - "owner": "cosmos", - "repo": "gaia", - "rev": "5db8fcc9a229730f5115bed82d0f85b6db7184b4", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v7.1.0", - "repo": "gaia", - "type": "github" - } - }, - "gaia8-src": { - "flake": false, - "locked": { - "lastModified": 1676667875, - "narHash": "sha256-8XPcJRQEQDtTbGFg0pWexkNdWESn1FoKvz4T2Z8UPDw=", - "owner": "cosmos", - "repo": "gaia", - "rev": "890ab3aa2e5788537b0d2ebc9bafdc968340e0e5", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v8.0.1", - "repo": "gaia", - "type": "github" - } - }, - "gaia9-src": { - "flake": false, - "locked": { - "lastModified": 1681924944, - "narHash": "sha256-UIM6yfqs1yZZ2BO/bBB43pPYSW1IzaYsk2f500tDYzA=", - "owner": "cosmos", - "repo": "gaia", - "rev": "05b6b87d3c9121e933eab437772ea56f33ae268f", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v9.0.3", - "repo": "gaia", - "type": "github" - } - }, - "gex-src": { - "flake": false, - "locked": { - "lastModified": 1697704475, - "narHash": "sha256-lgJVxn7Q2I8TBdvbzyn7bl1MN5StEw3NvRzCvBFFuB8=", - "owner": "cosmos", - "repo": "gex", - "rev": "233d335dc9e8c89fb318d1081fae74435f6cac11", - "type": "github" - }, - "original": { - "owner": "cosmos", - "repo": "gex", - "rev": "233d335dc9e8c89fb318d1081fae74435f6cac11", - "type": "github" - } - }, - "gomod2nix": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1702956934, - "narHash": "sha256-f1NuMA2mZ3Chw2CjlUkRAzNgDw0TYyj1i5YZJRByDdo=", - "owner": "JonathanLorimer", - "repo": "gomod2nix", - "rev": "6d2fce6003d08eee42648f2931de8449d3de1f5f", - "type": "github" - }, - "original": { - "owner": "JonathanLorimer", - "ref": "jonathan/update-go", - "repo": "gomod2nix", - "type": "github" - } - }, - "gomod2nix_2": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1701687253, - "narHash": "sha256-qJCMxIKWXonJODPF2oV7mCd0xu7VYVenTucrY0bizto=", - "owner": "nix-community", - "repo": "gomod2nix", - "rev": "001bbfa22e2adeb87c34c6015e5694e88721cabe", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "gomod2nix", - "type": "github" - } - }, - "hermes-src": { - "flake": false, - "locked": { - "lastModified": 1702629809, - "narHash": "sha256-JTZMp4By/pGsMdKzfi4H1LQS1RKYQHBq5NEju5ADX/s=", - "owner": "informalsystems", - "repo": "hermes", - "rev": "ab732666fe35de129ada98731280d03411f6375f", - "type": "github" - }, - "original": { - "owner": "informalsystems", - "ref": "v1.7.4", - "repo": "hermes", - "type": "github" - } - }, - "ibc-go-v2-src": { - "flake": false, - "locked": { - "lastModified": 1663274791, - "narHash": "sha256-LuJvlXmGRyJAiM6+uk+NuamjIsEqMqF20twBmB0p8+k=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "e45fa32d1cf91c36807428f688d8e2ec88947940", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v2.4.1", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v3-src": { - "flake": false, - "locked": { - "lastModified": 1663683283, - "narHash": "sha256-Er24B1unLYR/gG4JSrV+vZ/cPD6t7OFvtqp7AJCtDSE=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "250157f3fd40abaf9f8f1452cd78bf3304c38c72", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v3.3.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v4-src": { - "flake": false, - "locked": { - "lastModified": 1667809128, - "narHash": "sha256-R1/AH6laXdaMftgwnV4t/pL3QoKnZ1UaBGoqOipOvQI=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "ecb845d5e43f53decf48f8ed88c7847a9a4375cb", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v4.2.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v5-src": { - "flake": false, - "locked": { - "lastModified": 1668024626, - "narHash": "sha256-+Z78PyGODLr2Y5G8evubsoQE3tyUcxCHJDsLXKTmdlI=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "c0acd5bd1778f2b7ecdf593006f56bd3e273bd49", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v5.1.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v6-src": { - "flake": false, - "locked": { - "lastModified": 1671525236, - "narHash": "sha256-V8kUNwgNfx1tZJazlnaTF6wBb7ztueh1KrAGgiP8hCM=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "d34cef7e075dda1a24a0a3e9b6d3eff406cc606c", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v6.1.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v7-src": { - "flake": false, - "locked": { - "lastModified": 1693509694, - "narHash": "sha256-umh/ckDALt0ugXwN8glcaCkGfAQvXY7S3Jd95Do2XeA=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "c75650a1a037a9fecba5a9005df380f707520ff7", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v7.3.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v8-channel-upgrade-src": { - "flake": false, - "locked": { - "lastModified": 1695726576, - "narHash": "sha256-mM6h1KAi8lQUrJakxI6f8WI+vpmBhCnAysk3hTZBI7M=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "63c30108f0ecf954108cf51f50f3d36ec58c7e51", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "04-channel-upgrades-alpha.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-go-v8-src": { - "flake": false, - "locked": { - "lastModified": 1699602904, - "narHash": "sha256-BcP3y874QviVsV+04p9CioolyvmWH82ORbb5EB2GyRI=", - "owner": "cosmos", - "repo": "ibc-go", - "rev": "2551dea41cd3c512845007ca895c8402afa9b79f", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v8.0.0", - "repo": "ibc-go", - "type": "github" - } - }, - "ibc-rs-src": { - "flake": false, - "locked": { - "lastModified": 1661171856, - "narHash": "sha256-M9KsPQdvyTArDe3sTi29+gfs69KHtpoNYLgI7IHYo9U=", - "owner": "informalsystems", - "repo": "ibc-rs", - "rev": "ed4dd8c8b4ebd695730de2a1c69f3011cb179352", - "type": "github" - }, - "original": { - "owner": "informalsystems", - "ref": "v1.0.0", - "repo": "ibc-rs", - "type": "github" - } - }, - "ica-src": { - "flake": false, - "locked": { - "lastModified": 1695202199, - "narHash": "sha256-8RwZSnqqZzVjQsSMTckNhmTy3VYyubVmgE/hU6ntq9M=", - "owner": "cosmos", - "repo": "interchain-accounts-demo", - "rev": "9d9ec3f4f7e37e9d2a1c7f4a199e7d18c17e14db", - "type": "github" - }, - "original": { - "owner": "cosmos", - "repo": "interchain-accounts-demo", - "type": "github" - } - }, - "ignite-cli-src": { - "flake": false, - "locked": { - "lastModified": 1662991379, - "narHash": "sha256-sVgIjecswxD8OBXRXoVk2BNsTXzUcYAb6QZk0rVrQqo=", - "owner": "ignite", - "repo": "cli", - "rev": "21c6430cfcc17c69885524990c448d4a3f56461c", - "type": "github" - }, - "original": { - "owner": "ignite", - "ref": "v0.24.0", - "repo": "cli", - "type": "github" - } - }, - "interchain-security-src": { - "flake": false, - "locked": { - "lastModified": 1700577019, - "narHash": "sha256-adBzn51PKoRsCL9gIzC5Tcqmu7u3GjxTcDj2jpZ/da8=", - "owner": "cosmos", - "repo": "interchain-security", - "rev": "03aada4af3243dbf739a12adfacc7b37232df694", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "feat/ics-misbehaviour-handling", - "repo": "interchain-security", - "type": "github" - } - }, - "iris-src": { - "flake": false, - "locked": { - "lastModified": 1618986686, - "narHash": "sha256-1nPJOuYeGjzBYFCS0IiC5j9TJd5KVa9IL0kROks328E=", - "owner": "irisnet", - "repo": "irishub", - "rev": "53e156b2ee7eeb0b9d5b263066d0d3c88a1af736", - "type": "github" - }, - "original": { - "owner": "irisnet", - "ref": "v1.1.1", - "repo": "irishub", - "type": "github" - } - }, - "ixo-src": { - "flake": false, - "locked": { - "lastModified": 1645476442, - "narHash": "sha256-Ewp9UyoH6z7YGrcXVpYJveRvDq02c1mNZj2hzlOoW8s=", - "owner": "ixofoundation", - "repo": "ixo-blockchain", - "rev": "2bef5d79205057be71677837dc1174be848e13e9", - "type": "github" - }, - "original": { - "owner": "ixofoundation", - "ref": "v0.18.0-rc1", - "repo": "ixo-blockchain", - "type": "github" - } - }, - "juno-src": { - "flake": false, - "locked": { - "lastModified": 1697166503, - "narHash": "sha256-z9TOeDyUnn1T8Z662XqQJ9ydVIKKB54YISt7ms4xvos=", - "owner": "CosmosContracts", - "repo": "juno", - "rev": "48507ed9b83511089cbf1fdc5bae54cae4a7f4b2", - "type": "github" - }, - "original": { - "owner": "CosmosContracts", - "ref": "v17.1.1", - "repo": "juno", - "type": "github" - } - }, - "migaloo-src": { - "flake": false, - "locked": { - "lastModified": 1699273936, - "narHash": "sha256-O+vGWFnV3+bvXinxl1QjVyDnQskp5H1VnlL+TaMfiSs=", - "owner": "White-Whale-Defi-Platform", - "repo": "migaloo-chain", - "rev": "de98de2dd96917ae1ab79161d573fc0b4ee1facf", - "type": "github" - }, - "original": { - "owner": "White-Whale-Defi-Platform", - "ref": "v3.0.2", - "repo": "migaloo-chain", - "type": "github" - } - }, - "namada-src": { - "flake": false, - "locked": { - "lastModified": 1702488720, - "narHash": "sha256-WyIVffqszY3rz3ClQJlpDaexLGQk8pVK+Y3k/D9Lvxg=", - "owner": "anoma", - "repo": "namada", - "rev": "468d3d3bcadd2bd11760855d2bbfcc0b4ce27e14", - "type": "github" - }, - "original": { - "owner": "anoma", - "ref": "v0.28.1", - "repo": "namada", - "type": "github" - } - }, - "neutron-src": { - "flake": false, - "locked": { - "lastModified": 1701174344, - "narHash": "sha256-NuoOlrciBeL2f/A7wlQBqYlYJhSYucXRhLgxdasfyhI=", - "owner": "neutron-org", - "repo": "neutron", - "rev": "e605ed3db4381994ee8185ba4a0ff0877d34e67f", - "type": "github" - }, - "original": { - "owner": "neutron-org", - "ref": "v2.0.0", - "repo": "neutron", - "type": "github" - } - }, - "nix-std": { - "locked": { - "lastModified": 1701658249, - "narHash": "sha256-KIt1TUuBvldhaVRta010MI5FeQlB8WadjqljybjesN0=", - "owner": "chessai", - "repo": "nix-std", - "rev": "715db541ffff4194620e48d210b76f73a74b5b5d", - "type": "github" - }, - "original": { - "owner": "chessai", - "repo": "nix-std", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1702272962, - "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-lib_2": { - "locked": { - "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1681358109, - "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1674990008, - "narHash": "sha256-4zOyp+hFW2Y7imxIpZqZGT8CEqKmDjwgfD6BzRUE0mQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d2bbcbe6c626d339b25a4995711f07625b508214", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1703438236, - "narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "osmosis-src": { - "flake": false, - "locked": { - "lastModified": 1702398856, - "narHash": "sha256-4uLO7izIZ8JvKTfUXbYkxQFpIjwMEcO81WvhklrzI9E=", - "owner": "osmosis-labs", - "repo": "osmosis", - "rev": "b0aee0006ce55d0851773084bd7880db7e32ad70", - "type": "github" - }, - "original": { - "owner": "osmosis-labs", - "ref": "v21.0.0", - "repo": "osmosis", - "type": "github" - } - }, - "provenance-src": { - "flake": false, - "locked": { - "lastModified": 1699901286, - "narHash": "sha256-dTX3kg2QUsC9SwsaommP4IFgIdQgWZrGQNtp/B+fzys=", - "owner": "provenance-io", - "repo": "provenance", - "rev": "91b0813de2f93d03cefe8efb226dc32f02690840", - "type": "github" - }, - "original": { - "owner": "provenance-io", - "ref": "v1.17.0", - "repo": "provenance", - "type": "github" - } - }, - "regen-src": { - "flake": false, - "locked": { - "lastModified": 1645832054, - "narHash": "sha256-lDb0/Bw4hAX71jsCQJUju1mKYNacWEVezx6+KdIdu6Q=", - "owner": "regen-network", - "repo": "regen-ledger", - "rev": "5fb6268ed18a488ab88fb3bfa4b84e10892a7562", - "type": "github" - }, - "original": { - "owner": "regen-network", - "ref": "v3.0.0", - "repo": "regen-ledger", - "type": "github" - } - }, - "relayer-src": { - "flake": false, - "locked": { - "lastModified": 1635197290, - "narHash": "sha256-xD+xZG4Gb6557y/jkXTGdbt8qJ6izMgC4H3uo2/j5vU=", - "owner": "cosmos", - "repo": "relayer", - "rev": "7797aa103af68faa4269af586fe6df1d30e91d4a", - "type": "github" - }, - "original": { - "owner": "cosmos", - "ref": "v1.0.0", - "repo": "relayer", - "type": "github" - } - }, - "root": { - "inputs": { - "cosmos": "cosmos", - "flake-parts": "flake-parts_2", - "gomod2nix": "gomod2nix_2", - "nixpkgs": "nixpkgs_4" - } - }, - "rust-overlay": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1702347444, - "narHash": "sha256-ueDw7aQf4Xyk69XnDD0YNWDlFdlOgJGPeWFa7uu/cfw=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "bc13176f27cf3be724d18924b4f6aa47686ca2e3", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "sbt-derivation": { - "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1698464090, - "narHash": "sha256-Pnej7WZIPomYWg8f/CZ65sfW85IfIUjYhphMMg7/LT0=", - "owner": "zaninime", - "repo": "sbt-derivation", - "rev": "6762cf2c31de50efd9ff905cbcc87239995a4ef9", - "type": "github" - }, - "original": { - "owner": "zaninime", - "repo": "sbt-derivation", - "type": "github" - } - }, - "sconfig-src": { - "flake": false, - "locked": { - "lastModified": 1679585941, - "narHash": "sha256-ywh9IcqMWbRHqJkGJezcDCvfbBYNJH7ualKvPJQRcHA=", - "owner": "freshautomations", - "repo": "sconfig", - "rev": "41450b55f3b37b4b7a0fdf4a69c707619dbeb47c", - "type": "github" - }, - "original": { - "owner": "freshautomations", - "repo": "sconfig", - "type": "github" - } - }, - "sentinel-src": { - "flake": false, - "locked": { - "lastModified": 1647195309, - "narHash": "sha256-+ZobsjLNxVL3+zi6OEFQhff6Gbd9kng8B0haqcOoiP0=", - "owner": "sentinel-official", - "repo": "hub", - "rev": "7001dc8bc4517efa33cfcc83e8b127528b5bdf2e", - "type": "github" - }, - "original": { - "owner": "sentinel-official", - "ref": "v0.9.0-rc0", - "repo": "hub", - "type": "github" - } - }, - "sifchain-src": { - "flake": false, - "locked": { - "lastModified": 1648486445, - "narHash": "sha256-n5fmWtdrc0Rhs6Uo+zjcSXmyEFVIsA5L9dlrbRXGDmU=", - "owner": "Sifchain", - "repo": "sifnode", - "rev": "269cfadf6a4c08879247c2b8373323ae7239a425", - "type": "github" - }, - "original": { - "owner": "Sifchain", - "ref": "v0.12.1", - "repo": "sifnode", - "type": "github" - } - }, - "stargaze-src": { - "flake": false, - "locked": { - "lastModified": 1645539964, - "narHash": "sha256-5I5pdnBJHwNaI2Soet+zH3aH+pUbYdC9TgHBjOd1TmA=", - "owner": "public-awesome", - "repo": "stargaze", - "rev": "6ee57f18714a6d94cc6205afcd1af2ab655f8f0f", - "type": "github" - }, - "original": { - "owner": "public-awesome", - "ref": "v3.0.0", - "repo": "stargaze", - "type": "github" - } - }, - "stoml-src": { - "flake": false, - "locked": { - "lastModified": 1666796497, - "narHash": "sha256-Adjag1/Hd2wrar2/anD6jQEMDvUc2TOIG7DlEgxpTXc=", - "owner": "freshautomations", - "repo": "stoml", - "rev": "4b2cd09b5795a54fddc215f0d24e24071894b3cf", - "type": "github" - }, - "original": { - "owner": "freshautomations", - "repo": "stoml", - "type": "github" - } - }, - "stride-consumer-src": { - "flake": false, - "locked": { - "lastModified": 1689464372, - "narHash": "sha256-DByig9ISs9x9Kvakc8LFL558VKhM+UBiaESWgyVzI0w=", - "owner": "Stride-Labs", - "repo": "stride", - "rev": "bbf0bb7f52878f3205c76bb1e96662fe7bd7af8d", - "type": "github" - }, - "original": { - "owner": "Stride-Labs", - "ref": "v12.1.0", - "repo": "stride", - "type": "github" - } - }, - "stride-src": { - "flake": false, - "locked": { - "lastModified": 1679819302, - "narHash": "sha256-fdjnFHPBZNnhDyVoMuPfqNb6YUYRdcMO73FlZHjIuzA=", - "owner": "Stride-Labs", - "repo": "stride", - "rev": "3c69e7644859981b1fd9313eb1f0c5e5886e4a0d", - "type": "github" - }, - "original": { - "owner": "Stride-Labs", - "ref": "v8.0.0", - "repo": "stride", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "umee-src": { - "flake": false, - "locked": { - "lastModified": 1649261156, - "narHash": "sha256-hydRL/88fHCW/k7z7GoqAwvynZuvLEDLyA6A9Cm+6UY=", - "owner": "umee-network", - "repo": "umee", - "rev": "42f57545251ce5337dcc5fe4309520ead89183b9", - "type": "github" - }, - "original": { - "owner": "umee-network", - "ref": "v2.0.0", - "repo": "umee", - "type": "github" - } - }, - "wasmd-src": { - "flake": false, - "locked": { - "lastModified": 1669987561, - "narHash": "sha256-F0p555FEeA405tuLn82yUEbRZpJLs85GrUKvSrjTdjk=", - "owner": "CosmWasm", - "repo": "wasmd", - "rev": "a347ace2ff41539fe06c68168bc6f28d6ca9fa52", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v0.30.0", - "repo": "wasmd", - "type": "github" - } - }, - "wasmd_next-src": { - "flake": false, - "locked": { - "lastModified": 1682094944, - "narHash": "sha256-b+6XhBdKyQlrzsYxVRrDf4vHpv8GAJkGwHVfJ9sdf3U=", - "owner": "CosmWasm", - "repo": "wasmd", - "rev": "c2bb27d289f7f72f1471a4b33cb08fdfc8d66f63", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v0.40.0-rc.1", - "repo": "wasmd", - "type": "github" - } - }, - "wasmvm_1-src": { - "flake": false, - "locked": { - "lastModified": 1652698028, - "narHash": "sha256-4m64mPwFLz7aZEKVxM2lJQtX98BkhdKTZb3evpDOk/4=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "bc49a2f4842d023c0038798f343b56f3f0530646", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.0.0", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_1_1-src": { - "flake": false, - "locked": { - "lastModified": 1663600745, - "narHash": "sha256-9K/G7Wu/TfW4Z+lseEutXbdtr+A40nbVejBphegF5z4=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "3d791055751e428f93f54f64c2d20d20da2ff2a9", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.1.1", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_1_2-src": { - "flake": false, - "locked": { - "lastModified": 1681833975, - "narHash": "sha256-EbzMNkZUO94jEdX0WgAdy5qfhlCG3lpHpVHyT2FcSDw=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "4f84395b1c623483a3c7936c990c2f7e5dad70d8", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.1.2", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_2_3-src": { - "flake": false, - "locked": { - "lastModified": 1681831436, - "narHash": "sha256-GscUMJ0Tkg77S9IYA9komyKKoa1AyVXSSaU8hw3ZNwk=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "61e41ae2a80081224f469614a267b0ba2a2d305f", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.2.3", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_2_4-src": { - "flake": false, - "locked": { - "lastModified": 1685977963, - "narHash": "sha256-/GOvkKLQwsPms7h7yEZYLwbZn9Lzk5qQnBXXoZ/R6JM=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "ba491fe9a663e0b45728dd5f0c43f6a93c97f5fe", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.2.4", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_3_0-src": { - "flake": false, - "locked": { - "lastModified": 1689589428, - "narHash": "sha256-rsTYvbkYpDkUE4IvILdSL3hXMgAWxz5ltGotJB2t1e4=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "71a9c0dc0ecf9623148e82facb3564fbbf0a896f", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.3.0", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_5_0-src": { - "flake": false, - "locked": { - "lastModified": 1698746477, - "narHash": "sha256-l0cNF0YjviEl/JLJ4VdvDtIGuAYyFfncVo83ROfQFD8=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "2041b184c146f278157d195361bc6cc6b56cc9d4", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.5.0", - "repo": "wasmvm", - "type": "github" - } - }, - "wasmvm_1_beta7-src": { - "flake": false, - "locked": { - "lastModified": 1646675433, - "narHash": "sha256-tt9aAPLxtIRsG1VFM1YAIHSotuBl170EiBcHSWTtARI=", - "owner": "CosmWasm", - "repo": "wasmvm", - "rev": "f7015565a59255cd09ebfcbf9345f3c87666fedd", - "type": "github" - }, - "original": { - "owner": "CosmWasm", - "ref": "v1.0.0-beta7", - "repo": "wasmvm", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} \ No newline at end of file diff --git a/flake.nix b/flake.nix deleted file mode 100644 index fd77c004f..000000000 --- a/flake.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ - description = "composable-cosmos"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - gomod2nix = { - url = github:nix-community/gomod2nix; - inputs.nixpkgs.follows = "nixpkgs"; - }; - cosmos = { - url = "github:informalsystems/cosmos.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - outputs = inputs @ { - flake-parts, - gomod2nix, - cosmos, - self, - ... - }: - flake-parts.lib.mkFlake {inherit inputs;} { - imports = [ - ]; - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - perSystem = { - config, - self', - inputs', - pkgs, - system, - ... - }: let - inherit (inputs.gomod2nix.legacyPackages.${system}) buildGoApplication mkGoEvn gomod2nix; - libwasmvm = cosmos.packages.${system}.libwasmvm_1_5_0; - cosmwasm-check = cosmos.packages.${system}.cosmwasm-check; - cosmosLib = cosmos.lib {inherit pkgs cosmwasm-check;}; - in { - formatter = pkgs.alejandra; - devShells = { - default = pkgs.mkShell { - buildInputs = with pkgs; [ - bingo - gci - gnumake - go - delve - golangci-lint - gomod2nix - gotools - libwasmvm - ]; - }; - }; - - packages = rec { - centaurid = buildGoApplication rec { - pname = "centaurid"; - version = "v7.0.0"; - src = ./.; - subPackages = ["cmd/${pname}"]; - modules = ./gomod2nix.toml; - preFixup = '' - ${cosmosLib.wasmdPreFixupPhase libwasmvm pname} - ''; - checkPhase = "true"; - buildInputs = [libwasmvm]; - ldflags = '' - -X github.com/cosmos/cosmos-sdk/version.Name=centauri -X github.com/cosmos/cosmos-sdk/version.AppName=${pname} -X github.com/cosmos/cosmos-sdk/version.Version=${version} -X github.com/cosmos/cosmos-sdk/version.Commit=${self.rev or self.dirtyRev or "dirty"} -X github.com/cometbft/cometbft/version.TMCoreSemVer=v0.37.2 - ''; - }; - default = ci; - ci = pkgs.writeShellApplication { - name = "ci"; - text = '' - go get mvdan.cc/gofumpt - go get github.com/client9/misspell/cmd/misspell - go get golang.org/x/tools/cmd/goimports - make lint - nix fmt - go mod tidy - golangci-lint run --fix - gomod2nix - ''; - }; - }; - }; - }; -} From fd9785d53e83989e17877a168b566e5a9a0c1f73 Mon Sep 17 00:00:00 2001 From: rustdev Date: Thu, 7 Mar 2024 21:50:35 +0000 Subject: [PATCH 51/71] create a new chain upgrade handler for chain upgrade. --- app/app.go | 4 ++-- app/upgrades/v6_4_7/constants.go | 21 +++++++++++++++++++++ app/upgrades/v6_4_7/upgrade.go | 23 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v6_4_7/constants.go create mode 100644 app/upgrades/v6_4_7/upgrade.go diff --git a/app/app.go b/app/app.go index 9f71e5bfe..78be271d3 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades/v6_4_6" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_7" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -147,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_6.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_7.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_7/constants.go b/app/upgrades/v6_4_7/constants.go new file mode 100644 index 000000000..549c1e41e --- /dev/null +++ b/app/upgrades/v6_4_7/constants.go @@ -0,0 +1,21 @@ +package v6_4_7 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_6" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_7/upgrade.go b/app/upgrades/v6_4_7/upgrade.go new file mode 100644 index 000000000..682c58a62 --- /dev/null +++ b/app/upgrades/v6_4_7/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_7 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} From 7265629c18b3701647ceabb853a52406fc2eb945 Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 19 Mar 2024 16:30:10 +0000 Subject: [PATCH 52/71] introduce the validation to now allow timeout timestamp less then Xnanos --- custom/ibc-transfer/keeper/msg_server.go | 8 ++ .../v1beta1/ibctransfermiddleware.proto | 1 + .../types/ibctransfermiddleware.pb.go | 97 +++++++++++++------ .../types/parachain_token_info.pb.go | 2 +- 4 files changed, 77 insertions(+), 31 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index 12cf61fd7..991bc55b8 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -29,6 +30,9 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ if params.ChannelFees != nil && len(params.ChannelFees) > 0 { channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel) if channelFee != nil { + if channelFee.MinTimeoutTimestamp > 0 && msg.TimeoutTimestamp < channelFee.MinTimeoutTimestamp { + return nil, ErrInvalidTimeoutTimestamp + } coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) if coin != nil { return &types.MsgTransferResponse{}, nil @@ -88,3 +92,7 @@ func findCoinByDenom(allowedTokens []*ibctransfermiddlewaretypes.CoinItem, denom } return nil // If the denom is not found } + +var ( + ErrInvalidTimeoutTimestamp = fmt.Errorf("proto: incorrect timeout timestamp found during ibc transfer") +) diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto index 007daf732..1f15c0510 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -19,6 +19,7 @@ message ChannelFee{ string channel = 1; repeated CoinItem allowed_tokens = 2; string fee_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + uint64 min_timeout_timestamp = 4; } message CoinItem{ diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go index 2d0ea9016..67340cec9 100644 --- a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -73,9 +73,10 @@ func (m *Params) GetChannelFees() []*ChannelFee { } type ChannelFee struct { - Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` - AllowedTokens []*CoinItem `protobuf:"bytes,2,rep,name=allowed_tokens,json=allowedTokens,proto3" json:"allowed_tokens,omitempty"` - FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty"` + Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` + AllowedTokens []*CoinItem `protobuf:"bytes,2,rep,name=allowed_tokens,json=allowedTokens,proto3" json:"allowed_tokens,omitempty"` + FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty"` + MinTimeoutTimestamp uint64 `protobuf:"varint,4,opt,name=min_timeout_timestamp,json=minTimeoutTimestamp,proto3" json:"min_timeout_timestamp,omitempty"` } func (m *ChannelFee) Reset() { *m = ChannelFee{} } @@ -132,6 +133,13 @@ func (m *ChannelFee) GetFeeAddress() string { return "" } +func (m *ChannelFee) GetMinTimeoutTimestamp() uint64 { + if m != nil { + return m.MinTimeoutTimestamp + } + return 0 +} + type CoinItem struct { MinFee types.Coin `protobuf:"bytes,1,opt,name=min_fee,json=minFee,proto3" json:"min_fee"` Percentage int64 `protobuf:"varint,2,opt,name=percentage,proto3" json:"percentage,omitempty"` @@ -195,33 +203,35 @@ func init() { } var fileDescriptor_1193893bc248bc1b = []byte{ - // 406 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0xeb, 0xd3, 0x30, - 0x18, 0xc6, 0x9b, 0x0d, 0x36, 0x97, 0xaa, 0x60, 0x19, 0xd8, 0x0d, 0x8c, 0x63, 0xa7, 0x22, 0xd8, - 0xb2, 0x29, 0x88, 0x07, 0x0f, 0x4e, 0x11, 0xbc, 0x49, 0x15, 0x44, 0x2f, 0x25, 0x6d, 0xdf, 0xd6, - 0x60, 0x93, 0x94, 0x24, 0x6c, 0xfa, 0x2d, 0xfc, 0x18, 0x1e, 0x3d, 0x78, 0xf4, 0x03, 0xec, 0x38, - 0x3c, 0x79, 0x12, 0xd9, 0x0e, 0x7e, 0x0d, 0x69, 0x9b, 0x39, 0x85, 0x09, 0xfe, 0x2f, 0x6d, 0xde, - 0xf7, 0xd7, 0xe7, 0xe9, 0x93, 0xbc, 0xc1, 0x8f, 0x33, 0xc9, 0x6b, 0xa9, 0x69, 0x5a, 0x41, 0xc4, - 0xd2, 0xcc, 0x28, 0x2a, 0x74, 0x01, 0x8a, 0xb3, 0x3c, 0xaf, 0x60, 0x43, 0x15, 0x44, 0xeb, 0x45, - 0x0a, 0x86, 0x2e, 0xce, 0xd3, 0xb0, 0x56, 0xd2, 0x48, 0x2f, 0x38, 0xb9, 0x84, 0xe7, 0xbf, 0xb3, - 0x2e, 0xd3, 0x71, 0x29, 0x4b, 0xd9, 0x8a, 0xa2, 0x66, 0xd5, 0xe9, 0xa7, 0x93, 0x4c, 0x6a, 0x2e, - 0x75, 0xd2, 0x81, 0xae, 0xb0, 0x88, 0x74, 0x55, 0x94, 0x52, 0x7d, 0xca, 0x92, 0x49, 0x26, 0x2c, - 0xbf, 0x46, 0x39, 0x13, 0x32, 0x6a, 0x9f, 0xb6, 0x75, 0xdd, 0x4a, 0xb8, 0x2e, 0xa3, 0xf5, 0xa2, - 0x79, 0x75, 0x60, 0x4e, 0xf1, 0xe0, 0x19, 0x55, 0x94, 0x6b, 0xef, 0x25, 0xbe, 0x9c, 0xbd, 0xa1, - 0x42, 0x40, 0x95, 0x14, 0x00, 0xda, 0x47, 0xb3, 0x7e, 0xe0, 0x2e, 0xef, 0x86, 0xff, 0xbb, 0x8f, - 0xf0, 0x51, 0xa7, 0x7e, 0x02, 0x10, 0xbb, 0xd9, 0xef, 0xb5, 0x9e, 0x7f, 0x41, 0x18, 0x9f, 0x98, - 0xe7, 0xe3, 0xa1, 0xa5, 0x3e, 0x9a, 0xa1, 0x60, 0x14, 0x1f, 0x4b, 0xef, 0x15, 0xbe, 0x4a, 0xab, - 0x4a, 0x6e, 0x20, 0x4f, 0x8c, 0x7c, 0x0b, 0x42, 0xfb, 0xbd, 0x36, 0xc3, 0xf2, 0x02, 0x19, 0x24, - 0x13, 0x4f, 0x0d, 0xf0, 0xf8, 0x8a, 0x75, 0x7a, 0xd1, 0x1a, 0x79, 0xf7, 0xb1, 0x5b, 0x00, 0x24, - 0x34, 0xcf, 0x15, 0x68, 0xed, 0xf7, 0x9b, 0x1f, 0xaf, 0xfc, 0xaf, 0x9f, 0x6f, 0x8f, 0xed, 0xc9, - 0x3e, 0xec, 0xc8, 0x73, 0xa3, 0x98, 0x28, 0x63, 0x5c, 0x00, 0xd8, 0xce, 0x9c, 0xe1, 0x4b, 0x47, - 0x57, 0xef, 0x01, 0x1e, 0x72, 0x26, 0x9a, 0xf3, 0x69, 0xb3, 0xbb, 0xcb, 0x49, 0x68, 0xf5, 0xcd, - 0x2c, 0xfe, 0x4a, 0xb1, 0x1a, 0x6d, 0xbf, 0xdf, 0x74, 0x3e, 0xfe, 0xfc, 0x74, 0x0b, 0xc5, 0x03, - 0xce, 0x44, 0xb3, 0x75, 0x82, 0x71, 0x0d, 0x2a, 0x03, 0x61, 0x68, 0x09, 0x7e, 0x6f, 0x86, 0x82, - 0x7e, 0xfc, 0x47, 0x67, 0x75, 0x6f, 0xbb, 0x27, 0x68, 0xb7, 0x27, 0xe8, 0xc7, 0x9e, 0xa0, 0x0f, - 0x07, 0xe2, 0xec, 0x0e, 0xc4, 0xf9, 0x76, 0x20, 0xce, 0xeb, 0x1b, 0xef, 0xfe, 0x71, 0x15, 0xcd, - 0xfb, 0x1a, 0x74, 0x3a, 0x68, 0x87, 0x79, 0xe7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xef, - 0x13, 0x3a, 0xbb, 0x02, 0x00, 0x00, + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x8b, 0xd4, 0x30, + 0x18, 0xc6, 0x27, 0x3b, 0xcb, 0xac, 0x9b, 0x51, 0xc1, 0xba, 0x62, 0x76, 0xc1, 0x38, 0xcc, 0xa9, + 0x08, 0xb6, 0x4c, 0x15, 0xc4, 0x83, 0x07, 0x47, 0x11, 0xbc, 0x49, 0x1d, 0x10, 0xbd, 0x94, 0xb4, + 0x7d, 0x5b, 0x83, 0x4d, 0x52, 0x92, 0xb8, 0xab, 0xdf, 0xc2, 0x8f, 0xe1, 0xd1, 0x83, 0x1f, 0x62, + 0x8f, 0x8b, 0x27, 0x4f, 0x22, 0x33, 0x07, 0xaf, 0x7e, 0x04, 0x69, 0x93, 0x71, 0x14, 0x46, 0x70, + 0x2f, 0x4d, 0xde, 0xf7, 0xd7, 0xe7, 0xc9, 0x93, 0x3f, 0xf8, 0x71, 0xa1, 0x44, 0xab, 0x0c, 0xcb, + 0x1b, 0x88, 0x79, 0x5e, 0x58, 0xcd, 0xa4, 0xa9, 0x40, 0x0b, 0x5e, 0x96, 0x0d, 0x9c, 0x30, 0x0d, + 0xf1, 0xf1, 0x2c, 0x07, 0xcb, 0x66, 0xdb, 0x69, 0xd4, 0x6a, 0x65, 0x55, 0x10, 0x6e, 0x5c, 0xa2, + 0xed, 0xff, 0x79, 0x97, 0xa3, 0x83, 0x5a, 0xd5, 0xaa, 0x17, 0xc5, 0xdd, 0xcc, 0xe9, 0x8f, 0x0e, + 0x0b, 0x65, 0x84, 0x32, 0x99, 0x03, 0xae, 0xf0, 0x88, 0xba, 0x2a, 0xce, 0x99, 0xd9, 0x64, 0x29, + 0x14, 0x97, 0x9e, 0x5f, 0x61, 0x82, 0x4b, 0x15, 0xf7, 0x5f, 0xdf, 0xba, 0xee, 0x25, 0xc2, 0xd4, + 0xf1, 0xf1, 0xac, 0x1b, 0x1c, 0x98, 0x32, 0x3c, 0x7a, 0xc6, 0x34, 0x13, 0x26, 0x78, 0x81, 0x2f, + 0x16, 0xaf, 0x99, 0x94, 0xd0, 0x64, 0x15, 0x80, 0x21, 0x68, 0x32, 0x0c, 0xc7, 0xc9, 0xdd, 0xe8, + 0x7f, 0xf7, 0x11, 0x3d, 0x72, 0xea, 0x27, 0x00, 0xe9, 0xb8, 0xf8, 0x3d, 0x37, 0xd3, 0x9f, 0x08, + 0xe3, 0x0d, 0x0b, 0x08, 0xde, 0xf3, 0x94, 0xa0, 0x09, 0x0a, 0xf7, 0xd3, 0x75, 0x19, 0xbc, 0xc4, + 0x97, 0x59, 0xd3, 0xa8, 0x13, 0x28, 0x33, 0xab, 0xde, 0x80, 0x34, 0x64, 0xa7, 0xcf, 0x90, 0x9c, + 0x23, 0x83, 0xe2, 0xf2, 0xa9, 0x05, 0x91, 0x5e, 0xf2, 0x4e, 0x8b, 0xde, 0x28, 0xb8, 0x8f, 0xc7, + 0x15, 0x40, 0xc6, 0xca, 0x52, 0x83, 0x31, 0x64, 0xd8, 0x2d, 0x3c, 0x27, 0x5f, 0x3e, 0xdf, 0x3e, + 0xf0, 0x27, 0xfb, 0xd0, 0x91, 0xe7, 0x56, 0x73, 0x59, 0xa7, 0xb8, 0x02, 0xf0, 0x9d, 0x20, 0xc1, + 0xd7, 0x04, 0x97, 0x99, 0xe5, 0x02, 0xd4, 0x5b, 0xdb, 0x8f, 0xc6, 0x32, 0xd1, 0x92, 0xdd, 0x09, + 0x0a, 0x77, 0xd3, 0xab, 0x82, 0xcb, 0x85, 0x63, 0x8b, 0x35, 0x9a, 0x72, 0x7c, 0x61, 0x9d, 0x24, + 0x78, 0x80, 0xf7, 0x3a, 0x7d, 0x05, 0xd0, 0xef, 0x77, 0x9c, 0x1c, 0x46, 0x7e, 0xcd, 0xee, 0xfe, + 0xfe, 0x4a, 0x3e, 0xdf, 0x3f, 0xfd, 0x76, 0x73, 0xf0, 0xf1, 0xc7, 0xa7, 0x5b, 0x28, 0x1d, 0x09, + 0x2e, 0xbb, 0xe3, 0xa2, 0x18, 0xb7, 0xa0, 0x0b, 0x90, 0x96, 0xd5, 0x40, 0x76, 0x26, 0x28, 0x1c, + 0xa6, 0x7f, 0x74, 0xe6, 0xf7, 0x4e, 0x97, 0x14, 0x9d, 0x2d, 0x29, 0xfa, 0xbe, 0xa4, 0xe8, 0xc3, + 0x8a, 0x0e, 0xce, 0x56, 0x74, 0xf0, 0x75, 0x45, 0x07, 0xaf, 0x6e, 0xbc, 0xfb, 0xc7, 0xf3, 0xb5, + 0xef, 0x5b, 0x30, 0xf9, 0xa8, 0x7f, 0x00, 0x77, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x20, + 0x7e, 0x4d, 0xef, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -281,6 +291,11 @@ func (m *ChannelFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinTimeoutTimestamp != 0 { + i = encodeVarintIbctransfermiddleware(dAtA, i, uint64(m.MinTimeoutTimestamp)) + i-- + dAtA[i] = 0x20 + } if len(m.FeeAddress) > 0 { i -= len(m.FeeAddress) copy(dAtA[i:], m.FeeAddress) @@ -396,6 +411,9 @@ func (m *ChannelFee) Size() (n int) { if l > 0 { n += 1 + l + sovIbctransfermiddleware(uint64(l)) } + if m.MinTimeoutTimestamp != 0 { + n += 1 + sovIbctransfermiddleware(uint64(m.MinTimeoutTimestamp)) + } return n } @@ -630,6 +648,25 @@ func (m *ChannelFee) Unmarshal(dAtA []byte) error { } m.FeeAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTimeoutTimestamp", wireType) + } + m.MinTimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIbctransfermiddleware + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinTimeoutTimestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipIbctransfermiddleware(dAtA[iNdEx:]) diff --git a/x/transfermiddleware/types/parachain_token_info.pb.go b/x/transfermiddleware/types/parachain_token_info.pb.go index 854ea11c0..ea33c7e44 100644 --- a/x/transfermiddleware/types/parachain_token_info.pb.go +++ b/x/transfermiddleware/types/parachain_token_info.pb.go @@ -28,7 +28,7 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ParachainIBCTokenInfo represents information about transferable IBC tokens -// from Parachain(Substrate based network). +// from Parachain. type ParachainIBCTokenInfo struct { // ibc_denom is the denomination of the ibced token transferred from the // dotsama chain. From 290f193e47ad406ebabcfa1586f9daa53fd95ae8 Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 19 Mar 2024 16:46:50 +0000 Subject: [PATCH 53/71] fix lint --- custom/ibc-transfer/keeper/msg_server.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index 991bc55b8..bb9b825f8 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -31,7 +31,7 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel) if channelFee != nil { if channelFee.MinTimeoutTimestamp > 0 && msg.TimeoutTimestamp < channelFee.MinTimeoutTimestamp { - return nil, ErrInvalidTimeoutTimestamp + return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer") } coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) if coin != nil { @@ -92,7 +92,3 @@ func findCoinByDenom(allowedTokens []*ibctransfermiddlewaretypes.CoinItem, denom } return nil // If the denom is not found } - -var ( - ErrInvalidTimeoutTimestamp = fmt.Errorf("proto: incorrect timeout timestamp found during ibc transfer") -) From 62c5ae8a1c49e76f003c02f9b13ef458652a6e07 Mon Sep 17 00:00:00 2001 From: kkast Date: Tue, 19 Mar 2024 01:08:44 +0300 Subject: [PATCH 54/71] slashing + pfm --- Makefile | 2 +- app/keepers/keepers.go | 1 + app/upgrades/v6_4_8/constants.go | 15 +++++++++++ app/upgrades/v6_4_8/upgrade.go | 39 +++++++++++++++++++++++++++ custom/bank/keeper/keeper.go | 17 ------------ custom/staking/keeper/keeper.go | 45 ++++++++++++++++++++++++++++++-- go.mod | 2 +- go.sum | 4 +-- tests/interchaintest/setup.go | 6 +---- x/mint/abci.go | 7 ++--- x/mint/types/events.go | 2 ++ 11 files changed, 107 insertions(+), 33 deletions(-) create mode 100644 app/upgrades/v6_4_8/constants.go create mode 100644 app/upgrades/v6_4_8/upgrade.go diff --git a/Makefile b/Makefile index 26d1cf2b2..d2191acdc 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ build: go build $(BUILD_FLAGS) -o bin/centaurid ./cmd/centaurid docker-build-debug: - @DOCKER_BUILDKIT=1 docker build -t centauri:debug -f Dockerfile . + @DOCKER_BUILDKIT=1 docker build -t centauri:local -f Dockerfile . lint: @find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run mvdan.cc/gofumpt -w . diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 6db33ec70..b3a95d7d6 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -210,6 +210,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[distrtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + appKeepers.StakingKeeper.RegisterKeepers(appKeepers.DistrKeeper, appKeepers.BankKeeper) appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, cdc, appKeepers.keys[slashingtypes.StoreKey], appKeepers.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/app/upgrades/v6_4_8/constants.go b/app/upgrades/v6_4_8/constants.go new file mode 100644 index 000000000..9acdab086 --- /dev/null +++ b/app/upgrades/v6_4_8/constants.go @@ -0,0 +1,15 @@ +package v6_4_8 + +import ( + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_8" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v6_4_8/upgrade.go b/app/upgrades/v6_4_8/upgrade.go new file mode 100644 index 000000000..44d158dc5 --- /dev/null +++ b/app/upgrades/v6_4_8/upgrade.go @@ -0,0 +1,39 @@ +package v6_4_8 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + // remove broken proposals + BrokenProposals := [3]uint64{2, 6, 11} + for _, proposal := range BrokenProposals { + keepers.GovKeeper.DeleteProposal(ctx, proposal) + } + + // burn extra ppica in escrow account + // this ppica is unused because it is a native token stored in escrow account + // it was unnecessarily minted to match pica escrowed on picasso to ppica minted + // in genesis, to make initial native ppica transferrable to picasso + amount, ok := sdk.NewIntFromString("1066669217167120000000") + if ok { + coins := sdk.Coins{sdk.NewCoin("ppica", amount)} + keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins) + keepers.BankKeeper.BurnCoins(ctx, "gov", coins) + } + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/custom/bank/keeper/keeper.go b/custom/bank/keeper/keeper.go index a7c312c6d..5422ac308 100644 --- a/custom/bank/keeper/keeper.go +++ b/custom/bank/keeper/keeper.go @@ -18,7 +18,6 @@ import ( transfermiddlewarekeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancetypes "github.com/terra-money/alliance/x/alliance/types" ) type Keeper struct { @@ -68,16 +67,6 @@ func (k Keeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*t ctx := sdk.UnwrapSDKContext(c) supply := k.GetSupply(ctx, req.Denom) - if req.Denom == k.sk.BondDenom(ctx) { - assets := k.ak.GetAllAssets(ctx) - totalRewardWeights := sdk.ZeroDec() - for _, asset := range assets { - totalRewardWeights = totalRewardWeights.Add(asset.RewardWeight) - } - allianceBonded := k.ak.GetAllianceBondedAmount(ctx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - supply.Amount = supply.Amount.Sub(allianceBonded) - } - return &types.QuerySupplyOfResponse{Amount: sdk.NewCoin(req.Denom, supply.Amount)}, nil } @@ -93,11 +82,5 @@ func (k Keeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequ duplicateCoins := k.tfmk.GetTotalEscrowedToken(sdkCtx) totalSupply = totalSupply.Sub(duplicateCoins...) - allianceBonded := k.ak.GetAllianceBondedAmount(sdkCtx, k.acck.GetModuleAddress(alliancetypes.ModuleName)) - bondDenom := k.sk.BondDenom(sdkCtx) - if totalSupply.AmountOf(bondDenom).IsPositive() { - totalSupply = totalSupply.Sub(sdk.NewCoin(bondDenom, allianceBonded)) - } - return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 2c5b6a5dd..7549e8faf 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -1,13 +1,18 @@ package keeper import ( + "fmt" + + "cosmossdk.io/math" abcicometbft "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/staking/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + distkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/cosmos/cosmos-sdk/x/staking/types" + minttypes "github.com/notional-labs/composable/v6/x/mint/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) @@ -16,6 +21,9 @@ type Keeper struct { cdc codec.BinaryCodec Stakingmiddleware *stakingmiddleware.Keeper authority string + mintKeeper minttypes.BankKeeper + distrKeeper distkeeper.Keeper + authKeeper minttypes.AccountKeeper } func (k Keeper) BlockValidatorUpdates(ctx sdk.Context, height int64) []abcicometbft.ValidatorUpdate { @@ -117,6 +125,39 @@ func NewKeeper( authority: authority, Stakingmiddleware: stakingmiddleware, cdc: cdc, + mintKeeper: nil, + distrKeeper: distkeeper.Keeper{}, + authKeeper: ak, } return &keeper } + +func (k *Keeper) RegisterKeepers(dk distkeeper.Keeper, mk minttypes.BankKeeper) { + k.distrKeeper = dk + k.mintKeeper = mk +} + +// SlashWithInfractionReason send coins to community pool +func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec, _ types.Infraction) math.Int { + // keep slashing logic the same + amountBurned := k.Slash(ctx, consAddr, infractionHeight, power, slashFactor) + // after usual slashing and burning is done, mint burned coinds into community pool + coins := sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), amountBurned)) + err := k.mintKeeper.MintCoins(ctx, types.ModuleName, coins) + if err != nil { + k.Logger(ctx).Error("Failed to mint slashed coins: ", amountBurned) + } else { + err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(types.ModuleName)) + if err != nil { + k.Logger(ctx).Error(fmt.Sprintf("Failed to fund community pool. Tokens minted to the staking module account: %d. ", amountBurned)) + } else { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + minttypes.EventTypeMintSlashed, + sdk.NewAttribute(sdk.AttributeKeyAmount, amountBurned.String()), + ), + ) + } + } + return amountBurned +} diff --git a/go.mod b/go.mod index bafa84462..cf4998b28 100644 --- a/go.mod +++ b/go.mod @@ -332,7 +332,7 @@ replace ( github.com/cosmos/cosmos-sdk v0.47.5 => github.com/rust-ninja/cosmos-sdk v0.47.5-patch-validators-trim-tag - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/kkast/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240318214000-902597680c1e // ibc-go with wasm client github.com/cosmos/ibc-go/v7 => github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f diff --git a/go.sum b/go.sum index 8d9694860..8310125ce 100644 --- a/go.sum +++ b/go.sum @@ -836,6 +836,8 @@ github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= github.com/kkHAIKE/contextcheck v1.1.3/go.mod h1:PG/cwd6c0705/LM0KTr1acO2gORUxkSVWyLJOFW5qoo= +github.com/kkast/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240318214000-902597680c1e h1:7qS2bTRnQeN/MaMIxxHH+0WPjVoAZPp/xlMXo+0zoKw= +github.com/kkast/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240318214000-902597680c1e/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= @@ -968,8 +970,6 @@ github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647 h1:vCSokMIO60u0td51l7NB+pikUChJozIwIb4u8UeqTKI= github.com/notional-labs/alliance v1.0.1-0.20231106184124-5cc1ff759647/go.mod h1:GFQ8TsXDMTpu7kif0Dwddz6rxazy0ZJQHfN38ZmAodI= -github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9 h1:4rte3LTbrQnlu0Gnw6gouj2voGwgjweORA1dcgnQxlU= -github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f h1:Uw35VHCdLTsQf8B4UGTjHCR6HqcYFF6dwPW8uJzS0f4= github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f/go.mod h1:hjcl3RPLSDf0LSXrFyk2iTQCCFs5pfLbJb8h/5gJ2Vg= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/tests/interchaintest/setup.go b/tests/interchaintest/setup.go index 384f31cb5..be7fe8df1 100644 --- a/tests/interchaintest/setup.go +++ b/tests/interchaintest/setup.go @@ -45,11 +45,7 @@ func GetDockerImageInfo() (repo, version string) { if !found { // make local-image repo = "centauri" - branchVersion = "debug" + branchVersion = "local" } - - // github converts / to - for pushed docker images - // branchVersion = strings.ReplaceAll(branchVersion, "/", "-") - branchVersion = "latest" return repo, branchVersion } diff --git a/x/mint/abci.go b/x/mint/abci.go index c24f80747..42964667d 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -25,7 +25,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio minter.AnnualProvisions = minter.NextAnnualProvisions(params, totalStakingSupply) k.SetMinter(ctx, minter) - // mint coins, update supply + // calculate how many we would mint, but we dont mint them, we take them from the prefunded account mintedCoin := minter.BlockProvision(params) mintedCoins := sdk.NewCoins(mintedCoin) @@ -41,10 +41,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper, ic types.InflationCalculatio ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeMint, - sdk.NewAttribute(types.AttributeKeyBondedRatio, bondedRatio.String()), - sdk.NewAttribute(types.AttributeKeyInflation, minter.Inflation.String()), - sdk.NewAttribute(types.AttributeKeyAnnualProvisions, minter.AnnualProvisions.String()), + types.EventTypeReward, sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), ), ) diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 891f50768..92d52efac 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -3,6 +3,8 @@ package types // Minting module event types const ( EventTypeMint = ModuleName + EventTypeReward = "reward_distributed" + EventTypeMintSlashed = "mint_slashed_into_comminity_pool" EventAddAllowedFundAddress = "add_allowed_fund" AttributeKeyBondedRatio = "bonded_ratio" From 06dafe65ad52f0b7fac4c8ed3f69fcc74f9ea533 Mon Sep 17 00:00:00 2001 From: kkast Date: Tue, 19 Mar 2024 20:11:19 +0300 Subject: [PATCH 55/71] upgrade fix --- app/app.go | 4 ++-- app/upgrades/v6_4_8/upgrade.go | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index 78be271d3..d23bfcfe9 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades/v6_4_7" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_8" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -147,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_7.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_8.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_8/upgrade.go b/app/upgrades/v6_4_8/upgrade.go index 44d158dc5..dde896d6b 100644 --- a/app/upgrades/v6_4_8/upgrade.go +++ b/app/upgrades/v6_4_8/upgrade.go @@ -20,8 +20,12 @@ func CreateUpgradeHandler( return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // remove broken proposals BrokenProposals := [3]uint64{2, 6, 11} - for _, proposal := range BrokenProposals { - keepers.GovKeeper.DeleteProposal(ctx, proposal) + for _, proposal_id := range BrokenProposals { + _, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id) + if ok { + keepers.GovKeeper.DeleteProposal(ctx, proposal_id) + } + } // burn extra ppica in escrow account From 9836bc53c002c150da6301301a9a99f1bd508d48 Mon Sep 17 00:00:00 2001 From: kkast Date: Tue, 19 Mar 2024 21:01:08 +0300 Subject: [PATCH 56/71] test fix --- x/transfermiddleware/ibc_ante_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/transfermiddleware/ibc_ante_test.go b/x/transfermiddleware/ibc_ante_test.go index da9aafd9f..bbf739a8c 100644 --- a/x/transfermiddleware/ibc_ante_test.go +++ b/x/transfermiddleware/ibc_ante_test.go @@ -17,7 +17,7 @@ import ( // NOTE: This is the address of the gov authority on the chain that is being tested. // This means that we need to check bech32 .... everywhere. -var govAuthorityAddress = "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" +var govAuthorityAddress = "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m" // ORIGINAL NOTES: // convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m From 71e93e0e4760bec57fc30db769adf3960c38fdec Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 20 Mar 2024 15:03:06 +0300 Subject: [PATCH 57/71] use ComposableFi fork --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cf4998b28..959c4fae2 100644 --- a/go.mod +++ b/go.mod @@ -332,7 +332,7 @@ replace ( github.com/cosmos/cosmos-sdk v0.47.5 => github.com/rust-ninja/cosmos-sdk v0.47.5-patch-validators-trim-tag - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/kkast/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240318214000-902597680c1e + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240320115741-f32994360827 // ibc-go with wasm client github.com/cosmos/ibc-go/v7 => github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f diff --git a/go.sum b/go.sum index 8310125ce..de6ea89d6 100644 --- a/go.sum +++ b/go.sum @@ -221,6 +221,8 @@ github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240320115741-f32994360827 h1:PkDT2gEjAgttuF9lZTP+niYjcXutnmqHHK2UaAL9bLs= +github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240320115741-f32994360827/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/CosmWasm/wasmd v0.40.1 h1:LxbO78t/6S8TkeQlUrJ0m5O87HtAwLx4RGHq3rdrOEU= github.com/CosmWasm/wasmd v0.40.1/go.mod h1:6EOwnv7MpuFaEqxcUOdFV9i4yvrdOciaY6VQ1o7A3yg= github.com/CosmWasm/wasmvm v1.2.6 h1:QmOaiJUyeh8+pPCjJBTgWrbi/hCzCuWewduDO85Pcpc= @@ -836,8 +838,6 @@ github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= github.com/kkHAIKE/contextcheck v1.1.3/go.mod h1:PG/cwd6c0705/LM0KTr1acO2gORUxkSVWyLJOFW5qoo= -github.com/kkast/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240318214000-902597680c1e h1:7qS2bTRnQeN/MaMIxxHH+0WPjVoAZPp/xlMXo+0zoKw= -github.com/kkast/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240318214000-902597680c1e/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= From 6c4ffee3cff84e68116852eea01d790aefc2d02f Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 19 Mar 2024 22:02:25 +0000 Subject: [PATCH 58/71] introduce validation for timeout timestamp for eth ibc bridge --- custom/ibc-transfer/keeper/msg_server.go | 14 +++- .../v1beta1/ibctransfermiddleware.proto | 2 +- .../types/ibctransfermiddleware.pb.go | 64 +++++++++---------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index bb9b825f8..f84dff356 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -30,8 +31,17 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ if params.ChannelFees != nil && len(params.ChannelFees) > 0 { channelFee := findChannelParams(params.ChannelFees, msg.SourceChannel) if channelFee != nil { - if channelFee.MinTimeoutTimestamp > 0 && msg.TimeoutTimestamp < channelFee.MinTimeoutTimestamp { - return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer") + if channelFee.MinTimeoutTimestamp > 0 { + + goCtx := sdk.UnwrapSDKContext(goCtx) + blockTime := goCtx.BlockTime() + + timeoutTimeInFuture := time.Unix(0, int64(msg.TimeoutTimestamp)) + difference := timeoutTimeInFuture.Sub(blockTime).Nanoseconds() + + if difference < channelFee.MinTimeoutTimestamp { + return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer") + } } coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) if coin != nil { diff --git a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto index 1f15c0510..f789dee2f 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/ibctransfermiddleware.proto @@ -19,7 +19,7 @@ message ChannelFee{ string channel = 1; repeated CoinItem allowed_tokens = 2; string fee_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - uint64 min_timeout_timestamp = 4; + int64 min_timeout_timestamp = 4; } message CoinItem{ diff --git a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go index 67340cec9..e58115dcd 100644 --- a/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go +++ b/x/ibctransfermiddleware/types/ibctransfermiddleware.pb.go @@ -76,7 +76,7 @@ type ChannelFee struct { Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"` AllowedTokens []*CoinItem `protobuf:"bytes,2,rep,name=allowed_tokens,json=allowedTokens,proto3" json:"allowed_tokens,omitempty"` FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty"` - MinTimeoutTimestamp uint64 `protobuf:"varint,4,opt,name=min_timeout_timestamp,json=minTimeoutTimestamp,proto3" json:"min_timeout_timestamp,omitempty"` + MinTimeoutTimestamp int64 `protobuf:"varint,4,opt,name=min_timeout_timestamp,json=minTimeoutTimestamp,proto3" json:"min_timeout_timestamp,omitempty"` } func (m *ChannelFee) Reset() { *m = ChannelFee{} } @@ -133,7 +133,7 @@ func (m *ChannelFee) GetFeeAddress() string { return "" } -func (m *ChannelFee) GetMinTimeoutTimestamp() uint64 { +func (m *ChannelFee) GetMinTimeoutTimestamp() int64 { if m != nil { return m.MinTimeoutTimestamp } @@ -203,35 +203,35 @@ func init() { } var fileDescriptor_1193893bc248bc1b = []byte{ - // 438 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x8b, 0xd4, 0x30, - 0x18, 0xc6, 0x27, 0x3b, 0xcb, 0xac, 0x9b, 0x51, 0xc1, 0xba, 0x62, 0x76, 0xc1, 0x38, 0xcc, 0xa9, - 0x08, 0xb6, 0x4c, 0x15, 0xc4, 0x83, 0x07, 0x47, 0x11, 0xbc, 0x49, 0x1d, 0x10, 0xbd, 0x94, 0xb4, - 0x7d, 0x5b, 0x83, 0x4d, 0x52, 0x92, 0xb8, 0xab, 0xdf, 0xc2, 0x8f, 0xe1, 0xd1, 0x83, 0x1f, 0x62, - 0x8f, 0x8b, 0x27, 0x4f, 0x22, 0x33, 0x07, 0xaf, 0x7e, 0x04, 0x69, 0x93, 0x71, 0x14, 0x46, 0x70, - 0x2f, 0x4d, 0xde, 0xf7, 0xd7, 0xe7, 0xc9, 0x93, 0x3f, 0xf8, 0x71, 0xa1, 0x44, 0xab, 0x0c, 0xcb, - 0x1b, 0x88, 0x79, 0x5e, 0x58, 0xcd, 0xa4, 0xa9, 0x40, 0x0b, 0x5e, 0x96, 0x0d, 0x9c, 0x30, 0x0d, - 0xf1, 0xf1, 0x2c, 0x07, 0xcb, 0x66, 0xdb, 0x69, 0xd4, 0x6a, 0x65, 0x55, 0x10, 0x6e, 0x5c, 0xa2, - 0xed, 0xff, 0x79, 0x97, 0xa3, 0x83, 0x5a, 0xd5, 0xaa, 0x17, 0xc5, 0xdd, 0xcc, 0xe9, 0x8f, 0x0e, - 0x0b, 0x65, 0x84, 0x32, 0x99, 0x03, 0xae, 0xf0, 0x88, 0xba, 0x2a, 0xce, 0x99, 0xd9, 0x64, 0x29, - 0x14, 0x97, 0x9e, 0x5f, 0x61, 0x82, 0x4b, 0x15, 0xf7, 0x5f, 0xdf, 0xba, 0xee, 0x25, 0xc2, 0xd4, - 0xf1, 0xf1, 0xac, 0x1b, 0x1c, 0x98, 0x32, 0x3c, 0x7a, 0xc6, 0x34, 0x13, 0x26, 0x78, 0x81, 0x2f, - 0x16, 0xaf, 0x99, 0x94, 0xd0, 0x64, 0x15, 0x80, 0x21, 0x68, 0x32, 0x0c, 0xc7, 0xc9, 0xdd, 0xe8, - 0x7f, 0xf7, 0x11, 0x3d, 0x72, 0xea, 0x27, 0x00, 0xe9, 0xb8, 0xf8, 0x3d, 0x37, 0xd3, 0x9f, 0x08, - 0xe3, 0x0d, 0x0b, 0x08, 0xde, 0xf3, 0x94, 0xa0, 0x09, 0x0a, 0xf7, 0xd3, 0x75, 0x19, 0xbc, 0xc4, - 0x97, 0x59, 0xd3, 0xa8, 0x13, 0x28, 0x33, 0xab, 0xde, 0x80, 0x34, 0x64, 0xa7, 0xcf, 0x90, 0x9c, - 0x23, 0x83, 0xe2, 0xf2, 0xa9, 0x05, 0x91, 0x5e, 0xf2, 0x4e, 0x8b, 0xde, 0x28, 0xb8, 0x8f, 0xc7, - 0x15, 0x40, 0xc6, 0xca, 0x52, 0x83, 0x31, 0x64, 0xd8, 0x2d, 0x3c, 0x27, 0x5f, 0x3e, 0xdf, 0x3e, - 0xf0, 0x27, 0xfb, 0xd0, 0x91, 0xe7, 0x56, 0x73, 0x59, 0xa7, 0xb8, 0x02, 0xf0, 0x9d, 0x20, 0xc1, - 0xd7, 0x04, 0x97, 0x99, 0xe5, 0x02, 0xd4, 0x5b, 0xdb, 0x8f, 0xc6, 0x32, 0xd1, 0x92, 0xdd, 0x09, - 0x0a, 0x77, 0xd3, 0xab, 0x82, 0xcb, 0x85, 0x63, 0x8b, 0x35, 0x9a, 0x72, 0x7c, 0x61, 0x9d, 0x24, - 0x78, 0x80, 0xf7, 0x3a, 0x7d, 0x05, 0xd0, 0xef, 0x77, 0x9c, 0x1c, 0x46, 0x7e, 0xcd, 0xee, 0xfe, - 0xfe, 0x4a, 0x3e, 0xdf, 0x3f, 0xfd, 0x76, 0x73, 0xf0, 0xf1, 0xc7, 0xa7, 0x5b, 0x28, 0x1d, 0x09, - 0x2e, 0xbb, 0xe3, 0xa2, 0x18, 0xb7, 0xa0, 0x0b, 0x90, 0x96, 0xd5, 0x40, 0x76, 0x26, 0x28, 0x1c, - 0xa6, 0x7f, 0x74, 0xe6, 0xf7, 0x4e, 0x97, 0x14, 0x9d, 0x2d, 0x29, 0xfa, 0xbe, 0xa4, 0xe8, 0xc3, - 0x8a, 0x0e, 0xce, 0x56, 0x74, 0xf0, 0x75, 0x45, 0x07, 0xaf, 0x6e, 0xbc, 0xfb, 0xc7, 0xf3, 0xb5, - 0xef, 0x5b, 0x30, 0xf9, 0xa8, 0x7f, 0x00, 0x77, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x20, - 0x7e, 0x4d, 0xef, 0x02, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x8b, 0xd4, 0x30, + 0x14, 0xc7, 0x27, 0x3b, 0x32, 0xeb, 0x66, 0x54, 0xb0, 0xae, 0x98, 0x5d, 0x30, 0x0e, 0x73, 0x1a, + 0x04, 0x5b, 0xa6, 0x0a, 0xe2, 0xc1, 0x83, 0xa3, 0x08, 0xde, 0xa4, 0x0e, 0x88, 0x5e, 0x4a, 0xda, + 0xbe, 0xd6, 0x60, 0x93, 0x94, 0x24, 0xee, 0xea, 0xb7, 0xf0, 0x63, 0x78, 0xf4, 0xe0, 0x87, 0xd8, + 0xe3, 0xe2, 0xc9, 0x93, 0xc8, 0xcc, 0xc1, 0xab, 0x1f, 0x41, 0x9a, 0x64, 0x1c, 0x85, 0x15, 0xf4, + 0xd2, 0xe4, 0xbd, 0x5f, 0xff, 0xef, 0xfd, 0x93, 0x3c, 0xfc, 0xa8, 0x54, 0xa2, 0x53, 0x86, 0x15, + 0x2d, 0x24, 0xbc, 0x28, 0xad, 0x66, 0xd2, 0xd4, 0xa0, 0x05, 0xaf, 0xaa, 0x16, 0x8e, 0x99, 0x86, + 0xe4, 0x68, 0x5e, 0x80, 0x65, 0xf3, 0xb3, 0x69, 0xdc, 0x69, 0x65, 0x55, 0x34, 0xdb, 0x56, 0x89, + 0xcf, 0xfe, 0x2f, 0x54, 0x39, 0xdc, 0x6f, 0x54, 0xa3, 0x9c, 0x28, 0xe9, 0x77, 0x5e, 0x7f, 0x78, + 0x50, 0x2a, 0x23, 0x94, 0xc9, 0x3d, 0xf0, 0x41, 0x40, 0xd4, 0x47, 0x49, 0xc1, 0xcc, 0xd6, 0x4b, + 0xa9, 0xb8, 0x0c, 0xfc, 0x32, 0x13, 0x5c, 0xaa, 0xc4, 0x7d, 0x43, 0xea, 0x5a, 0x90, 0x08, 0xd3, + 0x24, 0x47, 0xf3, 0x7e, 0xf1, 0x60, 0xca, 0xf0, 0xe8, 0x29, 0xd3, 0x4c, 0x98, 0xe8, 0x39, 0xbe, + 0x50, 0xbe, 0x62, 0x52, 0x42, 0x9b, 0xd7, 0x00, 0x86, 0xa0, 0xc9, 0x70, 0x36, 0x4e, 0xef, 0xc4, + 0xff, 0x7a, 0x8e, 0xf8, 0xa1, 0x57, 0x3f, 0x06, 0xc8, 0xc6, 0xe5, 0xaf, 0xbd, 0x99, 0xfe, 0x40, + 0x18, 0x6f, 0x59, 0x44, 0xf0, 0x6e, 0xa0, 0x04, 0x4d, 0xd0, 0x6c, 0x2f, 0xdb, 0x84, 0xd1, 0x0b, + 0x7c, 0x89, 0xb5, 0xad, 0x3a, 0x86, 0x2a, 0xb7, 0xea, 0x35, 0x48, 0x43, 0x76, 0x9c, 0x87, 0xf4, + 0x3f, 0x3c, 0x28, 0x2e, 0x9f, 0x58, 0x10, 0xd9, 0xc5, 0x50, 0x69, 0xe9, 0x0a, 0x45, 0xf7, 0xf0, + 0xb8, 0x06, 0xc8, 0x59, 0x55, 0x69, 0x30, 0x86, 0x0c, 0xfb, 0xc6, 0x0b, 0xf2, 0xf9, 0xd3, 0xad, + 0xfd, 0x70, 0xb3, 0x0f, 0x3c, 0x79, 0x66, 0x35, 0x97, 0x4d, 0x86, 0x6b, 0x80, 0x90, 0x89, 0x52, + 0x7c, 0x55, 0x70, 0x99, 0x5b, 0x2e, 0x40, 0xbd, 0xb1, 0x6e, 0x35, 0x96, 0x89, 0x8e, 0x9c, 0x9b, + 0xa0, 0xd9, 0x30, 0xbb, 0x22, 0xb8, 0x5c, 0x7a, 0xb6, 0xdc, 0xa0, 0x29, 0xc7, 0xe7, 0x37, 0x4e, + 0xa2, 0xfb, 0x78, 0xb7, 0xd7, 0xd7, 0x00, 0xee, 0xbc, 0xe3, 0xf4, 0x20, 0x0e, 0x3d, 0xfb, 0xf7, + 0xfb, 0xc3, 0xf9, 0x62, 0xef, 0xe4, 0xeb, 0x8d, 0xc1, 0x87, 0xef, 0x1f, 0x6f, 0xa2, 0x6c, 0x24, + 0xb8, 0xec, 0xaf, 0x8b, 0x62, 0xdc, 0x81, 0x2e, 0x41, 0x5a, 0xd6, 0x00, 0xd9, 0x71, 0x3d, 0x7f, + 0xcb, 0x2c, 0xee, 0x9e, 0xac, 0x28, 0x3a, 0x5d, 0x51, 0xf4, 0x6d, 0x45, 0xd1, 0xfb, 0x35, 0x1d, + 0x9c, 0xae, 0xe9, 0xe0, 0xcb, 0x9a, 0x0e, 0x5e, 0x5e, 0x7f, 0xfb, 0x97, 0xf1, 0xb5, 0xef, 0x3a, + 0x30, 0xc5, 0xc8, 0x0d, 0xc0, 0xed, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x69, 0x03, 0x6b, 0xef, + 0xef, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -662,7 +662,7 @@ func (m *ChannelFee) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinTimeoutTimestamp |= uint64(b&0x7F) << shift + m.MinTimeoutTimestamp |= int64(b&0x7F) << shift if b < 0x80 { break } From 50195a238b8b5aeee5a67f090546b2fbaad71b8c Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 19 Mar 2024 23:48:55 +0000 Subject: [PATCH 59/71] extra validation that timeoutTimeInFuture.Before(blockTime) return error --- custom/ibc-transfer/keeper/msg_server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index f84dff356..a6d27234e 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -37,10 +37,14 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ blockTime := goCtx.BlockTime() timeoutTimeInFuture := time.Unix(0, int64(msg.TimeoutTimestamp)) + if timeoutTimeInFuture.Before(blockTime) { + return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. timeout timestamp is in the past") + } + difference := timeoutTimeInFuture.Sub(blockTime).Nanoseconds() if difference < channelFee.MinTimeoutTimestamp { - return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer") + return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. too soon") } } coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) From c6a028e3ed31730bbd0d0d1fac5a37efe4b295e4 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 20 Mar 2024 21:57:43 +0300 Subject: [PATCH 60/71] check --- app/upgrades/v6_4_8/upgrade.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/upgrades/v6_4_8/upgrade.go b/app/upgrades/v6_4_8/upgrade.go index dde896d6b..93a42d6c9 100644 --- a/app/upgrades/v6_4_8/upgrade.go +++ b/app/upgrades/v6_4_8/upgrade.go @@ -20,6 +20,7 @@ func CreateUpgradeHandler( return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // remove broken proposals BrokenProposals := [3]uint64{2, 6, 11} + for _, proposal_id := range BrokenProposals { _, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id) if ok { From ca10944e83855a5c4d97b1bc9303298ec6c5f972 Mon Sep 17 00:00:00 2001 From: kkast Date: Wed, 20 Mar 2024 22:18:09 +0300 Subject: [PATCH 61/71] try2 --- app/upgrades/v6_4_8/constants.go | 6 ++++++ app/upgrades/v6_4_8/upgrade.go | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/upgrades/v6_4_8/constants.go b/app/upgrades/v6_4_8/constants.go index 9acdab086..bb164f5ca 100644 --- a/app/upgrades/v6_4_8/constants.go +++ b/app/upgrades/v6_4_8/constants.go @@ -1,7 +1,9 @@ package v6_4_8 import ( + store "github.com/cosmos/cosmos-sdk/store/types" "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) const ( @@ -12,4 +14,8 @@ const ( var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{ibctransfermiddleware.StoreKey}, + Deleted: []string{}, + }, } diff --git a/app/upgrades/v6_4_8/upgrade.go b/app/upgrades/v6_4_8/upgrade.go index 93a42d6c9..58fe2a14d 100644 --- a/app/upgrades/v6_4_8/upgrade.go +++ b/app/upgrades/v6_4_8/upgrade.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/notional-labs/composable/v6/app/keepers" "github.com/notional-labs/composable/v6/app/upgrades" + ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) func CreateUpgradeHandler( @@ -18,9 +19,11 @@ func CreateUpgradeHandler( keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState() + keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params) + // remove broken proposals BrokenProposals := [3]uint64{2, 6, 11} - for _, proposal_id := range BrokenProposals { _, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id) if ok { From ff6854139de97d853d52148d6b2bcb786f746395 Mon Sep 17 00:00:00 2001 From: rustdev Date: Wed, 20 Mar 2024 19:33:58 +0000 Subject: [PATCH 62/71] change storage key and module name. --- x/ibctransfermiddleware/types/keys.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/ibctransfermiddleware/types/keys.go b/x/ibctransfermiddleware/types/keys.go index e349116db..7968743d0 100644 --- a/x/ibctransfermiddleware/types/keys.go +++ b/x/ibctransfermiddleware/types/keys.go @@ -7,9 +7,9 @@ var ( const ( // module name - ModuleName = "ibctransfermiddleware" + ModuleName = "ibctransferparamsmodule" // StoreKey is the default store key for ibctransfermiddleware module that store params when apply validator set changes and when allow to unbond/redelegate - StoreKey = "customibctransferparams" // not using the module name because of collisions with key "staking" + StoreKey = "customibcparams" // not using the module name because of collisions with key "staking" ) From a76ebd371059b778aa3e9799366b09e8453f114b Mon Sep 17 00:00:00 2001 From: kkast Date: Thu, 21 Mar 2024 00:34:03 +0300 Subject: [PATCH 63/71] set mint modules to be a minter --- app/keepers/keepers.go | 2 +- custom/staking/keeper/keeper.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index b3a95d7d6..658784071 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -210,7 +210,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( appCodec, appKeepers.keys[distrtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - appKeepers.StakingKeeper.RegisterKeepers(appKeepers.DistrKeeper, appKeepers.BankKeeper) + appKeepers.StakingKeeper.RegisterKeepers(appKeepers.DistrKeeper, appKeepers.MintKeeper) appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, cdc, appKeepers.keys[slashingtypes.StoreKey], appKeepers.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) diff --git a/custom/staking/keeper/keeper.go b/custom/staking/keeper/keeper.go index 7549e8faf..4f9fde1fd 100644 --- a/custom/staking/keeper/keeper.go +++ b/custom/staking/keeper/keeper.go @@ -12,6 +12,7 @@ import ( distkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" + mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper" minttypes "github.com/notional-labs/composable/v6/x/mint/types" stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper" ) @@ -21,7 +22,7 @@ type Keeper struct { cdc codec.BinaryCodec Stakingmiddleware *stakingmiddleware.Keeper authority string - mintKeeper minttypes.BankKeeper + mintKeeper mintkeeper.Keeper distrKeeper distkeeper.Keeper authKeeper minttypes.AccountKeeper } @@ -125,14 +126,14 @@ func NewKeeper( authority: authority, Stakingmiddleware: stakingmiddleware, cdc: cdc, - mintKeeper: nil, + mintKeeper: mintkeeper.Keeper{}, distrKeeper: distkeeper.Keeper{}, authKeeper: ak, } return &keeper } -func (k *Keeper) RegisterKeepers(dk distkeeper.Keeper, mk minttypes.BankKeeper) { +func (k *Keeper) RegisterKeepers(dk distkeeper.Keeper, mk mintkeeper.Keeper) { k.distrKeeper = dk k.mintKeeper = mk } @@ -143,11 +144,11 @@ func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddr amountBurned := k.Slash(ctx, consAddr, infractionHeight, power, slashFactor) // after usual slashing and burning is done, mint burned coinds into community pool coins := sdk.NewCoins(sdk.NewCoin(k.BondDenom(ctx), amountBurned)) - err := k.mintKeeper.MintCoins(ctx, types.ModuleName, coins) + err := k.mintKeeper.MintCoins(ctx, coins) if err != nil { k.Logger(ctx).Error("Failed to mint slashed coins: ", amountBurned) } else { - err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(types.ModuleName)) + err = k.distrKeeper.FundCommunityPool(ctx, coins, k.authKeeper.GetModuleAddress(minttypes.ModuleName)) if err != nil { k.Logger(ctx).Error(fmt.Sprintf("Failed to fund community pool. Tokens minted to the staking module account: %d. ", amountBurned)) } else { From 6a2efe45f0edd63bc935cafe5374c9329bb73be1 Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 15:32:14 +0000 Subject: [PATCH 64/71] add extra tx to update and remove channel fee from module's storage --- .../ibctransfermiddleware/v1beta1/tx.proto | 43 + x/ibctransfermiddleware/client/cli/tx.go | 86 +- x/ibctransfermiddleware/keeper/msg_server.go | 65 ++ x/ibctransfermiddleware/types/keys.go | 2 + x/ibctransfermiddleware/types/msg.go | 103 ++ x/ibctransfermiddleware/types/tx.pb.go | 993 ++++++++++++++++-- 6 files changed, 1224 insertions(+), 68 deletions(-) create mode 100644 x/ibctransfermiddleware/types/msg.go diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto index 14cf391ae..adc82a8ac 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -14,6 +14,11 @@ service Msg { option (cosmos.msg.v1.service) = true; rpc UpdateCustomIbcParams(MsgUpdateCustomIbcParams) returns (MsgUpdateParamsCustomIbcResponse); + + rpc AddIBCFeeConfig(MsgAddIBCFeeConfig) + returns (MsgAddIBCFeeConfigResponse); + rpc RemoveIBCFeeConfig(MsgRemoveIBCFeeConfig) + returns (MsgRemoveIBCFeeConfigResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -39,3 +44,41 @@ message MsgUpdateCustomIbcParams { // // Since: cosmos-sdk 0.47 message MsgUpdateParamsCustomIbcResponse {} + + +// MsgAddParachainInfo represents a message to add new parachain info. +message MsgAddIBCFeeConfig { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; + string fee_address = 3 [ (gogoproto.moretags) = "yaml:\"rly_address\"" ]; + + int64 min_timeout_timestamp = 4; +} + +message MsgAddIBCFeeConfigResponse {} + +// MsgRemoveParachainIBCTokenInfo represents a message to remove new parachain +// info. +message MsgRemoveIBCFeeConfig { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + ; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; +} + +message MsgRemoveIBCFeeConfigResponse {} diff --git a/x/ibctransfermiddleware/client/cli/tx.go b/x/ibctransfermiddleware/client/cli/tx.go index 95ab3dd0e..b95789b5b 100644 --- a/x/ibctransfermiddleware/client/cli/tx.go +++ b/x/ibctransfermiddleware/client/cli/tx.go @@ -1,7 +1,13 @@ package cli import ( + "fmt" + "strconv" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" "github.com/spf13/cobra" ) @@ -16,7 +22,85 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - txCmd.AddCommand() + txCmd.AddCommand( + AddIBCFeeConfig(), + RemoveIBCFeeConfig(), + ) return txCmd } + +func AddIBCFeeConfig() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-config [addr ]", + Short: "add ibc fee config", + Args: cobra.MatchAll(cobra.ExactArgs(3), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware add-config [channel] [feeAddress] [minTimeoutTimestamp]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + feeAddress := args[1] + minTimeoutTimestamp := args[2] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + //string to int64 conversion + minTimeoutTimestampInt, err := strconv.ParseInt(minTimeoutTimestamp, 10, 64) + + if err != nil { + return err + } + + msg := types.NewMsgAddIBCFeeConfig( + fromAddress, + channel, + feeAddress, + minTimeoutTimestampInt, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func RemoveIBCFeeConfig() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-config [addr ]", + Short: "add ibc fee config", + Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware remove-config [channel]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + msg := types.NewMsgRemoveIBCFeeConfig( + fromAddress, + channel, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index 99fb81b7c..5aa00a9aa 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -36,3 +36,68 @@ func (ms msgServer) UpdateCustomIbcParams(goCtx context.Context, req *types.MsgU return &types.MsgUpdateParamsCustomIbcResponse{}, nil } + +// AddIBCFeeConfig(MsgAddIBCFeeConfig) returns (MsgAddIBCFeeConfigResponse); +func (ms msgServer) AddIBCFeeConfig(goCtx context.Context, req *types.MsgAddIBCFeeConfig) (*types.MsgAddIBCFeeConfigResponse, error) { + if ms.authority != req.Authority { + // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; Nikita expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + _, err := sdk.AccAddressFromBech32(req.FeeAddress) + if err != nil { + return nil, err + } + + params := ms.Keeper.GetParams(ctx) + channelFee := findChannelParams(params.ChannelFees, req.ChannelID) + if channelFee != nil { + channelFee.FeeAddress = req.FeeAddress + channelFee.MinTimeoutTimestamp = req.MinTimeoutTimestamp + } else { + channelFee := &types.ChannelFee{ + Channel: req.ChannelID, + FeeAddress: req.FeeAddress, + MinTimeoutTimestamp: req.MinTimeoutTimestamp, + AllowedTokens: []*types.CoinItem{}, + } + params.ChannelFees = append(params.ChannelFees, channelFee) + } + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + return &types.MsgAddIBCFeeConfigResponse{}, nil +} + +func (ms msgServer) RemoveIBCFeeConfig(goCtx context.Context, req *types.MsgRemoveIBCFeeConfig) (*types.MsgRemoveIBCFeeConfigResponse, error) { + if ms.authority != req.Authority { + // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.Keeper.GetParams(ctx) + //remove channel id in list of channel fees + for i, fee := range params.ChannelFees { + if fee.Channel == req.ChannelID { + params.ChannelFees = append(params.ChannelFees[:i], params.ChannelFees[i+1:]...) + break + } + } + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + + return &types.MsgRemoveIBCFeeConfigResponse{}, nil +} + +func findChannelParams(channelFees []*types.ChannelFee, targetChannelID string) *types.ChannelFee { + for _, fee := range channelFees { + if fee.Channel == targetChannelID { + return fee + } + } + return nil // If the channel is not found +} diff --git a/x/ibctransfermiddleware/types/keys.go b/x/ibctransfermiddleware/types/keys.go index 7968743d0..353130e94 100644 --- a/x/ibctransfermiddleware/types/keys.go +++ b/x/ibctransfermiddleware/types/keys.go @@ -12,4 +12,6 @@ const ( // StoreKey is the default store key for ibctransfermiddleware module that store params when apply validator set changes and when allow to unbond/redelegate StoreKey = "customibcparams" // not using the module name because of collisions with key "staking" + + RouterKey = ModuleName ) diff --git a/x/ibctransfermiddleware/types/msg.go b/x/ibctransfermiddleware/types/msg.go new file mode 100644 index 000000000..23fbb96c0 --- /dev/null +++ b/x/ibctransfermiddleware/types/msg.go @@ -0,0 +1,103 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgAddIBCFeeConfig{} + +const ( + TypeMsgAddIBCFeeConfig = "add_config" + TypeMsgRemoveIBCFeeConfig = "remove_config" +) + +func NewMsgAddIBCFeeConfig( + authority string, + channelID string, + feeAddress string, + minTimeoutTimestamp int64, +) *MsgAddIBCFeeConfig { + return &MsgAddIBCFeeConfig{ + Authority: authority, + ChannelID: channelID, + FeeAddress: feeAddress, + MinTimeoutTimestamp: minTimeoutTimestamp, + } +} + +// Route Implements Msg. +func (msg MsgAddIBCFeeConfig) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgAddIBCFeeConfig) Type() string { return TypeMsgAddIBCFeeConfig } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgAddIBCFeeConfig) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgAddParachainIBCTokenInfo message. +func (msg *MsgAddIBCFeeConfig) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgAddIBCFeeConfig) ValidateBasic() error { + // validate authority + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + // // validate channelIDs + // if err := host.ChannelIdentifierValidator(msg.ChannelID); err != nil { + // return err + // } + + // // validate ibcDenom + // err := ibctransfertypes.ValidateIBCDenom(msg.IbcDenom) + // if err != nil { + // return err + // } + + return nil +} + +var _ sdk.Msg = &MsgRemoveIBCFeeConfig{} + +func NewMsgRemoveIBCFeeConfig( + authority string, + channelID string, +) *MsgRemoveIBCFeeConfig { + return &MsgRemoveIBCFeeConfig{ + Authority: authority, + ChannelID: channelID, + } +} + +// Route Implements Msg. +func (msg MsgRemoveIBCFeeConfig) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRemoveIBCFeeConfig) Type() string { return TypeMsgRemoveIBCFeeConfig } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgRemoveIBCFeeConfig) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgRemoveParachainIBCTokenInfo message. +func (msg *MsgRemoveIBCFeeConfig) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgRemoveIBCFeeConfig) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go index 055172e52..c4adbde16 100644 --- a/x/ibctransfermiddleware/types/tx.pb.go +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -131,9 +131,212 @@ func (m *MsgUpdateParamsCustomIbcResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsCustomIbcResponse proto.InternalMessageInfo +// MsgAddParachainInfo represents a message to add new parachain info. +type MsgAddIBCFeeConfig struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + FeeAddress string `protobuf:"bytes,3,opt,name=fee_address,json=feeAddress,proto3" json:"fee_address,omitempty" yaml:"rly_address"` + MinTimeoutTimestamp int64 `protobuf:"varint,4,opt,name=min_timeout_timestamp,json=minTimeoutTimestamp,proto3" json:"min_timeout_timestamp,omitempty"` +} + +func (m *MsgAddIBCFeeConfig) Reset() { *m = MsgAddIBCFeeConfig{} } +func (m *MsgAddIBCFeeConfig) String() string { return proto.CompactTextString(m) } +func (*MsgAddIBCFeeConfig) ProtoMessage() {} +func (*MsgAddIBCFeeConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{2} +} +func (m *MsgAddIBCFeeConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddIBCFeeConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddIBCFeeConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddIBCFeeConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddIBCFeeConfig.Merge(m, src) +} +func (m *MsgAddIBCFeeConfig) XXX_Size() int { + return m.Size() +} +func (m *MsgAddIBCFeeConfig) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddIBCFeeConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddIBCFeeConfig proto.InternalMessageInfo + +func (m *MsgAddIBCFeeConfig) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddIBCFeeConfig) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgAddIBCFeeConfig) GetFeeAddress() string { + if m != nil { + return m.FeeAddress + } + return "" +} + +func (m *MsgAddIBCFeeConfig) GetMinTimeoutTimestamp() int64 { + if m != nil { + return m.MinTimeoutTimestamp + } + return 0 +} + +type MsgAddIBCFeeConfigResponse struct { +} + +func (m *MsgAddIBCFeeConfigResponse) Reset() { *m = MsgAddIBCFeeConfigResponse{} } +func (m *MsgAddIBCFeeConfigResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddIBCFeeConfigResponse) ProtoMessage() {} +func (*MsgAddIBCFeeConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{3} +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddIBCFeeConfigResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddIBCFeeConfigResponse.Merge(m, src) +} +func (m *MsgAddIBCFeeConfigResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddIBCFeeConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddIBCFeeConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddIBCFeeConfigResponse proto.InternalMessageInfo + +// MsgRemoveParachainIBCTokenInfo represents a message to remove new parachain +// info. +type MsgRemoveIBCFeeConfig struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *MsgRemoveIBCFeeConfig) Reset() { *m = MsgRemoveIBCFeeConfig{} } +func (m *MsgRemoveIBCFeeConfig) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveIBCFeeConfig) ProtoMessage() {} +func (*MsgRemoveIBCFeeConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{4} +} +func (m *MsgRemoveIBCFeeConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveIBCFeeConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveIBCFeeConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveIBCFeeConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveIBCFeeConfig.Merge(m, src) +} +func (m *MsgRemoveIBCFeeConfig) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveIBCFeeConfig) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveIBCFeeConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveIBCFeeConfig proto.InternalMessageInfo + +func (m *MsgRemoveIBCFeeConfig) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgRemoveIBCFeeConfig) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +type MsgRemoveIBCFeeConfigResponse struct { +} + +func (m *MsgRemoveIBCFeeConfigResponse) Reset() { *m = MsgRemoveIBCFeeConfigResponse{} } +func (m *MsgRemoveIBCFeeConfigResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveIBCFeeConfigResponse) ProtoMessage() {} +func (*MsgRemoveIBCFeeConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{5} +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveIBCFeeConfigResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveIBCFeeConfigResponse.Merge(m, src) +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveIBCFeeConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveIBCFeeConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveIBCFeeConfigResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateCustomIbcParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateCustomIbcParams") proto.RegisterType((*MsgUpdateParamsCustomIbcResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsCustomIbcResponse") + proto.RegisterType((*MsgAddIBCFeeConfig)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddIBCFeeConfig") + proto.RegisterType((*MsgAddIBCFeeConfigResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddIBCFeeConfigResponse") + proto.RegisterType((*MsgRemoveIBCFeeConfig)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveIBCFeeConfig") + proto.RegisterType((*MsgRemoveIBCFeeConfigResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveIBCFeeConfigResponse") } func init() { @@ -141,31 +344,45 @@ func init() { } var fileDescriptor_bf5c053de6965bca = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0xcf, 0x2d, - 0xc8, 0x2f, 0x4e, 0x4c, 0xca, 0x49, 0xd5, 0xcf, 0x4c, 0x4a, 0x2e, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, - 0x4b, 0x2d, 0xca, 0xcd, 0x4c, 0x49, 0xc9, 0x49, 0x2d, 0x4f, 0x2c, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, - 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xd2, 0x40, - 0x68, 0xd1, 0xc3, 0xaa, 0x45, 0x0f, 0xaa, 0x45, 0x4a, 0x3c, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, - 0x3f, 0xb7, 0x38, 0x5d, 0xbf, 0xcc, 0x10, 0x44, 0x41, 0x8c, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, - 0xcb, 0xd7, 0x07, 0x93, 0x50, 0x21, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, - 0x8a, 0x4a, 0x42, 0x4c, 0x88, 0x87, 0x48, 0x40, 0x38, 0x50, 0x29, 0x17, 0xa2, 0x5d, 0x8e, 0xdd, - 0x91, 0x60, 0x53, 0x94, 0xde, 0x31, 0x72, 0x49, 0xf8, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, - 0xa4, 0x3a, 0x97, 0x16, 0x97, 0xe4, 0xe7, 0x7a, 0x26, 0x25, 0x07, 0x24, 0x16, 0x25, 0xe6, 0x16, - 0x0b, 0x99, 0x71, 0x71, 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, - 0x30, 0x6a, 0x70, 0x3a, 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x87, 0x63, 0x4a, 0x4a, 0x51, - 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x50, 0x30, 0x17, 0x5b, - 0x01, 0xd8, 0x04, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x03, 0x3d, 0x62, 0x83, 0x4c, 0x0f, - 0x62, 0xb3, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0x1a, - 0x65, 0xe5, 0xda, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0x92, 0xae, 0xe7, 0x1b, 0xb4, 0x8c, 0x90, 0x82, - 0xa0, 0x02, 0x47, 0x20, 0xc0, 0x3d, 0x07, 0x31, 0x59, 0x49, 0x89, 0x4b, 0x01, 0x4d, 0x08, 0xee, - 0xeb, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x6d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, - 0xe9, 0x42, 0xcb, 0x19, 0xb9, 0x44, 0xb1, 0x87, 0x8c, 0x13, 0xf1, 0x3e, 0xc2, 0x15, 0xba, 0x52, - 0x5e, 0x64, 0x98, 0x81, 0xc3, 0xc5, 0x52, 0xac, 0x0d, 0xa0, 0xb0, 0x72, 0x32, 0x3f, 0xf1, 0x48, - 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, - 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x59, 0x5c, 0xe1, 0x53, 0x52, 0x59, 0x90, 0x5a, - 0x9c, 0xc4, 0x06, 0x4e, 0x0d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x4e, 0xf0, 0x3b, - 0x0f, 0x03, 0x00, 0x00, + // 600 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0x33, 0x8d, 0x16, 0x76, 0x0a, 0x6a, 0xd7, 0x56, 0xd7, 0xc5, 0xee, 0x86, 0x3d, 0x85, + 0x82, 0x59, 0x13, 0xc1, 0x42, 0x10, 0x24, 0x9b, 0xa8, 0x44, 0x08, 0xc8, 0xb6, 0x5e, 0xbc, 0x84, + 0x49, 0x76, 0xb2, 0x5d, 0xc8, 0xec, 0x2c, 0x3b, 0x93, 0xd8, 0xdc, 0xc4, 0x93, 0x78, 0xf2, 0xe2, + 0xb5, 0x57, 0x3d, 0xe6, 0xe0, 0x1f, 0xd1, 0x63, 0xf1, 0xe4, 0x29, 0x48, 0x72, 0xc8, 0x4d, 0x21, + 0x7f, 0x81, 0x64, 0x67, 0x93, 0xd4, 0xfc, 0x80, 0xd4, 0x5e, 0xbc, 0x64, 0x67, 0xde, 0x9b, 0xf7, + 0x99, 0xef, 0x7c, 0xf3, 0x66, 0x60, 0xb6, 0x4e, 0x49, 0x40, 0x19, 0xaa, 0x35, 0xb1, 0xe9, 0xd5, + 0xea, 0x3c, 0x44, 0x3e, 0x6b, 0xe0, 0x90, 0x78, 0x8e, 0xd3, 0xc4, 0x6f, 0x51, 0x88, 0xcd, 0x76, + 0xb6, 0x86, 0x39, 0xca, 0x9a, 0xfc, 0x24, 0x13, 0x84, 0x94, 0x53, 0x39, 0x3d, 0x2b, 0xc9, 0x2c, + 0x2d, 0xc9, 0xc4, 0x25, 0xea, 0xdd, 0x3a, 0x65, 0x84, 0x32, 0x93, 0x30, 0xd7, 0x6c, 0x67, 0xc7, + 0x1f, 0x81, 0x50, 0xb7, 0x11, 0xf1, 0x7c, 0x6a, 0x46, 0xbf, 0x71, 0x68, 0xc7, 0xa5, 0x2e, 0x8d, + 0x86, 0xe6, 0x78, 0x14, 0x47, 0xef, 0x09, 0x42, 0x55, 0x24, 0xc4, 0x24, 0x4e, 0x95, 0xd6, 0x56, + 0xbe, 0x5c, 0x64, 0x44, 0x31, 0x7e, 0x01, 0xa8, 0x54, 0x98, 0xfb, 0x3a, 0x70, 0x10, 0xc7, 0xc5, + 0x16, 0xe3, 0x94, 0x94, 0x6b, 0xf5, 0x57, 0x28, 0x44, 0x84, 0xc9, 0x8f, 0xa1, 0x84, 0x5a, 0xfc, + 0x98, 0x86, 0x1e, 0xef, 0x28, 0x20, 0x05, 0xd2, 0x92, 0xa5, 0x7c, 0xff, 0xf6, 0x60, 0x27, 0xd6, + 0x51, 0x70, 0x9c, 0x10, 0x33, 0x76, 0xc8, 0x43, 0xcf, 0x77, 0xed, 0xd9, 0x52, 0xf9, 0x10, 0x6e, + 0x06, 0x11, 0x41, 0xd9, 0x48, 0x81, 0xf4, 0x56, 0xee, 0x61, 0x66, 0x5d, 0xcb, 0x32, 0x62, 0x67, + 0x4b, 0x3a, 0xeb, 0xe9, 0x89, 0xaf, 0xc3, 0xee, 0x3e, 0xb0, 0x63, 0x54, 0xfe, 0xd9, 0xfb, 0x61, + 0x77, 0x7f, 0xb6, 0xc9, 0xc7, 0x61, 0x77, 0x3f, 0x77, 0xc1, 0x82, 0x93, 0x15, 0x26, 0x4c, 0x0f, + 0x27, 0xc8, 0x86, 0x01, 0x53, 0x73, 0xa1, 0xe9, 0xa9, 0x6d, 0xcc, 0x02, 0xea, 0x33, 0x6c, 0x7c, + 0xd8, 0x80, 0x72, 0x85, 0xb9, 0x05, 0xc7, 0x29, 0x5b, 0xc5, 0xe7, 0x18, 0x17, 0xa9, 0xdf, 0xf0, + 0x5c, 0x39, 0xb7, 0x68, 0xc7, 0xce, 0xa8, 0xa7, 0xdf, 0xea, 0x20, 0xd2, 0xcc, 0x1b, 0xd3, 0x94, + 0x71, 0xd1, 0x8a, 0x02, 0x84, 0xf5, 0x63, 0xe4, 0xfb, 0xb8, 0x59, 0xf5, 0x9c, 0xc8, 0x0e, 0xc9, + 0x32, 0xfa, 0x3d, 0x5d, 0x2a, 0x8a, 0x68, 0xb9, 0x34, 0xea, 0xe9, 0xdb, 0x82, 0x30, 0x5b, 0x68, + 0xd8, 0x52, 0x3c, 0x29, 0x3b, 0xf2, 0x01, 0xdc, 0x6a, 0x60, 0x5c, 0x45, 0xc2, 0x6d, 0x25, 0x19, + 0x31, 0xee, 0x8c, 0x7a, 0xba, 0x2c, 0xca, 0xc2, 0x66, 0x67, 0x92, 0x34, 0x6c, 0xd8, 0xc0, 0x38, + 0xfe, 0x5f, 0xe4, 0x1c, 0xdc, 0x25, 0x9e, 0x5f, 0xe5, 0x1e, 0xc1, 0xb4, 0xc5, 0xa3, 0x2f, 0xe3, + 0x88, 0x04, 0xca, 0xb5, 0x14, 0x48, 0x27, 0xed, 0xdb, 0xc4, 0xf3, 0x8f, 0x44, 0xee, 0x68, 0x92, + 0xca, 0xdf, 0xf8, 0xdb, 0x65, 0xe3, 0x3e, 0x54, 0x17, 0x9d, 0x98, 0x1a, 0x75, 0x0a, 0xe0, 0x6e, + 0x85, 0xb9, 0x36, 0x26, 0xb4, 0x8d, 0xff, 0x03, 0xaf, 0x16, 0xe4, 0xeb, 0x70, 0x6f, 0xa9, 0xbe, + 0xc9, 0x09, 0x72, 0xbf, 0x93, 0x30, 0x59, 0x61, 0xae, 0xfc, 0x05, 0xc0, 0xdd, 0xe5, 0x97, 0xc0, + 0x5a, 0xbf, 0x79, 0x57, 0x5d, 0x24, 0xf5, 0xe5, 0x3f, 0x30, 0x56, 0x34, 0xa7, 0xfc, 0x19, 0xc0, + 0x9b, 0xf3, 0x9d, 0xf9, 0xe4, 0x52, 0xfc, 0xb9, 0x6a, 0xb5, 0x74, 0x95, 0xea, 0xa9, 0xae, 0x53, + 0x00, 0xe5, 0x25, 0x8d, 0xf0, 0xf4, 0x52, 0xf0, 0x45, 0x80, 0xfa, 0xe2, 0x8a, 0x80, 0x89, 0x40, + 0xf5, 0xfa, 0xbb, 0xf1, 0x7b, 0x62, 0x1d, 0x9c, 0xf5, 0x35, 0x70, 0xde, 0xd7, 0xc0, 0xcf, 0xbe, + 0x06, 0x3e, 0x0d, 0xb4, 0xc4, 0xf9, 0x40, 0x4b, 0xfc, 0x18, 0x68, 0x89, 0x37, 0x7b, 0xab, 0xde, + 0x10, 0xde, 0x09, 0x30, 0xab, 0x6d, 0x46, 0x2f, 0xe6, 0xa3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x6c, 0xfd, 0xab, 0xe5, 0x33, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -181,6 +398,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) + AddIBCFeeConfig(ctx context.Context, in *MsgAddIBCFeeConfig, opts ...grpc.CallOption) (*MsgAddIBCFeeConfigResponse, error) + RemoveIBCFeeConfig(ctx context.Context, in *MsgRemoveIBCFeeConfig, opts ...grpc.CallOption) (*MsgRemoveIBCFeeConfigResponse, error) } type msgClient struct { @@ -200,9 +419,29 @@ func (c *msgClient) UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCust return out, nil } +func (c *msgClient) AddIBCFeeConfig(ctx context.Context, in *MsgAddIBCFeeConfig, opts ...grpc.CallOption) (*MsgAddIBCFeeConfigResponse, error) { + out := new(MsgAddIBCFeeConfigResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/AddIBCFeeConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveIBCFeeConfig(ctx context.Context, in *MsgRemoveIBCFeeConfig, opts ...grpc.CallOption) (*MsgRemoveIBCFeeConfigResponse, error) { + out := new(MsgRemoveIBCFeeConfigResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveIBCFeeConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { UpdateCustomIbcParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) + AddIBCFeeConfig(context.Context, *MsgAddIBCFeeConfig) (*MsgAddIBCFeeConfigResponse, error) + RemoveIBCFeeConfig(context.Context, *MsgRemoveIBCFeeConfig) (*MsgRemoveIBCFeeConfigResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -212,6 +451,12 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateCustomIbcParams(ctx context.Context, req *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateCustomIbcParams not implemented") } +func (*UnimplementedMsgServer) AddIBCFeeConfig(ctx context.Context, req *MsgAddIBCFeeConfig) (*MsgAddIBCFeeConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddIBCFeeConfig not implemented") +} +func (*UnimplementedMsgServer) RemoveIBCFeeConfig(ctx context.Context, req *MsgRemoveIBCFeeConfig) (*MsgRemoveIBCFeeConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveIBCFeeConfig not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -235,6 +480,42 @@ func _Msg_UpdateCustomIbcParams_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Msg_AddIBCFeeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddIBCFeeConfig) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddIBCFeeConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/AddIBCFeeConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddIBCFeeConfig(ctx, req.(*MsgAddIBCFeeConfig)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveIBCFeeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveIBCFeeConfig) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveIBCFeeConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveIBCFeeConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveIBCFeeConfig(ctx, req.(*MsgRemoveIBCFeeConfig)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "composable.ibctransfermiddleware.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -243,6 +524,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateCustomIbcParams", Handler: _Msg_UpdateCustomIbcParams_Handler, }, + { + MethodName: "AddIBCFeeConfig", + Handler: _Msg_AddIBCFeeConfig_Handler, + }, + { + MethodName: "RemoveIBCFeeConfig", + Handler: _Msg_RemoveIBCFeeConfig_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", @@ -311,62 +600,253 @@ func (m *MsgUpdateParamsCustomIbcResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgAddIBCFeeConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgUpdateCustomIbcParams) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgAddIBCFeeConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddIBCFeeConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.MinTimeoutTimestamp != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MinTimeoutTimestamp)) + i-- + dAtA[i] = 0x20 } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n + if len(m.FeeAddress) > 0 { + i -= len(m.FeeAddress) + copy(dAtA[i:], m.FeeAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FeeAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgAddIBCFeeConfigResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgAddIBCFeeConfigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddIBCFeeConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *MsgRemoveIBCFeeConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *MsgRemoveIBCFeeConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ + +func (m *MsgRemoveIBCFeeConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveIBCFeeConfigResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveIBCFeeConfigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveIBCFeeConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateCustomIbcParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddIBCFeeConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.FeeAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MinTimeoutTimestamp != 0 { + n += 1 + sovTx(uint64(m.MinTimeoutTimestamp)) + } + return n +} + +func (m *MsgAddIBCFeeConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveIBCFeeConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveIBCFeeConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break @@ -517,6 +997,385 @@ func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddIBCFeeConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTimeoutTimestamp", wireType) + } + m.MinTimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinTimeoutTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 2c06ec9f35caaaaeae1396b0efd3accc3a322334 Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 16:45:58 +0000 Subject: [PATCH 65/71] added 2 extra method that allow to add/remove allowed tokens for ibc tx --- .../ibctransfermiddleware/v1beta1/tx.proto | 54 + x/ibctransfermiddleware/client/cli/tx.go | 91 +- x/ibctransfermiddleware/keeper/msg_server.go | 80 ++ x/ibctransfermiddleware/types/errors.go | 10 + x/ibctransfermiddleware/types/msg.go | 88 ++ x/ibctransfermiddleware/types/tx.pb.go | 1211 +++++++++++++++-- 6 files changed, 1394 insertions(+), 140 deletions(-) create mode 100644 x/ibctransfermiddleware/types/errors.go diff --git a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto index adc82a8ac..a25506804 100644 --- a/proto/composable/ibctransfermiddleware/v1beta1/tx.proto +++ b/proto/composable/ibctransfermiddleware/v1beta1/tx.proto @@ -19,6 +19,11 @@ service Msg { returns (MsgAddIBCFeeConfigResponse); rpc RemoveIBCFeeConfig(MsgRemoveIBCFeeConfig) returns (MsgRemoveIBCFeeConfigResponse); + + rpc AddAllowedIbcToken(MsgAddAllowedIbcToken) + returns (MsgAddAllowedIbcTokenResponse); + rpc RemoveAllowedIbcToken(MsgRemoveAllowedIbcToken) + returns (MsgRemoveAllowedIbcTokenResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -82,3 +87,52 @@ message MsgRemoveIBCFeeConfig { } message MsgRemoveIBCFeeConfigResponse {} + + + +// MsgAddParachainInfo represents a message to add new parachain info. +message MsgAddAllowedIbcToken { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; + + string denom = 3 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "Denom" + ]; + + int64 amount = 4; + + int64 percentage = 5; +} + +message MsgAddAllowedIbcTokenResponse {} + + +message MsgRemoveAllowedIbcToken { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + ; + + string channel_id = 2 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "ChannelID" + ]; + + string denom = 3 [ + (gogoproto.moretags) = "yaml:\"channel_id\"", + (gogoproto.customname) = "Denom" + ]; +} + +message MsgRemoveAllowedIbcTokenResponse {} diff --git a/x/ibctransfermiddleware/client/cli/tx.go b/x/ibctransfermiddleware/client/cli/tx.go index b95789b5b..b9982e3b9 100644 --- a/x/ibctransfermiddleware/client/cli/tx.go +++ b/x/ibctransfermiddleware/client/cli/tx.go @@ -25,6 +25,8 @@ func GetTxCmd() *cobra.Command { txCmd.AddCommand( AddIBCFeeConfig(), RemoveIBCFeeConfig(), + AddAllowedIbcToken(), + RemoveAllowedIbcToken(), ) return txCmd @@ -32,7 +34,7 @@ func GetTxCmd() *cobra.Command { func AddIBCFeeConfig() *cobra.Command { cmd := &cobra.Command{ - Use: "add-config [addr ]", + Use: "add-config [channel] [feeAddress] [minTimeoutTimestamp]", Short: "add ibc fee config", Args: cobra.MatchAll(cobra.ExactArgs(3), cobra.OnlyValidArgs), Example: fmt.Sprintf("%s tx ibctransfermiddleware add-config [channel] [feeAddress] [minTimeoutTimestamp]", version.AppName), @@ -73,10 +75,59 @@ func AddIBCFeeConfig() *cobra.Command { return cmd } +func AddAllowedIbcToken() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-allowed-ibc-token [channel] [denom] [amount] [percentage]", + Short: "add allowed ibc token", + Args: cobra.MatchAll(cobra.ExactArgs(4), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware add-allowed-ibc-token [channel] [denom] [amount] [percentage] (percentage '5' means 1/5 of amount will be taken as fee) ", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + denom := args[1] + amount := args[2] + percentage := args[3] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + amountInt, err := strconv.ParseInt(amount, 10, 64) + if err != nil { + return err + } + + percentageInt, errPercentage := strconv.ParseInt(percentage, 10, 64) + if errPercentage != nil { + return errPercentage + } + + msg := types.NewMsgAddAllowedIbcToken( + fromAddress, + channel, + denom, + amountInt, + percentageInt, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + func RemoveIBCFeeConfig() *cobra.Command { cmd := &cobra.Command{ - Use: "remove-config [addr ]", - Short: "add ibc fee config", + Use: "remove-config [channel]", + Short: "remove ibc fee config", Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), Example: fmt.Sprintf("%s tx ibctransfermiddleware remove-config [channel]", version.AppName), RunE: func(cmd *cobra.Command, args []string) error { @@ -104,3 +155,37 @@ func RemoveIBCFeeConfig() *cobra.Command { return cmd } + +func RemoveAllowedIbcToken() *cobra.Command { + cmd := &cobra.Command{ + Use: "remove-allowed-ibc-token [channel] [denom]", + Short: "remove allowed ibc token", + Args: cobra.MatchAll(cobra.ExactArgs(2), cobra.OnlyValidArgs), + Example: fmt.Sprintf("%s tx ibctransfermiddleware remove-allowed-ibc-token [channel] [denom]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + channel := args[0] + denom := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromAddress := clientCtx.GetFromAddress().String() + + msg := types.NewMsgRemoveAllowedIbcToken( + fromAddress, + channel, + denom, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index 5aa00a9aa..d88fb99ff 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -93,6 +93,72 @@ func (ms msgServer) RemoveIBCFeeConfig(goCtx context.Context, req *types.MsgRemo return &types.MsgRemoveIBCFeeConfigResponse{}, nil } +func (ms msgServer) AddAllowedIbcToken(goCtx context.Context, req *types.MsgAddAllowedIbcToken) (*types.MsgAddAllowedIbcTokenResponse, error) { + if ms.authority != req.Authority { + // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; Nikita expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.Keeper.GetParams(ctx) + channelFee := findChannelParams(params.ChannelFees, req.ChannelID) + if channelFee != nil { + coin := findCoinByDenom(channelFee.AllowedTokens, req.Denom) + if coin != nil { + coin_c := sdk.Coin{ + Denom: req.Denom, + Amount: sdk.NewInt(req.Amount), + } + coin.MinFee = coin_c + coin.Percentage = req.Percentage + } else { + coin_c := sdk.Coin{ + Denom: req.Denom, + Amount: sdk.NewInt(req.Amount), + } + coin := &types.CoinItem{ + MinFee: coin_c, + Percentage: req.Percentage, + } + channelFee.AllowedTokens = append(channelFee.AllowedTokens, coin) + } + } else { + return nil, errorsmod.Wrapf(types.ErrChannelFeeNotFound, "channel fee not found for channel %s", req.ChannelID) + } + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + + return &types.MsgAddAllowedIbcTokenResponse{}, nil +} + +func (ms msgServer) RemoveAllowedIbcToken(goCtx context.Context, req *types.MsgRemoveAllowedIbcToken) (*types.MsgRemoveAllowedIbcTokenResponse, error) { + if ms.authority != req.Authority { + // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.Keeper.GetParams(ctx) + channelFee := findChannelParams(params.ChannelFees, req.ChannelID) + if channelFee != nil { + for i, coin := range channelFee.AllowedTokens { + if coin.MinFee.Denom == req.Denom { + channelFee.AllowedTokens = append(channelFee.AllowedTokens[:i], channelFee.AllowedTokens[i+1:]...) + break + } + } + } else { + return nil, errorsmod.Wrapf(types.ErrChannelFeeNotFound, "channel fee not found for channel %s", req.ChannelID) + } + + errSetParams := ms.Keeper.SetParams(ctx, params) + if errSetParams != nil { + return nil, errSetParams + } + + return &types.MsgRemoveAllowedIbcTokenResponse{}, nil +} + func findChannelParams(channelFees []*types.ChannelFee, targetChannelID string) *types.ChannelFee { for _, fee := range channelFees { if fee.Channel == targetChannelID { @@ -101,3 +167,17 @@ func findChannelParams(channelFees []*types.ChannelFee, targetChannelID string) } return nil // If the channel is not found } + +func findCoinByDenom(allowedTokens []*types.CoinItem, denom string) *types.CoinItem { + for _, coin := range allowedTokens { + if coin.MinFee.Denom == denom { + return coin + } + } + return nil // If the denom is not found +} + +// rpc AddAllowedIbcToken(MsgAddAllowedIbcToken) +// returns (MsgAddAllowedIbcTokenResponse); +// rpc RemoveAllowedIbcToken(MsgRemoveAllowedIbcToken) +// returns (MsgRemoveAllowedIbcTokenResponse); diff --git a/x/ibctransfermiddleware/types/errors.go b/x/ibctransfermiddleware/types/errors.go new file mode 100644 index 000000000..929a6801d --- /dev/null +++ b/x/ibctransfermiddleware/types/errors.go @@ -0,0 +1,10 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/ratelimit module sentinel errors +var ( + ErrChannelFeeNotFound = errorsmod.Register(ModuleName, 1, "channel fee not found for channel") +) diff --git a/x/ibctransfermiddleware/types/msg.go b/x/ibctransfermiddleware/types/msg.go index 23fbb96c0..bd7474835 100644 --- a/x/ibctransfermiddleware/types/msg.go +++ b/x/ibctransfermiddleware/types/msg.go @@ -10,6 +10,9 @@ var _ sdk.Msg = &MsgAddIBCFeeConfig{} const ( TypeMsgAddIBCFeeConfig = "add_config" TypeMsgRemoveIBCFeeConfig = "remove_config" + + TypeMsgAddAllowedIbcToken = "add_allowed_ibc_token" + TypeMsgRemoveAllowedIbcToken = "remove_allowed_ibc_token" ) func NewMsgAddIBCFeeConfig( @@ -101,3 +104,88 @@ func (msg *MsgRemoveIBCFeeConfig) ValidateBasic() error { return nil } + +var _ sdk.Msg = &MsgAddAllowedIbcToken{} + +func NewMsgAddAllowedIbcToken( + authority string, + channelID string, + denom string, + amount int64, + percentage int64, +) *MsgAddAllowedIbcToken { + return &MsgAddAllowedIbcToken{ + Authority: authority, + ChannelID: channelID, + Denom: denom, + Amount: amount, + Percentage: percentage, + } +} + +// Route Implements Msg. +func (msg MsgAddAllowedIbcToken) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgAddAllowedIbcToken) Type() string { return TypeMsgAddAllowedIbcToken } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgAddAllowedIbcToken) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgAddParachainIBCTokenInfo message. +func (msg *MsgAddAllowedIbcToken) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgAddAllowedIbcToken) ValidateBasic() error { + // validate authority + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} + +var _ sdk.Msg = &MsgRemoveAllowedIbcToken{} + +func NewMsgRemoveAllowedIbcToken( + authority string, + channelID string, + denom string, +) *MsgRemoveAllowedIbcToken { + return &MsgRemoveAllowedIbcToken{ + Authority: authority, + ChannelID: channelID, + Denom: denom, + } +} + +// Route Implements Msg. +func (msg MsgRemoveAllowedIbcToken) Route() string { return RouterKey } + +// Type Implements Msg. +func (msg MsgRemoveAllowedIbcToken) Type() string { return TypeMsgRemoveAllowedIbcToken } + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgRemoveAllowedIbcToken) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners returns the expected signers for a MsgRemoveParachainIBCTokenInfo message. +func (msg *MsgRemoveAllowedIbcToken) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgRemoveAllowedIbcToken) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + return nil +} diff --git a/x/ibctransfermiddleware/types/tx.pb.go b/x/ibctransfermiddleware/types/tx.pb.go index c4adbde16..feeca5b08 100644 --- a/x/ibctransfermiddleware/types/tx.pb.go +++ b/x/ibctransfermiddleware/types/tx.pb.go @@ -330,6 +330,219 @@ func (m *MsgRemoveIBCFeeConfigResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveIBCFeeConfigResponse proto.InternalMessageInfo +// MsgAddParachainInfo represents a message to add new parachain info. +type MsgAddAllowedIbcToken struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty" yaml:"channel_id"` + Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + Percentage int64 `protobuf:"varint,5,opt,name=percentage,proto3" json:"percentage,omitempty"` +} + +func (m *MsgAddAllowedIbcToken) Reset() { *m = MsgAddAllowedIbcToken{} } +func (m *MsgAddAllowedIbcToken) String() string { return proto.CompactTextString(m) } +func (*MsgAddAllowedIbcToken) ProtoMessage() {} +func (*MsgAddAllowedIbcToken) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{6} +} +func (m *MsgAddAllowedIbcToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAllowedIbcToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAllowedIbcToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAllowedIbcToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAllowedIbcToken.Merge(m, src) +} +func (m *MsgAddAllowedIbcToken) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAllowedIbcToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAllowedIbcToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAllowedIbcToken proto.InternalMessageInfo + +func (m *MsgAddAllowedIbcToken) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddAllowedIbcToken) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgAddAllowedIbcToken) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *MsgAddAllowedIbcToken) GetAmount() int64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *MsgAddAllowedIbcToken) GetPercentage() int64 { + if m != nil { + return m.Percentage + } + return 0 +} + +type MsgAddAllowedIbcTokenResponse struct { +} + +func (m *MsgAddAllowedIbcTokenResponse) Reset() { *m = MsgAddAllowedIbcTokenResponse{} } +func (m *MsgAddAllowedIbcTokenResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddAllowedIbcTokenResponse) ProtoMessage() {} +func (*MsgAddAllowedIbcTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{7} +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAllowedIbcTokenResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAllowedIbcTokenResponse.Merge(m, src) +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAllowedIbcTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAllowedIbcTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAllowedIbcTokenResponse proto.InternalMessageInfo + +type MsgRemoveAllowedIbcToken struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + ChannelID string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty" yaml:"channel_id"` +} + +func (m *MsgRemoveAllowedIbcToken) Reset() { *m = MsgRemoveAllowedIbcToken{} } +func (m *MsgRemoveAllowedIbcToken) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAllowedIbcToken) ProtoMessage() {} +func (*MsgRemoveAllowedIbcToken) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{8} +} +func (m *MsgRemoveAllowedIbcToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAllowedIbcToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAllowedIbcToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveAllowedIbcToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAllowedIbcToken.Merge(m, src) +} +func (m *MsgRemoveAllowedIbcToken) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAllowedIbcToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAllowedIbcToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAllowedIbcToken proto.InternalMessageInfo + +func (m *MsgRemoveAllowedIbcToken) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgRemoveAllowedIbcToken) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + +func (m *MsgRemoveAllowedIbcToken) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type MsgRemoveAllowedIbcTokenResponse struct { +} + +func (m *MsgRemoveAllowedIbcTokenResponse) Reset() { *m = MsgRemoveAllowedIbcTokenResponse{} } +func (m *MsgRemoveAllowedIbcTokenResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAllowedIbcTokenResponse) ProtoMessage() {} +func (*MsgRemoveAllowedIbcTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bf5c053de6965bca, []int{9} +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse.Merge(m, src) +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAllowedIbcTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAllowedIbcTokenResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateCustomIbcParams)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateCustomIbcParams") proto.RegisterType((*MsgUpdateParamsCustomIbcResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgUpdateParamsCustomIbcResponse") @@ -337,6 +550,10 @@ func init() { proto.RegisterType((*MsgAddIBCFeeConfigResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddIBCFeeConfigResponse") proto.RegisterType((*MsgRemoveIBCFeeConfig)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveIBCFeeConfig") proto.RegisterType((*MsgRemoveIBCFeeConfigResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveIBCFeeConfigResponse") + proto.RegisterType((*MsgAddAllowedIbcToken)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddAllowedIbcToken") + proto.RegisterType((*MsgAddAllowedIbcTokenResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgAddAllowedIbcTokenResponse") + proto.RegisterType((*MsgRemoveAllowedIbcToken)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveAllowedIbcToken") + proto.RegisterType((*MsgRemoveAllowedIbcTokenResponse)(nil), "composable.ibctransfermiddleware.v1beta1.MsgRemoveAllowedIbcTokenResponse") } func init() { @@ -344,45 +561,53 @@ func init() { } var fileDescriptor_bf5c053de6965bca = []byte{ - // 600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xc7, 0x33, 0x8d, 0x16, 0x76, 0x0a, 0x6a, 0xd7, 0x56, 0xd7, 0xc5, 0xee, 0x86, 0x3d, 0x85, - 0x82, 0x59, 0x13, 0xc1, 0x42, 0x10, 0x24, 0x9b, 0xa8, 0x44, 0x08, 0xc8, 0xb6, 0x5e, 0xbc, 0x84, - 0x49, 0x76, 0xb2, 0x5d, 0xc8, 0xec, 0x2c, 0x3b, 0x93, 0xd8, 0xdc, 0xc4, 0x93, 0x78, 0xf2, 0xe2, - 0xb5, 0x57, 0x3d, 0xe6, 0xe0, 0x1f, 0xd1, 0x63, 0xf1, 0xe4, 0x29, 0x48, 0x72, 0xc8, 0x4d, 0x21, - 0x7f, 0x81, 0x64, 0x67, 0x93, 0xd4, 0xfc, 0x80, 0xd4, 0x5e, 0xbc, 0x64, 0x67, 0xde, 0x9b, 0xf7, - 0x99, 0xef, 0x7c, 0xf3, 0x66, 0x60, 0xb6, 0x4e, 0x49, 0x40, 0x19, 0xaa, 0x35, 0xb1, 0xe9, 0xd5, - 0xea, 0x3c, 0x44, 0x3e, 0x6b, 0xe0, 0x90, 0x78, 0x8e, 0xd3, 0xc4, 0x6f, 0x51, 0x88, 0xcd, 0x76, - 0xb6, 0x86, 0x39, 0xca, 0x9a, 0xfc, 0x24, 0x13, 0x84, 0x94, 0x53, 0x39, 0x3d, 0x2b, 0xc9, 0x2c, - 0x2d, 0xc9, 0xc4, 0x25, 0xea, 0xdd, 0x3a, 0x65, 0x84, 0x32, 0x93, 0x30, 0xd7, 0x6c, 0x67, 0xc7, - 0x1f, 0x81, 0x50, 0xb7, 0x11, 0xf1, 0x7c, 0x6a, 0x46, 0xbf, 0x71, 0x68, 0xc7, 0xa5, 0x2e, 0x8d, - 0x86, 0xe6, 0x78, 0x14, 0x47, 0xef, 0x09, 0x42, 0x55, 0x24, 0xc4, 0x24, 0x4e, 0x95, 0xd6, 0x56, - 0xbe, 0x5c, 0x64, 0x44, 0x31, 0x7e, 0x01, 0xa8, 0x54, 0x98, 0xfb, 0x3a, 0x70, 0x10, 0xc7, 0xc5, - 0x16, 0xe3, 0x94, 0x94, 0x6b, 0xf5, 0x57, 0x28, 0x44, 0x84, 0xc9, 0x8f, 0xa1, 0x84, 0x5a, 0xfc, - 0x98, 0x86, 0x1e, 0xef, 0x28, 0x20, 0x05, 0xd2, 0x92, 0xa5, 0x7c, 0xff, 0xf6, 0x60, 0x27, 0xd6, - 0x51, 0x70, 0x9c, 0x10, 0x33, 0x76, 0xc8, 0x43, 0xcf, 0x77, 0xed, 0xd9, 0x52, 0xf9, 0x10, 0x6e, - 0x06, 0x11, 0x41, 0xd9, 0x48, 0x81, 0xf4, 0x56, 0xee, 0x61, 0x66, 0x5d, 0xcb, 0x32, 0x62, 0x67, - 0x4b, 0x3a, 0xeb, 0xe9, 0x89, 0xaf, 0xc3, 0xee, 0x3e, 0xb0, 0x63, 0x54, 0xfe, 0xd9, 0xfb, 0x61, - 0x77, 0x7f, 0xb6, 0xc9, 0xc7, 0x61, 0x77, 0x3f, 0x77, 0xc1, 0x82, 0x93, 0x15, 0x26, 0x4c, 0x0f, - 0x27, 0xc8, 0x86, 0x01, 0x53, 0x73, 0xa1, 0xe9, 0xa9, 0x6d, 0xcc, 0x02, 0xea, 0x33, 0x6c, 0x7c, - 0xd8, 0x80, 0x72, 0x85, 0xb9, 0x05, 0xc7, 0x29, 0x5b, 0xc5, 0xe7, 0x18, 0x17, 0xa9, 0xdf, 0xf0, - 0x5c, 0x39, 0xb7, 0x68, 0xc7, 0xce, 0xa8, 0xa7, 0xdf, 0xea, 0x20, 0xd2, 0xcc, 0x1b, 0xd3, 0x94, - 0x71, 0xd1, 0x8a, 0x02, 0x84, 0xf5, 0x63, 0xe4, 0xfb, 0xb8, 0x59, 0xf5, 0x9c, 0xc8, 0x0e, 0xc9, - 0x32, 0xfa, 0x3d, 0x5d, 0x2a, 0x8a, 0x68, 0xb9, 0x34, 0xea, 0xe9, 0xdb, 0x82, 0x30, 0x5b, 0x68, - 0xd8, 0x52, 0x3c, 0x29, 0x3b, 0xf2, 0x01, 0xdc, 0x6a, 0x60, 0x5c, 0x45, 0xc2, 0x6d, 0x25, 0x19, - 0x31, 0xee, 0x8c, 0x7a, 0xba, 0x2c, 0xca, 0xc2, 0x66, 0x67, 0x92, 0x34, 0x6c, 0xd8, 0xc0, 0x38, - 0xfe, 0x5f, 0xe4, 0x1c, 0xdc, 0x25, 0x9e, 0x5f, 0xe5, 0x1e, 0xc1, 0xb4, 0xc5, 0xa3, 0x2f, 0xe3, - 0x88, 0x04, 0xca, 0xb5, 0x14, 0x48, 0x27, 0xed, 0xdb, 0xc4, 0xf3, 0x8f, 0x44, 0xee, 0x68, 0x92, - 0xca, 0xdf, 0xf8, 0xdb, 0x65, 0xe3, 0x3e, 0x54, 0x17, 0x9d, 0x98, 0x1a, 0x75, 0x0a, 0xe0, 0x6e, - 0x85, 0xb9, 0x36, 0x26, 0xb4, 0x8d, 0xff, 0x03, 0xaf, 0x16, 0xe4, 0xeb, 0x70, 0x6f, 0xa9, 0xbe, - 0xc9, 0x09, 0x72, 0xbf, 0x93, 0x30, 0x59, 0x61, 0xae, 0xfc, 0x05, 0xc0, 0xdd, 0xe5, 0x97, 0xc0, - 0x5a, 0xbf, 0x79, 0x57, 0x5d, 0x24, 0xf5, 0xe5, 0x3f, 0x30, 0x56, 0x34, 0xa7, 0xfc, 0x19, 0xc0, - 0x9b, 0xf3, 0x9d, 0xf9, 0xe4, 0x52, 0xfc, 0xb9, 0x6a, 0xb5, 0x74, 0x95, 0xea, 0xa9, 0xae, 0x53, - 0x00, 0xe5, 0x25, 0x8d, 0xf0, 0xf4, 0x52, 0xf0, 0x45, 0x80, 0xfa, 0xe2, 0x8a, 0x80, 0x89, 0x40, - 0xf5, 0xfa, 0xbb, 0xf1, 0x7b, 0x62, 0x1d, 0x9c, 0xf5, 0x35, 0x70, 0xde, 0xd7, 0xc0, 0xcf, 0xbe, - 0x06, 0x3e, 0x0d, 0xb4, 0xc4, 0xf9, 0x40, 0x4b, 0xfc, 0x18, 0x68, 0x89, 0x37, 0x7b, 0xab, 0xde, - 0x10, 0xde, 0x09, 0x30, 0xab, 0x6d, 0x46, 0x2f, 0xe6, 0xa3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x6c, 0xfd, 0xab, 0xe5, 0x33, 0x06, 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xb1, 0x6f, 0xd3, 0x4a, + 0x18, 0x8f, 0xdb, 0x97, 0x48, 0xb9, 0x4a, 0xef, 0xbd, 0xfa, 0xb5, 0x7d, 0xc1, 0xa2, 0x76, 0xe4, + 0x29, 0xaa, 0x44, 0x4c, 0x02, 0xa2, 0x52, 0x85, 0x54, 0xc5, 0x09, 0xa0, 0x54, 0x8a, 0x84, 0xdc, + 0xb2, 0xb0, 0x44, 0x17, 0xfb, 0xe2, 0x5a, 0xf8, 0x7c, 0x96, 0xef, 0xd2, 0x36, 0x1b, 0x62, 0x42, + 0x88, 0x81, 0x85, 0xb5, 0x2b, 0x8c, 0x1d, 0x98, 0xf8, 0x0b, 0x3a, 0x56, 0x2c, 0x30, 0x45, 0x28, + 0x1d, 0xba, 0x31, 0xf4, 0x2f, 0x40, 0xf1, 0x39, 0x4e, 0x9b, 0x38, 0x52, 0xd3, 0x0e, 0xc0, 0x12, + 0xfb, 0xbe, 0xef, 0xbe, 0x9f, 0x7f, 0xdf, 0xef, 0x8b, 0x7f, 0x67, 0x50, 0x32, 0x09, 0xf6, 0x09, + 0x85, 0x2d, 0x17, 0x69, 0x4e, 0xcb, 0x64, 0x01, 0xf4, 0x68, 0x1b, 0x05, 0xd8, 0xb1, 0x2c, 0x17, + 0xed, 0xc3, 0x00, 0x69, 0x7b, 0xa5, 0x16, 0x62, 0xb0, 0xa4, 0xb1, 0x83, 0xa2, 0x1f, 0x10, 0x46, + 0xc4, 0xc2, 0xa8, 0xa4, 0x98, 0x58, 0x52, 0x8c, 0x4a, 0xa4, 0xff, 0x4d, 0x42, 0x31, 0xa1, 0x1a, + 0xa6, 0xb6, 0xb6, 0x57, 0x1a, 0x5c, 0x38, 0x84, 0xb4, 0x08, 0xb1, 0xe3, 0x11, 0x2d, 0xfc, 0x8d, + 0x42, 0x4b, 0x36, 0xb1, 0x49, 0x78, 0xab, 0x0d, 0xee, 0xa2, 0xe8, 0x2d, 0x8e, 0xd0, 0xe4, 0x09, + 0xbe, 0x88, 0x52, 0xb5, 0x2b, 0x33, 0x4f, 0x26, 0x19, 0xa2, 0xa8, 0x3f, 0x04, 0x90, 0x6b, 0x50, + 0xfb, 0x99, 0x6f, 0x41, 0x86, 0xaa, 0x1d, 0xca, 0x08, 0xae, 0xb7, 0xcc, 0xa7, 0x30, 0x80, 0x98, + 0x8a, 0x0f, 0x40, 0x16, 0x76, 0xd8, 0x2e, 0x09, 0x1c, 0xd6, 0xcd, 0x09, 0x79, 0xa1, 0x90, 0xd5, + 0x73, 0x5f, 0x3e, 0xdd, 0x59, 0x8a, 0x78, 0x54, 0x2c, 0x2b, 0x40, 0x94, 0x6e, 0xb3, 0xc0, 0xf1, + 0x6c, 0x63, 0xb4, 0x55, 0xdc, 0x06, 0x19, 0x3f, 0x44, 0xc8, 0xcd, 0xe5, 0x85, 0xc2, 0x42, 0xf9, + 0x6e, 0xf1, 0xaa, 0x92, 0x15, 0xf9, 0x93, 0xf5, 0xec, 0x71, 0x4f, 0x49, 0x7d, 0x3c, 0x3b, 0x5a, + 0x13, 0x8c, 0x08, 0x6a, 0xe3, 0xd1, 0xab, 0xb3, 0xa3, 0xb5, 0xd1, 0x43, 0xde, 0x9c, 0x1d, 0xad, + 0x95, 0x2f, 0x48, 0x70, 0x30, 0x45, 0x84, 0xb8, 0x39, 0x8e, 0xac, 0xaa, 0x20, 0x3f, 0x16, 0x8a, + 0xbb, 0x36, 0x10, 0xf5, 0x89, 0x47, 0x91, 0xfa, 0x7a, 0x0e, 0x88, 0x0d, 0x6a, 0x57, 0x2c, 0xab, + 0xae, 0x57, 0x1f, 0x23, 0x54, 0x25, 0x5e, 0xdb, 0xb1, 0xc5, 0xf2, 0xa4, 0x1c, 0x4b, 0xe7, 0x3d, + 0xe5, 0xdf, 0x2e, 0xc4, 0xee, 0x86, 0x1a, 0xa7, 0xd4, 0x8b, 0x52, 0x54, 0x00, 0x30, 0x77, 0xa1, + 0xe7, 0x21, 0xb7, 0xe9, 0x58, 0xa1, 0x1c, 0x59, 0x5d, 0xed, 0xf7, 0x94, 0x6c, 0x95, 0x47, 0xeb, + 0xb5, 0xf3, 0x9e, 0xb2, 0xc8, 0x11, 0x46, 0x1b, 0x55, 0x23, 0x1b, 0x2d, 0xea, 0x96, 0xb8, 0x0e, + 0x16, 0xda, 0x08, 0x35, 0x21, 0x57, 0x3b, 0x37, 0x1f, 0x62, 0xac, 0x9c, 0xf7, 0x14, 0x91, 0x97, + 0x05, 0x6e, 0x77, 0x98, 0x54, 0x0d, 0xd0, 0x46, 0x28, 0x9a, 0x8b, 0x58, 0x06, 0xcb, 0xd8, 0xf1, + 0x9a, 0xcc, 0xc1, 0x88, 0x74, 0x58, 0x78, 0xa5, 0x0c, 0x62, 0x3f, 0xf7, 0x57, 0x5e, 0x28, 0xcc, + 0x1b, 0xff, 0x61, 0xc7, 0xdb, 0xe1, 0xb9, 0x9d, 0x61, 0x6a, 0xe3, 0xef, 0xcb, 0x2a, 0xab, 0xb7, + 0x81, 0x34, 0xa9, 0x44, 0x2c, 0xd4, 0xa1, 0x00, 0x96, 0x1b, 0xd4, 0x36, 0x10, 0x26, 0x7b, 0xe8, + 0x37, 0xd0, 0x6a, 0x82, 0xbe, 0x02, 0x56, 0x13, 0xf9, 0xc5, 0x1d, 0xbc, 0x9d, 0x0b, 0x3b, 0xa8, + 0x58, 0x56, 0xc5, 0x75, 0xc9, 0x3e, 0xb2, 0xea, 0x2d, 0x73, 0x87, 0xbc, 0x40, 0xde, 0xaf, 0x9a, + 0xf6, 0x7d, 0x90, 0xb6, 0x90, 0x47, 0x70, 0x34, 0x67, 0xb9, 0xdf, 0x53, 0xd2, 0xb5, 0x41, 0x20, + 0xb9, 0x92, 0x6f, 0x16, 0x57, 0x40, 0x06, 0x62, 0xd2, 0xf1, 0x58, 0x34, 0xdb, 0x68, 0x25, 0xca, + 0x00, 0xf8, 0x28, 0x30, 0x91, 0xc7, 0xa0, 0x8d, 0x72, 0xe9, 0x30, 0x77, 0x21, 0x32, 0x45, 0xaf, + 0x49, 0x35, 0x62, 0xbd, 0xbe, 0x72, 0xbf, 0xe0, 0x8a, 0xfe, 0xc9, 0x92, 0x4d, 0xb4, 0xce, 0x8d, + 0x21, 0xb1, 0xb1, 0x61, 0xf7, 0xe5, 0xcf, 0x19, 0x30, 0xdf, 0xa0, 0xb6, 0xf8, 0x41, 0x00, 0xcb, + 0xc9, 0x96, 0xa9, 0x5f, 0xdd, 0xea, 0xa6, 0xd9, 0xae, 0xb4, 0x75, 0x0d, 0x8c, 0x29, 0x56, 0x26, + 0xbe, 0x17, 0xc0, 0x3f, 0xe3, 0x3e, 0xf6, 0x70, 0x26, 0xfc, 0xb1, 0x6a, 0xa9, 0x76, 0x93, 0xea, + 0x98, 0xd7, 0xa1, 0x00, 0xc4, 0x04, 0xdb, 0xd8, 0x9c, 0x09, 0x7c, 0x12, 0x40, 0x7a, 0x72, 0x43, + 0x80, 0x4b, 0x04, 0x13, 0x5c, 0x61, 0x73, 0xd6, 0xee, 0xc7, 0x00, 0x66, 0x24, 0x38, 0xfd, 0x4d, + 0x0c, 0xff, 0x83, 0xc9, 0xaf, 0xa1, 0x7e, 0x0d, 0x0d, 0xc6, 0x69, 0x6e, 0xdd, 0x1c, 0x63, 0xc8, + 0x54, 0x4a, 0xbf, 0x1c, 0x1c, 0xe4, 0xfa, 0xfa, 0x71, 0x5f, 0x16, 0x4e, 0xfa, 0xb2, 0xf0, 0xbd, + 0x2f, 0x0b, 0xef, 0x4e, 0xe5, 0xd4, 0xc9, 0xa9, 0x9c, 0xfa, 0x76, 0x2a, 0xa7, 0x9e, 0xaf, 0x4e, + 0x3b, 0xbc, 0x59, 0xd7, 0x47, 0xb4, 0x95, 0x09, 0x3f, 0x55, 0xee, 0xfd, 0x0c, 0x00, 0x00, 0xff, + 0xff, 0x87, 0x62, 0x58, 0x5e, 0xac, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -400,6 +625,8 @@ type MsgClient interface { UpdateCustomIbcParams(ctx context.Context, in *MsgUpdateCustomIbcParams, opts ...grpc.CallOption) (*MsgUpdateParamsCustomIbcResponse, error) AddIBCFeeConfig(ctx context.Context, in *MsgAddIBCFeeConfig, opts ...grpc.CallOption) (*MsgAddIBCFeeConfigResponse, error) RemoveIBCFeeConfig(ctx context.Context, in *MsgRemoveIBCFeeConfig, opts ...grpc.CallOption) (*MsgRemoveIBCFeeConfigResponse, error) + AddAllowedIbcToken(ctx context.Context, in *MsgAddAllowedIbcToken, opts ...grpc.CallOption) (*MsgAddAllowedIbcTokenResponse, error) + RemoveAllowedIbcToken(ctx context.Context, in *MsgRemoveAllowedIbcToken, opts ...grpc.CallOption) (*MsgRemoveAllowedIbcTokenResponse, error) } type msgClient struct { @@ -437,11 +664,31 @@ func (c *msgClient) RemoveIBCFeeConfig(ctx context.Context, in *MsgRemoveIBCFeeC return out, nil } +func (c *msgClient) AddAllowedIbcToken(ctx context.Context, in *MsgAddAllowedIbcToken, opts ...grpc.CallOption) (*MsgAddAllowedIbcTokenResponse, error) { + out := new(MsgAddAllowedIbcTokenResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/AddAllowedIbcToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveAllowedIbcToken(ctx context.Context, in *MsgRemoveAllowedIbcToken, opts ...grpc.CallOption) (*MsgRemoveAllowedIbcTokenResponse, error) { + out := new(MsgRemoveAllowedIbcTokenResponse) + err := c.cc.Invoke(ctx, "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveAllowedIbcToken", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { UpdateCustomIbcParams(context.Context, *MsgUpdateCustomIbcParams) (*MsgUpdateParamsCustomIbcResponse, error) AddIBCFeeConfig(context.Context, *MsgAddIBCFeeConfig) (*MsgAddIBCFeeConfigResponse, error) RemoveIBCFeeConfig(context.Context, *MsgRemoveIBCFeeConfig) (*MsgRemoveIBCFeeConfigResponse, error) + AddAllowedIbcToken(context.Context, *MsgAddAllowedIbcToken) (*MsgAddAllowedIbcTokenResponse, error) + RemoveAllowedIbcToken(context.Context, *MsgRemoveAllowedIbcToken) (*MsgRemoveAllowedIbcTokenResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -457,6 +704,12 @@ func (*UnimplementedMsgServer) AddIBCFeeConfig(ctx context.Context, req *MsgAddI func (*UnimplementedMsgServer) RemoveIBCFeeConfig(ctx context.Context, req *MsgRemoveIBCFeeConfig) (*MsgRemoveIBCFeeConfigResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveIBCFeeConfig not implemented") } +func (*UnimplementedMsgServer) AddAllowedIbcToken(ctx context.Context, req *MsgAddAllowedIbcToken) (*MsgAddAllowedIbcTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddAllowedIbcToken not implemented") +} +func (*UnimplementedMsgServer) RemoveAllowedIbcToken(ctx context.Context, req *MsgRemoveAllowedIbcToken) (*MsgRemoveAllowedIbcTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveAllowedIbcToken not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -516,6 +769,42 @@ func _Msg_RemoveIBCFeeConfig_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Msg_AddAllowedIbcToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddAllowedIbcToken) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddAllowedIbcToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/AddAllowedIbcToken", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddAllowedIbcToken(ctx, req.(*MsgAddAllowedIbcToken)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveAllowedIbcToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveAllowedIbcToken) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveAllowedIbcToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/composable.ibctransfermiddleware.v1beta1.Msg/RemoveAllowedIbcToken", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveAllowedIbcToken(ctx, req.(*MsgRemoveAllowedIbcToken)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "composable.ibctransfermiddleware.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -532,6 +821,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RemoveIBCFeeConfig", Handler: _Msg_RemoveIBCFeeConfig_Handler, }, + { + MethodName: "AddAllowedIbcToken", + Handler: _Msg_AddAllowedIbcToken_Handler, + }, + { + MethodName: "RemoveAllowedIbcToken", + Handler: _Msg_RemoveAllowedIbcToken_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "composable/ibctransfermiddleware/v1beta1/tx.proto", @@ -732,48 +1029,192 @@ func (m *MsgRemoveIBCFeeConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgAddAllowedIbcToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgUpdateCustomIbcParams) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgAddAllowedIbcToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAllowedIbcToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.Percentage != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Percentage)) + i-- + dAtA[i] = 0x28 } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgAddAllowedIbcTokenResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *MsgAddIBCFeeConfig) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgAddAllowedIbcTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAllowedIbcTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Authority) + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAllowedIbcToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveAllowedIbcToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAllowedIbcToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAllowedIbcTokenResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveAllowedIbcTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAllowedIbcTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateCustomIbcParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsCustomIbcResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddIBCFeeConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -788,51 +1229,497 @@ func (m *MsgAddIBCFeeConfig) Size() (n int) { if m.MinTimeoutTimestamp != 0 { n += 1 + sovTx(uint64(m.MinTimeoutTimestamp)) } - return n -} + return n +} + +func (m *MsgAddIBCFeeConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveIBCFeeConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveIBCFeeConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddAllowedIbcToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + if m.Percentage != 0 { + n += 1 + sovTx(uint64(m.Percentage)) + } + return n +} + +func (m *MsgAddAllowedIbcTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveAllowedIbcToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveAllowedIbcTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateCustomIbcParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddIBCFeeConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinTimeoutTimestamp", wireType) + } + m.MinTimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinTimeoutTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *MsgAddIBCFeeConfigResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n + return nil } - -func (m *MsgRemoveIBCFeeConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ChannelID) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgAddIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - return n -} -func (m *MsgRemoveIBCFeeConfigResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -855,10 +1742,10 @@ func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateCustomIbcParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateCustomIbcParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -895,9 +1782,9 @@ func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -907,24 +1794,23 @@ func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ChannelID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -947,7 +1833,7 @@ func (m *MsgUpdateCustomIbcParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -970,10 +1856,10 @@ func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsCustomIbcResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -997,7 +1883,7 @@ func (m *MsgUpdateParamsCustomIbcResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { +func (m *MsgAddAllowedIbcToken) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1020,10 +1906,10 @@ func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddIBCFeeConfig: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddAllowedIbcToken: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddAllowedIbcToken: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1092,7 +1978,7 @@ func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1120,13 +2006,13 @@ func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FeeAddress = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinTimeoutTimestamp", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - m.MinTimeoutTimestamp = 0 + m.Amount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1136,7 +2022,26 @@ func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinTimeoutTimestamp |= int64(b&0x7F) << shift + m.Amount |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Percentage", wireType) + } + m.Percentage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Percentage |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -1162,7 +2067,7 @@ func (m *MsgAddIBCFeeConfig) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddAllowedIbcTokenResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1185,10 +2090,10 @@ func (m *MsgAddIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddAllowedIbcTokenResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddAllowedIbcTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1212,7 +2117,7 @@ func (m *MsgAddIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveAllowedIbcToken) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1235,10 +2140,10 @@ func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveAllowedIbcToken: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveIBCFeeConfig: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveAllowedIbcToken: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1305,6 +2210,38 @@ func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { } m.ChannelID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1326,7 +2263,7 @@ func (m *MsgRemoveIBCFeeConfig) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveAllowedIbcTokenResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1349,10 +2286,10 @@ func (m *MsgRemoveIBCFeeConfigResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveAllowedIbcTokenResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveIBCFeeConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveAllowedIbcTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From 31e6e9961a25396acc61a1dd78e82852076a3b6f Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 17:19:56 +0000 Subject: [PATCH 66/71] use list of addresses as authority to update/remove ibc fee configs,coin --- app/keepers/keepers.go | 10 +++++++- x/ibctransfermiddleware/keeper/keeper.go | 4 ++++ x/ibctransfermiddleware/keeper/msg_server.go | 25 +++++++++++++------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 658784071..0441962d5 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -195,7 +195,15 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) - appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), + []string{"centauri1ay9y5uns9khw2kzaqr3r33v2pkuptfnnr93j5j", + "centauri14lz7gaw92valqjearnye4shex7zg2p05mlx9q0", + "centauri1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w6lytan", + "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m", + + "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9", //remove for mainnet + }) + // "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs", appKeepers.StakingKeeper = customstaking.NewKeeper( appCodec, appKeepers.keys[stakingtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), &appKeepers.StakingMiddlewareKeeper, diff --git a/x/ibctransfermiddleware/keeper/keeper.go b/x/ibctransfermiddleware/keeper/keeper.go index 7de752baa..a43bdb4b9 100644 --- a/x/ibctransfermiddleware/keeper/keeper.go +++ b/x/ibctransfermiddleware/keeper/keeper.go @@ -16,6 +16,8 @@ type Keeper struct { // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string + + addresses []string } // NewKeeper creates a new middleware Keeper instance @@ -23,11 +25,13 @@ func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, authority string, + addresses []string, ) Keeper { return Keeper{ cdc: cdc, storeKey: key, authority: authority, + addresses: addresses, } } diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index d88fb99ff..00a1523fe 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -39,8 +39,8 @@ func (ms msgServer) UpdateCustomIbcParams(goCtx context.Context, req *types.MsgU // AddIBCFeeConfig(MsgAddIBCFeeConfig) returns (MsgAddIBCFeeConfigResponse); func (ms msgServer) AddIBCFeeConfig(goCtx context.Context, req *types.MsgAddIBCFeeConfig) (*types.MsgAddIBCFeeConfigResponse, error) { - if ms.authority != req.Authority { - // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; Nikita expected %s, got %s", ms.authority, req.Authority) + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -72,8 +72,8 @@ func (ms msgServer) AddIBCFeeConfig(goCtx context.Context, req *types.MsgAddIBCF } func (ms msgServer) RemoveIBCFeeConfig(goCtx context.Context, req *types.MsgRemoveIBCFeeConfig) (*types.MsgRemoveIBCFeeConfigResponse, error) { - if ms.authority != req.Authority { - // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -94,8 +94,8 @@ func (ms msgServer) RemoveIBCFeeConfig(goCtx context.Context, req *types.MsgRemo } func (ms msgServer) AddAllowedIbcToken(goCtx context.Context, req *types.MsgAddAllowedIbcToken) (*types.MsgAddAllowedIbcTokenResponse, error) { - if ms.authority != req.Authority { - // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; Nikita expected %s, got %s", ms.authority, req.Authority) + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -133,8 +133,8 @@ func (ms msgServer) AddAllowedIbcToken(goCtx context.Context, req *types.MsgAddA } func (ms msgServer) RemoveAllowedIbcToken(goCtx context.Context, req *types.MsgRemoveAllowedIbcToken) (*types.MsgRemoveAllowedIbcTokenResponse, error) { - if ms.authority != req.Authority { - // return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + if !contains(ms.addresses, req.Authority) && ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected of this addresses from list: %s, got %s", ms.addresses, req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) @@ -177,6 +177,15 @@ func findCoinByDenom(allowedTokens []*types.CoinItem, denom string) *types.CoinI return nil // If the denom is not found } +func contains(arr []string, element string) bool { + for _, v := range arr { + if v == element { + return true + } + } + return false +} + // rpc AddAllowedIbcToken(MsgAddAllowedIbcToken) // returns (MsgAddAllowedIbcTokenResponse); // rpc RemoveAllowedIbcToken(MsgRemoveAllowedIbcToken) From a4762f7db526e67422f824970360862b568433d9 Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 17:24:07 +0000 Subject: [PATCH 67/71] fix lint and unused comments --- app/keepers/keepers.go | 2 +- x/ibctransfermiddleware/client/cli/tx.go | 2 -- x/ibctransfermiddleware/keeper/msg_server.go | 1 - x/ibctransfermiddleware/types/msg.go | 5 ++--- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 0441962d5..68b0012a4 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -201,7 +201,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( "centauri1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w6lytan", "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m", - "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9", //remove for mainnet + "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9", }) // "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs", diff --git a/x/ibctransfermiddleware/client/cli/tx.go b/x/ibctransfermiddleware/client/cli/tx.go index b9982e3b9..1d212ff83 100644 --- a/x/ibctransfermiddleware/client/cli/tx.go +++ b/x/ibctransfermiddleware/client/cli/tx.go @@ -50,9 +50,7 @@ func AddIBCFeeConfig() *cobra.Command { fromAddress := clientCtx.GetFromAddress().String() - //string to int64 conversion minTimeoutTimestampInt, err := strconv.ParseInt(minTimeoutTimestamp, 10, 64) - if err != nil { return err } diff --git a/x/ibctransfermiddleware/keeper/msg_server.go b/x/ibctransfermiddleware/keeper/msg_server.go index 00a1523fe..f3fc4daa3 100644 --- a/x/ibctransfermiddleware/keeper/msg_server.go +++ b/x/ibctransfermiddleware/keeper/msg_server.go @@ -78,7 +78,6 @@ func (ms msgServer) RemoveIBCFeeConfig(goCtx context.Context, req *types.MsgRemo ctx := sdk.UnwrapSDKContext(goCtx) params := ms.Keeper.GetParams(ctx) - //remove channel id in list of channel fees for i, fee := range params.ChannelFees { if fee.Channel == req.ChannelID { params.ChannelFees = append(params.ChannelFees[:i], params.ChannelFees[i+1:]...) diff --git a/x/ibctransfermiddleware/types/msg.go b/x/ibctransfermiddleware/types/msg.go index bd7474835..f985d5672 100644 --- a/x/ibctransfermiddleware/types/msg.go +++ b/x/ibctransfermiddleware/types/msg.go @@ -8,9 +8,8 @@ import ( var _ sdk.Msg = &MsgAddIBCFeeConfig{} const ( - TypeMsgAddIBCFeeConfig = "add_config" - TypeMsgRemoveIBCFeeConfig = "remove_config" - + TypeMsgAddIBCFeeConfig = "add_config" + TypeMsgRemoveIBCFeeConfig = "remove_config" TypeMsgAddAllowedIbcToken = "add_allowed_ibc_token" TypeMsgRemoveAllowedIbcToken = "remove_allowed_ibc_token" ) From e3efd9a663fe179deb4a2855868cb10776d4a3fc Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 17:28:11 +0000 Subject: [PATCH 68/71] remove commented code --- x/ibctransfermiddleware/types/msg.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/x/ibctransfermiddleware/types/msg.go b/x/ibctransfermiddleware/types/msg.go index f985d5672..fbb9d4593 100644 --- a/x/ibctransfermiddleware/types/msg.go +++ b/x/ibctransfermiddleware/types/msg.go @@ -52,17 +52,6 @@ func (msg *MsgAddIBCFeeConfig) ValidateBasic() error { return sdkerrors.Wrap(err, "invalid authority address") } - // // validate channelIDs - // if err := host.ChannelIdentifierValidator(msg.ChannelID); err != nil { - // return err - // } - - // // validate ibcDenom - // err := ibctransfertypes.ValidateIBCDenom(msg.IbcDenom) - // if err != nil { - // return err - // } - return nil } From 198a50843d938224dc126b736157c8b0e2022d76 Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 18:48:08 +0000 Subject: [PATCH 69/71] use v6_4_9 as a next chain upgrade name for ibc fee module. --- app/app.go | 4 ++-- app/upgrades/v6_4_9/constants.go | 20 ++++++++++++++++++++ app/upgrades/v6_4_9/upgrade.go | 23 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v6_4_9/constants.go create mode 100644 app/upgrades/v6_4_9/upgrade.go diff --git a/app/app.go b/app/app.go index d23bfcfe9..f68c91bf5 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades/v6_4_8" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_9" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -147,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_8.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_9.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_9/constants.go b/app/upgrades/v6_4_9/constants.go new file mode 100644 index 000000000..4572af53f --- /dev/null +++ b/app/upgrades/v6_4_9/constants.go @@ -0,0 +1,20 @@ +package v6_4_9 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_9" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_9/upgrade.go b/app/upgrades/v6_4_9/upgrade.go new file mode 100644 index 000000000..70b06b6a6 --- /dev/null +++ b/app/upgrades/v6_4_9/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_9 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} From 62f24deaf77754aca0d37247cc622ab365e12ffb Mon Sep 17 00:00:00 2001 From: rustdev Date: Mon, 25 Mar 2024 23:49:05 +0000 Subject: [PATCH 70/71] inject a new ibc transfer custom wrapper module instead of original ibc --- app/app.go | 2 +- app/keepers/keepers.go | 3 ++- custom/ibc-transfer/keeper/msg_server.go | 10 +++++++--- custom/ibc-transfer/module.go | 8 ++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/app.go b/app/app.go index f68c91bf5..1b9505a9d 100644 --- a/app/app.go +++ b/app/app.go @@ -339,7 +339,7 @@ func NewComposableApp( ) // transferModule := transfer.NewAppModule(app.TransferKeeper) - transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper) + transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper, app.BankKeeper) routerModule := router.NewAppModule(app.RouterKeeper) transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper) txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 68b0012a4..563aea083 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -202,8 +202,9 @@ func (appKeepers *AppKeepers) InitNormalKeepers( "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m", "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9", + + // "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs", }) - // "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs", appKeepers.StakingKeeper = customstaking.NewKeeper( appCodec, appKeepers.keys[stakingtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), &appKeepers.StakingMiddlewareKeeper, diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index a6d27234e..4826edfc8 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" ibctransfermiddlewaretypes "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types" ) @@ -18,6 +19,10 @@ type msgServer struct { var _ types.MsgServer = msgServer{} +func NewMsgServerImpl(ibcKeeper Keeper, bankKeeper custombankkeeper.Keeper) types.MsgServer { + return &msgServer{Keeper: ibcKeeper, bank: bankKeeper, msgServer: ibcKeeper.Keeper} +} + // Transfer is the server API around the Transfer method of the IBC transfer module. // It checks if the sender is allowed to transfer the token and if the channel has fees. // If the channel has fees, it will charge the sender and send the fees to the fee address. @@ -42,14 +47,13 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ } difference := timeoutTimeInFuture.Sub(blockTime).Nanoseconds() - if difference < channelFee.MinTimeoutTimestamp { return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. too soon") } } coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom) - if coin != nil { - return &types.MsgTransferResponse{}, nil + if coin == nil { + return nil, fmt.Errorf("token not allowed to be transferred in this channel") } minFee := coin.MinFee.Amount charge := minFee diff --git a/custom/ibc-transfer/module.go b/custom/ibc-transfer/module.go index 9580c34ef..dd34f0716 100644 --- a/custom/ibc-transfer/module.go +++ b/custom/ibc-transfer/module.go @@ -9,6 +9,7 @@ import ( ibctransfermodule "github.com/cosmos/ibc-go/v7/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper" customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper" ) @@ -16,16 +17,18 @@ import ( type AppModule struct { ibctransfermodule.AppModule keeper customibctransferkeeper.Keeper + bank custombankkeeper.Keeper // subspace exported.Subspace msgServer types.MsgServer } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper customibctransferkeeper.Keeper) AppModule { +func NewAppModule(cdc codec.Codec, keeper customibctransferkeeper.Keeper, bank custombankkeeper.Keeper) AppModule { ibctransferModule := ibctransfermodule.NewAppModule(keeper.Keeper) return AppModule{ AppModule: ibctransferModule, keeper: keeper, + bank: bank, // subspace: ss, msgServer: keeper.Keeper, } @@ -33,7 +36,8 @@ func NewAppModule(cdc codec.Codec, keeper customibctransferkeeper.Keeper) AppMod // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper.Keeper) + msgServer := customibctransferkeeper.NewMsgServerImpl(am.keeper, am.bank) + types.RegisterMsgServer(cfg.MsgServer(), msgServer) types.RegisterQueryServer(cfg.QueryServer(), am.keeper.Keeper) m := ibctransferkeeper.NewMigrator(am.keeper.Keeper) From cee444918dc7e5bcf1b0a3bed02d74645bd509ed Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 26 Mar 2024 08:55:32 +0000 Subject: [PATCH 71/71] v6_4_91 chain upgrade name to replace original ibc module --- app/app.go | 4 ++-- app/upgrades/v6_4_91/constants.go | 20 ++++++++++++++++++++ app/upgrades/v6_4_91/upgrade.go | 23 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v6_4_91/constants.go create mode 100644 app/upgrades/v6_4_91/upgrade.go diff --git a/app/app.go b/app/app.go index 1b9505a9d..9f78d19d5 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades/v6_4_9" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_91" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -147,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_9.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_91.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_91/constants.go b/app/upgrades/v6_4_91/constants.go new file mode 100644 index 000000000..83a2fb7f7 --- /dev/null +++ b/app/upgrades/v6_4_91/constants.go @@ -0,0 +1,20 @@ +package v6_4_91 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_91" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_91/upgrade.go b/app/upgrades/v6_4_91/upgrade.go new file mode 100644 index 000000000..a1888ea62 --- /dev/null +++ b/app/upgrades/v6_4_91/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_91 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +}