Skip to content

Commit

Permalink
refactor: empty out target and data
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRBerg committed Jun 23, 2023
1 parent 17f65af commit af7353c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/PRBProxyRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ contract PRBProxyRegistry is IPRBProxyRegistry {
// Prevent front-running the salt by hashing the concatenation of "tx.origin" and the user-provided seed.
bytes32 salt = keccak256(abi.encode(tx.origin, seed));

// Deploy the proxy with CREATE2, and execute the delegate call in the constructor.
// Set the constructor params.
address owner = msg.sender;
constructorParams = ConstructorParams({ owner: owner, target: target, data: data });

// Deploy the proxy with CREATE2.
proxy = new PRBProxy{ salt: salt }();
delete constructorParams;

Expand Down Expand Up @@ -128,8 +130,10 @@ contract PRBProxyRegistry is IPRBProxyRegistry {
// Prevent front-running the salt by hashing the concatenation of "tx.origin" and the user-provided seed.
bytes32 salt = keccak256(abi.encode(tx.origin, seed));

// Set the owner and empty out the target and the data, as a precautionary step.
constructorParams = ConstructorParams({ owner: owner, target: address(0), data: "" });

// Deploy the proxy with CREATE2.
constructorParams.owner = owner;
proxy = new PRBProxy{ salt: salt }();
delete constructorParams;

Expand Down
Loading

0 comments on commit af7353c

Please sign in to comment.