Skip to content

Commit

Permalink
sdk 47 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Apr 24, 2023
1 parent 3af562b commit 41d65ee
Show file tree
Hide file tree
Showing 91 changed files with 12,553 additions and 40 deletions.
39 changes: 39 additions & 0 deletions proto/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This Dockerfile is used for proto generation
# To build, run `make proto-image-build`

FROM bufbuild/buf:1.7.0 as BUILDER

FROM golang:1.19-alpine


RUN apk add --no-cache \
nodejs \
npm \
git \
make

ENV GOLANG_PROTOBUF_VERSION=1.28.0 \
GOGO_PROTOBUF_VERSION=1.3.2 \
GRPC_GATEWAY_VERSION=1.16.0


RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION}
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION}

# install all gogo protobuf binaries
RUN git clone https://github.com/regen-network/protobuf.git; \
cd protobuf; \
go mod download; \
make install

# we need to use git clone because we use 'replace' directive in go.mod
# protoc-gen-gocosmos was moved to to in cosmos/gogoproto but pending a migration there.
RUN git clone https://github.com/regen-network/cosmos-proto.git; \
cd cosmos-proto/protoc-gen-gocosmos; \
go install .

RUN npm install -g swagger-combine

COPY --from=BUILDER /usr/local/bin /usr/local/bin
5 changes: 5 additions & 0 deletions proto/buf.gen.doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: v1
plugins:
- name: doc
out: ../docs/proto
opt: ../docs/proto/protodoc-markdown.tmpl,proto-docs.md
4 changes: 2 additions & 2 deletions proto/buf.gen.gogo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: v1
plugins:
- name: gocosmos
out: ..
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
opt: plugins=grpc,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/orm/v1alpha1/orm.proto=github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1
- name: grpc-gateway
out: ..
opt: logtostderr=true,allow_colon_final_segments=true
opt: logtostderr=true,allow_colon_final_segments=true
8 changes: 8 additions & 0 deletions proto/buf.gen.gogo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- name: gocosmos
out: ..
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- name: grpc-gateway
out: ..
opt: logtostderr=true,allow_colon_final_segments=true
4 changes: 2 additions & 2 deletions proto/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ deps:
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
commit: e0cedba5309948a0b4734cab8e311723
commit: 8dc523b705c34317bfd4a961fba89e72
- remote: buf.build
owner: cosmos
repository: gogo-proto
commit: 34d970b699f84aa382f3c29773a60836
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 75b4300737fb4efca0831636be94e517
commit: 5ae7f88519b04fe1965da0f8a375a088
4 changes: 3 additions & 1 deletion proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: v1
name: buf.build/CosmosContracts/juno
name: buf.build/osmosis-labs/osmosis
deps:
- buf.build/cosmos/cosmos-sdk
- buf.build/cosmos/cosmos-proto
Expand All @@ -19,3 +19,5 @@ lint:
- SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME
ignore:
- tendermint
17 changes: 17 additions & 0 deletions proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package osmosis.tokenfactory.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types";

// DenomAuthorityMetadata specifies metadata for addresses that have specific
// capabilities over a token factory denom. Right now there is only one Admin
// permission, but is planned to be extended to the future.
message DenomAuthorityMetadata {
option (gogoproto.equal) = true;

// Can be empty for no admin, or a valid osmosis address
string admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ];
}
32 changes: 32 additions & 0 deletions proto/osmosis/tokenfactory/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";
package osmosis.tokenfactory.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto";
import "osmosis/tokenfactory/v1beta1/params.proto";

option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types";

// GenesisState defines the tokenfactory module's genesis state.
message GenesisState {
// params defines the paramaters of the module.
Params params = 1 [ (gogoproto.nullable) = false ];

repeated GenesisDenom factory_denoms = 2 [
(gogoproto.moretags) = "yaml:\"factory_denoms\"",
(gogoproto.nullable) = false
];
}

// GenesisDenom defines a tokenfactory denom that is defined within genesis
// state. The structure contains DenomAuthorityMetadata which defines the
// denom's admin.
message GenesisDenom {
option (gogoproto.equal) = true;

string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
DenomAuthorityMetadata authority_metadata = 2 [
(gogoproto.moretags) = "yaml:\"authority_metadata\"",
(gogoproto.nullable) = false
];
}
26 changes: 26 additions & 0 deletions proto/osmosis/tokenfactory/v1beta1/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";
package osmosis.tokenfactory.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types";

// Params defines the parameters for the tokenfactory module.
message Params {
repeated cosmos.base.v1beta1.Coin denom_creation_fee = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"denom_creation_fee\"",
(gogoproto.nullable) = false
];

// if denom_creation_fee is an empty array, then this field is used to add more gas consumption
// to the base cost.
// https://github.com/CosmWasm/token-factory/issues/11
uint64 denom_creation_gas_consume = 2 [
(gogoproto.moretags) = "yaml:\"denom_creation_gas_consume\"",
(gogoproto.nullable) = true
];
}
71 changes: 71 additions & 0 deletions proto/osmosis/tokenfactory/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
syntax = "proto3";
package osmosis.tokenfactory.v1beta1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto";
import "osmosis/tokenfactory/v1beta1/params.proto";

option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types";

// Query defines the gRPC querier service.
service Query {
// Params defines a gRPC query method that returns the tokenfactory module's
// parameters.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/params";
}

// DenomAuthorityMetadata defines a gRPC query method for fetching
// DenomAuthorityMetadata for a particular denom.
rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest)
returns (QueryDenomAuthorityMetadataResponse) {
option (google.api.http).get =
"/osmosis/tokenfactory/v1beta1/denoms/{denom}/authority_metadata";
}

// DenomsFromCreator defines a gRPC query method for fetching all
// denominations created by a specific admin/creator.
rpc DenomsFromCreator(QueryDenomsFromCreatorRequest)
returns (QueryDenomsFromCreatorResponse) {
option (google.api.http).get =
"/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}";
}
}

// 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 ];
}

// QueryDenomAuthorityMetadataRequest defines the request structure for the
// DenomAuthorityMetadata gRPC query.
message QueryDenomAuthorityMetadataRequest {
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
}

// QueryDenomAuthorityMetadataResponse defines the response structure for the
// DenomAuthorityMetadata gRPC query.
message QueryDenomAuthorityMetadataResponse {
DenomAuthorityMetadata authority_metadata = 1 [
(gogoproto.moretags) = "yaml:\"authority_metadata\"",
(gogoproto.nullable) = false
];
}

// QueryDenomsFromCreatorRequest defines the request structure for the
// DenomsFromCreator gRPC query.
message QueryDenomsFromCreatorRequest {
string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
}

// QueryDenomsFromCreatorRequest defines the response structure for the
// DenomsFromCreator gRPC query.
message QueryDenomsFromCreatorResponse {
repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ];
}
109 changes: 109 additions & 0 deletions proto/osmosis/tokenfactory/v1beta1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
syntax = "proto3";
package osmosis.tokenfactory.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";

option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types";

// Msg defines the tokefactory module's gRPC message service.
service Msg {
rpc CreateDenom(MsgCreateDenom) returns (MsgCreateDenomResponse);
rpc Mint(MsgMint) returns (MsgMintResponse);
rpc Burn(MsgBurn) returns (MsgBurnResponse);
rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse);
rpc SetDenomMetadata(MsgSetDenomMetadata)
returns (MsgSetDenomMetadataResponse);
rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse);
}

// MsgCreateDenom defines the message structure for the CreateDenom gRPC service
// method. It allows an account to create a new denom. It requires a sender
// address and a sub denomination. The (sender_address, sub_denomination) tuple
// must be unique and cannot be re-used.
//
// The resulting denom created is defined as
// <factory/{creatorAddress}/{subdenom}>. The resulting denom's admin is
// originally set to be the creator, but this can be changed later. The token
// denom does not indicate the current admin.
message MsgCreateDenom {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// subdenom can be up to 44 "alphanumeric" characters long.
string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ];
}

// MsgCreateDenomResponse is the return value of MsgCreateDenom
// It returns the full string of the newly created denom
message MsgCreateDenomResponse {
string new_token_denom = 1
[ (gogoproto.moretags) = "yaml:\"new_token_denom\"" ];
}

// MsgMint is the sdk.Msg type for allowing an admin account to mint
// more of a token. For now, we only support minting to the sender account
message MsgMint {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.nullable) = false
];
string mintToAddress = 3
[ (gogoproto.moretags) = "yaml:\"mint_to_address\"" ];
}

message MsgMintResponse {}

// MsgBurn is the sdk.Msg type for allowing an admin account to burn
// a token. For now, we only support burning from the sender account.
message MsgBurn {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.nullable) = false
];
string burnFromAddress = 3
[ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ];
}

message MsgBurnResponse {}

// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign
// adminship of a denom to a new account
message MsgChangeAdmin {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ];
}

// MsgChangeAdminResponse defines the response structure for an executed
// MsgChangeAdmin message.
message MsgChangeAdminResponse {}

// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set
// the denom's bank metadata
message MsgSetDenomMetadata {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.bank.v1beta1.Metadata metadata = 2 [
(gogoproto.moretags) = "yaml:\"metadata\"",
(gogoproto.nullable) = false
];
}

// MsgSetDenomMetadataResponse defines the response structure for an executed
// MsgSetDenomMetadata message.
message MsgSetDenomMetadataResponse {}

message MsgForceTransfer {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin amount = 2 [
(gogoproto.moretags) = "yaml:\"amount\"",
(gogoproto.nullable) = false
];
string transferFromAddress = 3
[ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ];
string transferToAddress = 4
[ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ];
}

message MsgForceTransferResponse {}
2 changes: 1 addition & 1 deletion x/feeshare/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/CosmosContracts/juno/v15/app"
"github.com/CosmosContracts/juno/v15/x/feeshare"
"github.com/CosmosContracts/juno/v15/x/feeshare/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
)

type GenesisTestSuite struct {
Expand Down
10 changes: 5 additions & 5 deletions x/feeshare/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package feeshare_test
import (
"encoding/json"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

"cosmossdk.io/simapp"
junoapp "github.com/CosmosContracts/juno/v15/app"
"github.com/cosmos/cosmos-sdk/simapp"

"github.com/CosmosContracts/juno/v15/x/mint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
Loading

0 comments on commit 41d65ee

Please sign in to comment.