Skip to content

Commit

Permalink
Add comments on secret generation in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
byshape committed Jul 30, 2024
1 parent 40b184c commit 1e24f9a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/integration/MerkleStorageInvalidator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ contract MerkleStorageInvalidatorIntTest is BaseSetup {
dstWithParts = Address.wrap(uint256(uint160(address(dai))) | (PARTS_AMOUNT << 240));

for (uint256 i = 0; i < SECRETS_AMOUNT; i++) {
// Note: This is not production-ready code. Use cryptographically secure random to generate secrets.
hashedSecrets[i] = keccak256(abi.encodePacked(i));
hashedPairs[i] = keccak256(abi.encodePacked(i, hashedSecrets[i]));
}
Expand Down
1 change: 1 addition & 0 deletions test/unit/EscrowFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract EscrowFactoryTest is BaseSetup {
function setUp() public virtual override {
BaseSetup.setUp();

// Note: This is not production-ready code. Use cryptographically secure random to generate secrets.
for (uint256 i = 0; i < SECRETS_AMOUNT; i++) {
hashedSecrets[i] = keccak256(abi.encodePacked(i));
hashedPairs[i] = keccak256(abi.encodePacked(i, hashedSecrets[i]));
Expand Down
2 changes: 2 additions & 0 deletions test/unit/MerkleStorageInvalidator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ contract MerkleStorageInvalidatorTest is BaseSetup {
bytes32[] memory hashedSecrets = new bytes32[](secretsAmount);
bytes32[] memory hashedPairs = new bytes32[](secretsAmount);

// Note: This is not production-ready code. Use cryptographically secure random to generate secrets.
for (uint256 i = 0; i < secretsAmount; i++) {
hashedSecrets[i] = keccak256(abi.encodePacked(i));
hashedPairs[i] = keccak256(abi.encodePacked(i, hashedSecrets[i]));
Expand Down Expand Up @@ -74,6 +75,7 @@ contract MerkleStorageInvalidatorTest is BaseSetup {
bytes32[] memory hashedSecrets = new bytes32[](secretsAmount);
bytes32[] memory hashedPairs = new bytes32[](secretsAmount);

// Note: This is not production-ready code. Use cryptographically secure random to generate secrets.
for (uint256 i = 0; i < secretsAmount; i++) {
hashedSecrets[i] = keccak256(abi.encodePacked(i));
hashedPairs[i] = keccak256(abi.encodePacked(i, hashedSecrets[i]));
Expand Down

0 comments on commit 1e24f9a

Please sign in to comment.