Skip to content

Commit

Permalink
fix: check runtime in _submit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabnock01 committed Dec 19, 2023
1 parent 5a5e8f1 commit 76a3b6c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/CurtaGolf.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,17 @@ contract CurtaGolf is ICurtaGolf, KingERC721, Owned {
// Revert if the course does not exist.
if (address(courseData.course) == address(0)) revert CourseDoesNotExist(_courseId);

// Revert if the solution contains invalid opcodes.
if (!purityChecker.check(_solution, getAllowedOpcodes[_courseId])) {
revert PollutedSolution();
}

// Deploy the solution.
address target;
assembly {
target := create(0, add(_solution, 0x20), mload(_solution))
}

// Revert if the solution contains invalid opcodes.
if (!purityChecker.check(target.code, getAllowedOpcodes[_courseId])) {
revert PollutedSolution();
}

// Run solution and mint NFT if it beats the leading score.
uint32 gasUsed = courseData.course.run(target, block.prevrandao);
if (courseData.gasUsed == 0 || gasUsed < courseData.gasUsed) {
Expand Down

0 comments on commit 76a3b6c

Please sign in to comment.