Skip to content

Commit

Permalink
remove revert
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Oct 8, 2024
1 parent a766400 commit 4f33d58
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
7 changes: 0 additions & 7 deletions contracts/src/utils/metadata/MetadataExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ abstract contract MetadataExtension is ERC165, DaoAuthorizable {
/// @notice Emitted when metadata is updated.
event MetadataUpdated(bytes metadata);

/// @notice Thrown if metadata is set empty.
error EmptyMetadata();

bytes private metadata;

/// @notice Checks if this or the parent contract supports an interface by its ID.
Expand Down Expand Up @@ -47,10 +44,6 @@ abstract contract MetadataExtension is ERC165, DaoAuthorizable {
/// @notice Internal function to update metadata.
/// @param _metadata The utf8 bytes of a content addressing cid that stores contract's information.
function _updateMetadata(bytes memory _metadata) internal virtual {
if (_metadata.length == 0) {
revert EmptyMetadata();
}

metadata = _metadata;
emit MetadataUpdated(_metadata);
}
Expand Down
7 changes: 0 additions & 7 deletions contracts/src/utils/metadata/MetadataExtensionUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ abstract contract MetadataExtensionUpgradeable is ERC165Upgradeable, DaoAuthoriz
/// @notice Emitted when metadata is updated.
event MetadataUpdated(bytes metadata);

/// @notice Thrown if metadata is set empty.
error EmptyMetadata();

struct MetadataExtensionStorage {
bytes metadata;
}
Expand Down Expand Up @@ -66,10 +63,6 @@ abstract contract MetadataExtensionUpgradeable is ERC165Upgradeable, DaoAuthoriz
/// @notice Internal function to update metadata.
/// @param _metadata The utf8 bytes of a content addressing cid that stores contract's information.
function _updateMetadata(bytes memory _metadata) internal virtual {
if (_metadata.length == 0) {
revert EmptyMetadata();
}

MetadataExtensionStorage storage $ = _getMetadataExtensionStorage();
$.metadata = _metadata;

Expand Down
14 changes: 3 additions & 11 deletions contracts/test/utils/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ function MetadataExtensionBaseTests(fixture: () => Promise<FixtureResult>) {
).to.be.revertedWithCustomError(metadataMock, 'DaoUnauthorized');
});

it('reverts if empty metadata is being set', async () => {
const {metadataMock} = data;

await expect(
metadataMock.updateMetadata('0x')
).to.be.revertedWithCustomError(metadataMock, 'EmptyMetadata');
});

it('sets the metadata and emits the event', async () => {
const {metadataMock} = data;
const metadata = '0x11';
Expand All @@ -82,9 +74,9 @@ function MetadataExtensionBaseTests(fixture: () => Promise<FixtureResult>) {

// Check that it correctly retrieves the metadata if the length is > 32
// This ensures that our `sstore/sload` operations behave correctly.
// metadata = '0x' + '11'.repeat(50);
// await metadataMock.updateMetadata(metadata);
// expect(await metadataMock.getMetadata()).to.equal(metadata);
metadata = '0x' + '11'.repeat(50);
await metadataMock.updateMetadata(metadata);
expect(await metadataMock.getMetadata()).to.equal(metadata);
});
});
}
Expand Down

0 comments on commit 4f33d58

Please sign in to comment.