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

chore: replace amino cosmos_dec_bytes annoation by scalar cosmos.Dec and add missing annotations #17000

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
chore: replace amino cosmos_dec_bytes annoation by scalarcosmos.Dec
  • Loading branch information
julienrbrt committed Jul 14, 2023
commit 832e7d5989dbad78df5b2cfd5c9eb270a1123620
88 changes: 43 additions & 45 deletions api/cosmos/slashing/v1beta1/slashing.pulsar.go

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

6 changes: 3 additions & 3 deletions proto/cosmos/slashing/v1beta1/slashing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ message Params {

int64 signed_blocks_window = 1;
bytes min_signed_per_window = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false,
(amino.encoding) = "cosmos_dec_bytes",
(amino.dont_omitempty) = true
];
google.protobuf.Duration downtime_jail_duration = 3 [
Expand All @@ -54,15 +54,15 @@ message Params {
(gogoproto.stdduration) = true
];
bytes slash_fraction_double_sign = 4 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false,
(amino.encoding) = "cosmos_dec_bytes",
(amino.dont_omitempty) = true
];
bytes slash_fraction_downtime = 5 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false,
(amino.encoding) = "cosmos_dec_bytes",
(amino.dont_omitempty) = true
];
}
3 changes: 3 additions & 0 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,6 @@ replace (
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
)

// TODO to be removed after API tag
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be tagging a new api after this PR.

replace cosmossdk.io/api => ../api
2 changes: 0 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX
cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
cosmossdk.io/api v0.6.0 h1:AEpx/sRZaQEusARZqAxbg20zRXnS6e1F+uoal39trOM=
cosmossdk.io/api v0.6.0/go.mod h1:kJFAEMLN57y0viszHDPLMmieF0471o5QAwwApa+270M=
cosmossdk.io/collections v0.3.0 h1:v0eEqLBxebAV+t+Ahwf9tSJOu95HVLINwROXx2TTZ08=
cosmossdk.io/collections v0.3.0/go.mod h1:CHE1+niUElL9ikCpevRZcp0yqQ4TU0TrEEGirN0mvIg=
cosmossdk.io/core v0.9.0 h1:30ScAOHDIUOCg1DKAwqkho9wuQJnu7GUrMcg0XLioic=
Expand Down
10 changes: 3 additions & 7 deletions tests/integration/rapidgen/rapidgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"google.golang.org/protobuf/reflect/protoregistry"
"pgregory.net/rapid"

"cosmossdk.io/api/amino"
authapi "cosmossdk.io/api/cosmos/auth/v1beta1"
authzapi "cosmossdk.io/api/cosmos/authz/v1beta1"
bankapi "cosmossdk.io/api/cosmos/bank/v1beta1"
Expand Down Expand Up @@ -85,14 +84,11 @@ func GeneratorFieldMapper(t *rapid.T, field protoreflect.FieldDescriptor, name s
i32 := rapid.Int32().Draw(t, name)
return protoreflect.ValueOfString(fmt.Sprintf("%d", i32)), true
case "cosmos.Dec":
return protoreflect.ValueOfString(""), true
}
case field.Kind() == protoreflect.BytesKind:
if proto.HasExtension(opts, amino.E_Encoding) {
encoding := proto.GetExtension(opts, amino.E_Encoding).(string)
if encoding == "cosmos_dec_bytes" {
if field.Kind() == protoreflect.BytesKind {
return protoreflect.ValueOfBytes([]byte{}), true
}

return protoreflect.ValueOfString(""), true
}
}

Expand Down
Loading
Loading