Skip to content

Commit

Permalink
fix: add back initcode check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabnock01 committed Dec 23, 2023
1 parent 6f279bb commit 65b085e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/CurtaGolf.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,18 @@ 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 initcode 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.
// Revert if the runtime contains invalid opcodes.
if (!purityChecker.check(target.code, getAllowedOpcodes[_courseId])) {
revert PollutedSolution();
}
Expand Down

0 comments on commit 65b085e

Please sign in to comment.