Skip to content

Commit

Permalink
add revert condition for puzzle names
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabnock01 committed Nov 3, 2023
1 parent 1df24ac commit 1da8246
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Curta.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ contract Curta is ICurta, FlagsERC721, Owned {
// Revert if the puzzle does not exist.
if (address(puzzle) == address(0)) revert PuzzleDoesNotExist(_puzzleId);

// Revert if puzzle name is an empty string or not implemented.
if (bytes(puzzle.name()).length == 0) revert PuzzleNotNamed(_puzzleId);

// Revert if submissions are closed.
uint40 firstSolveTimestamp = puzzleData.firstSolveTimestamp;
uint40 solveTimestamp = uint40(block.timestamp);
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/ICurta.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ interface ICurta {
/// @param _puzzleId The ID of a puzzle.
error PuzzleDoesNotExist(uint32 _puzzleId);

/// @notice Emitted when a puzzle has a zero-length name.
/// @param _puzzleId The ID of a puzzle.
error PuzzleNotNamed(uint32 _puzzleId);

/// @notice Emitted when the puzzle was not the one that went longest
/// unsolved.
/// @param _puzzleId The ID of a puzzle.
Expand Down

0 comments on commit 1da8246

Please sign in to comment.