WIP: Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord
Some checks failed
Build / cleanup-runs (pull_request) Successful in 7s
Deploy Contract / cleanup-runs (pull_request) Successful in 4s
Build / build (pull_request) Failing after 1m15s
Deploy Contract / deploy (pull_request) Failing after 1m6s
Pull Request Labeler / triage (pull_request) Failing after 13s
CodeQL / Analyze (go) (pull_request) Failing after 2m11s
Lint / Run flake8 on python integration tests (pull_request) Failing after 47s
Protobuf / lint (pull_request) Successful in 20s
Lint / Run golangci-lint (pull_request) Failing after 1m17s
Dependency Review / dependency-review (pull_request) Failing after 2m41s
Protobuf / break-check (pull_request) Successful in 39s
Semgrep / Scan (pull_request) Failing after 25s
Run Gosec / Gosec (pull_request) Failing after 48s
Tests / cleanup-runs (pull_request) Failing after 42s
Tests / test-rpc (pull_request) Failing after 36s
Tests / test-unit-cover (pull_request) Failing after 1m32s
Tests / test-importer (pull_request) Failing after 1m24s
Tests / sdk_tests (pull_request) Failing after 3m7s

This commit is contained in:
Thomas E Lackey 2023-11-17 17:03:39 -06:00
parent 4fe710307d
commit 7ea9a26cc8
5 changed files with 2219 additions and 44 deletions

View File

@ -31,3 +31,44 @@ message WebsiteRegistrationRecord {
string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
} }
message ApplicationRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string homepage = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""];
string license = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
string author = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""];
string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
string engines = 12 [(gogoproto.moretags) = "json:\"engines\" yaml:\"engines\""];
repeated string os = 13 [(gogoproto.moretags) = "json:\"os\" yaml:\"os\""];
repeated string cpu = 14 [(gogoproto.moretags) = "json:\"cpu\" yaml:\"cpu\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message WebAppDeploymentRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string application = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
string url = 6 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}
message GeneralRecord {
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
string category = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""];
string value = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

View File

@ -339,6 +339,9 @@ func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) erro
} }
} }
case "WebsiteRegistrationRecord": case "WebsiteRegistrationRecord":
case "ApplicationRecord":
case "WebAppDeploymentRecord":
case "GeneralRecord":
{ {
// #nosec G705 // #nosec G705
for key := range record.Attributes { for key := range record.Attributes {

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,24 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
(*Attributes)(nil), (*Attributes)(nil),
&WebsiteRegistrationRecord{}, &WebsiteRegistrationRecord{},
) )
registry.RegisterInterface(
"vulcanize.registry.v1beta1.ApplicationRecord",
(*Attributes)(nil),
&ApplicationRecord{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.WebAppDeploymentRecord",
(*Attributes)(nil),
&WebAppDeploymentRecord{},
)
registry.RegisterInterface(
"vulcanize.registry.v1beta1.GeneralRecord",
(*Attributes)(nil),
&GeneralRecord{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
} }

View File

@ -68,6 +68,33 @@ func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, e
} }
return codectypes.NewAnyWithValue(&attributes) return codectypes.NewAnyWithValue(&attributes)
} }
case "ApplicationRecord":
{
var attributes ApplicationRecord
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
case "WebAppDeploymentRecord":
{
var attributes WebAppDeploymentRecord
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
case "GeneralRecord":
{
var attributes GeneralRecord
err := json.Unmarshal(bz, &attributes)
if err != nil {
return &codectypes.Any{}, err
}
return codectypes.NewAnyWithValue(&attributes)
}
default: default:
return &codectypes.Any{}, fmt.Errorf("unsupported record type %s", recordType.(string)) return &codectypes.Any{}, fmt.Errorf("unsupported record type %s", recordType.(string))
} }
@ -135,6 +162,45 @@ func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) {
panic("Proto unmarshal error") panic("Proto unmarshal error")
} }
bz, err = json.Marshal(attributes)
if err != nil {
panic("JSON marshal error")
}
}
case "ApplicationRecord":
{
var attributes ApplicationRecord
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 "WebAppDeploymentRecord":
{
var attributes WebAppDeploymentRecord
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 "GeneralRecord":
{
var attributes GeneralRecord
err := proto.Unmarshal(any.Value, &attributes)
if err != nil {
panic("Proto unmarshal error")
}
bz, err = json.Marshal(attributes) bz, err = json.Marshal(attributes)
if err != nil { if err != nil {
panic("JSON marshal error") panic("JSON marshal error")