As amino doesn't support map, and it's complicated to implement and map are much heavier than array when dealing with lots of data (repetition of the keys), we should remove map from proto.Struct type.
The order will play a very important role to know which value belongs to which inputs/outputs/events' definition from the mesg.yml.
The engine already define its own proto.Struct type, so we just need to make a few adjustment, update the encoding/decoding functions of the js library, and update the go services.
The proposed modification in the protobuf/types/struct.proto file is to simply remove message Struct and its use in the oneof of Value:
message Struct {
// Unordered map of dynamically typed values.
map<string, Value> fields = 1 [
(gogoproto.moretags) = 'hash:"name:1"'
];
}
message Value {
// The kind of value.
oneof kind {
// Represents a null value.
NullValue null_value = 1 [
(gogoproto.moretags) = 'hash:"name:1"'
];
...
// Represents a structured value.
This issue is not relevant as we find solution to transform map to array when encoding in amino and map are really useful and easy to sort for deterministic encoding.
As amino doesn't support map, and it's complicated to implement and map are much heavier than array when dealing with lots of data (repetition of the keys), we should remove map from
proto.Struct
type. The order will play a very important role to know which value belongs to which inputs/outputs/events' definition from themesg.yml
.The engine already define its own
proto.Struct
type, so we just need to make a few adjustment, update the encoding/decoding functions of the js library, and update the go services.protobuf/types/struct.proto
file is to simply remove messageStruct
and its use in the oneof ofValue
:message Value { // The kind of value. oneof kind { // Represents a null value. NullValue null_value = 1 [ (gogoproto.moretags) = 'hash:"name:1"' ]; ... // Represents a structured value.
Value
. ListValue list_value = 6 [ (gogoproto.moretags) = 'hash:"name:6"' ]; } }execution.proto
, we will have to replacemesg.protobuf.Struct
byrepeated mesg.protobuf.Value
:repeated mesg.protobuf.Value inputs = 7 [ (gogoproto.moretags) = 'hash:"name:7"' ];
// outputs are the returned data of successful execution.
Here an example of those previous modifications from the service used in e2e:
mesg.yml
uses atype: Object
without more definition, then the data should be sorted by stable alphabet order.This issue is a breaking change from the API point of view, but with the right update on the js library, it should not break the API of the js lib ;)