-
Notifications
You must be signed in to change notification settings - Fork 49
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
sep/027: upgrade and re-initialize SystemConfig
#418
base: main
Are you sure you want to change the base?
Conversation
SystemConfig
tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md
Outdated
Show resolved
Hide resolved
SystemConfig
SystemConfig
50aeb48
to
2e881b4
Compare
tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol
Outdated
Show resolved
Hide resolved
tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol
Outdated
Show resolved
Hide resolved
tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md
Outdated
Show resolved
Hide resolved
existing task in flight for 025
…ave them, e.g. metal)
…kip only if not found in the TOML file
tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol
Show resolved
Hide resolved
constructor(string memory l1ChainName, string memory l2ChainName, string memory release) | ||
SuperchainRegistry(l1ChainName, l2ChainName, release) |
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.
Since l1ChainName
and l2ChainName
are storage variable names in the SuperchainRegistry
contract, using them as argument names in the constructors shadows those variable names
constructor(string memory l1ChainName, string memory l2ChainName, string memory release) | |
SuperchainRegistry(l1ChainName, l2ChainName, release) | |
constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) | |
SuperchainRegistry(_l1ChainName, _l1ChainName, _release) |
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.
import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | ||
import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; | ||
|
||
contract SystemConfigUpgrade is SuperchainRegistry { |
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.
Can you add comments explaining what this contract is supposed to do and when it should be used? Would be good to have explanatory comments in Verification.s.sol
as well
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.
import {console2 as console} from "forge-std/console2.sol"; | ||
import {Vm} from "forge-std/Vm.sol"; | ||
import {LibString} from "solady/utils/LibString.sol"; | ||
import {SuperchainRegistry} from "script/verification/Verification.s.sol"; | ||
import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; | ||
import {ISystemConfig} from "./ISystemConfig.sol"; | ||
import {IResourceMetering} from "./IResourceMetering.sol"; | ||
import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; | ||
import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | ||
import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; |
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.
removing unused imports
import {console2 as console} from "forge-std/console2.sol"; | |
import {Vm} from "forge-std/Vm.sol"; | |
import {LibString} from "solady/utils/LibString.sol"; | |
import {SuperchainRegistry} from "script/verification/Verification.s.sol"; | |
import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; | |
import {ISystemConfig} from "./ISystemConfig.sol"; | |
import {IResourceMetering} from "./IResourceMetering.sol"; | |
import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; | |
import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | |
import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; | |
import {LibString} from "solady/utils/LibString.sol"; | |
import {SuperchainRegistry} from "script/verification/Verification.s.sol"; | |
import {ISystemConfig} from "./ISystemConfig.sol"; | |
import {IResourceMetering} from "./IResourceMetering.sol"; |
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.
address[] memory exceptions = new address[](4); | ||
exceptions[0] = previous.owner; // NOTE this can be removed for mainnet | ||
exceptions[1] = address(uint160(uint256((previous.batcherHash)))); | ||
exceptions[2] = previous.unsafeBlockSigner; | ||
exceptions[3] = previous.batchInbox; |
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.
We can make this conditional based off chain ID to remove the need for the note (untested code, please review/test it before applying suggestion)
address[] memory exceptions = new address[](4); | |
exceptions[0] = previous.owner; // NOTE this can be removed for mainnet | |
exceptions[1] = address(uint160(uint256((previous.batcherHash)))); | |
exceptions[2] = previous.unsafeBlockSigner; | |
exceptions[3] = previous.batchInbox; | |
uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. | |
address[] memory exceptions = new address[](len); | |
uint256 i = 0; | |
exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); | |
exceptions[i++] = previous.unsafeBlockSigner; | |
exceptions[i++] = previous.batchInbox; | |
if (block.chainid != 1) exceptions[i++] = previous.owner; |
constructor(string memory l1ChainName, string memory l2ChainName, string memory release) | ||
SystemConfigUpgrade(l1ChainName, l2ChainName, release) |
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.
same comment on variable shadowing
constructor(string memory l1ChainName, string memory l2ChainName, string memory release) | |
SystemConfigUpgrade(l1ChainName, l2ChainName, release) | |
constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) | |
SystemConfigUpgrade(_l1ChainName, _l2ChainName, _release) |
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.
import {console2 as console} from "forge-std/console2.sol"; | ||
import {Vm} from "forge-std/Vm.sol"; | ||
import {LibString} from "solady/utils/LibString.sol"; | ||
import {SuperchainRegistry} from "script/verification/Verification.s.sol"; | ||
import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; | ||
import {ISystemConfig} from "./ISystemConfig.sol"; | ||
import {IResourceMetering} from "./IResourceMetering.sol"; | ||
import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; | ||
import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | ||
import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; |
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.
removing unused imports
import {console2 as console} from "forge-std/console2.sol"; | |
import {Vm} from "forge-std/Vm.sol"; | |
import {LibString} from "solady/utils/LibString.sol"; | |
import {SuperchainRegistry} from "script/verification/Verification.s.sol"; | |
import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; | |
import {ISystemConfig} from "./ISystemConfig.sol"; | |
import {IResourceMetering} from "./IResourceMetering.sol"; | |
import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; | |
import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | |
import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; | |
import {console2 as console} from "forge-std/console2.sol"; | |
import {LibString} from "solady/utils/LibString.sol"; | |
import {ISystemConfig} from "./ISystemConfig.sol"; |
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.
import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; | ||
import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; | ||
|
||
contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { |
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.
Same comment about adding explanatory code comments
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.
uint256 reencodedScalar = | ||
(uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); |
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.
Is this only needed temporarily since we are upgrading the SystemConfig to a version that no longer needs encoding?
if ( | ||
uint8(previous.scalar >> 248) == 1 // most significant bit | ||
) { |
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.
Why is this behind an if
block? A code comment for what this method is testing would be helpful for people not familiar with this encoding
function tryReadAddress(string memory toml, string memory key) internal pure returns (address) { | ||
try vmSafe.parseTomlAddress(toml, key) returns (address a) { | ||
return a; | ||
} catch { | ||
console.log("failed to read address for ", key); | ||
return address(0); | ||
} | ||
} |
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.
We can delete this, update our forge-std version to the latest release, and instead use: https://github.com/foundry-rs/forge-std/blob/b5a86914561f38735ef1fc357685de3e7c92dc48/src/StdToml.sol#L148
You can either use it like this:
stdToml.readAddressOr(toml, "$.addresses.AnchorStateRegistryProxy", address(0));
or like this, similar to LibString
using StdToml for string;
// --- snip ---
toml.readAddressOr("$.addresses.AnchorStateRegistryProxy", address(0));
@@ -2,6 +2,8 @@ | |||
|
|||
Status: [EXECUTED](https://sepolia.etherscan.io/tx/0x88bd1d85740af3741e2ed96d6fd07f2abb4541afc667625480bf6a28451c4d6d) | |||
|
|||
> ⚠️ **Warning:** This task is incorrect and is superceded by [Task 027](../027-holocene-system-config-upgrade-and-init-multi-chain/) |
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.
nit (according to my spellchecker extension, I also thought your spelling was correct)
> ⚠️ **Warning:** This task is incorrect and is superceded by [Task 027](../027-holocene-system-config-upgrade-and-init-multi-chain/) | |
> ⚠️ **Warning:** This task is incorrect and is superseded by [Task 027](../027-holocene-system-config-upgrade-and-init-multi-chain/) |
|
||
contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { | ||
string constant l1ChainName = "sepolia"; | ||
string constant release = "v1.8.0-rc.4"; |
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 gov proposal has passed so we don't need to use the RC anymore and should be using the finalized release, which is what we want for mainnet also
string constant release = "v1.8.0-rc.4"; | |
string constant release = "v1.8.0"; |
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'd suggest deleting this file since we don't need it, just one less thing to review
@@ -0,0 +1,30 @@ | |||
# Holocene Hardfork Upgrade - `SystemConfig` | |||
|
|||
Status: DRAFT, NOT READY TO SIGN |
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.
what do we need for this to become ready to sign?
Status: DRAFT, NOT READY TO SIGN | |
Status: DRAFT, NOT READY TO SIGN |
This upgrades the `SystemConfig` in the | ||
[v1.8.0-rc.4](https://github.com/ethereum-optimism/optimism/tree/v1.8.0-rc.4) release. |
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.
we should just use 1.8.0 now that it's passed
This upgrades the `SystemConfig` in the | |
[v1.8.0-rc.4](https://github.com/ethereum-optimism/optimism/tree/v1.8.0-rc.4) release. | |
This upgrades the `SystemConfig` in the | |
[v1.8.0](https://github.com/ethereum-optimism/optimism/tree/v1.8.0) release. |
|
||
## Pre-deployments | ||
|
||
- `SystemConfig` - `0x33b83E4C305c908B2Fc181dDa36e230213058d7d` |
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.
Any messages you can link to so I can verify this address?
## Simulation | ||
|
||
Please see the "Simulating and Verifying the Transaction" instructions in [NESTED.md](../../../NESTED.md). | ||
When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks/<path>/NestedSignFromJson.s.sol`. |
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.
When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks/<path>/NestedSignFromJson.s.sol`. | |
When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol`. |
@@ -0,0 +1,85 @@ | |||
# Validation |
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 have not yet validated this file or run the simulation
require(reencodedScalar == previous.scalar, "scalar-100 (reencoding produced incorrect result)"); | ||
// We do this check last because it would fail if the scalar is wrong, and we get less debug info from it. | ||
// It checks all of the other fields which should not have changed (via a hash). | ||
super.checkSystemConfigUpgrade(); |
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 think we should call this unconditionally, and pull the scalar check out of the base contract into this one.
TODO
020
to signify that it was incorrect and that this task supercedes itCloses #394