I deployed the same contract 2 times, they would have the same bytecode and the same extcodesize, but when trying this in Foundry I'm getting different hashes:
address anotherChallengeImpl = address(new MyContract());
address anotherChallengeImpl2 = address(new MyContract());
bytes32 codeHash;
console.log("CodeHash of another Implementations:");
assembly {
codeHash := extcodehash(anotherChallengeImpl)
}
console.logBytes32(codeHash);
assembly {
codeHash := extcodehash(anotherChallengeImpl2)
}
console.logBytes32(codeHash);
Output:
CodeHash of another Implementations:
0x6a8ae1efefa1130954998d656c53df68c351e99fc0e0aed5f976fd3f6dc9514c
0x78848a0409fe43dce452de5122ea366da5768c4e8bfabdc197fb196200dbd0db
Does the bytecode contain something else and my reasoning is wrong?
did you used the same constructor args ?
No constructor args, exactly like in the test snippet I pasted
i tried your simple code it's returns the same bytes (size) , but i don't understand Exactly ;as i understood when you deploy a new implementation contract two times with the same logic (code) you get Different byte code size? correct me if i'm wrong
I think both of the transactions need to have the same nonce
are you doing anything in constructor of MyContract?
Обсуждают сегодня