-
Notifications
You must be signed in to change notification settings - Fork 958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mask Immutables in Local Verify Task #691
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
I looked into it, and the constructor arguments are not included in the Hardhat deployment data. |
We don't have any arguments, do we? There is an "args" field in the artifacts with an empty array. |
You can also do an diff -u --color \
<(cat deployments/localhost/SafeProxyFactory.json | jq '.deployedBytecode') \
<(curl -s "$NODE_URL" -X POST -H 'content-type: application/json' --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"id\":0,\"params\":[{\"data\":$(cat deployments/localhost/SafeProxyFactory.json | jq '.bytecode')}]}" | jq '.result') |
🤦 - correct. For some reason I assumed that the |
Then I'd say it's good as is |
@@ -11,24 +11,31 @@ task("local-verify", "Verifies that the local deployment files correspond to the | |||
delete meta.compiler; | |||
delete meta.output; | |||
delete meta.version; | |||
const sources = Object.values<any>(meta.sources); | |||
const sources = Object.values<Record<string, unknown>>(meta.sources); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huge props for fixing types 💪
Fixes #689
The local verification task does not work correctly for contracts with
immutable
s. This is because,immutable
values get written when the contract's init code executes on-chain, but uses0
place holders in thedeployedBytecode
compiler output.This causes the code that is fetched from the deployed contract to differ slightly from the compiler's byte code output (fetched code has non-0
immutable
values, while the compiler output has 0immutable
values).The fix is to mask the
immutable
s from the fetched code with 0's before comparing.With this fix,
local-verify
script now works for theSimulateTxAccessor
contract: