-
Notifications
You must be signed in to change notification settings - Fork 8
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
deployment: base and mainnet #50
Changes from all commits
fe43dfb
50d846c
a21743f
90ac20c
5b4ebbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import {Addresses} from "@forge-proposal-simulator/addresses/Addresses.sol"; | |
|
||
import {Guard} from "src/Guard.sol"; | ||
import {Timelock} from "src/Timelock.sol"; | ||
import {BytesHelper} from "src/BytesHelper.sol"; | ||
import {TimelockFactory} from "src/TimelockFactory.sol"; | ||
import {InstanceDeployer} from "src/InstanceDeployer.sol"; | ||
import {AddressCalculation} from "src/views/AddressCalculation.sol"; | ||
|
@@ -15,6 +16,8 @@ import {RecoverySpellFactory} from "src/RecoverySpellFactory.sol"; | |
/// all contracts are permissionless | ||
/// DO_PRINT=false DO_BUILD=false DO_RUN=false DO_DEPLOY=true DO_VALIDATE=true forge script src/deploy/SystemDeploy.s.sol:SystemDeploy --fork-url base -vvvvv | ||
contract SystemDeploy is MultisigProposal { | ||
using BytesHelper for bytes; | ||
|
||
bytes32 public salt = | ||
0x0000000000000000000000000000000000000000000000000000000000003afe; | ||
|
||
|
@@ -77,23 +80,29 @@ contract SystemDeploy is MultisigProposal { | |
if (addresses.isAddressSet("TIMELOCK_FACTORY")) { | ||
address factory = addresses.getAddress("TIMELOCK_FACTORY"); | ||
assertEq( | ||
keccak256(factory.code), | ||
keccak256(type(TimelockFactory).runtimeCode), | ||
keccak256(factory.code.sliceBytes(0, 24116)), | ||
keccak256( | ||
type(TimelockFactory).runtimeCode.sliceBytes(0, 24116) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is differences in last 128 bytes. Works with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. last 138 bytes cab be removed.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah i'm not sure what accounts for this change either, only that it is necessary to make things work. |
||
), | ||
"Incorrect TimelockFactory Bytecode" | ||
); | ||
|
||
address guard = addresses.getAddress("GUARD"); | ||
|
||
assertEq( | ||
keccak256(guard.code), | ||
keccak256(type(Guard).runtimeCode), | ||
keccak256(guard.code.sliceBytes(0, 950)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is difference in last 53 bytes. 2 CBOR bytes and 51 metadata bytes. so removing last 53 bytes would work i.e. |
||
keccak256(type(Guard).runtimeCode.sliceBytes(0, 950)), | ||
"Incorrect Guard Bytecode" | ||
); | ||
|
||
address recoverySpellFactory = | ||
addresses.getAddress("RECOVERY_SPELL_FACTORY"); | ||
|
||
assertEq( | ||
keccak256(recoverySpellFactory.code), | ||
keccak256(type(RecoverySpellFactory).runtimeCode), | ||
keccak256(recoverySpellFactory.code.sliceBytes(0, 9470)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Last 106. bytes are metadata. two metadatas one for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the data to be removed.
|
||
keccak256( | ||
type(RecoverySpellFactory).runtimeCode.sliceBytes(0, 9470) | ||
), | ||
"Incorrect RecoverySpellFactory Bytecode" | ||
); | ||
|
||
|
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.
I thought
.code
only returns the runtime bytecode. What is the reason for the slice here? Could you add a comment explaining, please? And why at 24116? How did you calculate that?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.
It was calculated based on the data that afterwards we needed to remove.
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.
The only thing we can get from a deployed contract is the bytecode as it exists onchain. So yes, that is what we are getting here.