Remove unnecessary address parameter from CanonicalVoteExtension

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-04-13 13:50:48 -04:00
parent 8104cf5188
commit b3b74dfa3a
3 changed files with 38 additions and 92 deletions

View File

@@ -308,13 +308,13 @@ func (m *CanonicalVote) GetChainID() string {
return ""
}
// CanonicalVoteExtension
// CanonicalVoteExtension provides us a way to serialize a vote extension from
// a particular validator such that we can sign over those serialized bytes.
type CanonicalVoteExtension struct {
Extension []byte `protobuf:"bytes,1,opt,name=extension,proto3" json:"extension,omitempty"`
Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"`
ChainId string `protobuf:"bytes,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Address []byte `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *CanonicalVoteExtension) Reset() { *m = CanonicalVoteExtension{} }
@@ -378,13 +378,6 @@ func (m *CanonicalVoteExtension) GetChainId() string {
return ""
}
func (m *CanonicalVoteExtension) GetAddress() []byte {
if m != nil {
return m.Address
}
return nil
}
func init() {
proto.RegisterType((*CanonicalBlockID)(nil), "tendermint.types.CanonicalBlockID")
proto.RegisterType((*CanonicalPartSetHeader)(nil), "tendermint.types.CanonicalPartSetHeader")
@@ -396,41 +389,40 @@ func init() {
func init() { proto.RegisterFile("tendermint/types/canonical.proto", fileDescriptor_8d1a1a84ff7267ed) }
var fileDescriptor_8d1a1a84ff7267ed = []byte{
// 542 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xce, 0xa6, 0xf9, 0xdd, 0x26, 0x10, 0x56, 0x55, 0x65, 0xa2, 0xca, 0x8e, 0x7c, 0x40, 0xe6,
0x62, 0x4b, 0xed, 0x81, 0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0xfa, 0xf7, 0x36, 0x1c, 0x57, 0xb2, 0x2e, 0x19, 0xa7, 0xff, 0xc3,
0xd7, 0xa6, 0x59, 0x9d, 0x7f, 0x69, 0x56, 0xf7, 0xef, 0xcd, 0xea, 0x3d, 0x60, 0xd6, 0x37, 0xd0,
0xf8, 0x9a, 0x85, 0x59, 0xaf, 0xbe, 0x70, 0x1a, 0xa5, 0x01, 0x8b, 0xd0, 0x11, 0x1c, 0xd2, 0x12,
0x14, 0x3f, 0x56, 0x9d, 0xd8, 0xb1, 0x67, 0xef, 0x7e, 0x7b, 0xba, 0xa5, 0x3d, 0x4f, 0x1b, 0x72,
0x84, 0x3d, 0xc3, 0x4a, 0x01, 0x52, 0x60, 0x9f, 0xb8, 0x6e, 0x42, 0xd3, 0x54, 0xbe, 0xeb, 0x08,
0x97, 0xd0, 0xfe, 0x70, 0x93, 0xa9, 0xe0, 0x36, 0x53, 0xc1, 0xef, 0x4c, 0x05, 0xd7, 0x5b, 0xb5,
0x75, 0xbb, 0x55, 0x5b, 0x3f, 0xb6, 0x6a, 0xeb, 0xe3, 0x0b, 0x2f, 0xe0, 0xfe, 0x7a, 0x69, 0x3a,
0x6c, 0x65, 0x35, 0x2f, 0x93, 0x3a, 0xcc, 0x2f, 0x9d, 0xdd, 0x8b, 0x66, 0xd9, 0x93, 0xf9, 0x93,
0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xba, 0xba, 0x40, 0xcd, 0x04, 0x00, 0x00,
// 528 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcf, 0x6e, 0xd3, 0x40,
0x10, 0xc6, 0xe3, 0xc4, 0x49, 0xec, 0x6d, 0x03, 0x61, 0x55, 0x55, 0x26, 0xaa, 0x6c, 0xcb, 0x07,
0x64, 0x2e, 0xb6, 0xd4, 0x1e, 0xb8, 0xbb, 0x20, 0x11, 0x04, 0xa2, 0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0x1a, 0x5b, 0x97, 0x84, 0xe2, 0xff,
0xc1, 0xb5, 0x0b, 0x4b, 0xfc, 0x97, 0xb0, 0x86, 0x7f, 0x0f, 0x6b, 0xf4, 0x00, 0xac, 0x6f, 0x9d,
0x3f, 0x33, 0x63, 0xf5, 0xea, 0x0b, 0xc5, 0x49, 0x1e, 0x91, 0x04, 0x1e, 0x01, 0x19, 0xd7, 0x41,
0xf5, 0x5d, 0xb5, 0x89, 0x1d, 0x3a, 0x83, 0xfb, 0xe9, 0x0c, 0x6b, 0x3a, 0x4f, 0x3b, 0x6e, 0x18,
0x1d, 0xb9, 0x31, 0xe0, 0x7c, 0xb8, 0x29, 0x54, 0xe1, 0xb6, 0x50, 0x85, 0xdf, 0x85, 0x2a, 0x5c,
0x6f, 0xd5, 0xde, 0xed, 0x56, 0xed, 0xfd, 0xd8, 0xaa, 0xbd, 0x8f, 0x2f, 0x82, 0x88, 0x86, 0xeb,
0xa5, 0xe5, 0x91, 0x95, 0xdd, 0x7d, 0x31, 0xda, 0x63, 0xf9, 0xb2, 0xec, 0xbe, 0x26, 0xcb, 0x11,
0xcf, 0x9f, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xa0, 0x6a, 0x61, 0xb2, 0x04, 0x00, 0x00,
}
func (m *CanonicalBlockID) Marshal() (dAtA []byte, err error) {
@@ -667,13 +659,6 @@ func (m *CanonicalVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i
var l int
_ = l
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintCanonical(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0x2a
}
if len(m.ChainId) > 0 {
i -= len(m.ChainId)
copy(dAtA[i:], m.ChainId)
@@ -822,10 +807,6 @@ func (m *CanonicalVoteExtension) Size() (n int) {
if l > 0 {
n += 1 + l + sovCanonical(uint64(l))
}
l = len(m.Address)
if l > 0 {
n += 1 + l + sovCanonical(uint64(l))
}
return n
}
@@ -1587,40 +1568,6 @@ func (m *CanonicalVoteExtension) Unmarshal(dAtA []byte) error {
}
m.ChainId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCanonical
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCanonical
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCanonical
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
if m.Address == nil {
m.Address = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCanonical(dAtA[iNdEx:])

View File

@@ -36,11 +36,11 @@ message CanonicalVote {
string chain_id = 6 [(gogoproto.customname) = "ChainID"];
}
// CanonicalVoteExtension
// CanonicalVoteExtension provides us a way to serialize a vote extension from
// a particular validator such that we can sign over those serialized bytes.
message CanonicalVoteExtension {
bytes extension = 1;
int64 height = 2;
int32 round = 3;
string chain_id = 4;
bytes address = 5;
}

View File

@@ -74,7 +74,6 @@ func CanonicalizeVoteExtension(chainID string, vote *tmproto.Vote) tmproto.Canon
Height: vote.Height,
Round: vote.Round,
ChainId: chainID,
Address: vote.ValidatorAddress,
}
}