Skip to content

Commit

Permalink
fix: hash all parameters in salt
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Nov 18, 2023
1 parent d4047dc commit 6934af4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/SablierV2MerkleStreamerFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,18 @@ contract SablierV2MerkleStreamerFactory is ISablierV2MerkleStreamerFactory {
returns (ISablierV2MerkleStreamerLL merkleStreamerLL)
{
// Hash the parameters to generate a salt.
bytes32 salt = keccak256(abi.encodePacked(initialAdmin, lockupLinear, asset, merkleRoot, expiration));
bytes32 salt = keccak256(
abi.encodePacked(
initialAdmin,
lockupLinear,
asset,
merkleRoot,
expiration,
keccak256(abi.encode(streamDurations)),
cancelable,
transferable
)
);

// Deploy the Merkle streamer with CREATE2.
merkleStreamerLL = new SablierV2MerkleStreamerLL{salt: salt} (
Expand Down
13 changes: 12 additions & 1 deletion test/Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,18 @@ abstract contract Base_Test is DeployOptimized, Events, Merkle, V2CoreAssertions
internal
returns (address)
{
bytes32 salt = keccak256(abi.encodePacked(admin, lockupLinear, asset, merkleRoot, expiration));
bytes32 salt = keccak256(
abi.encodePacked(
admin,
lockupLinear,
asset,
merkleRoot,
expiration,
keccak256(abi.encode(defaults.durations())),
defaults.CANCELABLE(),
defaults.TRANSFERABLE()
)
);
bytes32 creationBytecodeHash = keccak256(getMerkleStreamerLLBytecode(admin, merkleRoot, expiration));
return computeCreate2Address({
salt: salt,
Expand Down

0 comments on commit 6934af4

Please sign in to comment.