RGB-WG / RFC

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

RCP-240313B: Move script and type libraries outside of schema, interfaces and operations #4

Open dr-orlovsky opened 5 months ago

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

With RGB v0.10 schema, interfaces and implementations include explicit source code of script (AluVM) and type (Strict Types) libraries. With v0.11, assignments in genesis, state transitions and extensions are also allowed to provide script spending conditions, and all operations will be able to come with their own script and type libraries.

This will result in the replication of the same type libraries over and over again, bloating sizes of consignments and stashes. Even with v0.10, a typical contract replicates the same type library twice (schema and interface), leading to ~30% increase in the size of the contract consignment for any asset.

Since on the consensus level schemata, interfaces and operations since v0.11 commit to the id of the script and type library - and not the library source code, I propose to move the source code into a dedicated segment in the consignment (or interface/schema containers), and let RGB data reference them only by their ids. This will prevent library replication and reduce the size of the consignments and other containers.