From 65b085eb3eb3979c8acc44234216a4e7fdf75ec3 Mon Sep 17 00:00:00 2001 From: Sabnock01 <24715302+Sabnock01@users.noreply.github.com> Date: Sat, 23 Dec 2023 07:37:05 -0600 Subject: [PATCH] fix: add back initcode check --- src/CurtaGolf.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CurtaGolf.sol b/src/CurtaGolf.sol index 3d36184..b59b08a 100644 --- a/src/CurtaGolf.sol +++ b/src/CurtaGolf.sol @@ -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(); }