Skip to content

feat: move PieceMetadata off-chain #574

Description

@Kubuxu

Due to gas costs, we are going to stop storing PieceMetadata on-chain.

In principle, the change is the removal of:

for (uint256 k = 0; k < pieceKeys.length; k++) {
string memory key = pieceKeys[k];
string memory value = pieceValues[k];
require(
bytes(dataSetPieceMetadata[dataSetId][pieceId][key]).length == 0,
Errors.DuplicateMetadataKey(dataSetId, key)
);
require(
bytes(key).length <= MAX_KEY_LENGTH,
Errors.MetadataKeyExceedsMaxLength(k, MAX_KEY_LENGTH, bytes(key).length)
);
require(
bytes(value).length <= MAX_VALUE_LENGTH,
Errors.MetadataValueExceedsMaxLength(k, MAX_VALUE_LENGTH, bytes(value).length)
);
dataSetPieceMetadata[dataSetId][pieceId][key] = string(value);
dataSetPieceMetadataKeys[dataSetId][pieceId].push(key);
}
plus depracation/removal of getters of PieceMetadata.
PieceMetadata will still be emitted as an event.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
⌨️ In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions