Skip to content
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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
uses: ./.github/actions

- name: Integration Test Contracts
run: time forge test --mc IntegrationTest -vvv --fork-url $ETH_RPC_URL
run: time forge test --mc IntegrationTest -vvv --fork-url $ETH_RPC_URL --libraries src/BytesHelper.sol:BytesHelper:0x98afd3357918eb5d4be1246ead2256a27de369e3
27 changes: 26 additions & 1 deletion addresses/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"isContract": true
},
{
"addr": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"addr": "0x29B28B0Ff5B6B26448F3Ac02Cd209539626D96Ab",
"name": "DEPLOYER_EOA",
"isContract": false
},
Expand Down Expand Up @@ -68,5 +68,30 @@
"addr": "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5",
"name": "C_ETHER",
"isContract": true
},
{
"addr": "0x11abBC55900602B8A3a6DC71e25a1Ea40CE114a7",
"isContract": true,
"name": "TIMELOCK_FACTORY"
},
{
"addr": "0x3B957Bf3Fbc615792c3FFa97fce892EF4FA9ee72",
"isContract": true,
"name": "RECOVERY_SPELL_FACTORY"
},
{
"addr": "0xfC2275aD9C251bF3792d52E03B3E10371d18D62d",
"isContract": true,
"name": "GUARD"
},
{
"addr": "0x48f351443c58aDFf7e1e5D2B1DF30817F9a1C497",
"isContract": true,
"name": "INSTANCE_DEPLOYER"
},
{
"addr": "0x9aaba81F20B125cE656dC37154CAAF05dfD3049d",
"isContract": true,
"name": "ADDRESS_CALCULATION"
}
]
25 changes: 25 additions & 0 deletions addresses/8453.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,30 @@
"addr": "0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552",
"name": "SAFE_LOGIC",
"isContract": true
},
{
"addr": "0x11abBC55900602B8A3a6DC71e25a1Ea40CE114a7",
"isContract": true,
"name": "TIMELOCK_FACTORY"
},
{
"addr": "0x3B957Bf3Fbc615792c3FFa97fce892EF4FA9ee72",
"isContract": true,
"name": "RECOVERY_SPELL_FACTORY"
},
{
"addr": "0xfC2275aD9C251bF3792d52E03B3E10371d18D62d",
"isContract": true,
"name": "GUARD"
},
{
"addr": "0x48f351443c58aDFf7e1e5D2B1DF30817F9a1C497",
"isContract": true,
"name": "INSTANCE_DEPLOYER"
},
{
"addr": "0x9aaba81F20B125cE656dC37154CAAF05dfD3049d",
"isContract": true,
"name": "ADDRESS_CALCULATION"
}
]
21 changes: 15 additions & 6 deletions src/deploy/SystemDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;

Expand Down Expand Up @@ -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)),
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

keccak256(
type(TimelockFactory).runtimeCode.sliceBytes(0, 24116)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is differences in last 128 bytes. Works with sliceBytes(0, 24187).
I don't understand why 128 bytes are different when CBOR bytes tell that metadata is 51 bytes long.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last 138 bytes cab be removed.

a2646970667358221220faf3b7cb28c8bf5fe4d307231fad9edac131eccb00c5a5e363d013efe4a59a9764736f6c6343000819003308f913ffb0ba4369820330664f249be5a609b8d6503893d07eda734fd42bd4c6a264697066735822122090333ae03f10ea21d15a94de29f40350f00e215ed90ab2b63844e3dae2d05b6364736f6c63430008190033

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)),
Copy link
Collaborator

Choose a reason for hiding this comment

The 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. sliceBytes(0, 953)

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)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last 106. bytes are metadata. two metadatas one for RecoverySpell and other for RecoverySpellFactory. So last 106 bytes should be removed.
Ref: ethereum/solidity#14827

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the data to be removed.

a26469706673582212207bc965e90185648126b9111f159955c4b4afbc31cf59b1f93a4ec86501d4215e64736f6c63430008190033a2646970667358221220903c7bdd4b158ba0037ba1c0fc25619bd86084c68e73a918d80f5b7310271df864736f6c63430008190033

keccak256(
type(RecoverySpellFactory).runtimeCode.sliceBytes(0, 9470)
),
"Incorrect RecoverySpellFactory Bytecode"
);

Expand Down
Loading