The index keys for the Metadata module can all be shortened by one or two bytes.
Problem Definition
The indexes in the Metadata module all contain a full metadata address (or two). However, the type byte of the Metadata Addresses can be inferred by the type byte of the index. That means these index keys can be reduced by one or two bytes. This results in less storage needed.
Proposal
Basically, anywhere a full metadata address is part of an index key, change it so it's not including its type byte anymore. We'll also need new type bytes for each index.
Make the following changes to the Metadata index key formats:
party -> scope: from 0x17<party_address><scope_id> to 0x22<party_address><scope_uuid>
scope spec -> scope: from 0x11<scope_spec_id><scope_id> to 0x23<scope_spec_uuid><scope_uuid>
value owner -> scope: from 0x18<value_owner_address><scope_id> to 0x24<value_owner_address><scope_uuid>
owner -> scope spec: from 0x19<owner_address><scope_spec_id> to 0x25<owner_address><scope_spec_uuid>
contract spec -> scope spec: from 0x14<contract_spec_id><scope_spec_id> to 0x26<contract_spec_uuid><scope_spec_uuid>
owner -> contract spec: from 0x20<owner_address><contract_spec_id> to 0x27<owner_address><contract_spec_uuid>
This change will require a migration and will probably be associated with bug #541
this could be part of a larger refresh of the metadata module to align with the more nft/erc-721 style management of off-chain digital asset records...
Summary
The index keys for the Metadata module can all be shortened by one or two bytes.
Problem Definition
The indexes in the Metadata module all contain a full metadata address (or two). However, the type byte of the Metadata Addresses can be inferred by the type byte of the index. That means these index keys can be reduced by one or two bytes. This results in less storage needed.
Proposal
Basically, anywhere a full metadata address is part of an index key, change it so it's not including its type byte anymore. We'll also need new type bytes for each index.
Make the following changes to the Metadata index key formats:
0x17<party_address><scope_id>
to0x22<party_address><scope_uuid>
0x11<scope_spec_id><scope_id>
to0x23<scope_spec_uuid><scope_uuid>
0x18<value_owner_address><scope_id>
to0x24<value_owner_address><scope_uuid>
0x19<owner_address><scope_spec_id>
to0x25<owner_address><scope_spec_uuid>
0x14<contract_spec_id><scope_spec_id>
to0x26<contract_spec_uuid><scope_spec_uuid>
0x20<owner_address><contract_spec_id>
to0x27<owner_address><contract_spec_uuid>
This change will require a migration and will probably be associated with bug #541
For Admin Use