Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how profiles are stored #385

Merged
merged 15 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ proto-lint:
proto-check-breaking:
@$(DOCKER_BUF) check breaking --against $(HTTPS_GIT)#branch=master

TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.8/proto/tendermint
TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.9/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
COSMOS_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.42.3/proto/cosmos
COSMOS_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.42.4/proto/cosmos
COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
CONFIO_URL = https://raw.githubusercontent.com/confio/ics23/v0.6.3

Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ func NewDesmosApp(
keys[profilestypes.StoreKey],
app.GetSubspace(profilestypes.ModuleName),
app.RelationshipsKeeper,
app.AccountKeeper,
)
app.ReportsKeeper = reportsKeeper.NewKeeper(
app.appCodec,
Expand Down
12 changes: 7 additions & 5 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

profilestypes "github.com/desmos-labs/desmos/x/profiles/types"
postsTypes "github.com/desmos-labs/desmos/x/staging/posts/types"
poststypes "github.com/desmos-labs/desmos/x/staging/posts/types"
relationshipstypes "github.com/desmos-labs/desmos/x/staging/relationships/types"
reportsTypes "github.com/desmos-labs/desmos/x/staging/reports/types"
reportstypes "github.com/desmos-labs/desmos/x/staging/reports/types"

simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down Expand Up @@ -72,6 +72,9 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) {
// SetupSimulation wraps simapp.SetupSimulation in order to create any export directory if they do not exist yet
func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error) {
config, db, dir, logger, skip, err := simapp.SetupSimulation(dirPrefix, dbName)
if err != nil {
return simtypes.Config{}, nil, "", nil, false, err
}

paths := []string{config.ExportParamsPath, config.ExportStatePath, config.ExportStatsPath}
for _, path := range paths {
Expand Down Expand Up @@ -217,11 +220,10 @@ func TestAppImportExport(t *testing.T) {
{app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}},
{app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}},

{app.keys[postsTypes.StoreKey], newApp.keys[postsTypes.StoreKey], [][]byte{}},
{app.keys[poststypes.StoreKey], newApp.keys[poststypes.StoreKey], [][]byte{}},
{app.keys[profilestypes.StoreKey], newApp.keys[profilestypes.StoreKey], [][]byte{}},
{app.keys[reportsTypes.StoreKey], newApp.keys[reportsTypes.StoreKey], [][]byte{}},
{app.keys[reportstypes.StoreKey], newApp.keys[reportstypes.StoreKey], [][]byte{}},
{app.keys[relationshipstypes.StoreKey], newApp.keys[relationshipstypes.StoreKey], [][]byte{}},

{app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}},
{app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}},
{app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}},
Expand Down
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@ module github.com/desmos-labs/desmos
go 1.15

require (
github.com/cosmos/cosmos-sdk v0.42.3
github.com/cosmos/cosmos-sdk v0.42.4
github.com/desmos-labs/Go-Emoji-Utils v1.1.1-0.20200515063516-9c493b11de3e
github.com/ghodss/yaml v1.0.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.1
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/rakyll/statik v0.1.7
github.com/regen-network/cosmos-proto v0.3.1
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.1.1
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.8
github.com/tendermint/tendermint v0.34.9
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f
google.golang.org/grpc v1.35.0
google.golang.org/protobuf v1.26.0
)

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/cosmos/cosmos-sdk => github.com/RiccardoM/cosmos-sdk v0.40.2-0.20210413061315-e274652f0ed8
11 changes: 7 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RiccardoM/cosmos-sdk v0.40.2-0.20210413061315-e274652f0ed8 h1:G7H3ueYhTqqxP9HCJOEx2m4yjBMG/olrR08Um39hnsY=
github.com/RiccardoM/cosmos-sdk v0.40.2-0.20210413061315-e274652f0ed8/go.mod h1:I1Zw1zmU4rA/NITaakTb71pXQnQrWyFBhqo3WSeg0vA=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
Expand Down Expand Up @@ -104,8 +106,6 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/cosmos-sdk v0.42.3 h1:VFYq7spDBBIlygAxwcI79Xh2JuIrG1ZCPKpvqKghIZs=
github.com/cosmos/cosmos-sdk v0.42.3/go.mod h1:xiLp1G8mumj82S5KLJGCAyeAlD+7VNomg/aRSJV12yk=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
Expand Down Expand Up @@ -174,6 +174,7 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -237,6 +238,8 @@ github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSN
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us=
github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
Expand Down Expand Up @@ -573,8 +576,8 @@ github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM
github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4=
github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg=
github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ=
github.com/tendermint/tendermint v0.34.8 h1:PMWgUx47FrNTsfhxCWzoiIlVAC1SE9+WBlnsF9oQW0I=
github.com/tendermint/tendermint v0.34.8/go.mod h1:JVuu3V1ZexOaZG8VJMRl8lnfrGw6hEB2TVnoUwKRbss=
github.com/tendermint/tendermint v0.34.9 h1:9P2MXDEPOcPW0NBcHQ/HDSfvczZm+q5nUUw7AZ6f1Vc=
github.com/tendermint/tendermint v0.34.9/go.mod h1:kl4Z1JwGx1I+u1SXIzMDy7Z3T8LiMeCAOnzNn6AIMT4=
github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI=
github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8=
github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ=
Expand Down
13 changes: 4 additions & 9 deletions proto/desmos/profiles/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ option go_package = "github.com/desmos-labs/desmos/x/profiles/types";

// GenesisState defines the profiles module's genesis state.
message GenesisState {
repeated desmos.profiles.v1beta1.Profile profiles = 1 [
repeated desmos.profiles.v1beta1.DTagTransferRequest dtag_transfer_requests =
1 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"profiles\""
(gogoproto.moretags) = "yaml:\"dtag_transfer_requests\""
];

repeated desmos.profiles.v1beta1.DTagTransferRequest dtag_transfer_requests =
2 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"dtag_transfer_requests\""
];

desmos.profiles.v1beta1.Params params = 3 [
desmos.profiles.v1beta1.Params params = 2 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"params\""
];
Expand Down
25 changes: 0 additions & 25 deletions proto/desmos/profiles/v1beta1/keeper/types.proto

This file was deleted.

44 changes: 23 additions & 21 deletions proto/desmos/profiles/v1beta1/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ syntax = "proto3";
package desmos.profiles.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/desmos-labs/desmos/x/profiles/types";

Expand All @@ -11,31 +13,27 @@ message Pictures {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;

string profile = 1 [ (gogoproto.moretags) = "yaml:\"profile\"" ];
string cover = 2 [ (gogoproto.moretags) = "yaml:\"cover\"" ];
string profile = 1 [(gogoproto.moretags) = "yaml:\"profile\""];
string cover = 2 [(gogoproto.moretags) = "yaml:\"cover\""];
}

// ___________________________________________________________________________________________________________________

// Profile represents a generic first on Desmos, containing the information of a
// single user
message Profile {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;

string dtag = 1 [ (gogoproto.moretags) = "yaml:\"dtag\"" ];

string moniker = 2 [ (gogoproto.moretags) = "yaml:\"moniker\"" ];

string bio = 3 [ (gogoproto.moretags) = "yaml:\"bio\"" ];

Pictures pictures = 4 [
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;

google.protobuf.Any account = 1
[(cosmos_proto.accepts_interface) = "AccountI"];
string dtag = 2 [(gogoproto.moretags) = "yaml:\"dtag\""];
string moniker = 3 [(gogoproto.moretags) = "yaml:\"moniker\""];
string bio = 4 [(gogoproto.moretags) = "yaml:\"bio\""];
Pictures pictures = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"pictures\""
];

string creator = 5 [ (gogoproto.moretags) = "yaml:\"creator\"" ];

google.protobuf.Timestamp creation_date = 6 [
(gogoproto.stdtime) = true,
(gogoproto.moretags) = "yaml:\"creation_date\"",
Expand All @@ -51,11 +49,15 @@ message DTagTransferRequest {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;

string dtag_to_trade = 1 [ (gogoproto.moretags) = "yaml:\"dtag_to_trade\"" ];

string sender = 2 [ (gogoproto.moretags) = "yaml:\"sender\"" ];

string receiver = 3 [ (gogoproto.moretags) = "yaml:\"receiver\"" ];
string dtag_to_trade = 1 [(gogoproto.moretags) = "yaml:\"dtag_to_trade\""];
string sender = 2 [(gogoproto.moretags) = "yaml:\"sender\""];
string receiver = 3 [(gogoproto.moretags) = "yaml:\"receiver\""];
}

// ___________________________________________________________________________________________________________________
// DTagTransferRequests contains a list of DTagTransferRequest
message DTagTransferRequests {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;

repeated DTagTransferRequest requests = 1 [(gogoproto.nullable) = false];
}
12 changes: 9 additions & 3 deletions proto/desmos/profiles/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@ package desmos.profiles.v1beta1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "desmos/profiles/v1beta1/params.proto";
import "desmos/profiles/v1beta1/models.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/desmos-labs/desmos/x/profiles/types";

// Query defines the gRPC querier service.
service Query {
// Profile queries the profile of a specific user
// Profile queries the profile of a specific user given their DTag or address.
// If the queried user does not have a profile, the returned response will
// contain a null profile.
rpc Profile(QueryProfileRequest) returns (QueryProfileResponse) {
option (google.api.http).get = "/desmos/profiles/v1beta1/profiles/{user}";
}

// DTagTransfers queries all the DTag transfers requests
// DTagTransfers queries all the DTag transfers requests that have been made
// towards the user with the given address
rpc DTagTransfers(QueryDTagTransfersRequest)
returns (QueryDTagTransfersResponse) {
option (google.api.http).get = "/desmos/profiles/v1beta1/dtag_transfers";
Expand All @@ -40,7 +45,8 @@ message QueryProfileRequest {

// QueryProfileResponse is the response type for the Query/Profile RPC method.
message QueryProfileResponse {
desmos.profiles.v1beta1.Profile profile = 1 [ (gogoproto.nullable) = false ];
google.protobuf.Any profile = 1
[(cosmos_proto.accepts_interface) = "AccountI"];
}

// ___________________________________________________________________________________________________________________
Expand Down
8 changes: 1 addition & 7 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ protoc_gen_gocosmos() {
return 1
fi

go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2>/dev/null
}

protoc_gen_gocosmos
Expand All @@ -20,12 +20,6 @@ for dir in $proto_dirs; do
-I "third_party/proto" \
--gocosmos_out=plugins=interfacetype+grpc,\
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

# command to generate gRPC gateway (*.pb.gw.go in respective modules) files
buf protoc \
-I "proto" \
-I "third_party/proto" \
--grpc-gateway_out=logtostderr=true:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

Expand Down
2 changes: 1 addition & 1 deletion third_party/proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ message ResponseDeliverTx {
int64 gas_wanted = 5 [json_name = "gas_wanted"];
int64 gas_used = 6 [json_name = "gas_used"];
repeated Event events = 7
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic
string codespace = 8;
}

Expand Down
Loading