From 06aaf934be3b24f8c6fc4b139e07b301d24b78ee Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Tue, 7 May 2024 16:03:09 -0600 Subject: [PATCH] [1760]: Refactor the MetadataAddress.Format method to handle more casses in better ways. Specifically, %v will now output the bech32 string so that the other .String() methods have the bech32 there instead of the hex bytes. --- proto/provenance/metadata/v1/scope.proto | 7 + .../metadata/v1/specification.proto | 12 + x/metadata/types/address.go | 27 +- x/metadata/types/address_test.go | 180 ++++++++----- x/metadata/types/scope.go | 12 - x/metadata/types/scope.pb.go | 228 ++++++++++------ x/metadata/types/scope_test.go | 162 ++++++++---- x/metadata/types/specification.pb.go | 244 +++++++++++++----- x/metadata/types/specification_test.go | 177 ++++++------- 9 files changed, 688 insertions(+), 361 deletions(-) diff --git a/proto/provenance/metadata/v1/scope.proto b/proto/provenance/metadata/v1/scope.proto index 732ce45235..68bf9fa616 100644 --- a/proto/provenance/metadata/v1/scope.proto +++ b/proto/provenance/metadata/v1/scope.proto @@ -69,6 +69,9 @@ Indexes (special kvstore records for efficient cross reference/queries) // Scope defines a root reference for a collection of records owned by one or more parties. message Scope { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + // Unique ID for this scope. Implements sdk.Address interface for use where addresses are required in Cosmos bytes scope_id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "MetadataAddress"]; // the scope specification that contains the specifications for data elements allowed within this scope @@ -91,6 +94,9 @@ message Scope { // // NOTE: When there are no more Records within a Scope that reference a Session, the Session is removed. message Session { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + bytes session_id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "MetadataAddress"]; // unique id of the contract specification that was used to create this session. bytes specification_id = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "MetadataAddress"]; @@ -107,6 +113,7 @@ message Session { // A record (of fact) is attached to a session or each consideration output from a contract message Record { option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; // name/identifier for this record. Value must be unique within the scope. Also known as a Fact name string name = 1; diff --git a/proto/provenance/metadata/v1/specification.proto b/proto/provenance/metadata/v1/specification.proto index 6ef6bd1c59..b42eee6111 100644 --- a/proto/provenance/metadata/v1/specification.proto +++ b/proto/provenance/metadata/v1/specification.proto @@ -35,6 +35,9 @@ option java_multiple_files = true; // ScopeSpecification defines the required parties, resources, conditions, and consideration outputs for a contract message ScopeSpecification { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + // unique identifier for this specification on chain bytes specification_id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "MetadataAddress"]; // General information about this scope specification. @@ -49,6 +52,9 @@ message ScopeSpecification { // ContractSpecification defines the required parties, resources, conditions, and consideration outputs for a contract message ContractSpecification { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + // unique identifier for this specification on chain bytes specification_id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "MetadataAddress"]; // Description information for this contract specification @@ -71,6 +77,9 @@ message ContractSpecification { // RecordSpecification defines the specification for a Record including allowed/required inputs/outputs message RecordSpecification { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + // unique identifier for this specification on chain bytes specification_id = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "MetadataAddress"]; // Name of Record that will be created when this specification is used @@ -88,6 +97,9 @@ message RecordSpecification { // InputSpecification defines a name, type_name, and source reference (either on or off chain) to define an input // parameter message InputSpecification { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = true; + // name for this input string name = 1; // a type_name (typically a proto name or class_name) diff --git a/x/metadata/types/address.go b/x/metadata/types/address.go index e5181112b1..0c1c83a2a6 100644 --- a/x/metadata/types/address.go +++ b/x/metadata/types/address.go @@ -626,15 +626,30 @@ func (ma MetadataAddress) ContractSpecRecordSpecIteratorPrefix() ([]byte, error) return append(RecordSpecificationKeyPrefix, ma[1:17]...), nil } -// Format implements fmt.Format interface +// Format implements fmt.Formatter interface for a MetadataAddress. func (ma MetadataAddress) Format(s fmt.State, verb rune) { + var out string switch verb { - case 's': - s.Write([]byte(ma.String())) - case 'p': - s.Write([]byte(fmt.Sprintf("%p", ma))) + case 's', 'q': + out = fmt.Sprintf(fmt.FormatString(s, verb), ma.String()) + case 'v': + if s.Flag('#') { + out = fmt.Sprintf(fmt.FormatString(s, verb), []byte(ma)) + out = "MetadataAddress" + strings.TrimPrefix(out, "[]byte") + } else { + // The auto-generated gogoproto.stringer methods use "%v" for the MetadataAddress fields. + // So here, we return the bech32 for "%v" so that those other strings look right. + out = fmt.Sprintf(fmt.FormatString(s, verb), ma.String()) + } + case 'p', 'T': + out = fmt.Sprintf(fmt.FormatString(s, verb), ma) default: - s.Write([]byte(fmt.Sprintf("%X", []byte(ma)))) + out = fmt.Sprintf(fmt.FormatString(s, verb), []byte(ma)) + } + + _, err := s.Write([]byte(out)) + if err != nil { + panic(err) } } diff --git a/x/metadata/types/address_test.go b/x/metadata/types/address_test.go index cae9451e2a..f2471dd456 100644 --- a/x/metadata/types/address_test.go +++ b/x/metadata/types/address_test.go @@ -1717,80 +1717,130 @@ func (s *AddressTestSuite) TestContractSpecAddressConverters() { } } +type mockState struct { + err string +} + +var _ fmt.State = (*mockState)(nil) + +func (s mockState) Write(b []byte) (n int, err error) { + return 0, errors.New(s.err) +} + +func (s mockState) Width() (int, bool) { + return 0, false +} + +func (s mockState) Precision() (int, bool) { + return 0, false +} + +func (s mockState) Flag(c int) bool { + return false +} + func (s *AddressTestSuite) TestFormat() { - scopeID := ScopeMetadataAddress(s.scopeUUID) - emptyID := MetadataAddress{} + someUUIDStr := "97263339-CFAA-41D9-809E-82CD78C84F02" + someUUID, err := uuid.Parse(someUUIDStr) + s.Require().NoError(err, "uuid.Parse(%q)", someUUIDStr) + + type namedMetadataAddress struct { + name string + id MetadataAddress + } + + scopeID := namedMetadataAddress{name: "scope", id: ScopeMetadataAddress(someUUID)} + contractSpecID := namedMetadataAddress{name: "contract spec", id: ContractSpecMetadataAddress(someUUID)} + emptyID := namedMetadataAddress{name: "empty", id: MetadataAddress{}} + nilID := namedMetadataAddress{name: "nil", id: nil} + invalidID := namedMetadataAddress{name: "invalid", id: MetadataAddress("do not create MetadataAddresses this way")} tests := []struct { - name string - id MetadataAddress - format string - expected string + id namedMetadataAddress + fmt string + exp string }{ - { - "format using %s", - scopeID, - "%s", - s.scopeBech32, - }, - { - // %p is for the address (in memory). Can't hard-code it. - "format using %p", - scopeID, - "%p", - fmt.Sprintf("%p", scopeID), - }, - { - "format using %d - should use default %X", - scopeID, - "%d", - "008D80B25AC0894446956E5D08CFE3E1A5", - }, - { - "format using %v - should use default %X", - scopeID, - "%v", - "008D80B25AC0894446956E5D08CFE3E1A5", - }, - { - "format empty using %s", - emptyID, - "%s", - "", - }, - { - // %p is for the address (in memory). Can't hard-code it. - "format using %p", - emptyID, - "%p", - fmt.Sprintf("%p", emptyID), - }, - { - "format empty using %d - should use default %X", - emptyID, - "%d", - "", - }, - { - "format empty using %v - should use default %X", - emptyID, - "%v", - "", - }, - { - "format %s is equal to .String() which fails on bad addresses", - MetadataAddress("do not create MetadataAddresses this way"), - "%s", - "%!s(PANIC=Format method: invalid metadata address type: 100)", - }, + {id: scopeID, fmt: "%s", exp: "scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"}, + {id: scopeID, fmt: "%20s", exp: "scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"}, + {id: scopeID, fmt: "%-20s", exp: "scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"}, + {id: scopeID, fmt: "%50s", exp: " scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"}, + {id: scopeID, fmt: "%-50s", exp: "scope1qztjvveee74yrkvqn6pv67xgfupqyumx55 "}, + {id: scopeID, fmt: "%q", exp: `"scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"`}, + {id: scopeID, fmt: "%20q", exp: `"scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"`}, + {id: scopeID, fmt: "%-20q", exp: `"scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"`}, + {id: scopeID, fmt: "%50q", exp: ` "scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"`}, + {id: scopeID, fmt: "%-50q", exp: `"scope1qztjvveee74yrkvqn6pv67xgfupqyumx55" `}, + {id: scopeID, fmt: "%v", exp: "scope1qztjvveee74yrkvqn6pv67xgfupqyumx55"}, + {id: scopeID, fmt: "%#v", exp: "MetadataAddress{0x0, 0x97, 0x26, 0x33, 0x39, 0xcf, 0xaa, 0x41, 0xd9, 0x80, 0x9e, 0x82, 0xcd, 0x78, 0xc8, 0x4f, 0x2}"}, + {id: scopeID, fmt: "%p", exp: fmt.Sprintf("%p", []byte(scopeID.id))}, // e.g. 0x14000d95818 + {id: scopeID, fmt: "%#p", exp: fmt.Sprintf("%#p", []byte(scopeID.id))}, // e.g. 14000d95818 + {id: scopeID, fmt: "%T", exp: "types.MetadataAddress"}, + {id: scopeID, fmt: "%d", exp: "[0 151 38 51 57 207 170 65 217 128 158 130 205 120 200 79 2]"}, + {id: scopeID, fmt: "%x", exp: "0097263339cfaa41d9809e82cd78c84f02"}, + {id: scopeID, fmt: "%#x", exp: "0x0097263339cfaa41d9809e82cd78c84f02"}, + {id: scopeID, fmt: "%X", exp: "0097263339CFAA41D9809E82CD78C84F02"}, + {id: scopeID, fmt: "%#X", exp: "0X0097263339CFAA41D9809E82CD78C84F02"}, + {id: contractSpecID, fmt: "%s", exp: "contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"}, + {id: contractSpecID, fmt: "%20s", exp: "contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"}, + {id: contractSpecID, fmt: "%-20s", exp: "contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"}, + {id: contractSpecID, fmt: "%50s", exp: " contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"}, + {id: contractSpecID, fmt: "%-50s", exp: "contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh "}, + {id: contractSpecID, fmt: "%q", exp: `"contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"`}, + {id: contractSpecID, fmt: "%20q", exp: `"contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"`}, + {id: contractSpecID, fmt: "%-20q", exp: `"contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"`}, + {id: contractSpecID, fmt: "%50q", exp: ` "contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"`}, + {id: contractSpecID, fmt: "%-50q", exp: `"contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh" `}, + {id: contractSpecID, fmt: "%v", exp: "contractspec1qwtjvveee74yrkvqn6pv67xgfupqghravh"}, + {id: contractSpecID, fmt: "%#v", exp: "MetadataAddress{0x3, 0x97, 0x26, 0x33, 0x39, 0xcf, 0xaa, 0x41, 0xd9, 0x80, 0x9e, 0x82, 0xcd, 0x78, 0xc8, 0x4f, 0x2}"}, + {id: contractSpecID, fmt: "%p", exp: fmt.Sprintf("%p", []byte(contractSpecID.id))}, // e.g. 0x14000d95818 + {id: contractSpecID, fmt: "%#p", exp: fmt.Sprintf("%#p", []byte(contractSpecID.id))}, // e.g. 14000d95818 + {id: contractSpecID, fmt: "%T", exp: "types.MetadataAddress"}, + {id: contractSpecID, fmt: "%d", exp: "[3 151 38 51 57 207 170 65 217 128 158 130 205 120 200 79 2]"}, + {id: contractSpecID, fmt: "%x", exp: "0397263339cfaa41d9809e82cd78c84f02"}, + {id: contractSpecID, fmt: "%#x", exp: "0x0397263339cfaa41d9809e82cd78c84f02"}, + {id: contractSpecID, fmt: "%X", exp: "0397263339CFAA41D9809E82CD78C84F02"}, + {id: contractSpecID, fmt: "%#X", exp: "0X0397263339CFAA41D9809E82CD78C84F02"}, + {id: emptyID, fmt: "%s", exp: ""}, + {id: emptyID, fmt: "%q", exp: `""`}, + {id: emptyID, fmt: "%v", exp: ""}, + {id: emptyID, fmt: "%#v", exp: "MetadataAddress{}"}, + {id: emptyID, fmt: "%T", exp: "types.MetadataAddress"}, + {id: emptyID, fmt: "%x", exp: ""}, + {id: nilID, fmt: "%s", exp: ""}, + {id: nilID, fmt: "%q", exp: `""`}, + {id: nilID, fmt: "%v", exp: ""}, + {id: nilID, fmt: "%#v", exp: "MetadataAddress(nil)"}, + {id: nilID, fmt: "%T", exp: "types.MetadataAddress"}, + {id: nilID, fmt: "%x", exp: ""}, + {id: invalidID, fmt: "%s", exp: "%!s(PANIC=Format method: invalid metadata address type: 100)"}, + {id: invalidID, fmt: "%q", exp: "%!q(PANIC=Format method: invalid metadata address type: 100)"}, + {id: invalidID, fmt: "%v", exp: "%!v(PANIC=Format method: invalid metadata address type: 100)"}, + {id: invalidID, fmt: "%#v", exp: "MetadataAddress{0x64, 0x6f, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x61, 0x79}"}, + {id: invalidID, fmt: "%T", exp: "types.MetadataAddress"}, + {id: invalidID, fmt: "%x", exp: "646f206e6f7420637265617465204d65746164617461416464726573736573207468697320776179"}, } for _, test := range tests { - s.T().Run(test.name, func(t *testing.T) { - actual := fmt.Sprintf(test.format, test.id) - assert.Equal(t, test.expected, actual, test.name) + s.Run(test.id.name+" "+test.fmt, func() { + var actual string + testFunc := func() { + actual = fmt.Sprintf(test.fmt, test.id.id) + } + s.Require().NotPanics(testFunc, "Sprintf(%q, ...)", test.fmt) + s.Assert().Equal(test.exp, actual) }) } + + s.Run("write error", func() { + expPanic := "injected write error" + state := &mockState{err: expPanic} + verb := 's' + addr := ScopeMetadataAddress(s.scopeUUID) + testFunc := func() { + addr.Format(state, verb) + } + s.Require().PanicsWithError(expPanic, testFunc, "Format") + }) } func (s *AddressTestSuite) TestGenerateExamples() { diff --git a/x/metadata/types/scope.go b/x/metadata/types/scope.go index bcf4bd96d7..205b57fdfc 100644 --- a/x/metadata/types/scope.go +++ b/x/metadata/types/scope.go @@ -3,7 +3,6 @@ package types import ( "errors" "fmt" - "strings" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -296,17 +295,6 @@ func (r Record) ValidateBasic() error { return nil } -// String implements stringer interface -func (r Record) String() string { - out := fmt.Sprintf("%s (%s) Results [", r.Name, r.SessionId) - for _, o := range r.Outputs { - out += fmt.Sprintf("%s - %s, ", o.Status, o.Hash) - } - out = strings.TrimRight(out, ", ") - out += fmt.Sprintf("] (%s/%s)", r.Process.Name, r.Process.Method) - return out -} - // GetRecordAddress returns the address for this record, or an empty MetadataAddress if it cannot be constructed. func (r Record) GetRecordAddress() MetadataAddress { addr, err := r.SessionId.AsRecordAddress(r.Name) diff --git a/x/metadata/types/scope.pb.go b/x/metadata/types/scope.pb.go index e3f75df312..796b4e2048 100644 --- a/x/metadata/types/scope.pb.go +++ b/x/metadata/types/scope.pb.go @@ -14,6 +14,8 @@ import ( io "io" math "math" math_bits "math/bits" + reflect "reflect" + strings "strings" time "time" ) @@ -116,9 +118,8 @@ type Scope struct { RequirePartyRollup bool `protobuf:"varint,6,opt,name=require_party_rollup,json=requirePartyRollup,proto3" json:"require_party_rollup,omitempty"` } -func (m *Scope) Reset() { *m = Scope{} } -func (m *Scope) String() string { return proto.CompactTextString(m) } -func (*Scope) ProtoMessage() {} +func (m *Scope) Reset() { *m = Scope{} } +func (*Scope) ProtoMessage() {} func (*Scope) Descriptor() ([]byte, []int) { return fileDescriptor_edeea634bfb18aba, []int{0} } @@ -195,9 +196,8 @@ type Session struct { Audit *AuditFields `protobuf:"bytes,99,opt,name=audit,proto3" json:"audit,omitempty"` } -func (m *Session) Reset() { *m = Session{} } -func (m *Session) String() string { return proto.CompactTextString(m) } -func (*Session) ProtoMessage() {} +func (m *Session) Reset() { *m = Session{} } +func (*Session) ProtoMessage() {} func (*Session) Descriptor() ([]byte, []int) { return fileDescriptor_edeea634bfb18aba, []int{1} } @@ -826,77 +826,78 @@ func init() { } var fileDescriptor_edeea634bfb18aba = []byte{ - // 1118 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0x23, 0x45, - 0x13, 0xf6, 0xf8, 0xdb, 0x65, 0xef, 0xbb, 0xde, 0xde, 0xd5, 0xbe, 0x5e, 0xc3, 0xda, 0xc6, 0x70, - 0x30, 0x91, 0x18, 0x6f, 0x0c, 0x8b, 0xc4, 0x97, 0x90, 0xbd, 0xc9, 0x12, 0x8b, 0x25, 0xb1, 0xda, - 0x09, 0x07, 0x2e, 0xa3, 0xf1, 0x4c, 0xc7, 0x1e, 0xc5, 0x9e, 0x1e, 0xa6, 0x7b, 0xbc, 0x31, 0xfc, - 0x83, 0x9c, 0x96, 0x1b, 0x97, 0x48, 0xf0, 0x03, 0xf8, 0x0d, 0x5c, 0xf7, 0xb8, 0x47, 0x04, 0xd2, - 0x82, 0x92, 0x0b, 0x3f, 0x03, 0x75, 0x4f, 0x8f, 0x3f, 0x88, 0x13, 0x25, 0x12, 0xb7, 0xe9, 0xaa, - 0xa7, 0xba, 0xaa, 0x9e, 0x7a, 0xca, 0x6d, 0xa8, 0x7b, 0x3e, 0x9d, 0x12, 0xd7, 0x74, 0x2d, 0xd2, - 0x9c, 0x10, 0x6e, 0xda, 0x26, 0x37, 0x9b, 0xd3, 0xcd, 0x26, 0xb3, 0xa8, 0x47, 0x74, 0xcf, 0xa7, - 0x9c, 0xa2, 0xfb, 0x0b, 0x8c, 0x1e, 0x61, 0xf4, 0xe9, 0x66, 0xb9, 0x62, 0x51, 0x36, 0xa1, 0xac, - 0x39, 0x30, 0x19, 0x69, 0x4e, 0x37, 0x07, 0x84, 0x9b, 0x9b, 0x4d, 0x8b, 0x3a, 0x6e, 0x18, 0x57, - 0xbe, 0x37, 0xa4, 0x43, 0x2a, 0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, 0x2a, 0x74, 0xad, 0x18, 0xd2, 0x37, 0x13, 0xc3, 0xc7, 0xc9, 0x1f, 0x7f, 0xaa, - 0xc6, 0xea, 0xdf, 0x43, 0x46, 0x35, 0x8b, 0xca, 0x90, 0x89, 0xb4, 0x2f, 0xd9, 0xde, 0x89, 0xe1, - 0xc8, 0x80, 0xee, 0x41, 0x72, 0x64, 0xb2, 0x91, 0x24, 0x5b, 0x38, 0xe4, 0x69, 0x3e, 0x9c, 0xc4, - 0xd2, 0x70, 0xee, 0x43, 0x7a, 0x42, 0xf8, 0x88, 0xda, 0x4a, 0x26, 0xea, 0x14, 0xa6, 0xeb, 0x14, - 0x00, 0x14, 0x99, 0x86, 0x63, 0xd7, 0xff, 0xd0, 0x20, 0xbf, 0x44, 0xd5, 0xda, 0x61, 0xb7, 0x20, - 0xe7, 0x4b, 0xc8, 0x62, 0xd6, 0x77, 0xd7, 0xf4, 0xb7, 0x13, 0xc3, 0xd9, 0x10, 0xd7, 0xb5, 0xe7, - 0xd5, 0x26, 0x56, 0xaa, 0x7d, 0x03, 0x72, 0x7c, 0xe6, 0x11, 0x63, 0x49, 0xc3, 0x59, 0x61, 0xd8, - 0x15, 0x69, 0xda, 0x90, 0x66, 0xdc, 0xe4, 0x41, 0xb8, 0xf7, 0xff, 0x6b, 0xbd, 0x7b, 0x8d, 0xd1, - 0xf6, 0x65, 0x00, 0x56, 0x81, 0xaa, 0xc3, 0x2c, 0xa4, 0x19, 0x0d, 0x7c, 0x8b, 0xd4, 0x0f, 0xa1, - 0xb0, 0x3c, 0x43, 0xd1, 0x9d, 0xac, 0x4a, 0x75, 0x27, 0x6b, 0xfa, 0x74, 0x9e, 0x36, 0x2e, 0xd3, - 0x5e, 0xa1, 0x06, 0x16, 0x8c, 0xd7, 0x66, 0xac, 0x7f, 0x07, 0x29, 0xb9, 0xae, 0x62, 0x17, 0x57, - 0x06, 0xb8, 0x18, 0xdf, 0x63, 0x48, 0xfa, 0x74, 0x4c, 0x54, 0x92,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d, 0x3e, 0x0a, 0x06, 0xba, 0x45, 0x27, 0xcd, 0x05, 0xe8, 0x3d, - 0x87, 0x2e, 0x9d, 0x9a, 0xc7, 0x8b, 0xbf, 0x50, 0xe2, 0xf7, 0x84, 0x0d, 0xd2, 0x52, 0x7f, 0xef, - 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xcc, 0xe3, 0x58, 0x1b, 0x0a, 0x00, 0x00, + // 1126 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xf6, 0xf8, 0xdf, 0x65, 0x2f, 0xeb, 0xed, 0x8d, 0x82, 0x63, 0x88, 0x6d, 0x0c, 0x07, 0x13, + 0x89, 0xf1, 0xc6, 0xb0, 0x48, 0x2c, 0x20, 0x64, 0xe7, 0x87, 0x58, 0x2c, 0x89, 0x35, 0x4e, 0x38, + 0x70, 0x19, 0x8d, 0x67, 0x3a, 0xf6, 0x28, 0xf6, 0xf4, 0x30, 0xdd, 0xe3, 0x8d, 0xe1, 0xc2, 0x39, + 0xa7, 0xe5, 0xc6, 0x25, 0x12, 0x3c, 0x05, 0xaf, 0xb0, 0xdc, 0xf6, 0x88, 0x00, 0x2d, 0x28, 0xb9, + 0xf2, 0x10, 0xa8, 0x7b, 0x7a, 0xfc, 0x43, 0x9c, 0x28, 0x91, 0xb8, 0x4d, 0x55, 0x7d, 0xd5, 0x55, + 0xfd, 0xd5, 0xd7, 0xdd, 0x03, 0x55, 0xd7, 0x23, 0x63, 0xec, 0x18, 0x8e, 0x89, 0xeb, 0x23, 0xcc, + 0x0c, 0xcb, 0x60, 0x46, 0x7d, 0xbc, 0x59, 0xa7, 0x26, 0x71, 0xb1, 0xea, 0x7a, 0x84, 0x11, 0xb4, + 0x3a, 0xc3, 0xa8, 0x21, 0x46, 0x1d, 0x6f, 0x16, 0x4b, 0x26, 0xa1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xf2, + 0xf2, 0xa2, 0xa4, 0xfc, 0x7d, 0x51, 0x52, 0x9e, 0x5f, 0x96, 0x22, 0x2f, 0x2f, 0x4b, 0x91, 0xdf, + 0x2e, 0x4b, 0x11, 0x58, 0xb3, 0xc9, 0x35, 0xe7, 0xa1, 0xa3, 0x7c, 0xfd, 0x41, 0xdf, 0x66, 0x03, + 0xbf, 0xa7, 0x9a, 0x64, 0x54, 0x9f, 0x81, 0xde, 0xb3, 0xc9, 0x9c, 0x55, 0x3f, 0x9d, 0xfd, 0x5a, + 0xf1, 0xfb, 0x84, 0xf6, 0x92, 0x42, 0x7f, 0xef, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x61, 0xf7, + 0xe7, 0xe3, 0x33, 0x0a, 0x00, 0x00, } func (m *Scope) Marshal() (dAtA []byte, err error) { @@ -1767,6 +1768,79 @@ func sovScope(x uint64) (n int) { func sozScope(x uint64) (n int) { return sovScope(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (this *Scope) String() string { + if this == nil { + return "nil" + } + repeatedStringForOwners := "[]Party{" + for _, f := range this.Owners { + repeatedStringForOwners += fmt.Sprintf("%v", f) + "," + } + repeatedStringForOwners += "}" + s := strings.Join([]string{`&Scope{`, + `ScopeId:` + fmt.Sprintf("%v", this.ScopeId) + `,`, + `SpecificationId:` + fmt.Sprintf("%v", this.SpecificationId) + `,`, + `Owners:` + repeatedStringForOwners + `,`, + `DataAccess:` + fmt.Sprintf("%v", this.DataAccess) + `,`, + `ValueOwnerAddress:` + fmt.Sprintf("%v", this.ValueOwnerAddress) + `,`, + `RequirePartyRollup:` + fmt.Sprintf("%v", this.RequirePartyRollup) + `,`, + `}`, + }, "") + return s +} +func (this *Session) String() string { + if this == nil { + return "nil" + } + repeatedStringForParties := "[]Party{" + for _, f := range this.Parties { + repeatedStringForParties += fmt.Sprintf("%v", f) + "," + } + repeatedStringForParties += "}" + s := strings.Join([]string{`&Session{`, + `SessionId:` + fmt.Sprintf("%v", this.SessionId) + `,`, + `SpecificationId:` + fmt.Sprintf("%v", this.SpecificationId) + `,`, + `Parties:` + repeatedStringForParties + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Context:` + fmt.Sprintf("%v", this.Context) + `,`, + `Audit:` + strings.Replace(fmt.Sprintf("%v", this.Audit), "AuditFields", "AuditFields", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Record) String() string { + if this == nil { + return "nil" + } + repeatedStringForInputs := "[]RecordInput{" + for _, f := range this.Inputs { + repeatedStringForInputs += fmt.Sprintf("%v", f) + "," + } + repeatedStringForInputs += "}" + repeatedStringForOutputs := "[]RecordOutput{" + for _, f := range this.Outputs { + repeatedStringForOutputs += fmt.Sprintf("%v", f) + "," + } + repeatedStringForOutputs += "}" + s := strings.Join([]string{`&Record{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `SessionId:` + fmt.Sprintf("%v", this.SessionId) + `,`, + `Process:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Process), "Process", "Process", 1), `&`, ``, 1) + `,`, + `Inputs:` + repeatedStringForInputs + `,`, + `Outputs:` + repeatedStringForOutputs + `,`, + `SpecificationId:` + fmt.Sprintf("%v", this.SpecificationId) + `,`, + `}`, + }, "") + return s +} +func valueToStringScope(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} func (m *Scope) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/metadata/types/scope_test.go b/x/metadata/types/scope_test.go index 4544b6d950..4f5d8ff5c0 100644 --- a/x/metadata/types/scope_test.go +++ b/x/metadata/types/scope_test.go @@ -2,7 +2,6 @@ package types import ( "encoding/hex" - "fmt" "testing" "time" @@ -476,27 +475,28 @@ func (s *ScopeTestSuite) TestScopeHasOwnerAddress() { } func (s *ScopeTestSuite) TestScopeString() { - s.T().Run("scope string", func(t *testing.T) { - scopeUUID := uuid.MustParse("8d80b25a-c089-4446-956e-5d08cfe3e1a5") - sessionUUID := uuid.MustParse("c25c7bd4-c639-4367-a842-f64fa5fccc19") - scope := &Scope{ - ScopeId: ScopeMetadataAddress(scopeUUID), - SpecificationId: ScopeSpecMetadataAddress(sessionUUID), - Owners: OwnerPartyList(s.Addr), - DataAccess: []string{}, - } - require.Equal(t, `scope_id: scope1qzxcpvj6czy5g354dews3nlruxjsahhnsp -specification_id: scopespec1qnp9c775ccu5xeaggtmylf0uesvsqyrkq8 -owners: -- address: cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck - role: 5 - optional: false -data_access: [] -value_owner_address: "" -require_party_rollup: false -`, - scope.String()) - }) + scopeUUID := uuid.MustParse("8d80b25a-c089-4446-956e-5d08cfe3e1a5") + specUUID := uuid.MustParse("c25c7bd4-c639-4367-a842-f64fa5fccc19") + scope := &Scope{ + ScopeId: ScopeMetadataAddress(scopeUUID), + SpecificationId: ScopeSpecMetadataAddress(specUUID), + Owners: OwnerPartyList(s.Addr), + DataAccess: []string{}, + } + expected := "&Scope{" + + "ScopeId:scope1qzxcpvj6czy5g354dews3nlruxjsahhnsp," + + "SpecificationId:scopespec1qnp9c775ccu5xeaggtmylf0uesvsqyrkq8," + + "Owners:[]Party{cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck - PARTY_TYPE_OWNER,}," + + "DataAccess:[]," + + "ValueOwnerAddress:," + + "RequirePartyRollup:false," + + "}" + var actual string + testFunc := func() { + actual = scope.String() + } + s.Require().NotPanics(testFunc, "scope.String()") + s.Assert().Equal(expected, actual, "scope.String() result") } func (s *ScopeTestSuite) TestRecordValidateBasic() { @@ -761,33 +761,103 @@ func (s *ScopeTestSuite) TestSessionValidateBasic() { } func (s *ScopeTestSuite) TestSessionString() { + scopeUUID := uuid.MustParse("382b6eed-e61e-469b-933e-e4d0210c77f6") + sessionUUID := uuid.MustParse("c120ba2a-b13d-4678-8e5a-7459d92c3e90") + sessionID := SessionMetadataAddress(scopeUUID, sessionUUID) + contractSpecUUID := uuid.MustParse("888B0DAB-61ED-4074-B9B6-0F35CDFA4F0D") + contractSpecID := ContractSpecMetadataAddress(contractSpecUUID) + + session := &Session{ + SessionId: sessionID, + SpecificationId: contractSpecID, + Parties: []Party{ + {Address: "cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck", Role: PartyType_PARTY_TYPE_AFFILIATE}, + }, + Name: "whatever", + Context: []byte("moredata"), + Audit: &AuditFields{ + CreatedDate: time.Unix(0, 0), + CreatedBy: "cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck", + UpdatedDate: time.Unix(0, 0), + Message: "message", + }, + } - scopeUUID := uuid.New() - sessionUUID := uuid.New() + expected := "&Session{" + + "SessionId:session1qyuzkmhduc0ydxun8mjdqggvwlmvzg9692cn63nc3ed8gkwe9slfq747zd8," + + "SpecificationId:contractspec1qwygkrdtv8k5qa9ekc8ntn06fuxsj02zcg," + + "Parties:[]Party{cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck - PARTY_TYPE_AFFILIATE,}," + + "Name:whatever," + + "Context:[109 111 114 101 100 97 116 97]," + + "Audit:created_date:<> created_by:\"cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck\" updated_date:<> message:\"message\" ," + + "}" + + var actual string + testFunc := func() { + actual = session.String() + } + s.Require().NotPanics(testFunc, "session.String()") + s.Assert().Equal(expected, actual, "session.String() result") +} + +func (s *ScopeTestSuite) TestRecordString() { + scopeUUID := uuid.MustParse("382b6eed-e61e-469b-933e-e4d0210c77f6") + sessionUUID := uuid.MustParse("c120ba2a-b13d-4678-8e5a-7459d92c3e90") sessionID := SessionMetadataAddress(scopeUUID, sessionUUID) - contractSpec := ContractSpecMetadataAddress(uuid.New()) - session := NewSession("name", sessionID, contractSpec, []Party{ - {Address: "cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck", Role: PartyType_PARTY_TYPE_AFFILIATE}}, - &AuditFields{CreatedBy: "cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck", - Message: "message", - }) + contractSpecUUID := uuid.MustParse("888B0DAB-61ED-4074-B9B6-0F35CDFA4F0D") + name := "something" + recSpecID := RecordSpecMetadataAddress(contractSpecUUID, name) + otherUUID := uuid.MustParse("37b553b7-c36e-4e4a-9e72-aef0b3689ce8") + + record := &Record{ + Name: name, + SessionId: sessionID, + Process: Process{ + ProcessId: &Process_Hash{Hash: "5075140835d0bc504791c76b04c33d2b"}, + Name: "runner", + Method: "UsainBolt", + }, + Inputs: []RecordInput{ + { + Name: "incoming", + Source: &RecordInput_Hash{Hash: "d48f944ac6c78b97d544f98b89b506ca"}, + TypeName: "thingy", + Status: RecordInputStatus_Record, + }, + { + Name: "notacomeback", + Source: &RecordInput_RecordId{RecordId: RecordMetadataAddress(otherUUID, "beenhere")}, + TypeName: "widget", + Status: RecordInputStatus_Proposed, + }, + }, + Outputs: []RecordOutput{ + { + Hash: "fba028e9ebb6ae55787d676995306e06", + Status: ResultStatus_RESULT_STATUS_PASS, + }, + }, + SpecificationId: recSpecID, + } - // println(session.String()) - s.T().Run("session string", func(t *testing.T) { - require.Equal(t, fmt.Sprintf(`session_id: %s -specification_id: %s -parties: -- address: cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck - role: 6 - optional: false -type: name -context: [] -audit: - created_by: cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck - message: message -`, session.SessionId.String(), session.SpecificationId.String()), - session.String()) - }) + expected := "&Record{" + + "Name:something," + + "SessionId:session1qyuzkmhduc0ydxun8mjdqggvwlmvzg9692cn63nc3ed8gkwe9slfq747zd8," + + "Process:runner - UsainBolt - {5075140835d0bc504791c76b04c33d2b}," + + "Inputs:[]RecordInput{" + + "incoming (thingy) - RECORD_INPUT_STATUS_RECORD d48f944ac6c78b97d544f98b89b506ca," + + "notacomeback (widget) - RECORD_INPUT_STATUS_PROPOSED record1qgmm25ahcdhyuj57w2h0pvmgnn5v78sxmz4r9998fpk9zhc9yzexw8p9exn," + + "}," + + "Outputs:[]RecordOutput{fba028e9ebb6ae55787d676995306e06 - RESULT_STATUS_PASS,}," + + "SpecificationId:recspec1qkygkrdtv8k5qa9ekc8ntn06fuxnljdk39ze6uu03jy28fy2483n25phf7m," + + "}" + + var actual string + testFunc := func() { + actual = record.String() + } + s.Require().NotPanics(testFunc, "record.String()") + s.Assert().Equal(expected, actual, "record.String() result") } func (s *ScopeTestSuite) TestMetadataAuditUpdate() { diff --git a/x/metadata/types/specification.pb.go b/x/metadata/types/specification.pb.go index ed8e3cbc88..501d7cabcc 100644 --- a/x/metadata/types/specification.pb.go +++ b/x/metadata/types/specification.pb.go @@ -11,6 +11,8 @@ import ( io "io" math "math" math_bits "math/bits" + reflect "reflect" + strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. @@ -139,9 +141,8 @@ type ScopeSpecification struct { ContractSpecIds []MetadataAddress `protobuf:"bytes,5,rep,name=contract_spec_ids,json=contractSpecIds,proto3,customtype=MetadataAddress" json:"contract_spec_ids"` } -func (m *ScopeSpecification) Reset() { *m = ScopeSpecification{} } -func (m *ScopeSpecification) String() string { return proto.CompactTextString(m) } -func (*ScopeSpecification) ProtoMessage() {} +func (m *ScopeSpecification) Reset() { *m = ScopeSpecification{} } +func (*ScopeSpecification) ProtoMessage() {} func (*ScopeSpecification) Descriptor() ([]byte, []int) { return fileDescriptor_1e2d1042057ea889, []int{0} } @@ -215,9 +216,8 @@ type ContractSpecification struct { ClassName string `protobuf:"bytes,7,opt,name=class_name,json=className,proto3" json:"class_name,omitempty"` } -func (m *ContractSpecification) Reset() { *m = ContractSpecification{} } -func (m *ContractSpecification) String() string { return proto.CompactTextString(m) } -func (*ContractSpecification) ProtoMessage() {} +func (m *ContractSpecification) Reset() { *m = ContractSpecification{} } +func (*ContractSpecification) ProtoMessage() {} func (*ContractSpecification) Descriptor() ([]byte, []int) { return fileDescriptor_1e2d1042057ea889, []int{1} } @@ -337,9 +337,8 @@ type RecordSpecification struct { ResponsibleParties []PartyType `protobuf:"varint,6,rep,packed,name=responsible_parties,json=responsibleParties,proto3,enum=provenance.metadata.v1.PartyType" json:"responsible_parties,omitempty"` } -func (m *RecordSpecification) Reset() { *m = RecordSpecification{} } -func (m *RecordSpecification) String() string { return proto.CompactTextString(m) } -func (*RecordSpecification) ProtoMessage() {} +func (m *RecordSpecification) Reset() { *m = RecordSpecification{} } +func (*RecordSpecification) ProtoMessage() {} func (*RecordSpecification) Descriptor() ([]byte, []int) { return fileDescriptor_1e2d1042057ea889, []int{2} } @@ -421,9 +420,8 @@ type InputSpecification struct { Source isInputSpecification_Source `protobuf_oneof:"source"` } -func (m *InputSpecification) Reset() { *m = InputSpecification{} } -func (m *InputSpecification) String() string { return proto.CompactTextString(m) } -func (*InputSpecification) ProtoMessage() {} +func (m *InputSpecification) Reset() { *m = InputSpecification{} } +func (*InputSpecification) ProtoMessage() {} func (*InputSpecification) Descriptor() ([]byte, []int) { return fileDescriptor_1e2d1042057ea889, []int{3} } @@ -594,62 +592,63 @@ func init() { } var fileDescriptor_1e2d1042057ea889 = []byte{ - // 877 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0x4f, 0x6f, 0xe2, 0xc6, - 0x1b, 0xc6, 0x40, 0x08, 0xbc, 0xfc, 0x94, 0xf8, 0x37, 0xc9, 0x66, 0x9d, 0xdd, 0x16, 0x68, 0x2a, - 0xb5, 0x28, 0x52, 0x40, 0xa1, 0xfd, 0x02, 0x06, 0x9c, 0xcd, 0x48, 0xac, 0x8d, 0xc6, 0x26, 0xd5, - 0xf6, 0x62, 0x39, 0xf6, 0x6c, 0x62, 0x2d, 0x78, 0x2c, 0x8f, 0x61, 0x9b, 0x53, 0xbf, 0x40, 0x0f, - 0xbd, 0xf6, 0x0b, 0xf4, 0xd8, 0xcf, 0xb1, 0xc7, 0x3d, 0x56, 0xad, 0x14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 0x77, 0x77, 0x0d, 0xe9, 0xfd, 0x5d, 0x43, 0xfa, - 0xed, 0xae, 0x21, 0x7d, 0x7f, 0xdf, 0x28, 0xbc, 0xbf, 0x6f, 0x14, 0x7e, 0xbe, 0x6f, 0x14, 0xe0, - 0xd0, 0x67, 0x8f, 0xdc, 0x93, 0xb1, 0xf4, 0xf5, 0x97, 0xb9, 0x7f, 0xbd, 0x25, 0xe9, 0xc4, 0x67, - 0xb9, 0xb7, 0xee, 0x37, 0xcb, 0xaf, 0xbf, 0xf8, 0x1f, 0xbc, 0xac, 0x88, 0xaf, 0xf8, 0x17, 0x7f, - 0x06, 0x00, 0x00, 0xff, 0xff, 0xd2, 0xfd, 0x6f, 0x30, 0x21, 0x08, 0x00, 0x00, + // 896 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0x93, 0x34, 0x4d, 0x5e, 0x50, 0x6b, 0xa6, 0xdd, 0xae, 0xbb, 0x0b, 0x49, 0x28, 0x12, + 0x44, 0x95, 0x9a, 0xa8, 0x81, 0x13, 0x37, 0x27, 0x71, 0xb7, 0x23, 0x65, 0xed, 0x68, 0xe2, 0x14, + 0x2d, 0x17, 0xcb, 0xb5, 0x67, 0x5b, 0x6b, 0x13, 0x8f, 0xe5, 0x71, 0xb2, 0xf4, 0x04, 0x3f, 0x80, + 0x03, 0x47, 0x8e, 0x48, 0x48, 0xfc, 0x06, 0x7e, 0xc2, 0x1e, 0xf7, 0x88, 0x10, 0xaa, 0x50, 0x2b, + 0x7e, 0x02, 0x17, 0x4e, 0xc8, 0x63, 0xb7, 0x71, 0x42, 0x8a, 0x38, 0x70, 0xe4, 0xd4, 0x99, 0xf7, + 0x7d, 0xef, 0xcd, 0x7b, 0xdf, 0x37, 0xe3, 0x06, 0x0e, 0x83, 0x90, 0xcd, 0xa9, 0x6f, 0xf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, 0xb6, 0x96, 0x7b, 0x7b, 0x5b, 0xcb, 0xfd, 0x7c, + 0x5b, 0xcb, 0xc1, 0xbe, 0xc7, 0x1e, 0x78, 0x3b, 0x43, 0xe9, 0x8b, 0x4f, 0x33, 0xdf, 0xc4, 0x05, + 0xe9, 0xc8, 0x63, 0x99, 0x5d, 0xfb, 0xcb, 0xc5, 0xaf, 0x04, 0xf1, 0x95, 0x3c, 0x2f, 0x89, 0xff, + 0xf6, 0x9f, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0xf1, 0xe1, 0xcd, 0x6d, 0x49, 0x08, 0x00, 0x00, } func (m *ScopeSpecification) Marshal() (dAtA []byte, err error) { @@ -1278,6 +1277,115 @@ func sovSpecification(x uint64) (n int) { func sozSpecification(x uint64) (n int) { return sovSpecification(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (this *ScopeSpecification) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ScopeSpecification{`, + `SpecificationId:` + fmt.Sprintf("%v", this.SpecificationId) + `,`, + `Description:` + strings.Replace(fmt.Sprintf("%v", this.Description), "Description", "Description", 1) + `,`, + `OwnerAddresses:` + fmt.Sprintf("%v", this.OwnerAddresses) + `,`, + `PartiesInvolved:` + fmt.Sprintf("%v", this.PartiesInvolved) + `,`, + `ContractSpecIds:` + fmt.Sprintf("%v", this.ContractSpecIds) + `,`, + `}`, + }, "") + return s +} +func (this *ContractSpecification) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContractSpecification{`, + `SpecificationId:` + fmt.Sprintf("%v", this.SpecificationId) + `,`, + `Description:` + strings.Replace(fmt.Sprintf("%v", this.Description), "Description", "Description", 1) + `,`, + `OwnerAddresses:` + fmt.Sprintf("%v", this.OwnerAddresses) + `,`, + `PartiesInvolved:` + fmt.Sprintf("%v", this.PartiesInvolved) + `,`, + `Source:` + fmt.Sprintf("%v", this.Source) + `,`, + `ClassName:` + fmt.Sprintf("%v", this.ClassName) + `,`, + `}`, + }, "") + return s +} +func (this *ContractSpecification_ResourceId) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContractSpecification_ResourceId{`, + `ResourceId:` + fmt.Sprintf("%v", this.ResourceId) + `,`, + `}`, + }, "") + return s +} +func (this *ContractSpecification_Hash) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContractSpecification_Hash{`, + `Hash:` + fmt.Sprintf("%v", this.Hash) + `,`, + `}`, + }, "") + return s +} +func (this *RecordSpecification) String() string { + if this == nil { + return "nil" + } + repeatedStringForInputs := "[]*InputSpecification{" + for _, f := range this.Inputs { + repeatedStringForInputs += strings.Replace(f.String(), "InputSpecification", "InputSpecification", 1) + "," + } + repeatedStringForInputs += "}" + s := strings.Join([]string{`&RecordSpecification{`, + `SpecificationId:` + fmt.Sprintf("%v", this.SpecificationId) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Inputs:` + repeatedStringForInputs + `,`, + `TypeName:` + fmt.Sprintf("%v", this.TypeName) + `,`, + `ResultType:` + fmt.Sprintf("%v", this.ResultType) + `,`, + `ResponsibleParties:` + fmt.Sprintf("%v", this.ResponsibleParties) + `,`, + `}`, + }, "") + return s +} +func (this *InputSpecification) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&InputSpecification{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `TypeName:` + fmt.Sprintf("%v", this.TypeName) + `,`, + `Source:` + fmt.Sprintf("%v", this.Source) + `,`, + `}`, + }, "") + return s +} +func (this *InputSpecification_RecordId) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&InputSpecification_RecordId{`, + `RecordId:` + fmt.Sprintf("%v", this.RecordId) + `,`, + `}`, + }, "") + return s +} +func (this *InputSpecification_Hash) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&InputSpecification_Hash{`, + `Hash:` + fmt.Sprintf("%v", this.Hash) + `,`, + `}`, + }, "") + return s +} +func valueToStringSpecification(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} func (m *ScopeSpecification) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/metadata/types/specification_test.go b/x/metadata/types/specification_test.go index 3894868362..49936b6100 100644 --- a/x/metadata/types/specification_test.go +++ b/x/metadata/types/specification_test.go @@ -1148,22 +1148,24 @@ func (s *SpecificationTestSuite) TestScopeSpecString() { []PartyType{PartyType_PARTY_TYPE_OWNER}, []MetadataAddress{ContractSpecMetadataAddress(contractSpecUuid)}, ) - expected := `specification_id: scopespec1qnpqwjsrdak5q2dlutp6t6m7dzcscd7ff6 -description: - name: TestScopeSpecString Description - description: This is a description of a description used in a unit test. - website_url: https://figure.com/ - icon_url: https://figure.com/favicon.png -owner_addresses: -- cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck -parties_involved: -- 5 -contract_spec_ids: -- contractspec1qd2qmt038k7yc0azq46htdlhgwzqg6cr9l -` - actual := scopeSpec.String() - // fmt.Printf("Actual:\n%s\n-----\n", actual) - require.Equal(s.T(), expected, actual) + expected := "&ScopeSpecification{" + + "SpecificationId:scopespec1qnpqwjsrdak5q2dlutp6t6m7dzcscd7ff6," + + "Description:" + + "name:\"TestScopeSpecString Description\" " + + "description:\"This is a description of a description used in a unit test.\" " + + "website_url:\"https://figure.com/\" " + + "icon_url:\"https://figure.com/favicon.png\" ," + + "OwnerAddresses:[cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck]," + + "PartiesInvolved:[PARTY_TYPE_OWNER]," + + "ContractSpecIds:[contractspec1qd2qmt038k7yc0azq46htdlhgwzqg6cr9l]," + + "}" + + var actual string + testFunc := func() { + actual = scopeSpec.String() + } + s.Require().NotPanics(testFunc, "scopeSpec.String()") + s.Assert().Equal(expected, actual, "scopeSpec.String() result") } func (s *SpecificationTestSuite) TestContractSpecString() { @@ -1181,22 +1183,25 @@ func (s *SpecificationTestSuite) TestContractSpecString() { nil, "CS 201: Intro to Blockchain", ) - expected := `specification_id: contractspec1qd2qmt038k7yc0azq46htdlhgwzqg6cr9l -description: - name: TestContractSpecString Description - description: This is a description of a description used in a unit test. - website_url: https://figure.com/ - icon_url: https://figure.com/favicon.png -owner_addresses: -- cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck -parties_involved: -- 5 -source: null -class_name: 'CS 201: Intro to Blockchain' -` - actual := contractSpec.String() - // fmt.Printf("Actual:\n%s\n-----\n", actual) - require.Equal(s.T(), expected, actual) + + expected := "&ContractSpecification{" + + "SpecificationId:contractspec1qd2qmt038k7yc0azq46htdlhgwzqg6cr9l," + + "Description:" + + "name:\"TestContractSpecString Description\" " + + "description:\"This is a description of a description used in a unit test.\" " + + "website_url:\"https://figure.com/\" " + + "icon_url:\"https://figure.com/favicon.png\" ," + + "OwnerAddresses:[cosmos1sh49f6ze3vn7cdl2amh2gnc70z5mten3y08xck]," + + "PartiesInvolved:[PARTY_TYPE_OWNER]," + + "Source:," + + "ClassName:CS 201: Intro to Blockchain," + + "}" + var actual string + testFunc := func() { + actual = contractSpec.String() + } + s.Require().NotPanics(testFunc, "contractSpec.String()") + s.Assert().Equal(expected, actual, "contractSpec.String() result") } func (s *SpecificationTestSuite) TestRecordSpecString() { @@ -1224,39 +1229,35 @@ func (s *SpecificationTestSuite) TestRecordSpecString() { DefinitionType_DEFINITION_TYPE_RECORD, []PartyType{PartyType_PARTY_TYPE_CUSTODIAN, PartyType_PARTY_TYPE_INVESTOR}, ) - expected := `specification_id: recspec1q42qmt038k7yc0azq46htdlhgwzg5052mucgmerfku3gf5e7t3ej5fjh7rr -name: somename -inputs: -- name: inputSpecName1 - type_name: inputSpecTypeName1 - source: - hash: inputSpecSourceHash1 -- name: inputSpecName2 - type_name: inputSpecTypeName2 - source: - record_id: record1qgtcftnewlc5y892l8k2fhteu4ceth857yw3fprr4lvhfptn5gg4cv4ure3 -type_name: sometype -result_type: 2 -responsible_parties: -- 4 -- 3 -` - actual := recordSpec.String() - // fmt.Printf("Actual:\n%s\n-----\n", actual) - require.Equal(s.T(), expected, actual) + expected := "&RecordSpecification{" + + "SpecificationId:recspec1q42qmt038k7yc0azq46htdlhgwzg5052mucgmerfku3gf5e7t3ej5fjh7rr," + + "Name:somename," + + "Inputs:[]*InputSpecification{" + + "&InputSpecification{Name:inputSpecName1,TypeName:inputSpecTypeName1,Source:&InputSpecification_Hash{Hash:inputSpecSourceHash1,},}," + + "&InputSpecification{Name:inputSpecName2,TypeName:inputSpecTypeName2,Source:&InputSpecification_RecordId{RecordId:record1qgtcftnewlc5y892l8k2fhteu4ceth857yw3fprr4lvhfptn5gg4cv4ure3,},}," + + "}," + + "TypeName:sometype," + + "ResultType:DEFINITION_TYPE_RECORD," + + "ResponsibleParties:[PARTY_TYPE_CUSTODIAN PARTY_TYPE_INVESTOR]," + + "}" + + var actual string + testFunc := func() { + actual = recordSpec.String() + } + s.Require().NotPanics(testFunc, "recordSpec.String()") + s.Assert().Equal(expected, actual, "recordSpec.String() result") } func (s *SpecificationTestSuite) TestInputSpecString() { tests := []struct { - name string - outputActual bool - spec *InputSpecification - expected string + name string + spec *InputSpecification + expected string }{ { - "source is record id", - false, - NewInputSpecification( + name: "source is record id", + spec: NewInputSpecification( "inputSpecRecordIdSource", "inputSpecRecordIdSourceTypeName", NewInputSpecificationSourceRecordID(RecordMetadataAddress( @@ -1264,36 +1265,35 @@ func (s *SpecificationTestSuite) TestInputSpecString() { "inputSpecRecordIdSource", )), ), - `name: inputSpecRecordIdSource -type_name: inputSpecRecordIdSourceTypeName -source: - record_id: record1qgtcftnewlc5y892l8k2fhteu4ceth857yw3fprr4lvhfptn5gg4cv4ure3 -`, + expected: "&InputSpecification{" + + "Name:inputSpecRecordIdSource," + + "TypeName:inputSpecRecordIdSourceTypeName," + + "Source:&InputSpecification_RecordId{RecordId:record1qgtcftnewlc5y892l8k2fhteu4ceth857yw3fprr4lvhfptn5gg4cv4ure3,}," + + "}", }, { - "source is hash", - false, - NewInputSpecification( + name: "source is hash", + spec: NewInputSpecification( "inputSpecHashSource", "inputSpecHashSourceTypeName", NewInputSpecificationSourceHash("somehash"), ), - `name: inputSpecHashSource -type_name: inputSpecHashSourceTypeName -source: - hash: somehash -`, + expected: "&InputSpecification{" + + "Name:inputSpecHashSource," + + "TypeName:inputSpecHashSourceTypeName," + + "Source:&InputSpecification_Hash{Hash:somehash,}," + + "}", }, } - for _, tt := range tests { - tt := tt - s.T().Run(tt.name, func(t *testing.T) { - actual := tt.spec.String() - if tt.outputActual { - fmt.Printf("Actual [%s]:\n%s\n-----\n", tt.name, actual) + for _, tc := range tests { + s.Run(tc.name, func() { + var actual string + testFunc := func() { + actual = tc.spec.String() } - require.Equal(t, tt.expected, actual) + s.Require().NotPanics(testFunc, "inputSpec.String()") + s.Assert().Equal(tc.expected, actual, "inputSpec.String() result") }) } } @@ -1305,12 +1305,15 @@ func (s *SpecificationTestSuite) TestDescriptionString() { "https://provenance.io", "https://provenance.io/ico.png", ) - expected := `name: TestDescriptionString -description: This is a description of a description used in a unit test. -website_url: https://provenance.io -icon_url: https://provenance.io/ico.png -` - actual := description.String() - // fmt.Printf("Actual:\n%s\n-----\n", actual) - require.Equal(s.T(), expected, actual) + expected := "name:\"TestDescriptionString\" " + + "description:\"This is a description of a description used in a unit test.\" " + + "website_url:\"https://provenance.io\" " + + "icon_url:\"https://provenance.io/ico.png\" " + + var actual string + testFunc := func() { + actual = description.String() + } + s.Require().NotPanics(testFunc, "description.String()") + s.Assert().Equal(expected, actual, "description.String() result") }