update machine message

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2023-09-06 11:41:54 +02:00
parent 6d7158d124
commit b1f572ddee
No known key found for this signature in database
GPG Key ID: FA5EE906EB55316A
3 changed files with 94 additions and 37 deletions

View File

@ -16,6 +16,7 @@ message Machine {
string machineId = 9; string machineId = 9;
Metadata metadata = 10; Metadata metadata = 10;
uint32 type = 11; uint32 type = 11;
string machineIdSignature = 12;
} }
message Metadata { message Metadata {

View File

@ -72,6 +72,8 @@ func (s *E2ETestSuite) TearDownSuite() {
func (s *E2ETestSuite) TestAttestMachine() { func (s *E2ETestSuite) TestAttestMachine() {
val := s.network.Validators[0] val := s.network.Validators[0]
// register Ta
machine := sample.Machine(sample.Name, sample.PubKey) machine := sample.Machine(sample.Name, sample.PubKey)
machineJSON, err := json.Marshal(&machine) machineJSON, err := json.Marshal(&machine)
s.Require().NoError(err) s.Require().NoError(err)
@ -102,4 +104,6 @@ func (s *E2ETestSuite) TestAttestMachine() {
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdGetMachineByPublicKey(), args) _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, machinecli.CmdGetMachineByPublicKey(), args)
s.Require().NoError(err) s.Require().NoError(err)
// verify double registration fails
} }

View File

@ -23,17 +23,18 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Machine struct { type Machine struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Ticker string `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"` Ticker string `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"`
Domain string `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain,omitempty"` Domain string `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain,omitempty"`
Reissue bool `protobuf:"varint,4,opt,name=reissue,proto3" json:"reissue,omitempty"` Reissue bool `protobuf:"varint,4,opt,name=reissue,proto3" json:"reissue,omitempty"`
Amount uint64 `protobuf:"varint,5,opt,name=amount,proto3" json:"amount,omitempty"` Amount uint64 `protobuf:"varint,5,opt,name=amount,proto3" json:"amount,omitempty"`
Precision uint64 `protobuf:"varint,6,opt,name=precision,proto3" json:"precision,omitempty"` Precision uint64 `protobuf:"varint,6,opt,name=precision,proto3" json:"precision,omitempty"`
IssuerPlanetmint string `protobuf:"bytes,7,opt,name=issuerPlanetmint,proto3" json:"issuerPlanetmint,omitempty"` IssuerPlanetmint string `protobuf:"bytes,7,opt,name=issuerPlanetmint,proto3" json:"issuerPlanetmint,omitempty"`
IssuerLiquid string `protobuf:"bytes,8,opt,name=issuerLiquid,proto3" json:"issuerLiquid,omitempty"` IssuerLiquid string `protobuf:"bytes,8,opt,name=issuerLiquid,proto3" json:"issuerLiquid,omitempty"`
MachineId string `protobuf:"bytes,9,opt,name=machineId,proto3" json:"machineId,omitempty"` MachineId string `protobuf:"bytes,9,opt,name=machineId,proto3" json:"machineId,omitempty"`
Metadata *Metadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` Metadata *Metadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"`
Type uint32 `protobuf:"varint,11,opt,name=type,proto3" json:"type,omitempty"` Type uint32 `protobuf:"varint,11,opt,name=type,proto3" json:"type,omitempty"`
MachineIdSignature string `protobuf:"bytes,12,opt,name=machineIdSignature,proto3" json:"machineIdSignature,omitempty"`
} }
func (m *Machine) Reset() { *m = Machine{} } func (m *Machine) Reset() { *m = Machine{} }
@ -146,6 +147,13 @@ func (m *Machine) GetType() uint32 {
return 0 return 0
} }
func (m *Machine) GetMachineIdSignature() string {
if m != nil {
return m.MachineIdSignature
}
return ""
}
type Metadata struct { type Metadata struct {
Gps string `protobuf:"bytes,1,opt,name=gps,proto3" json:"gps,omitempty"` Gps string `protobuf:"bytes,1,opt,name=gps,proto3" json:"gps,omitempty"`
Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"`
@ -285,32 +293,33 @@ func init() {
} }
var fileDescriptor_1bb279745bef7c4b = []byte{ var fileDescriptor_1bb279745bef7c4b = []byte{
// 394 bytes of a gzipped FileDescriptorProto // 415 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x4a, 0xf3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x3d, 0x4f, 0xe3, 0x40,
0x14, 0xc5, 0x3b, 0x6d, 0xbf, 0x36, 0xb9, 0xed, 0x87, 0x75, 0x10, 0x99, 0x85, 0x86, 0x90, 0x55, 0x10, 0xcd, 0xc6, 0xb9, 0xc4, 0x9e, 0xe4, 0x74, 0xb9, 0xd5, 0xe9, 0xb4, 0xc5, 0x9d, 0x65, 0xb9,
0x10, 0x4d, 0x41, 0x17, 0x82, 0x4b, 0xed, 0xa6, 0x60, 0x41, 0xb2, 0x74, 0x37, 0x26, 0x63, 0x1d, 0xb2, 0x4e, 0x77, 0x8e, 0x74, 0x14, 0x48, 0x94, 0x90, 0x26, 0x12, 0x91, 0x90, 0xe9, 0xe8, 0x16,
0x6c, 0x26, 0x31, 0x99, 0x4a, 0x05, 0x1f, 0xc1, 0x85, 0x8f, 0xe5, 0xb2, 0x4b, 0xc1, 0x8d, 0xb4, 0x7b, 0x31, 0x2b, 0xe2, 0xb5, 0xb1, 0xd7, 0x28, 0x48, 0xfc, 0x03, 0x28, 0xf8, 0x59, 0x94, 0x29,
0x2f, 0x22, 0x99, 0x4c, 0x5a, 0xfb, 0x67, 0xe1, 0x2a, 0xe7, 0x9c, 0x7b, 0x86, 0x49,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, 0xda, 0x8d, 0x89, 0x08, 0xd8, 0x7c, 0xd3, 0x3c, 0xb4, 0x6d, 0xde,
0x9f, 0x5b, 0x95, 0xe9, 0xdc, 0xaa, 0x7c, 0xce, 0xad, 0xca, 0xed, 0xe1, 0x92, 0xf1, 0xc9, 0x30, 0xbe, 0xa8, 0xda, 0x9f, 0x8c, 0x4a, 0xdb, 0x8d, 0xea, 0xf8, 0xf0, 0x65, 0x69, 0xa2, 0xc5, 0xd2,
0xee, 0x4e, 0x16, 0x1b, 0x9c, 0x43, 0xcc, 0xee, 0x1a, 0x6a, 0x81, 0xcf, 0x7e, 0x02, 0x00, 0x00, 0x44, 0x6f, 0x4b, 0x13, 0x3d, 0xaf, 0xcc, 0xd6, 0x62, 0x65, 0xb6, 0x5e, 0x57, 0x66, 0xeb, 0xe2,
0xff, 0xff, 0xb9, 0x18, 0x24, 0xb2, 0xe6, 0x02, 0x00, 0x00, 0xf7, 0x3a, 0x93, 0x7f, 0x61, 0x3c, 0x9a, 0x37, 0x1b, 0x5f, 0x98, 0x9e, 0x5d, 0x76, 0xd5, 0xc2,
0x1f, 0xbc, 0x07, 0x00, 0x00, 0xff, 0xff, 0xec, 0xa8, 0x9d, 0xcd, 0x16, 0x03, 0x00, 0x00,
} }
func (m *Machine) Marshal() (dAtA []byte, err error) { func (m *Machine) Marshal() (dAtA []byte, err error) {
@ -333,6 +342,13 @@ func (m *Machine) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.MachineIdSignature) > 0 {
i -= len(m.MachineIdSignature)
copy(dAtA[i:], m.MachineIdSignature)
i = encodeVarintMachine(dAtA, i, uint64(len(m.MachineIdSignature)))
i--
dAtA[i] = 0x62
}
if m.Type != 0 { if m.Type != 0 {
i = encodeVarintMachine(dAtA, i, uint64(m.Type)) i = encodeVarintMachine(dAtA, i, uint64(m.Type))
i-- i--
@ -567,6 +583,10 @@ func (m *Machine) Size() (n int) {
if m.Type != 0 { if m.Type != 0 {
n += 1 + sovMachine(uint64(m.Type)) n += 1 + sovMachine(uint64(m.Type))
} }
l = len(m.MachineIdSignature)
if l > 0 {
n += 1 + l + sovMachine(uint64(l))
}
return n return n
} }
@ -956,6 +976,38 @@ func (m *Machine) Unmarshal(dAtA []byte) error {
break break
} }
} }
case 12:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MachineIdSignature", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMachine
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthMachine
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthMachine
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.MachineIdSignature = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipMachine(dAtA[iNdEx:]) skippy, err := skipMachine(dAtA[iNdEx:])