RGB-WG / RFC

Requests for comments RGB change proposals
5 stars 2 forks source link

RCP-240326A: Multiple metadata fields in contract operations #5

Open dr-orlovsky opened 5 months ago

dr-orlovsky commented 5 months ago
layers: consensus, standard library
consensus: pushback

Metadata are the way operation is provided with accessory data which are not kept as a part of the queryable contract state (do not blow it up), but are used in validation. A typical example is some witness (there is another operation-specific witness, and unlike it the metadata must be of the same type for all operations of certain class in the contract).

Right now, each operation has a single metadata, which has a form of serialized strict value. The operation schema commits to the data type. The idea was that if an operation needs complex metadata, it just constructs a corresponding data type, and there is no need in multiple metadata fields.

However, with interface inheritance the situation becomes more complex: each interface may require its own form of metadata, and if two or more interfaces in inheritance hierarchy needs their metadata, this interfaces can't be composed. This is a signification restriction, which can be removed by converting metadata field into a list which may contain maximum 255 values (since we have restriction on the number of composed interfaces, which can't exceed 255).