From e9b9b89ca5d2b19baadd69b1fd7ec59ea202e71a Mon Sep 17 00:00:00 2001 From: sudo rm -rf --no-preserve-root / Date: Mon, 7 Oct 2024 14:36:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20Add=20Note=20on=20`salt`-Based?= =?UTF-8?q?=20Address=20Calculations=20(#141)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🕓 Changelog Add clarification on what `salt` value to use for the read-only functions [`computeCreate2Address(bytes32,bytes32)`](https://github.com/pcaversaccio/createx/blob/main/src/CreateX.sol#L600-L610) and [`computeCreate3Address(bytes32)`](https://github.com/pcaversaccio/createx/blob/main/src/CreateX.sol#L857-L867) (resolves #140). --------- Signed-off-by: Pascal Marco Caversaccio --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ac4328d..78949cc 100644 --- a/README.md +++ b/README.md @@ -772,6 +772,9 @@ Please note that when you configure a permissioned deploy protection, you **must Furthermore, you can configure _only_ cross-chain redeploy protection by setting the first 20 bytes equal to the zero address `0x0000000000000000000000000000000000000000`. The rationale behind this logic is to prevent a pseudo-randomly generated 32 byte salt from inadvertently activating cross-chain redeploy protection. Also in this case, if you don't specify a cross-chain redeploy protection, i.e. the 21st byte is greater than `0x01`, the function reverts. The underlying reason for this logic is as well to enforce developer explicitness. +> [!IMPORTANT] +> When using the read-only functions [`computeCreate2Address(bytes32,bytes32)`](https://github.com/pcaversaccio/createx/blob/main/src/CreateX.sol#L600-L610) or [`computeCreate3Address(bytes32)`](https://github.com/pcaversaccio/createx/blob/main/src/CreateX.sol#L857-L867), it is essential to provide the _guarded_ `salt` value, meaning the value after being processed by the `_guard` function, as the input parameter. This ensures the correct computation of the deployment address. For more details, refer to [this issue](https://github.com/pcaversaccio/createx/issues/140). + ### Pseudo-Random Salt Value For developer convenience, the [`CreateX`](./src/CreateX.sol) contract offers several overloaded functions that generate the salt value pseudo-randomly using a diverse selection of block and transaction properties. Please note that this approach does not guarantee true randomness!