Add equal option to upgrade proto types

This commit is contained in:
Aleksandr Bezobchuk 2020-03-02 14:10:27 -05:00
parent c0384a1b91
commit a89eb77841
No known key found for this signature in database
GPG Key ID: 7DAC30FBD99879B0
2 changed files with 107 additions and 45 deletions

View File

@ -164,32 +164,90 @@ func init() {
func init() { proto.RegisterFile("x/upgrade/types/types.proto", fileDescriptor_2a308fd9dd71aff8) } func init() { proto.RegisterFile("x/upgrade/types/types.proto", fileDescriptor_2a308fd9dd71aff8) }
var fileDescriptor_2a308fd9dd71aff8 = []byte{ var fileDescriptor_2a308fd9dd71aff8 = []byte{
// 364 bytes of a gzipped FileDescriptorProto // 376 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x31, 0x6f, 0xe2, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x31, 0x6f, 0xe2, 0x30,
0x18, 0x8d, 0x8f, 0x1c, 0x3a, 0xcc, 0x66, 0x9d, 0x8e, 0x88, 0x13, 0x26, 0x62, 0xa8, 0x18, 0x5a, 0x18, 0x8d, 0x8f, 0x1c, 0x3a, 0xcc, 0x66, 0x9d, 0x8e, 0x88, 0x13, 0x4e, 0xc4, 0x70, 0x62, 0xb8,
0x47, 0xa5, 0x43, 0x3b, 0xd3, 0xbd, 0x42, 0x69, 0xab, 0x4a, 0x5d, 0x90, 0x49, 0x4c, 0x62, 0x91, 0x73, 0x74, 0xdc, 0x70, 0xa7, 0x1b, 0xe9, 0x5e, 0xa1, 0xb4, 0x5d, 0x2a, 0x55, 0xc8, 0x24, 0x26,
0xc4, 0x56, 0x6c, 0x5a, 0xd8, 0x3a, 0x77, 0xe2, 0x67, 0x31, 0x32, 0x32, 0xb5, 0x05, 0xfe, 0x48, 0xb1, 0x48, 0x62, 0x2b, 0x36, 0x2d, 0x6c, 0xfd, 0x09, 0xfc, 0x84, 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x4e, 0xbc, 0x2f, 0xdf, 0x64, 0x54, 0x2d, 0x5f, 0xe1, 0xec, 0x3d, 0xb6, 0x2e, 0x7f, 0xc6, 0x5c, 0x27, 0xb3, 0x31, 0x09, 0x45, 0xe6, 0x9b, 0xec, 0x87, 0xed, 0x97,
0x00, 0x00, 0xff, 0xff, 0x0f, 0x77, 0x53, 0x0a, 0x40, 0x02, 0x00, 0x00, 0x8a, 0xa6, 0xfe, 0x9b, 0x2f, 0x33, 0xae, 0x57, 0x2f, 0xf2, 0xe7, 0x39, 0x00, 0x00, 0xff, 0xff,
0x4f, 0x2c, 0xc2, 0xac, 0x4c, 0x02, 0x00, 0x00,
} }
func (this *SoftwareUpgradeProposal) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*SoftwareUpgradeProposal)
if !ok {
that2, ok := that.(SoftwareUpgradeProposal)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.Title != that1.Title {
return false
}
if this.Description != that1.Description {
return false
}
if !this.Plan.Equal(&that1.Plan) {
return false
}
return true
}
func (this *CancelSoftwareUpgradeProposal) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*CancelSoftwareUpgradeProposal)
if !ok {
that2, ok := that.(CancelSoftwareUpgradeProposal)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.Title != that1.Title {
return false
}
if this.Description != that1.Description {
return false
}
return true
}
func (m *Plan) Marshal() (dAtA []byte, err error) { func (m *Plan) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)

View File

@ -4,41 +4,45 @@ package cosmos_sdk.x.upgrade.v1;
import "third_party/proto/gogoproto/gogo.proto"; import "third_party/proto/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types";
option (gogoproto.goproto_stringer_all) = false; option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.goproto_getters_all) = false; option (gogoproto.goproto_getters_all) = false;
// Plan specifies information about a planned upgrade and when it should occur // Plan specifies information about a planned upgrade and when it should occur
message Plan { message Plan {
// Sets the name for the upgrade. This name will be used by the upgraded version of the software to apply any // Sets the name for the upgrade. This name will be used by the upgraded version of the software to apply any
// special "on-upgrade" commands during the first BeginBlock method after the upgrade is applied. It is also used // special "on-upgrade" commands during the first BeginBlock method after the upgrade is applied. It is also used
// to detect whether a software version can handle a given upgrade. If no upgrade handler with this name has been // to detect whether a software version can handle a given upgrade. If no upgrade handler with this name has been
// set in the software, it will be assumed that the software is out-of-date when the upgrade Time or Height // set in the software, it will be assumed that the software is out-of-date when the upgrade Time or Height
// is reached and the software will exit. // is reached and the software will exit.
string name = 1; string name = 1;
// The time after which the upgrade must be performed. // The time after which the upgrade must be performed.
// Leave set to its zero value to use a pre-defined Height instead. // Leave set to its zero value to use a pre-defined Height instead.
google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// The height at which the upgrade must be performed. // The height at which the upgrade must be performed.
// Only used if Time is not set. // Only used if Time is not set.
int64 height = 3; int64 height = 3;
// Any application specific upgrade info to be included on-chain // Any application specific upgrade info to be included on-chain
// such as a git commit that validators could automatically upgrade to // such as a git commit that validators could automatically upgrade to
string info = 4; string info = 4;
} }
// SoftwareUpgradeProposal is a gov Content type for initiating a software upgrade // SoftwareUpgradeProposal is a gov Content type for initiating a software upgrade
message SoftwareUpgradeProposal { message SoftwareUpgradeProposal {
string title = 1; option (gogoproto.equal) = true;
string description = 2;
Plan plan = 3 [(gogoproto.nullable) = false]; string title = 1;
string description = 2;
Plan plan = 3 [(gogoproto.nullable) = false];
} }
// SoftwareUpgradeProposal is a gov Content type for cancelling a software upgrade // SoftwareUpgradeProposal is a gov Content type for cancelling a software upgrade
message CancelSoftwareUpgradeProposal { message CancelSoftwareUpgradeProposal {
string title = 1; option (gogoproto.equal) = true;
string description = 2;
string title = 1;
string description = 2;
} }