Comments (5)
@Philogy this is a feature and not a bug. That's our design to implement safely a permissioned deploy protection and cross-chain redeploy protection (see here). The only way to not double hash the salt
is by generating it pseudo-randomly by CreateX
. We built on purpose our own cruncher createXcrunch
to accommodate for these features, where you not only can mine for leading zeros, or containing zeros, but also pattern-matching addresses. If you don't like it, fair, I can offer my predecessor of CreateX
, called Create2Deployer
(that one is added as a predeploy in the OP stack fyi).
from createx.
I understand. I'm just wondering why you couldn't have had all these features without having to rehash the salt, what additional security does it provide?
from createx.
I understand. I'm just wondering why you couldn't have had all these features without having to rehash the salt, what additional security does it provide?
I'm not sure I fully understand your question. We need to have a bytes32
salt
, depending on whether you want different protections (as elaborated in the section I linked above), you need to transform the salt
and the additional attributes msg.sender
and/or block.chainid
into another (pseudorandom) bytes32
salt
value. And that's why we use keccak256
.
For the non-pseudo-random cases here, the salt value salt
is hashed as part of the _guard
function to prevent the safeguard mechanisms from being bypassed. The reason is that if someone deploys on chain A
with a preconfigured mechanism, anyone can calculate the inferred guardedSalt
and reuse it on chain B
otherwise (if we wouldn't hash it).
from createx.
Yeah specifically in the last case, not sure I fully understand the purpose of doing keccak256(abi.encode(salt))
. What safety feature are you hoping people won't bypass?
The pre-image is still public and anyone else can still redeploy on other chains using the un-hashed salt by running it through the function themselves, I just don't understand this part, what's the value of the extra hash?
from createx.
Yeah specifically in the last case, not sure I fully understand the purpose of doing
keccak256(abi.encode(salt))
. What safety feature are you hoping people won't bypass?
So let's make an example:
- On chain
A
I deploy a contract using a permissioned deploy protection. This will give me the finalsalt
:
guardedSalt = _efficientHash({a: bytes32(uint256(uint160(msg.sender))), b: salt});
- Someone else sees this deployment, and can calculate the
guardedSalt
(or simply copy it from a transaction debugger). This person deploys on chainB
the same initcode with theguardedSalt
as input. Since themsg.sender
doesn't match in theif else
statement in the function_guard
, the code would lead him to the finalelse
statement. If we didn't hash here thesalt
, he would be able to deploy the same initcode from his address even though the original deployment configured a permissioned deploy protection (i.e. it's only me who can deploy it). Does this make sense?
from createx.
Related Issues (20)
- ➕ Add Polygon Amoy Testnet Deployment HOT 6
- 💥 Build a Simple SDK for Use Without Knowledge of the Interface, ABI, or Typechain Definitions HOT 4
- ➕ Add Mode Sepolia Testnet Deployment HOT 1
- ➕ Add Mode Main Network Deployment HOT 3
- ➕ Add Build on Bitcoin (BOB) Test Network Deployment
- ➕ Add Build on Bitcoin (BOB) Main Network Deployment HOT 1
- ➕ Add Fraxtal Main Network Deployment HOT 1
- 🔁 Upgrade Solidity Version to `0.8.23` HOT 1
- ⚡️ Gas Reports Summary for `CreateX` HOT 1
- 💥 Turn the `customChains` Object Into a Separate Package HOT 6
- Clarification request - PK management of CreateX deployer
- 💥 Build `CreateXCrunch` HOT 1
- 💥 Create Dune Dashboard to Track Usage Metrics
- ➕ Add zkSync Mainnet HOT 3
- ➕ Add OP-Endurance Test Network HOT 3
- ➕ Add Blast Test Network Deployment HOT 1
- ➕ Add DOS Chain Test and Main Network Deployments HOT 3
- ➕ Add Fraxtal Testnet Deployment HOT 4
- 💥 Compute Vanity Addresses HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from createx.