diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go index 72e0af82..1039f25d 100644 --- a/ethereum/eip712/eip712.go +++ b/ethereum/eip712/eip712.go @@ -2,6 +2,7 @@ package eip712 import ( "bytes" + "encoding/base64" "encoding/json" "fmt" "math/big" @@ -9,17 +10,15 @@ import ( "strings" "time" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + errortypes "github.com/cosmos/cosmos-sdk/types/errors" "golang.org/x/text/cases" "golang.org/x/text/language" - errorsmod "cosmossdk.io/errors" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - errortypes "github.com/cosmos/cosmos-sdk/types/errors" - - registry "github.com/cerc-io/laconicd/x/registry/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/signer/core/apitypes" @@ -34,24 +33,6 @@ func WrapTxToTypedData( data []byte, feeDelegation *FeeDelegationOptions, ) (apitypes.TypedData, error) { - txData := make(map[string]interface{}) - - if err := json.Unmarshal(data, &txData); err != nil { - return apitypes.TypedData{}, errorsmod.Wrap(errortypes.ErrJSONUnmarshal, "failed to JSON unmarshal data") - } - - if txData["msgs"].([]interface{})[0].(map[string]interface{})["value"].(map[string]interface{})["payload"] != nil { - setRecordMsg := msg.(*registry.MsgSetRecord) - var attr []interface{} - for _, b := range setRecordMsg.Payload.Record.Attributes.Value { - attr = append(attr, fmt.Sprintf("%v", b)) - } - - txData["msgs"].([]interface{})[0].(map[string]interface{})["value"].(map[string]interface{})["payload"].(map[string]interface{})["record"].(map[string]interface{})["attributes"] = map[string]interface{}{ //nolint:lll - "type_url": setRecordMsg.Payload.Record.Attributes.TypeUrl, - "value": attr, - } - } domain := apitypes.TypedDataDomain{ Name: "Cosmos Web3", @@ -66,22 +47,13 @@ func WrapTxToTypedData( return apitypes.TypedData{}, err } - if msgTypes["TypePayloadRecord"] != nil { - msgTypes["TypePayloadRecord"] = []apitypes.Type{ - {Name: "id", Type: "string"}, - {Name: "bond_id", Type: "string"}, - {Name: "create_time", Type: "string"}, - {Name: "expiry_time", Type: "string"}, - {Name: "deleted", Type: "bool"}, - {Name: "attributes", Type: "TypePayloadRecordAttributes"}, - } + txData := make(map[string]interface{}) + if err := json.Unmarshal(data, &txData); err != nil { + return apitypes.TypedData{}, errorsmod.Wrap(errortypes.ErrJSONUnmarshal, "failed to JSON unmarshal data") } - if msgTypes["TypePayloadRecordAttributes"] != nil { - msgTypes["TypePayloadRecordAttributes"] = []apitypes.Type{ - {Name: "type_url", Type: "string"}, - {Name: "value", Type: "uint8[]"}, - } - delete(msgTypes, "TypePayloadRecordAttributesValue") + + if err := patchTxData(txData, msgTypes, "Tx"); err != nil { + return apitypes.TypedData{}, errorsmod.Wrap(errortypes.ErrJSONUnmarshal, "failed to patch JSON data") } if feeDelegation != nil { @@ -320,10 +292,15 @@ func traverseFields( ethTyp := typToEth(fieldType) if len(ethTyp) > 0 { // Support array of uint64 - if isCollection && fieldType.Kind() != reflect.Slice && fieldType.Kind() != reflect.Array { - ethTyp += "[]" + if isCollection { + if fieldType.Kind() != reflect.Slice && fieldType.Kind() != reflect.Array { + ethTyp += "[]" + } + // convert uint8[] to bytes + if fieldType.Kind() == reflect.Uint8 { + ethTyp = "bytes" + } } - if prefix == typeDefPrefix { typeMap[rootType] = append(typeMap[rootType], apitypes.Type{ Name: fieldName, @@ -466,14 +443,13 @@ func typToEth(typ reflect.Type) string { return "uint32" case reflect.Uint64: return "uint64" - case reflect.Slice: - ethName := typToEth(typ.Elem()) - if len(ethName) > 0 { - return ethName + "[]" - } - case reflect.Array: + case reflect.Slice | reflect.Array: + // Note: this case may never be reached due to previous handling in traverseFields ethName := typToEth(typ.Elem()) if len(ethName) > 0 { + if ethName == "uint8" { + return "bytes" + } return ethName + "[]" } case reflect.Ptr: @@ -510,3 +486,77 @@ func doRecover(err *error) { *err = fmt.Errorf("%v", r) } } + +// Performs extra type conversions on JSON-decoded data accoding to the provided type definitions +// for compatibility with Geth's encoding +func patchTxData(data map[string]any, schema apitypes.Types, rootType string) error { + // Scan the data for any types that need to be converted. + // This is adapted from TypedData.EncodeData + for _, field := range schema[rootType] { + encType := field.Type + encValue := data[field.Name] + if encType[len(encType)-1:] == "]" { + arrayValue, ok := encValue.([]interface{}) + if !ok { + return dataMismatchError(encType, encValue) + } + + parsedType := strings.Split(encType, "[")[0] + if schema[parsedType] != nil { + for _, item := range arrayValue { + mapValue, ok := item.(map[string]interface{}) + if !ok { + return dataMismatchError(parsedType, item) + } + + err := patchTxData(mapValue, schema, parsedType) + if err != nil { + return err + } + } + } else { + for i, item := range arrayValue { + converted, err := handleConversion(parsedType, item) + if err != nil { + return err + } + arrayValue[i] = converted + } + } + + } else if schema[encType] != nil { + mapValue, ok := encValue.(map[string]interface{}) + if !ok { + return dataMismatchError(encType, encValue) + } + err := patchTxData(mapValue, schema, encType) + if err != nil { + return err + } + } else { + converted, err := handleConversion(encType, encValue) + if err != nil { + return err + } + data[field.Name] = converted + } + } + return nil +} + +func handleConversion(encType string, encValue any) (any, error) { + switch encType { + case "bytes": + // Protobuf encodes byte strings in base64 + if v, ok := encValue.(string); ok { + return base64.StdEncoding.DecodeString(v) + } + } + return encValue, nil +} + +// dataMismatchError generates an error for a mismatch between +// the provided type and data +func dataMismatchError(encType string, encValue any) error { + return fmt.Errorf("provided data '%v' doesn't match type '%s'", encValue, encType) +} diff --git a/ethereum/eip712/eip712_test.go b/ethereum/eip712/eip712_test.go index 9c1864d6..d51b8993 100644 --- a/ethereum/eip712/eip712_test.go +++ b/ethereum/eip712/eip712_test.go @@ -4,28 +4,25 @@ import ( "testing" "cosmossdk.io/math" - - "github.com/cerc-io/laconicd/ethereum/eip712" + registrytypes "github.com/cerc-io/laconicd/x/registry/types" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/ethereum/go-ethereum/crypto" - - "github.com/cerc-io/laconicd/crypto/ethsecp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cerc-io/laconicd/app" - "github.com/cerc-io/laconicd/encoding" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" - + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/suite" + + "github.com/cerc-io/laconicd/app" + "github.com/cerc-io/laconicd/crypto/ethsecp256k1" + "github.com/cerc-io/laconicd/encoding" + "github.com/cerc-io/laconicd/ethereum/eip712" ) // Unit tests for single-signer EIP-712 signature verification. Multi-signer verification tests are included @@ -332,6 +329,54 @@ func (suite *EIP712TestSuite) TestEIP712SignatureVerification() { sequence: 78, expectSuccess: false, }, + + // test laconic registry messages + { + title: "Succeeds - Standard MsgSetName", + fee: txtypes.Fee{ + Amount: suite.makeCoins("aphoton", math.NewInt(2000)), + GasLimit: 100000, + }, + memo: "", + msgs: []sdk.Msg{ + registrytypes.NewMsgSetName( + "testcrn", + "testcid", + suite.createTestAddress(), + ), + }, + accountNumber: 25, + sequence: 78, + expectSuccess: true, + }, + { + title: "Succeeds - Standard MsgSetRecord", + fee: txtypes.Fee{ + Amount: suite.makeCoins("aphoton", math.NewInt(2000)), + GasLimit: 100000, + }, + memo: "", + msgs: []sdk.Msg{ + registrytypes.NewMsgSetRecord( + registrytypes.Payload{ + Record: ®istrytypes.Record{ + Attributes: []byte("test attributes"), + }, + Signatures: []registrytypes.Signature{ + { + Sig: "fake sig", + PubKey: "fake pubkey", + }, + }, + }, + "testbondid", + suite.createTestAddress(), + ), + }, + accountNumber: 25, + sequence: 78, + expectSuccess: true, + }, } for _, tc := range testCases { diff --git a/gql/util.go b/gql/util.go index 935b293f..a6adabcb 100644 --- a/gql/util.go +++ b/gql/util.go @@ -61,7 +61,7 @@ func getGQLRecord(ctx context.Context, resolver QueryResolver, record registryty return nil, nil } - recordType := record.ToRecordType() + recordType := record.ToReadableRecord() attributes, err := getAttributes(&recordType) if err != nil { return nil, err @@ -163,7 +163,7 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au return &gqlAuction, nil } -func getReferences(ctx context.Context, resolver QueryResolver, r *registrytypes.RecordType) ([]*Record, error) { +func getReferences(ctx context.Context, resolver QueryResolver, r *registrytypes.RecordEncodable) ([]*Record, error) { var ids []string // #nosec G705 @@ -184,7 +184,7 @@ func getReferences(ctx context.Context, resolver QueryResolver, r *registrytypes return resolver.GetRecordsByIds(ctx, ids) } -func getAttributes(r *registrytypes.RecordType) ([]*KeyValue, error) { +func getAttributes(r *registrytypes.RecordEncodable) ([]*KeyValue, error) { return mapToKeyValuePairs(r.Attributes) } diff --git a/proto/vulcanize/registry/v1beta1/attributes.proto b/proto/vulcanize/registry/v1beta1/attributes.proto deleted file mode 100644 index c5d27020..00000000 --- a/proto/vulcanize/registry/v1beta1/attributes.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; -package vulcanize.registry.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/cerc-io/laconicd/x/registry/types"; - -message ServiceProviderRegistration { - string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; - string laconic_id = 2 [(gogoproto.moretags) = "json:\"laconicId\" yaml:\"laconicId\""]; - X500 x500 = 3 [(gogoproto.moretags) = "json:\"x500\" yaml:\"x500\""]; - string type = 4 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; - string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; -} - -message X500 { - string common_name = 1 [(gogoproto.moretags) = "json:\"commonName\" yaml:\"commonName\""]; - string organization_unit = 2 [(gogoproto.moretags) = "json:\"organizationUnit\" yaml:\"organizationUnit\""]; - string organization_name = 3 [(gogoproto.moretags) = "json:\"organizationName\" yaml:\"organizationName\""]; - string locality_name = 4 [(gogoproto.moretags) = "json:\"localityName\" yaml:\"localityName\""]; - string state_name = 5 [(gogoproto.moretags) = "json:\"stateName\" yaml:\"stateName\""]; - string country = 6 [(gogoproto.moretags) = "json:\"country\" yaml:\"country\""]; -} - -message WebsiteRegistrationRecord { - string url = 1 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""]; - string repo_registration_record_cid = 2 - [(gogoproto.moretags) = "json:\"repoRegistrationRecordCID\" yaml:\"repoRegistrationRecordCID\""]; - string build_artifact_cid = 3 [(gogoproto.moretags) = "json:\"buildArtifactCID\" yaml:\"buildArtifactCID\""]; - string tls_cert_cid = 4 [(gogoproto.moretags) = "json:\"TLSCertCID\" yaml:\"TLSCertCID\""]; - string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; - string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; -} \ No newline at end of file diff --git a/proto/vulcanize/registry/v1beta1/registry.proto b/proto/vulcanize/registry/v1beta1/registry.proto index 2c0e2804..b2c340f2 100644 --- a/proto/vulcanize/registry/v1beta1/registry.proto +++ b/proto/vulcanize/registry/v1beta1/registry.proto @@ -64,7 +64,7 @@ message Record { string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""]; bool deleted = 5; repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""]; - google.protobuf.Any attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""]; + bytes attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""]; repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""]; string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""]; } diff --git a/proto/vulcanize/registry/v1beta1/tx.proto b/proto/vulcanize/registry/v1beta1/tx.proto index a67769dc..de300434 100644 --- a/proto/vulcanize/registry/v1beta1/tx.proto +++ b/proto/vulcanize/registry/v1beta1/tx.proto @@ -7,13 +7,13 @@ import "vulcanize/registry/v1beta1/registry.proto"; option go_package = "github.com/cerc-io/laconicd/x/registry/types"; -// Msg +// Msg is a service which exposes the registry functionality service Msg { - // SetRecord will records a new record with given payload and bond id + // SetRecord records a new record with given payload and bond id rpc SetRecord(MsgSetRecord) returns (MsgSetRecordResponse) { option (google.api.http).post = "/vulcanize/registry/v1beta1/set_record"; } - // Renew Record will renew the expire record + // Renew Record renews an expired record rpc RenewRecord(MsgRenewRecord) returns (MsgRenewRecordResponse) { option (google.api.http).post = "/vulcanize/registry/v1beta1/renew_record"; } @@ -66,8 +66,10 @@ message MsgSetRecordResponse { // Payload message Payload { Record record = 1; - repeated Signature signatures = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\""]; + repeated Signature signatures = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\"" + ]; } // MsgSetName @@ -91,7 +93,7 @@ message MsgReserveAuthority { // MsgReserveNameResponse message MsgReserveAuthorityResponse {} -// MsgSetAuthorityBond is SDK message for SetAuthorityBond +// MsgSetAuthorityBond message MsgSetAuthorityBond { string name = 1; string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; @@ -101,7 +103,7 @@ message MsgSetAuthorityBond { // MsgSetAuthorityBondResponse message MsgSetAuthorityBondResponse {} -// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority +// MsgDeleteNameAuthority message MsgDeleteNameAuthority { string crn = 1; string signer = 2; @@ -110,7 +112,7 @@ message MsgDeleteNameAuthority { // MsgDeleteNameAuthorityResponse message MsgDeleteNameAuthorityResponse {} -// MsgRenewRecord is SDK message for Renew a record +// MsgRenewRecord message MsgRenewRecord { string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""]; string signer = 2; @@ -129,30 +131,30 @@ message MsgAssociateBond { // MsgAssociateBondResponse message MsgAssociateBondResponse {} -// MsgDissociateBond is SDK message for Msg/DissociateBond +// MsgDissociateBond message MsgDissociateBond { string record_id = 1 [(gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""]; string signer = 2; } -// MsgDissociateBondResponse is response type for MsgDissociateBond +// MsgDissociateBondResponse message MsgDissociateBondResponse {} -// MsgDissociateRecords is SDK message for Msg/DissociateRecords +// MsgDissociateRecords message MsgDissociateRecords { string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""]; string signer = 2; } -// MsgDissociateRecordsResponse is response type for MsgDissociateRecords +// MsgDissociateRecordsResponse message MsgDissociateRecordsResponse {} -// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords +// MsgReAssociateRecords message MsgReAssociateRecords { string new_bond_id = 1 [(gogoproto.moretags) = "json:\"newBondId\" yaml:\"newBondId\""]; string old_bond_id = 2 [(gogoproto.moretags) = "json:\"oldBondId\" yaml:\"oldBondId\""]; string signer = 3; } -// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords +// MsgReAssociateRecordsResponse message MsgReAssociateRecordsResponse {} diff --git a/x/registry/client/cli/query.go b/x/registry/client/cli/query.go index cd7358da..462940a6 100644 --- a/x/registry/client/cli/query.go +++ b/x/registry/client/cli/query.go @@ -161,9 +161,9 @@ $ %s query %s list } recordsList := res.GetRecords() - records := make([]types.RecordType, len(recordsList)) + records := make([]types.RecordEncodable, len(recordsList)) for i, record := range res.GetRecords() { - records[i] = record.ToRecordType() + records[i] = record.ToReadableRecord() } bytesResult, err := json.Marshal(records) if err != nil { diff --git a/x/registry/client/cli/tx.go b/x/registry/client/cli/tx.go index 1d228136..477fe643 100644 --- a/x/registry/client/cli/tx.go +++ b/x/registry/client/cli/tx.go @@ -66,17 +66,10 @@ $ %s tx %s set [payload file path] [bond-id] return err } - payload, err := payloadType.ToPayload() - if err != nil { - return err - } + payload := payloadType.ToPayload() msg := types.NewMsgSetRecord(payload, args[1], clientCtx.GetFromAddress()) - err = msg.ValidateBasic() - if err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -269,7 +262,7 @@ $ %s tx %s set-name [crn] [cid] if err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -377,8 +370,8 @@ $ %s tx %s delete-name [crn] } // GetPayloadFromFile Load payload object from YAML file. -func GetPayloadFromFile(filePath string) (*types.PayloadType, error) { - var payload types.PayloadType +func GetPayloadFromFile(filePath string) (*types.PayloadEncodable, error) { + var payload types.PayloadEncodable data, err := os.ReadFile(filePath) // #nosec G304 if err != nil { diff --git a/x/registry/client/testutil/grpc.go b/x/registry/client/testutil/grpc.go index 143dab90..835927fe 100644 --- a/x/registry/client/testutil/grpc.go +++ b/x/registry/client/testutil/grpc.go @@ -433,7 +433,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryGetRecordByID() { } out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, args) sr.NoError(err) - var records []nstypes.RecordType + var records []nstypes.RecordEncodable err = json.Unmarshal(out.Bytes(), &records) sr.NoError(err) return records[0].ID diff --git a/x/registry/client/testutil/query.go b/x/registry/client/testutil/query.go index f2b09b89..9aaeab18 100644 --- a/x/registry/client/testutil/query.go +++ b/x/registry/client/testutil/query.go @@ -114,7 +114,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryForRecords() { sr.Error(err) } else { sr.NoError(err) - var records []types.RecordType + var records []types.RecordEncodable err := json.Unmarshal(out.Bytes(), &records) sr.NoError(err) sr.Equal(tc.noOfRecords, len(records)) diff --git a/x/registry/client/testutil/tx.go b/x/registry/client/testutil/tx.go index 4da1bdc2..b85634ab 100644 --- a/x/registry/client/testutil/tx.go +++ b/x/registry/client/testutil/tx.go @@ -606,7 +606,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() { cmd = cli.GetCmdList() out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) sr.NoError(err) - var records []nstypes.RecordType + var records []nstypes.RecordEncodable err = json.Unmarshal(out.Bytes(), &records) sr.NoError(err) return records[0].ID @@ -848,7 +848,7 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() { cmd = cli.GetCmdList() out, err = clitestutil.ExecTestCLICmd(clientCtx, cmd, args) sr.NoError(err) - var records []nstypes.RecordType + var records []nstypes.RecordEncodable err = json.Unmarshal(out.Bytes(), &records) sr.NoError(err) diff --git a/x/registry/keeper/grpc_query_test.go b/x/registry/keeper/grpc_query_test.go index 4e580432..bbc1038d 100644 --- a/x/registry/keeper/grpc_query_test.go +++ b/x/registry/keeper/grpc_query_test.go @@ -106,8 +106,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { sr.NoError(err) payloadType, err := cli.GetPayloadFromFile(fmt.Sprint(dir, example)) sr.NoError(err) - payload, err := payloadType.ToPayload() - sr.NoError(err) + payload := payloadType.ToPayload() record, err := suite.app.RegistryKeeper.ProcessSetRecord(ctx, registrytypes.MsgSetRecord{ BondId: suite.bond.GetId(), Signer: suite.accounts[0].String(), @@ -129,9 +128,7 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() { sr.Equal(resp.GetRecords()[0].GetBondId(), suite.bond.GetId()) for _, record := range resp.GetRecords() { - bz, err := registrytypes.GetJSONBytesFromAny(*record.Attributes) - sr.NoError(err) - recAttr := helpers.UnMarshalMapFromJSONBytes(bz) + recAttr := helpers.UnMarshalMapFromJSONBytes(record.Attributes) for _, attr := range test.req.GetAttributes() { if attr.Key[:4] == "x500" { sr.Equal(keeper.GetAttributeValue(attr.Value), recAttr["x500"].(map[string]interface{})[attr.Key[4:]]) @@ -258,8 +255,7 @@ func (suite *KeeperTestSuite) TestGrpcQueryRegistryModuleBalance() { for _, example := range examples { payloadType, err := cli.GetPayloadFromFile(fmt.Sprint(dir, example)) sr.NoError(err) - payload, err := payloadType.ToPayload() - sr.NoError(err) + payload := payloadType.ToPayload() record, err := suite.app.RegistryKeeper.ProcessSetRecord(ctx, registrytypes.MsgSetRecord{ BondId: suite.bond.GetId(), Signer: suite.accounts[0].String(), diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index d44b13df..36d09a77 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -112,7 +112,8 @@ func (k Keeper) GetRecord(ctx sdk.Context, id string) (record types.Record) { store := ctx.KVStore(k.storeKey) result := store.Get(GetRecordIndexKey(id)) k.cdc.MustUnmarshal(result, &record) - return recordObjToRecord(store, record) + decodeRecordNames(store, &record) + return record } // ListRecords - get all records. @@ -125,15 +126,17 @@ func (k Keeper) ListRecords(ctx sdk.Context) []types.Record { for ; itr.Valid(); itr.Next() { bz := store.Get(itr.Key()) if bz != nil { - var obj types.Record - k.cdc.MustUnmarshal(bz, &obj) - records = append(records, recordObjToRecord(store, obj)) + var record types.Record + k.cdc.MustUnmarshal(bz, &record) + decodeRecordNames(store, &record) + records = append(records, record) } } return records } +// RecordsFromAttributes gets a list of records whose attributes match all provided values func (k Keeper) RecordsFromAttributes(ctx sdk.Context, attributes []*types.QueryListRecordsRequest_KeyValueInput, all bool) ([]types.Record, error) { resultRecordIds := []string{} for i, attr := range attributes { @@ -157,11 +160,11 @@ func (k Keeper) RecordsFromAttributes(ctx sdk.Context, attributes []*types.Query continue } store := ctx.KVStore(k.storeKey) - recordWithNames := recordObjToRecord(store, record) - if !all && len(recordWithNames.Names) == 0 { + decodeRecordNames(store, &record) + if !all && len(record.Names) == 0 { continue } - records = append(records, recordWithNames) + records = append(records, record) } return records, nil } @@ -233,9 +236,9 @@ func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord } // ProcessSetRecord creates a record. -func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.RecordType, error) { +func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.RecordEncodable, error) { payload := msg.Payload.ToReadablePayload() - record := types.RecordType{Attributes: payload.Record, BondID: msg.BondId} + record := types.RecordEncodable{Attributes: payload.Record, BondID: msg.BondId} // Check signatures. resourceSignBytes, _ := record.GetSignBytes() @@ -276,11 +279,13 @@ func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*type return &record, nil } -func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenewal bool) error { +func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordEncodable, isRenewal bool) error { params := k.GetParams(ctx) rent := params.RecordRent - err := k.bondKeeper.TransferCoinsToModuleAccount(ctx, record.BondID, types.RecordRentModuleAccountName, sdk.NewCoins(rent)) + err := k.bondKeeper.TransferCoinsToModuleAccount( + ctx, record.BondID, types.RecordRentModuleAccountName, sdk.NewCoins(rent), + ) if err != nil { return err } @@ -295,7 +300,15 @@ func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenew } k.PutRecord(ctx, recordObj) - if err := k.ProcessAttributes(ctx, *record); err != nil { + // TODO process type here + // recordType, ok := record.Attributes["type"].(string) + + if err := k.processAttributes(ctx, record.Attributes, record.ID, ""); err != nil { + return err + } + + expiryTimeKey := GetAttributesIndexKey(ExpiryTimeAttributeName, record.ExpiryTime) + if err := k.SetAttributeMapping(ctx, expiryTimeKey, record.ID); err != nil { return err } @@ -316,47 +329,17 @@ func (k Keeper) PutRecord(ctx sdk.Context, record types.Record) { k.updateBlockChangeSetForRecord(ctx, record.Id) } -func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) error { - switch record.Attributes["type"] { - case "ServiceProviderRegistration": - { - // #nosec G705 - for key := range record.Attributes { - if key == "x500" { - // #nosec G705 - for x500Key, x500Val := range record.Attributes[key].(map[string]interface{}) { - indexKey := GetAttributesIndexKey(fmt.Sprintf("x500%s", x500Key), x500Val) - if err := k.SetAttributeMapping(ctx, indexKey, record.ID); err != nil { - return err - } - } - } else { - indexKey := GetAttributesIndexKey(key, record.Attributes[key]) - if err := k.SetAttributeMapping(ctx, indexKey, record.ID); err != nil { - return err - } - } +func (k Keeper) processAttributes(ctx sdk.Context, attrs map[string]any, id string, prefix string) error { + for key, value := range attrs { + if subRecord, ok := value.(map[string]any); ok { + k.processAttributes(ctx, subRecord, id, key) + } else { + indexKey := GetAttributesIndexKey(prefix+key, value) + if err := k.SetAttributeMapping(ctx, indexKey, id); err != nil { + return err } } - case "WebsiteRegistrationRecord": - { - // #nosec G705 - for key := range record.Attributes { - indexKey := GetAttributesIndexKey(key, record.Attributes[key]) - if err := k.SetAttributeMapping(ctx, indexKey, record.ID); err != nil { - return err - } - } - } - default: - return fmt.Errorf("unsupported record type %s", record.Attributes["type"]) } - - expiryTimeKey := GetAttributesIndexKey(ExpiryTimeAttributeName, record.ExpiryTime) - if err := k.SetAttributeMapping(ctx, expiryTimeKey, record.ID); err != nil { - return err - } - return nil } @@ -394,7 +377,7 @@ func (k Keeper) GetAttributeMapping(ctx sdk.Context, key []byte) ([]string, erro var recordIds []string if err := json.Unmarshal(store.Get(key), &recordIds); err != nil { - return nil, fmt.Errorf("cannont unmarshal byte array, error, %w", err) + return nil, fmt.Errorf("cannot unmarshal byte array, error, %w", err) } return recordIds, nil @@ -572,7 +555,7 @@ func (k Keeper) GetModuleBalances(ctx sdk.Context) []*types.AccountBalance { return balances } -func recordObjToRecord(store sdk.KVStore, record types.Record) types.Record { +func decodeRecordNames(store sdk.KVStore, record *types.Record) { reverseNameIndexKey := GetCIDToNamesIndexKey(record.Id) if store.Has(reverseNameIndexKey) { @@ -583,6 +566,4 @@ func recordObjToRecord(store sdk.KVStore, record types.Record) types.Record { record.Names = names } - - return record } diff --git a/x/registry/keeper/record_keeper.go b/x/registry/keeper/record_keeper.go index 6d04271e..cea1be7d 100644 --- a/x/registry/keeper/record_keeper.go +++ b/x/registry/keeper/record_keeper.go @@ -147,9 +147,10 @@ func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID string) []types cid := itr.Key()[len(bondIDPrefix):] bz := store.Get(append(PrefixCIDToRecordIndex, cid...)) if bz != nil { - var obj types.Record - k.cdc.MustUnmarshal(bz, &obj) - records = append(records, recordObjToRecord(store, obj)) + var record types.Record + k.cdc.MustUnmarshal(bz, &record) + decodeRecordNames(store, &record) + records = append(records, record) } } @@ -173,7 +174,7 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Renewal not required.") } - recordType := record.ToRecordType() + recordType := record.ToReadableRecord() err = k.processRecord(ctx, &recordType, true) if err != nil { return err diff --git a/x/registry/types/attributes.go b/x/registry/types/attributes.go deleted file mode 100644 index 00a7a785..00000000 --- a/x/registry/types/attributes.go +++ /dev/null @@ -1,5 +0,0 @@ -package types - -type Attributes interface { - GetType() string -} diff --git a/x/registry/types/attributes.pb.go b/x/registry/types/attributes.pb.go deleted file mode 100644 index e0f61a9e..00000000 --- a/x/registry/types/attributes.pb.go +++ /dev/null @@ -1,1412 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: vulcanize/registry/v1beta1/attributes.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type ServiceProviderRegistration struct { - BondId string `protobuf:"bytes,1,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` - LaconicId string `protobuf:"bytes,2,opt,name=laconic_id,json=laconicId,proto3" json:"laconic_id,omitempty" json:"laconicId" yaml:"laconicId"` - X500 *X500 `protobuf:"bytes,3,opt,name=x500,proto3" json:"x500,omitempty" json:"x500" yaml:"x500"` - Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty" json:"type" yaml:"type"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty" json:"version" yaml:"version"` -} - -func (m *ServiceProviderRegistration) Reset() { *m = ServiceProviderRegistration{} } -func (m *ServiceProviderRegistration) String() string { return proto.CompactTextString(m) } -func (*ServiceProviderRegistration) ProtoMessage() {} -func (*ServiceProviderRegistration) Descriptor() ([]byte, []int) { - return fileDescriptor_f305abc771332c96, []int{0} -} -func (m *ServiceProviderRegistration) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceProviderRegistration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ServiceProviderRegistration.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ServiceProviderRegistration) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceProviderRegistration.Merge(m, src) -} -func (m *ServiceProviderRegistration) XXX_Size() int { - return m.Size() -} -func (m *ServiceProviderRegistration) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceProviderRegistration.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceProviderRegistration proto.InternalMessageInfo - -func (m *ServiceProviderRegistration) GetBondId() string { - if m != nil { - return m.BondId - } - return "" -} - -func (m *ServiceProviderRegistration) GetLaconicId() string { - if m != nil { - return m.LaconicId - } - return "" -} - -func (m *ServiceProviderRegistration) GetX500() *X500 { - if m != nil { - return m.X500 - } - return nil -} - -func (m *ServiceProviderRegistration) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *ServiceProviderRegistration) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - -type X500 struct { - CommonName string `protobuf:"bytes,1,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty" json:"commonName" yaml:"commonName"` - OrganizationUnit string `protobuf:"bytes,2,opt,name=organization_unit,json=organizationUnit,proto3" json:"organization_unit,omitempty" json:"organizationUnit" yaml:"organizationUnit"` - OrganizationName string `protobuf:"bytes,3,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty" json:"organizationName" yaml:"organizationName"` - LocalityName string `protobuf:"bytes,4,opt,name=locality_name,json=localityName,proto3" json:"locality_name,omitempty" json:"localityName" yaml:"localityName"` - StateName string `protobuf:"bytes,5,opt,name=state_name,json=stateName,proto3" json:"state_name,omitempty" json:"stateName" yaml:"stateName"` - Country string `protobuf:"bytes,6,opt,name=country,proto3" json:"country,omitempty" json:"country" yaml:"country"` -} - -func (m *X500) Reset() { *m = X500{} } -func (m *X500) String() string { return proto.CompactTextString(m) } -func (*X500) ProtoMessage() {} -func (*X500) Descriptor() ([]byte, []int) { - return fileDescriptor_f305abc771332c96, []int{1} -} -func (m *X500) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *X500) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_X500.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *X500) XXX_Merge(src proto.Message) { - xxx_messageInfo_X500.Merge(m, src) -} -func (m *X500) XXX_Size() int { - return m.Size() -} -func (m *X500) XXX_DiscardUnknown() { - xxx_messageInfo_X500.DiscardUnknown(m) -} - -var xxx_messageInfo_X500 proto.InternalMessageInfo - -func (m *X500) GetCommonName() string { - if m != nil { - return m.CommonName - } - return "" -} - -func (m *X500) GetOrganizationUnit() string { - if m != nil { - return m.OrganizationUnit - } - return "" -} - -func (m *X500) GetOrganizationName() string { - if m != nil { - return m.OrganizationName - } - return "" -} - -func (m *X500) GetLocalityName() string { - if m != nil { - return m.LocalityName - } - return "" -} - -func (m *X500) GetStateName() string { - if m != nil { - return m.StateName - } - return "" -} - -func (m *X500) GetCountry() string { - if m != nil { - return m.Country - } - return "" -} - -type WebsiteRegistrationRecord struct { - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty" json:"url" yaml:"url"` - RepoRegistrationRecordCid string `protobuf:"bytes,2,opt,name=repo_registration_record_cid,json=repoRegistrationRecordCid,proto3" json:"repo_registration_record_cid,omitempty" json:"repoRegistrationRecordCID" yaml:"repoRegistrationRecordCID"` - BuildArtifactCid string `protobuf:"bytes,3,opt,name=build_artifact_cid,json=buildArtifactCid,proto3" json:"build_artifact_cid,omitempty" json:"buildArtifactCID" yaml:"buildArtifactCID"` - TlsCertCid string `protobuf:"bytes,4,opt,name=tls_cert_cid,json=tlsCertCid,proto3" json:"tls_cert_cid,omitempty" json:"TLSCertCID" yaml:"TLSCertCID"` - Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty" json:"type" yaml:"type"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty" json:"version" yaml:"version"` -} - -func (m *WebsiteRegistrationRecord) Reset() { *m = WebsiteRegistrationRecord{} } -func (m *WebsiteRegistrationRecord) String() string { return proto.CompactTextString(m) } -func (*WebsiteRegistrationRecord) ProtoMessage() {} -func (*WebsiteRegistrationRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_f305abc771332c96, []int{2} -} -func (m *WebsiteRegistrationRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WebsiteRegistrationRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WebsiteRegistrationRecord.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WebsiteRegistrationRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_WebsiteRegistrationRecord.Merge(m, src) -} -func (m *WebsiteRegistrationRecord) XXX_Size() int { - return m.Size() -} -func (m *WebsiteRegistrationRecord) XXX_DiscardUnknown() { - xxx_messageInfo_WebsiteRegistrationRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_WebsiteRegistrationRecord proto.InternalMessageInfo - -func (m *WebsiteRegistrationRecord) GetUrl() string { - if m != nil { - return m.Url - } - return "" -} - -func (m *WebsiteRegistrationRecord) GetRepoRegistrationRecordCid() string { - if m != nil { - return m.RepoRegistrationRecordCid - } - return "" -} - -func (m *WebsiteRegistrationRecord) GetBuildArtifactCid() string { - if m != nil { - return m.BuildArtifactCid - } - return "" -} - -func (m *WebsiteRegistrationRecord) GetTlsCertCid() string { - if m != nil { - return m.TlsCertCid - } - return "" -} - -func (m *WebsiteRegistrationRecord) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *WebsiteRegistrationRecord) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - -func init() { - proto.RegisterType((*ServiceProviderRegistration)(nil), "vulcanize.registry.v1beta1.ServiceProviderRegistration") - proto.RegisterType((*X500)(nil), "vulcanize.registry.v1beta1.X500") - proto.RegisterType((*WebsiteRegistrationRecord)(nil), "vulcanize.registry.v1beta1.WebsiteRegistrationRecord") -} - -func init() { - proto.RegisterFile("vulcanize/registry/v1beta1/attributes.proto", fileDescriptor_f305abc771332c96) -} - -var fileDescriptor_f305abc771332c96 = []byte{ - // 661 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x6f, 0xd4, 0x3e, - 0x10, 0x6d, 0xba, 0x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 0x8d, 0xd7, 0x2f, 0x8e, 0xf7, 0xa9, 0xb0, 0x6d, - 0x2d, 0x04, 0x01, 0x19, 0x25, 0x3a, 0x61, 0x61, 0x75, 0xb7, 0x67, 0xfe, 0xc5, 0xdd, 0xde, 0x7b, - 0xf6, 0xfd, 0xbc, 0xed, 0x9c, 0x9d, 0xb7, 0x9d, 0x9f, 0xe7, 0x6d, 0xe7, 0xdb, 0x45, 0x7b, 0xea, - 0xec, 0xa2, 0x3d, 0xf5, 0xe3, 0xa2, 0x3d, 0xf5, 0xfe, 0xfe, 0x80, 0xc9, 0x4f, 0x69, 0xd0, 0x23, - 0x7c, 0xe8, 0x11, 0x2a, 0xc8, 0x03, 0xc6, 0xbd, 0xe2, 0x51, 0x0b, 0xbd, 0xd3, 0xc9, 0x4b, 0xae, - 0x66, 0x48, 0x82, 0x59, 0xfd, 0x16, 0x6f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x86, 0xbb, 0x04, - 0x2e, 0xec, 0x05, 0x00, 0x00, -} - -func (m *ServiceProviderRegistration) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServiceProviderRegistration) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceProviderRegistration) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x32 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x22 - } - if m.X500 != nil { - { - size, err := m.X500.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAttributes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.LaconicId) > 0 { - i -= len(m.LaconicId) - copy(dAtA[i:], m.LaconicId) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.LaconicId))) - i-- - dAtA[i] = 0x12 - } - if len(m.BondId) > 0 { - i -= len(m.BondId) - copy(dAtA[i:], m.BondId) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.BondId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *X500) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *X500) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *X500) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Country) > 0 { - i -= len(m.Country) - copy(dAtA[i:], m.Country) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.Country))) - i-- - dAtA[i] = 0x32 - } - if len(m.StateName) > 0 { - i -= len(m.StateName) - copy(dAtA[i:], m.StateName) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.StateName))) - i-- - dAtA[i] = 0x2a - } - if len(m.LocalityName) > 0 { - i -= len(m.LocalityName) - copy(dAtA[i:], m.LocalityName) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.LocalityName))) - i-- - dAtA[i] = 0x22 - } - if len(m.OrganizationName) > 0 { - i -= len(m.OrganizationName) - copy(dAtA[i:], m.OrganizationName) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.OrganizationName))) - i-- - dAtA[i] = 0x1a - } - if len(m.OrganizationUnit) > 0 { - i -= len(m.OrganizationUnit) - copy(dAtA[i:], m.OrganizationUnit) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.OrganizationUnit))) - i-- - dAtA[i] = 0x12 - } - if len(m.CommonName) > 0 { - i -= len(m.CommonName) - copy(dAtA[i:], m.CommonName) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.CommonName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WebsiteRegistrationRecord) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WebsiteRegistrationRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WebsiteRegistrationRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x32 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x2a - } - if len(m.TlsCertCid) > 0 { - i -= len(m.TlsCertCid) - copy(dAtA[i:], m.TlsCertCid) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.TlsCertCid))) - i-- - dAtA[i] = 0x22 - } - if len(m.BuildArtifactCid) > 0 { - i -= len(m.BuildArtifactCid) - copy(dAtA[i:], m.BuildArtifactCid) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.BuildArtifactCid))) - i-- - dAtA[i] = 0x1a - } - if len(m.RepoRegistrationRecordCid) > 0 { - i -= len(m.RepoRegistrationRecordCid) - copy(dAtA[i:], m.RepoRegistrationRecordCid) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.RepoRegistrationRecordCid))) - i-- - dAtA[i] = 0x12 - } - if len(m.Url) > 0 { - i -= len(m.Url) - copy(dAtA[i:], m.Url) - i = encodeVarintAttributes(dAtA, i, uint64(len(m.Url))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintAttributes(dAtA []byte, offset int, v uint64) int { - offset -= sovAttributes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ServiceProviderRegistration) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BondId) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.LaconicId) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - if m.X500 != nil { - l = m.X500.Size() - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - return n -} - -func (m *X500) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CommonName) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.OrganizationUnit) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.OrganizationName) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.LocalityName) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.StateName) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.Country) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - return n -} - -func (m *WebsiteRegistrationRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Url) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.RepoRegistrationRecordCid) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.BuildArtifactCid) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.TlsCertCid) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovAttributes(uint64(l)) - } - return n -} - -func sovAttributes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAttributes(x uint64) (n int) { - return sovAttributes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ServiceProviderRegistration) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ServiceProviderRegistration: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceProviderRegistration: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BondId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LaconicId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LaconicId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field X500", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAttributes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.X500 == nil { - m.X500 = &X500{} - } - if err := m.X500.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAttributes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAttributes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *X500) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: X500: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: X500: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommonName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CommonName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrganizationUnit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrganizationUnit = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrganizationName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrganizationName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LocalityName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LocalityName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Country", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Country = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAttributes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAttributes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WebsiteRegistrationRecord) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WebsiteRegistrationRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WebsiteRegistrationRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Url = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RepoRegistrationRecordCid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RepoRegistrationRecordCid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BuildArtifactCid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BuildArtifactCid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TlsCertCid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TlsCertCid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAttributes - } - 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 ErrInvalidLengthAttributes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAttributes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAttributes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAttributes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAttributes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAttributes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAttributes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAttributes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAttributes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAttributes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAttributes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAttributes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAttributes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAttributes = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/registry/types/codec.go b/x/registry/types/codec.go index 1a9dd50e..8be2cba9 100644 --- a/x/registry/types/codec.go +++ b/x/registry/types/codec.go @@ -39,17 +39,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgReAssociateRecords{}, ) - registry.RegisterInterface( - "vulcanize.registry.v1beta1.ServiceProvideRegistration", - (*Attributes)(nil), - &ServiceProviderRegistration{}, - ) - - registry.RegisterInterface( - "vulcanize.registry.v1beta1.WebsiteRegistrationRecord", - (*Attributes)(nil), - &WebsiteRegistrationRecord{}, - ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/registry/types/msg.go b/x/registry/types/msg.go index f2b511b5..1a3640a7 100644 --- a/x/registry/types/msg.go +++ b/x/registry/types/msg.go @@ -16,8 +16,8 @@ var ( ) // NewMsgSetName is the constructor function for MsgSetName. -func NewMsgSetName(crn string, cid string, signer sdk.AccAddress) MsgSetName { - return MsgSetName{ +func NewMsgSetName(crn string, cid string, signer sdk.AccAddress) *MsgSetName { + return &MsgSetName{ Crn: crn, Cid: cid, Signer: signer.String(), diff --git a/x/registry/types/record_msg.go b/x/registry/types/record_msg.go index 9fc4ced8..46c2789f 100644 --- a/x/registry/types/record_msg.go +++ b/x/registry/types/record_msg.go @@ -2,7 +2,6 @@ package types import ( errorsmod "cosmossdk.io/errors" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -14,13 +13,11 @@ var ( _ sdk.Msg = &MsgDissociateBond{} _ sdk.Msg = &MsgDissociateRecords{} _ sdk.Msg = &MsgReAssociateRecords{} - - _ cdctypes.UnpackInterfacesMessage = &MsgSetRecord{} ) // NewMsgSetRecord is the constructor function for MsgSetRecord. -func NewMsgSetRecord(payload Payload, bondID string, signer sdk.AccAddress) MsgSetRecord { - return MsgSetRecord{ +func NewMsgSetRecord(payload Payload, bondID string, signer sdk.AccAddress) *MsgSetRecord { + return &MsgSetRecord{ Payload: payload, BondId: bondID, Signer: signer.String(), @@ -61,12 +58,6 @@ func (msg MsgSetRecord) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgSetRecord) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { - var attr Attributes - return unpacker.UnpackAny(msg.Payload.Record.Attributes, &attr) -} - // NewMsgRenewRecord is the constructor function for MsgRenewRecord. func NewMsgRenewRecord(recordID string, signer sdk.AccAddress) MsgRenewRecord { return MsgRenewRecord{ diff --git a/x/registry/types/registry.pb.go b/x/registry/types/registry.pb.go index 26e43adf..4ea365c4 100644 --- a/x/registry/types/registry.pb.go +++ b/x/registry/types/registry.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - types1 "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/codec/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" @@ -155,17 +155,17 @@ func (m *Params) GetAuthorityAuctionMinimumBid() types.Coin { return types.Coin{} } -// Params defines the registry module records +// Record defines a registry record type Record struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` - BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` - CreateTime string `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty" json:"createTime" yaml:"createTime"` - ExpiryTime string `protobuf:"bytes,4,opt,name=expiry_time,json=expiryTime,proto3" json:"expiry_time,omitempty" json:"expiryTime" yaml:"expiryTime"` - Deleted bool `protobuf:"varint,5,opt,name=deleted,proto3" json:"deleted,omitempty"` - Owners []string `protobuf:"bytes,6,rep,name=owners,proto3" json:"owners,omitempty" json:"owners" yaml:"owners"` - Attributes *types1.Any `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty" json:"attributes" yaml:"attributes"` - Names []string `protobuf:"bytes,8,rep,name=names,proto3" json:"names,omitempty" json:"names" yaml:"names"` - Type string `protobuf:"bytes,9,opt,name=type,proto3" json:"type,omitempty" json:"types" yaml:"types"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` + BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` + CreateTime string `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty" json:"createTime" yaml:"createTime"` + ExpiryTime string `protobuf:"bytes,4,opt,name=expiry_time,json=expiryTime,proto3" json:"expiry_time,omitempty" json:"expiryTime" yaml:"expiryTime"` + Deleted bool `protobuf:"varint,5,opt,name=deleted,proto3" json:"deleted,omitempty"` + Owners []string `protobuf:"bytes,6,rep,name=owners,proto3" json:"owners,omitempty" json:"owners" yaml:"owners"` + Attributes []byte `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty" json:"attributes" yaml:"attributes"` + Names []string `protobuf:"bytes,8,rep,name=names,proto3" json:"names,omitempty" json:"names" yaml:"names"` + Type string `protobuf:"bytes,9,opt,name=type,proto3" json:"type,omitempty" json:"types" yaml:"types"` } func (m *Record) Reset() { *m = Record{} } @@ -243,7 +243,7 @@ func (m *Record) GetOwners() []string { return nil } -func (m *Record) GetAttributes() *types1.Any { +func (m *Record) GetAttributes() []byte { if m != nil { return m.Attributes } @@ -264,7 +264,7 @@ func (m *Record) GetType() string { return "" } -// AuthorityEntry defines the registry module AuthorityEntries +// AuthorityEntry defines a registry authority type AuthorityEntry struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Entry *NameAuthority `protobuf:"bytes,2,opt,name=entry,proto3" json:"entry,omitempty"` @@ -466,7 +466,7 @@ func (m *NameEntry) GetEntry() *NameRecord { return nil } -// NameRecord +// NameRecord defines a versioned name record type NameRecord struct { Latest *NameRecordEntry `protobuf:"bytes,1,opt,name=latest,proto3" json:"latest,omitempty"` History []*NameRecordEntry `protobuf:"bytes,2,rep,name=history,proto3" json:"history,omitempty"` @@ -781,92 +781,91 @@ func init() { } var fileDescriptor_5ca0f65a0e7121be = []byte{ - // 1347 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xce, 0xc6, 0x89, 0x13, 0x9f, 0x34, 0x01, 0x0d, 0x69, 0xeb, 0x04, 0xea, 0x0d, 0x46, 0xa5, - 0x0d, 0xa1, 0xb6, 0x4a, 0x2f, 0xca, 0xaf, 0x50, 0x36, 0x49, 0x4b, 0x84, 0x80, 0x30, 0xed, 0x0d, - 0x48, 0x95, 0x35, 0xbb, 0x3b, 0xb5, 0x87, 0x7a, 0x77, 0xad, 0xdd, 0xd9, 0x52, 0x73, 0xc7, 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0x2e, 0xc4, 0xd4, - 0x0f, 0x00, 0x00, + // 1344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0xc6, 0x89, 0x13, 0x9f, 0x34, 0xf9, 0xff, 0x35, 0xa4, 0xad, 0x13, 0xa8, 0x37, 0x18, + 0x95, 0x36, 0x84, 0xda, 0x2a, 0xbd, 0x28, 0x9f, 0x42, 0xd9, 0x24, 0x0d, 0x11, 0x02, 0xc2, 0xb4, + 0x37, 0x20, 0x21, 0x6b, 0x76, 0x77, 0x6a, 0x0f, 0xf5, 0xee, 0x5a, 0xbb, 0xb3, 0xa5, 0xe6, 0x0e, + 0xf1, 0x02, 0xb9, 0xec, 0x05, 0x6f, 0x00, 0x12, 0x8f, 0x41, 0x2f, 0x7b, 0x89, 0x90, 0x30, 0xa8, + 0x79, 0x03, 0x3f, 0x01, 0xda, 0xf9, 0xd8, 0x2f, 0xdb, 0x75, 0xa1, 0x77, 0x73, 0xbe, 0x7e, 0xf3, + 0x9b, 0x33, 0xe7, 0x9c, 0xd9, 0x85, 0xdd, 0x87, 0x71, 0xdf, 0x21, 0x3e, 0xfb, 0x9e, 0xb6, 0x43, + 0xda, 0x65, 0x11, 0x0f, 0x87, 0xed, 0x87, 0x37, 0x6d, 0xca, 0xc9, 0xcd, 0x54, 0xd1, 0x1a, 0x84, + 0x01, 0x0f, 0xd0, 0x76, 0xea, 0xda, 0x4a, 0x2d, 0xca, 0x75, 0xbb, 0xd1, 0x0d, 0x82, 0x6e, 0x9f, + 0xb6, 0x85, 0xa7, 0x1d, 0xdf, 0x6f, 0xbb, 0x71, 0x48, 0x38, 0x0b, 0x7c, 0x19, 0xbb, 0x6d, 0x96, + 0xed, 0x9c, 0x79, 0x34, 0xe2, 0xc4, 0x1b, 0x28, 0x87, 0xcd, 0x6e, 0xd0, 0x0d, 0xc4, 0xb2, 0x9d, + 0xac, 0x94, 0xb6, 0xe1, 0x04, 0x91, 0x17, 0x44, 0x6d, 0x9b, 0x44, 0x34, 0xa5, 0xe5, 0x04, 0x4c, + 0xc3, 0x6e, 0x95, 0x61, 0x89, 0xaf, 0xd8, 0x36, 0xff, 0x5c, 0x87, 0xea, 0x29, 0x09, 0x89, 0x17, + 0x21, 0x06, 0x6b, 0x21, 0x75, 0x82, 0xd0, 0xed, 0x84, 0xd4, 0xe7, 0x75, 0x63, 0xc7, 0xb8, 0xbe, + 0xf6, 0xce, 0x56, 0x4b, 0x62, 0xb7, 0x12, 0x6c, 0x7d, 0x8e, 0xd6, 0x41, 0xc0, 0x7c, 0xeb, 0xc6, + 0x93, 0x91, 0xb9, 0x30, 0x1e, 0x99, 0x57, 0xbf, 0x8d, 0x02, 0xff, 0xfd, 0x66, 0x2e, 0xb6, 0xb9, + 0x33, 0x24, 0x5e, 0xbf, 0xa8, 0xc2, 0x20, 0x25, 0x4c, 0x7d, 0x8e, 0xce, 0x0c, 0xd8, 0xcc, 0x19, + 0x3b, 0x3a, 0x0d, 0xf5, 0x45, 0xb5, 0xa9, 0x24, 0xdc, 0xd2, 0x84, 0x5b, 0x87, 0xca, 0xc1, 0x3a, + 0x50, 0x9b, 0xde, 0x9e, 0xd8, 0x34, 0x05, 0x99, 0xb2, 0x7b, 0x66, 0x7b, 0xfc, 0x97, 0x69, 0x60, + 0x94, 0x51, 0xd1, 0xc0, 0x28, 0x86, 0x0d, 0x12, 0xf3, 0x5e, 0x10, 0x32, 0x3e, 0x94, 0x09, 0xa8, + 0xcc, 0x4b, 0xc0, 0x2d, 0xc5, 0x65, 0x4f, 0x72, 0x29, 0x86, 0x6b, 0x16, 0x25, 0x2d, 0x5e, 0x4f, + 0x15, 0x22, 0x13, 0x3f, 0x19, 0x70, 0xb9, 0xe8, 0x92, 0x25, 0x63, 0x69, 0x5e, 0x32, 0x4e, 0x14, + 0x81, 0x8f, 0xa6, 0x11, 0x98,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 0x41, 0xb6, 0xee, 0x3c, 0x79, 0xd6, 0x30, 0x9e, 0x3e, 0x6b, 0x18, 0x7f, + 0x3f, 0x6b, 0x18, 0x67, 0xe7, 0x8d, 0x85, 0xa7, 0xe7, 0x8d, 0x85, 0xdf, 0xcf, 0x1b, 0x0b, 0x5f, + 0xbf, 0xdd, 0x65, 0xbc, 0x17, 0xdb, 0x2d, 0x27, 0xf0, 0xda, 0x0e, 0x0d, 0x9d, 0x1b, 0x2c, 0x68, + 0xf7, 0x89, 0x13, 0xf8, 0xcc, 0x71, 0xdb, 0x8f, 0xb2, 0x7f, 0x73, 0x31, 0xfd, 0xed, 0xaa, 0x98, + 0x01, 0xb7, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x03, 0x19, 0xcc, 0xfc, 0xbe, 0x0f, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -1028,15 +1027,10 @@ func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x42 } } - if m.Attributes != nil { - { - size, err := m.Attributes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRegistry(dAtA, i, uint64(size)) - } + if len(m.Attributes) > 0 { + i -= len(m.Attributes) + copy(dAtA[i:], m.Attributes) + i = encodeVarintRegistry(dAtA, i, uint64(len(m.Attributes))) i-- dAtA[i] = 0x3a } @@ -1152,12 +1146,12 @@ func (m *NameAuthority) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime):]) - if err13 != nil { - return 0, err13 + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime):]) + if err12 != nil { + return 0, err12 } - i -= n13 - i = encodeVarintRegistry(dAtA, i, uint64(n13)) + i -= n12 + i = encodeVarintRegistry(dAtA, i, uint64(n12)) i-- dAtA[i] = 0x3a if len(m.BondId) > 0 { @@ -1555,8 +1549,8 @@ func (m *Record) Size() (n int) { n += 1 + l + sovRegistry(uint64(l)) } } - if m.Attributes != nil { - l = m.Attributes.Size() + l = len(m.Attributes) + if l > 0 { n += 1 + l + sovRegistry(uint64(l)) } if len(m.Names) > 0 { @@ -2370,7 +2364,7 @@ func (m *Record) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRegistry @@ -2380,26 +2374,24 @@ func (m *Record) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthRegistry } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthRegistry } if postIndex > l { return io.ErrUnexpectedEOF } + m.Attributes = append(m.Attributes[:0], dAtA[iNdEx:postIndex]...) if m.Attributes == nil { - m.Attributes = &types1.Any{} - } - if err := m.Attributes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Attributes = []byte{} } iNdEx = postIndex case 8: diff --git a/x/registry/types/tx.pb.go b/x/registry/types/tx.pb.go index bab14347..70440c6b 100644 --- a/x/registry/types/tx.pb.go +++ b/x/registry/types/tx.pb.go @@ -385,7 +385,7 @@ func (m *MsgReserveAuthorityResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgReserveAuthorityResponse proto.InternalMessageInfo -// MsgSetAuthorityBond is SDK message for SetAuthorityBond +// MsgSetAuthorityBond type MsgSetAuthorityBond struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` @@ -483,7 +483,7 @@ func (m *MsgSetAuthorityBondResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetAuthorityBondResponse proto.InternalMessageInfo -// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority +// MsgDeleteNameAuthority type MsgDeleteNameAuthority struct { Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"` Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` @@ -573,7 +573,7 @@ func (m *MsgDeleteNameAuthorityResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDeleteNameAuthorityResponse proto.InternalMessageInfo -// MsgRenewRecord is SDK message for Renew a record +// MsgRenewRecord type MsgRenewRecord struct { RecordId string `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty" json:"recordId" yaml:"recordId"` Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` @@ -761,7 +761,7 @@ func (m *MsgAssociateBondResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAssociateBondResponse proto.InternalMessageInfo -// MsgDissociateBond is SDK message for Msg/DissociateBond +// MsgDissociateBond type MsgDissociateBond struct { RecordId string `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty" json:"recordId" yaml:"recordId"` Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` @@ -814,7 +814,7 @@ func (m *MsgDissociateBond) GetSigner() string { return "" } -// MsgDissociateBondResponse is response type for MsgDissociateBond +// MsgDissociateBondResponse type MsgDissociateBondResponse struct { } @@ -851,7 +851,7 @@ func (m *MsgDissociateBondResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDissociateBondResponse proto.InternalMessageInfo -// MsgDissociateRecords is SDK message for Msg/DissociateRecords +// MsgDissociateRecords type MsgDissociateRecords struct { BondId string `protobuf:"bytes,1,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` @@ -904,7 +904,7 @@ func (m *MsgDissociateRecords) GetSigner() string { return "" } -// MsgDissociateRecordsResponse is response type for MsgDissociateRecords +// MsgDissociateRecordsResponse type MsgDissociateRecordsResponse struct { } @@ -941,7 +941,7 @@ func (m *MsgDissociateRecordsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDissociateRecordsResponse proto.InternalMessageInfo -// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords +// MsgReAssociateRecords type MsgReAssociateRecords struct { NewBondId string `protobuf:"bytes,1,opt,name=new_bond_id,json=newBondId,proto3" json:"new_bond_id,omitempty" json:"newBondId" yaml:"newBondId"` OldBondId string `protobuf:"bytes,2,opt,name=old_bond_id,json=oldBondId,proto3" json:"old_bond_id,omitempty" json:"oldBondId" yaml:"oldBondId"` @@ -1002,7 +1002,7 @@ func (m *MsgReAssociateRecords) GetSigner() string { return "" } -// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords +// MsgReAssociateRecordsResponse type MsgReAssociateRecordsResponse struct { } @@ -1147,9 +1147,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // SetRecord will records a new record with given payload and bond id + // SetRecord records a new record with given payload and bond id SetRecord(ctx context.Context, in *MsgSetRecord, opts ...grpc.CallOption) (*MsgSetRecordResponse, error) - // Renew Record will renew the expire record + // Renew Record renews an expired record RenewRecord(ctx context.Context, in *MsgRenewRecord, opts ...grpc.CallOption) (*MsgRenewRecordResponse, error) // AssociateBond AssociateBond(ctx context.Context, in *MsgAssociateBond, opts ...grpc.CallOption) (*MsgAssociateBondResponse, error) @@ -1269,9 +1269,9 @@ func (c *msgClient) SetAuthorityBond(ctx context.Context, in *MsgSetAuthorityBon // MsgServer is the server API for Msg service. type MsgServer interface { - // SetRecord will records a new record with given payload and bond id + // SetRecord records a new record with given payload and bond id SetRecord(context.Context, *MsgSetRecord) (*MsgSetRecordResponse, error) - // Renew Record will renew the expire record + // Renew Record renews an expired record RenewRecord(context.Context, *MsgRenewRecord) (*MsgRenewRecordResponse, error) // AssociateBond AssociateBond(context.Context, *MsgAssociateBond) (*MsgAssociateBondResponse, error) diff --git a/x/registry/types/types.go b/x/registry/types/types.go index 69f770f2..6bd466b5 100644 --- a/x/registry/types/types.go +++ b/x/registry/types/types.go @@ -2,14 +2,9 @@ package types import ( "crypto/sha256" - "encoding/json" - "fmt" - "strings" "github.com/cerc-io/laconicd/x/registry/helpers" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" canonicalJson "github.com/gibson042/canonicaljson-go" - "github.com/gogo/protobuf/proto" ) const ( @@ -18,19 +13,21 @@ const ( AuthorityUnderAuction = "auction" ) -// PayloadType represents a signed record payload that can be serialized from/to YAML. -type PayloadType struct { +// TODO if schema records are to be more permissive than allowing a map of fields, this type will +// become specific to content records. schema records will either occupy a new message or have new +// more general purpose helper types. + +// PayloadEncodable represents a signed record payload that can be serialized from/to YAML. +type PayloadEncodable struct { Record map[string]interface{} `json:"record"` Signatures []Signature `json:"signatures"` } -// ToPayload converts PayloadType to Payload object. +// ToPayload converts PayloadEncodable to Payload object. // Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4. -func (payloadObj *PayloadType) ToPayload() (Payload, error) { - attributes, err := payLoadAttributes(payloadObj.Record) - if err != nil { - return Payload{}, err - } +func (payloadObj *PayloadEncodable) ToPayload() Payload { + // Note: record directly contains the attributes here + attributes := helpers.MarshalMapToJSONBytes(payloadObj.Record) payload := Payload{ Record: &Record{ Deleted: false, @@ -39,59 +36,23 @@ func (payloadObj *PayloadType) ToPayload() (Payload, error) { }, Signatures: payloadObj.Signatures, } - return payload, nil + // TODO rm error + return payload } -func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, error) { - recordType, ok := recordPayLoad["type"] - if !ok { - return &codectypes.Any{}, fmt.Errorf("cannot get type from payload") - } - bz := helpers.MarshalMapToJSONBytes(recordPayLoad) +// ToReadablePayload converts Payload to a serializable object +func (payload Payload) ToReadablePayload() PayloadEncodable { + var encodable PayloadEncodable - switch recordType.(string) { - case "ServiceProviderRegistration": - { - var attributes ServiceProviderRegistration - err := json.Unmarshal(bz, &attributes) - if err != nil { - return &codectypes.Any{}, err - } - return codectypes.NewAnyWithValue(&attributes) - } - case "WebsiteRegistrationRecord": - { - var attributes WebsiteRegistrationRecord - err := json.Unmarshal(bz, &attributes) - if err != nil { - return &codectypes.Any{}, err - } - return codectypes.NewAnyWithValue(&attributes) - } - default: - return &codectypes.Any{}, fmt.Errorf("unsupported record type %s", recordType.(string)) - } + encodable.Record = helpers.UnMarshalMapFromJSONBytes(payload.Record.Attributes) + encodable.Signatures = payload.Signatures + + return encodable } -// ToReadablePayload converts Payload to PayloadType -// It will unmarshal with record attributes -func (payload Payload) ToReadablePayload() PayloadType { - var payloadType PayloadType - bz, err := GetJSONBytesFromAny(*payload.Record.Attributes) - if err != nil { - panic(err) - } - - payloadType.Record = helpers.UnMarshalMapFromJSONBytes(bz) - payloadType.Signatures = payload.Signatures - - return payloadType -} - -// Record to Record Type for human-readable attributes - -func (r *Record) ToRecordType() RecordType { - var resourceObj RecordType +// ToReadableRecord converts Record to a serializable object +func (r *Record) ToReadableRecord() RecordEncodable { + var resourceObj RecordEncodable resourceObj.ID = r.Id resourceObj.BondID = r.BondId @@ -100,55 +61,13 @@ func (r *Record) ToRecordType() RecordType { resourceObj.Deleted = r.Deleted resourceObj.Owners = r.Owners resourceObj.Names = r.Names - - bz, err := GetJSONBytesFromAny(*r.Attributes) - if err != nil { - panic(err) - } - resourceObj.Attributes = helpers.UnMarshalMapFromJSONBytes(bz) + resourceObj.Attributes = helpers.UnMarshalMapFromJSONBytes(r.Attributes) return resourceObj } -func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) { - var bz []byte - s := strings.Split(any.TypeUrl, ".") - switch s[len(s)-1] { - case "ServiceProviderRegistration": - { - var attributes ServiceProviderRegistration - err := proto.Unmarshal(any.Value, &attributes) - if err != nil { - panic("Proto unmarshal error") - } - - bz, err = json.Marshal(attributes) - if err != nil { - panic("JSON marshal error") - } - } - case "WebsiteRegistrationRecord": - { - var attributes WebsiteRegistrationRecord - err := proto.Unmarshal(any.Value, &attributes) - if err != nil { - panic("Proto unmarshal error") - } - - bz, err = json.Marshal(attributes) - if err != nil { - panic("JSON marshal error") - } - } - default: - return nil, fmt.Errorf("unsupported type %s", s[len(s)-1]) - } - - return bz, nil -} - -// RecordType represents a WNS record. -type RecordType struct { +// RecordEncodable represents a WNS record. +type RecordEncodable struct { ID string `json:"id,omitempty"` Names []string `json:"names,omitempty"` BondID string `json:"bondId,omitempty"` @@ -161,11 +80,8 @@ type RecordType struct { // ToRecordObj converts Record to RecordObj. // Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4. -func (r *RecordType) ToRecordObj() (Record, error) { - attributes, err := payLoadAttributes(r.Attributes) - if err != nil { - return Record{}, err - } +func (r *RecordEncodable) ToRecordObj() (Record, error) { + attributes := helpers.MarshalMapToJSONBytes(r.Attributes) var resourceObj Record @@ -181,7 +97,7 @@ func (r *RecordType) ToRecordObj() (Record, error) { } // CanonicalJSON returns the canonical JSON representation of the record. -func (r *RecordType) CanonicalJSON() []byte { +func (r *RecordEncodable) CanonicalJSON() []byte { bytes, err := canonicalJson.Marshal(r.Attributes) if err != nil { panic("Record marshal error.") @@ -191,7 +107,7 @@ func (r *RecordType) CanonicalJSON() []byte { } // GetSignBytes generates a record hash to be signed. -func (r *RecordType) GetSignBytes() ([]byte, []byte) { +func (r *RecordEncodable) GetSignBytes() ([]byte, []byte) { // Double SHA256 hash. // Input to the first round of hashing. @@ -211,7 +127,7 @@ func (r *RecordType) GetSignBytes() ([]byte, []byte) { } // GetCID gets the record CID. -func (r *RecordType) GetCID() (string, error) { +func (r *RecordEncodable) GetCID() (string, error) { id, err := helpers.GetCid(r.CanonicalJSON()) if err != nil { return "", err