From fbe1a475a70ad8ce911781a74e8c51b5fc008e93 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Wed, 19 Jul 2023 16:09:15 +0200 Subject: [PATCH] adjust machine proto message and tests Signed-off-by: Lorenz Herzberger --- go.mod | 2 +- proto/planetmintgo/machine/machine.proto | 2 +- tests/e2e/asset/suite.go | 2 +- tests/e2e/machine/rest.go | 2 +- tests/e2e/machine/suite.go | 2 +- testutil/sample/sample.go | 2 +- x/asset/types/query.pb.gw.go | 4 -- x/machine/types/machine.pb.go | 78 +++++++++++++----------- x/machine/types/query.pb.gw.go | 4 -- 9 files changed, 48 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index 94bb462..fa0cfb9 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,7 @@ require ( google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 google.golang.org/grpc v1.55.0 gopkg.in/yaml.v2 v2.4.0 + sigs.k8s.io/yaml v1.3.0 ) require ( @@ -162,7 +163,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v0.5.5 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect ) replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/proto/planetmintgo/machine/machine.proto b/proto/planetmintgo/machine/machine.proto index f63304d..096ecab 100644 --- a/proto/planetmintgo/machine/machine.proto +++ b/proto/planetmintgo/machine/machine.proto @@ -7,7 +7,7 @@ message Machine { string name = 1; string ticker = 2; - uint64 issued = 3; + bool reissue = 3; uint64 amount = 4; uint64 precision = 5; string issuerPlanetmint = 6; diff --git a/tests/e2e/asset/suite.go b/tests/e2e/asset/suite.go index 661fabe..0fe40a8 100644 --- a/tests/e2e/asset/suite.go +++ b/tests/e2e/asset/suite.go @@ -75,7 +75,7 @@ func (s *E2ETestSuite) SetupSuite() { machine := machinetypes.Machine{ Name: "machine", Ticker: "machine_ticker", - Issued: 1, + Reissue: true, Amount: 1000, Precision: 8, IssuerPlanetmint: pkHex, diff --git a/tests/e2e/machine/rest.go b/tests/e2e/machine/rest.go index c52b6d8..d296402 100644 --- a/tests/e2e/machine/rest.go +++ b/tests/e2e/machine/rest.go @@ -23,7 +23,7 @@ func (s *E2ETestSuite) TestAttestMachineREST() { machine := machinetypes.Machine{ Name: "machine", Ticker: "machine_ticker", - Issued: 1, + Reissue: true, Amount: 1000, Precision: 8, IssuerPlanetmint: pubKey, diff --git a/tests/e2e/machine/suite.go b/tests/e2e/machine/suite.go index 8863ffa..12703a6 100644 --- a/tests/e2e/machine/suite.go +++ b/tests/e2e/machine/suite.go @@ -74,7 +74,7 @@ func (s *E2ETestSuite) TestAttestMachine() { machine := machinetypes.Machine{ Name: "machine", Ticker: "machine_ticker", - Issued: 1, + Reissue: true, Amount: 1000, Precision: 8, IssuerPlanetmint: pubKey, diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 0c09db7..2a039c4 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -30,7 +30,7 @@ func Machine(machineId string, pkPM string, pkL string) machinetypes.Machine { m := machinetypes.Machine{ Name: "machine", Ticker: "PM", - Issued: 1, + Reissue: true, Amount: 1000, Precision: 8, IssuerPlanetmint: pkPM, diff --git a/x/asset/types/query.pb.gw.go b/x/asset/types/query.pb.gw.go index fcd4762..affeb2c 100644 --- a/x/asset/types/query.pb.gw.go +++ b/x/asset/types/query.pb.gw.go @@ -13,9 +13,7 @@ import ( "io" "net/http" - //lint:ignore SA1019 file is generated "github.com/golang/protobuf/descriptor" - //lint:ignore SA1019 file is generated "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -32,8 +30,6 @@ var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray - -//lint:ignore SA1019 file is generated var _ = descriptor.ForMessage var _ = metadata.Join diff --git a/x/machine/types/machine.pb.go b/x/machine/types/machine.pb.go index 91d3e8c..fff0d7f 100644 --- a/x/machine/types/machine.pb.go +++ b/x/machine/types/machine.pb.go @@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Machine struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Ticker string `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"` - Issued uint64 `protobuf:"varint,3,opt,name=issued,proto3" json:"issued,omitempty"` + Reissue bool `protobuf:"varint,3,opt,name=reissue,proto3" json:"reissue,omitempty"` Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` Precision uint64 `protobuf:"varint,5,opt,name=precision,proto3" json:"precision,omitempty"` IssuerPlanetmint string `protobuf:"bytes,6,opt,name=issuerPlanetmint,proto3" json:"issuerPlanetmint,omitempty"` @@ -81,11 +81,11 @@ func (m *Machine) GetTicker() string { return "" } -func (m *Machine) GetIssued() uint64 { +func (m *Machine) GetReissue() bool { if m != nil { - return m.Issued + return m.Reissue } - return 0 + return false } func (m *Machine) GetAmount() uint64 { @@ -269,31 +269,31 @@ func init() { } var fileDescriptor_1bb279745bef7c4b = []byte{ - // 371 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4f, 0xf2, 0x30, - 0x18, 0xc7, 0x29, 0xe3, 0x05, 0xd6, 0x97, 0x44, 0x6c, 0x8c, 0xe9, 0x41, 0x1b, 0xb2, 0xd3, 0x62, - 0x74, 0x24, 0x7a, 0x30, 0xf1, 0xa8, 0x5c, 0x48, 0x24, 0x31, 0x3b, 0x7a, 0xab, 0x6b, 0xc5, 0x46, - 0xd6, 0xcd, 0xb5, 0x18, 0x4c, 0xfc, 0x08, 0x1e, 0xfc, 0x22, 0x7e, 0x0f, 0x8f, 0x1c, 0x3d, 0x1a, - 0xf8, 0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c, 0xd7, 0x67, 0xfc, 0x59, 0x44, 0x7c, 0xa1, - 0xab, 0xe8, 0x90, 0x0f, 0x77, 0xa8, 0x52, 0x5c, 0xf7, 0xf8, 0xbd, 0x90, 0x42, 0xe7, 0x12, 0x1c, - 0x13, 0xd8, 0xc4, 0xe8, 0x18, 0xee, 0x52, 0xc6, 0x4c, 0x4d, 0x47, 0x3d, 0xaa, 0xe9, 0x55, 0xbf, - 0x67, 0x5c, 0xba, 0x61, 0x79, 0xe0, 0xbd, 0xc2, 0x96, 0xfd, 0x7b, 0x7d, 0xc9, 0xf8, 0x64, 0x7d, - 0x71, 0xb0, 0xb9, 0xf8, 0x36, 0xcd, 0xd5, 0x3f, 0x6a, 0x76, 0xca, 0x9a, 0x2f, 0xcf, 0x3f, 0x67, - 0x04, 0x4c, 0x67, 0x04, 0x7c, 0xcf, 0x08, 0x78, 0x9f, 0x93, 0xca, 0x74, 0x4e, 0x2a, 0x5f, 0x73, - 0x52, 0xb9, 0x3d, 0x5c, 0xf9, 0x3c, 0x19, 0x26, 0xdd, 0xc9, 0xf2, 0x4e, 0xea, 0x97, 0x94, 0xab, - 0xbb, 0xba, 0xb9, 0x92, 0x67, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x3f, 0x35, 0x20, 0xb8, - 0x02, 0x00, 0x00, + // 378 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x4a, 0xeb, 0x40, + 0x14, 0xc6, 0x3b, 0x4d, 0x6f, 0x9b, 0x9c, 0x5b, 0xb8, 0xbd, 0xc3, 0xe5, 0x32, 0x0b, 0x0d, 0x21, + 0xab, 0x20, 0x9a, 0x82, 0x2e, 0x04, 0x97, 0xda, 0x4d, 0xc1, 0x82, 0x64, 0xe9, 0x6e, 0x4c, 0x8e, + 0x75, 0xb0, 0x99, 0xc4, 0x64, 0x2a, 0x15, 0x7c,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 0x82, + 0xa5, 0xdf, 0x7d, 0x21, 0x60, 0x56, 0x32, 0xed, 0x80, 0x31, 0x4c, 0xf3, 0x92, 0x58, 0x51, 0x16, + 0xf1, 0x23, 0x7c, 0x14, 0x21, 0x56, 0xc0, 0x16, 0x1d, 0xf5, 0xe0, 0x0f, 0xcf, 0x73, 0x54, 0x3d, + 0xbc, 0x15, 0x52, 0xa8, 0x02, 0x82, 0xa1, 0x0d, 0x9b, 0x32, 0x3d, 0x84, 0xbf, 0x3c, 0x8a, 0x74, + 0xcd, 0x47, 0x3d, 0xae, 0xf8, 0x45, 0xbf, 0xa7, 0x59, 0x5a, 0xc1, 0xf6, 0xc0, 0x7d, 0x86, 0x76, + 0xf9, 0x7e, 0x7d, 0x19, 0xe1, 0x64, 0x3d, 0x38, 0xd9, 0x0c, 0xbe, 0x0b, 0x73, 0xfd, 0x87, 0x98, + 0x8d, 0x6d, 0xcc, 0xe7, 0xa7, 0xef, 0x33, 0x9b, 0x4c, 0x67, 0x36, 0xf9, 0x9c, 0xd9, 0xe4, 0x75, + 0x6e, 0xd7, 0xa6, 0x73, 0xbb, 0xf6, 0x31, 0xb7, 0x6b, 0xd7, 0xfb, 0x2b, 0x9e, 0x47, 0xc3, 0xa4, + 0x3b, 0x59, 0x6e, 0xa5, 0x7a, 0x4a, 0x31, 0xbf, 0x69, 0xea, 0xa5, 0x3c, 0xf9, 0x0a, 0x00, 0x00, + 0xff, 0xff, 0x35, 0x4e, 0xee, 0x2e, 0xba, 0x02, 0x00, 0x00, } func (m *Machine) Marshal() (dAtA []byte, err error) { @@ -359,8 +359,13 @@ func (m *Machine) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.Issued != 0 { - i = encodeVarintMachine(dAtA, i, uint64(m.Issued)) + if m.Reissue { + i-- + if m.Reissue { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } i-- dAtA[i] = 0x18 } @@ -501,8 +506,8 @@ func (m *Machine) Size() (n int) { if l > 0 { n += 1 + l + sovMachine(uint64(l)) } - if m.Issued != 0 { - n += 1 + sovMachine(uint64(m.Issued)) + if m.Reissue { + n += 2 } if m.Amount != 0 { n += 1 + sovMachine(uint64(m.Amount)) @@ -676,9 +681,9 @@ func (m *Machine) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Issued", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Reissue", wireType) } - m.Issued = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMachine @@ -688,11 +693,12 @@ func (m *Machine) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Issued |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.Reissue = bool(v != 0) case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) diff --git a/x/machine/types/query.pb.gw.go b/x/machine/types/query.pb.gw.go index 99fa801..91257f3 100644 --- a/x/machine/types/query.pb.gw.go +++ b/x/machine/types/query.pb.gw.go @@ -13,9 +13,7 @@ import ( "io" "net/http" - //lint:ignore SA1019 file is generated "github.com/golang/protobuf/descriptor" - //lint:ignore SA1019 file is generated "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -32,8 +30,6 @@ var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray - -//lint:ignore SA1019 file is generated var _ = descriptor.ForMessage var _ = metadata.Join