Skip to content

Commit

Permalink
Problem: protobuf files are using v1beta from cosmos-sdk (fixes #395) (
Browse files Browse the repository at this point in the history
…#397)

Solution:
- upgraded Cosmos SDK to a patched version of 0.40.4
- updated changelog
- updated the module to explicitely prefix with v1
- updated the custom protobufs to be v1 instead of v1beta1 and regenerated files using protocgen
  • Loading branch information
tomtau authored Mar 3, 2021
1 parent 2977f84 commit ec02b54
Show file tree
Hide file tree
Showing 33 changed files with 154 additions and 142 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

*unreleased*
## v1.0.0?
A version based on a patched fork of Cosmos SDK 0.41.3.
*March 4, 2021*
## v1.0.0
A final initial released version based on a patched fork of Cosmos SDK 0.41.4
(the patch is identical to the 0.8.1 to 0.9.1 releases, i.e. it fixes the bech32 address lookup issue in v0.40/v0.41 SDK releases).

### Breaking changes
* initial modules and custom protobuf were named with "v1"

*February 4, 2021*
## v0.9.1
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ifeq ($(NETWORK),testnet)
TEST_TAGS := "--tags=testnet"
endif

SIMAPP = github.com/crypto-org-chain/chain-main/app
SIMAPP = github.com/crypto-org-chain/chain-main/v1/app
BINDIR ?= ~/go/bin

OS := $(shell uname)
Expand Down
14 changes: 7 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
appparams "github.com/crypto-org-chain/chain-main/app/params"
"github.com/crypto-org-chain/chain-main/x/chainmain"
chainmainkeeper "github.com/crypto-org-chain/chain-main/x/chainmain/keeper"
chainmaintypes "github.com/crypto-org-chain/chain-main/x/chainmain/types"
supply "github.com/crypto-org-chain/chain-main/x/supply"
supplykeeper "github.com/crypto-org-chain/chain-main/x/supply/keeper"
supplytypes "github.com/crypto-org-chain/chain-main/x/supply/types"
appparams "github.com/crypto-org-chain/chain-main/v1/app/params"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain"
chainmainkeeper "github.com/crypto-org-chain/chain-main/v1/x/chainmain/keeper"
chainmaintypes "github.com/crypto-org-chain/chain-main/v1/x/chainmain/types"
supply "github.com/crypto-org-chain/chain-main/v1/x/supply"
supplykeeper "github.com/crypto-org-chain/chain-main/v1/x/supply/keeper"
supplytypes "github.com/crypto-org-chain/chain-main/v1/x/supply/types"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/crypto-org-chain/chain-main/app/params"
"github.com/crypto-org-chain/chain-main/v1/app/params"
)

// MakeEncodingConfig creates an EncodingConfig for testing
Expand Down
8 changes: 4 additions & 4 deletions cmd/chain-maind/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import (
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/crypto-org-chain/chain-main/app"
"github.com/crypto-org-chain/chain-main/app/params"
"github.com/crypto-org-chain/chain-main/config"
chainmaincli "github.com/crypto-org-chain/chain-main/x/chainmain/client/cli"
"github.com/crypto-org-chain/chain-main/v1/app"
"github.com/crypto-org-chain/chain-main/v1/app/params"
"github.com/crypto-org-chain/chain-main/v1/config"
chainmaincli "github.com/crypto-org-chain/chain-main/v1/x/chainmain/client/cli"
)

// NewRootCmd creates a new root command for chain-maind. It is called once in the
Expand Down
4 changes: 2 additions & 2 deletions cmd/chain-maind/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/crypto-org-chain/chain-main/app"
cmd "github.com/crypto-org-chain/chain-main/cmd/chain-maind/app"
"github.com/crypto-org-chain/chain-main/v1/app"
cmd "github.com/crypto-org-chain/chain-main/v1/cmd/chain-maind/app"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/chain-maind/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/confluentinc/bincover"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/crypto-org-chain/chain-main/app"
cmd "github.com/crypto-org-chain/chain-main/cmd/chain-maind/app"
"github.com/crypto-org-chain/chain-main/v1/app"
cmd "github.com/crypto-org-chain/chain-main/v1/cmd/chain-maind/app"
)

func test_main() {
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
keys "github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/crypto-org-chain/chain-main/config"
"github.com/crypto-org-chain/chain-main/v1/config"
)

func TestMnemonic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let
src = lib.sourceByRegex ./. src_regexes;
};
subPackages = [ "cmd/chain-maind" ];
vendorSha256 = sha256:0bfpc25s90l5q11jc3qp5h9lrdpa5jn844fqcllh27zp0s1gm26i;
vendorSha256 = sha256:0pzq4fawihvmdd2zf5ckydqcddf11pydpwyr0qswszag329vrhc3;
runVend = true;
outputs = [
"out"
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/crypto-org-chain/chain-main
module github.com/crypto-org-chain/chain-main/v1

go 1.15

require (
github.com/confluentinc/bincover v0.1.0
github.com/cosmos/cosmos-sdk v0.41.0
github.com/cosmos/cosmos-sdk v0.41.4
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.4.3
Expand All @@ -15,7 +15,7 @@ require (
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.7
github.com/tendermint/tendermint v0.34.8
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f
google.golang.org/grpc v1.35.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ github.com/tendermint/tendermint v0.34.0-rc6 h1:SVuKGvvE22KxfuK8QUHctUrmOWJsncZS
github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg=
github.com/tendermint/tendermint v0.34.0 h1:eXCfMgoqVSzrjzOj6clI9GAejcHH0LvOlRjpCmMJksU=
github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ=
github.com/tendermint/tendermint v0.34.7 h1:lvBJFNqpDuEzKfLZKtUXOL5dMOpqHonHlO6LCujyl6E=
github.com/tendermint/tendermint v0.34.7/go.mod h1:JVuu3V1ZexOaZG8VJMRl8lnfrGw6hEB2TVnoUwKRbss=
github.com/tendermint/tendermint v0.34.8 h1:PMWgUx47FrNTsfhxCWzoiIlVAC1SE9+WBlnsF9oQW0I=
github.com/tendermint/tendermint v0.34.8/go.mod h1:JVuu3V1ZexOaZG8VJMRl8lnfrGw6hEB2TVnoUwKRbss=
github.com/tendermint/tm-db v0.6.2 h1:DOn8jwCdjJblrCFJbtonEIPD1IuJWpbRUUdR8GWE4RM=
github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI=
github.com/tendermint/tm-db v0.6.3 h1:ZkhQcKnB8/2jr5EaZwGndN4owkPsGezW2fSisS9zGbg=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package chainmain.chainmain.v1beta1;
package chainmain.chainmain.v1;

option go_package = "github.com/crypto-org-chain/chain-main/x/chainmain/types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package chainmain.supply.v1beta1;
package chainmain.supply.v1;

option go_package = "github.com/crypto-org-chain/chain-main/x/supply/types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package chainmain.supply.v1beta1;
package chainmain.supply.v1;

option go_package = "github.com/crypto-org-chain/chain-main/x/supply/types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package chainmain.supply.v1beta1;
package chainmain.supply.v1;

import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
Expand All @@ -11,12 +11,12 @@ option go_package = "github.com/crypto-org-chain/chain-main/x/supply/types";
service Query {
// TotalSupply queries the total supply of all coins.
rpc TotalSupply(SupplyRequest) returns (SupplyResponse) {
option (google.api.http).get = "/cosmos/supply/v1beta1/total";
option (google.api.http).get = "/chainmain/supply/v1/total";
}

// LiquidSupply queries the liquid supply of all coins.
rpc LiquidSupply(SupplyRequest) returns (SupplyResponse) {
option (google.api.http).get = "/cosmos/supply/v1beta1/liquid";
option (google.api.http).get = "/chainmain/supply/v1/liquid";
}
}

Expand Down
2 changes: 1 addition & 1 deletion pystarport/pystarport/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TENDERMINT=./tendermint
TMP=$(whereis grpc_python_plugin)
PLUGIN="$(cut -d' ' -f2 <<<"$TMP")"
mkdir $OUTPUT
git clone --branch v0.34.7 https://github.com/tendermint/tendermint.git
git clone --branch v0.34.8 https://github.com/tendermint/tendermint.git
# cosmos
python -m grpc.tools.protoc --proto_path=$COSMOS/proto --proto_path=$COSMOS/third_party/proto --python_out=$OUTPUT $(find $COSMOS/proto/cosmos -iname "*.proto") --grpc_python_out=$OUTPUT --plugin=protoc-gen-grpc_python=$PLUGIN
# cosmos third-party
Expand Down
2 changes: 1 addition & 1 deletion third_party/cosmos-sdk
4 changes: 2 additions & 2 deletions x/chainmain/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/cosmos/cosmos-sdk/version"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/crypto-org-chain/chain-main/config"
"github.com/crypto-org-chain/chain-main/x/chainmain/types"
"github.com/crypto-org-chain/chain-main/v1/config"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/types"
)

// GetQueryCmd returns the cli query commands for this module
Expand Down
2 changes: 1 addition & 1 deletion x/chainmain/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/crypto-org-chain/chain-main/x/chainmain/types"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/types"
)

// GetTxCmd returns the transaction commands for this module
Expand Down
4 changes: 2 additions & 2 deletions x/chainmain/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package chainmain

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/crypto-org-chain/chain-main/x/chainmain/keeper"
"github.com/crypto-org-chain/chain-main/x/chainmain/types"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/keeper"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/types"
)

// InitGenesis initializes the capability module's state from a provided genesis
Expand Down
2 changes: 1 addition & 1 deletion x/chainmain/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/crypto-org-chain/chain-main/x/chainmain/types"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/types"
)

type (
Expand Down
6 changes: 3 additions & 3 deletions x/chainmain/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/crypto-org-chain/chain-main/x/chainmain/client/cli"
"github.com/crypto-org-chain/chain-main/x/chainmain/keeper"
"github.com/crypto-org-chain/chain-main/x/chainmain/types"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/client/cli"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/keeper"
"github.com/crypto-org-chain/chain-main/v1/x/chainmain/types"
)

var (
Expand Down
28 changes: 14 additions & 14 deletions x/chainmain/types/genesis.pb.go

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

2 changes: 1 addition & 1 deletion x/supply/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
"github.com/crypto-org-chain/chain-main/x/supply/types"
"github.com/crypto-org-chain/chain-main/v1/x/supply/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion x/supply/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/crypto-org-chain/chain-main/x/supply/types"
"github.com/crypto-org-chain/chain-main/v1/x/supply/types"
)

// TotalSupplyHandlerFn returns HTTP request handler to query the total supply of coins
Expand Down
2 changes: 1 addition & 1 deletion x/supply/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/crypto-org-chain/chain-main/x/supply/types"
"github.com/crypto-org-chain/chain-main/v1/x/supply/types"
)

// InitGenesis initializes the supply module's state from a given genesis state.
Expand Down
2 changes: 1 addition & 1 deletion x/supply/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/crypto-org-chain/chain-main/x/supply/types"
"github.com/crypto-org-chain/chain-main/v1/x/supply/types"
)

// TotalSupply implements the Query/TotalSupply gRPC method
Expand Down
2 changes: 1 addition & 1 deletion x/supply/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/crypto-org-chain/chain-main/x/supply/types"
"github.com/crypto-org-chain/chain-main/v1/x/supply/types"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
Expand Down
8 changes: 4 additions & 4 deletions x/supply/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"encoding/json"
"fmt"

"github.com/crypto-org-chain/chain-main/x/supply/client/cli"
"github.com/crypto-org-chain/chain-main/x/supply/client/rest"
"github.com/crypto-org-chain/chain-main/x/supply/keeper"
"github.com/crypto-org-chain/chain-main/v1/x/supply/client/cli"
"github.com/crypto-org-chain/chain-main/v1/x/supply/client/rest"
"github.com/crypto-org-chain/chain-main/v1/x/supply/keeper"

"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"
"github.com/crypto-org-chain/chain-main/x/supply/types"
"github.com/crypto-org-chain/chain-main/v1/x/supply/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
Expand Down
Loading

0 comments on commit ec02b54

Please sign in to comment.