Open
Conversation
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Comment on lines
+106
to
+148
| function _validate(VmSafe.AccountAccess[] memory, Action[] memory, address) internal view override { | ||
| SuperchainAddressRegistry.ChainInfo[] memory chains = superchainAddrRegistry.getChains(); | ||
|
|
||
| // Cache standard validator's expected values (same for all chains) | ||
| address standardL1PAO = STANDARD_VALIDATOR.l1PAOMultisig(); | ||
| address standardChallenger = STANDARD_VALIDATOR.challenger(); | ||
|
|
||
| for (uint256 i = 0; i < chains.length; i++) { | ||
| uint256 chainId = chains[i].chainId; | ||
|
|
||
| IOPContractsManagerStandardValidator.ValidationInput memory input = IOPContractsManagerStandardValidator | ||
| .ValidationInput({ | ||
| sysCfg: ISystemConfig(superchainAddrRegistry.getAddress("SystemConfigProxy", chainId)), | ||
| cannonPrestate: Claim.unwrap(upgrades[chainId].cannonPrestate), | ||
| cannonKonaPrestate: Claim.unwrap(upgrades[chainId].cannonKonaPrestate), | ||
| l2ChainID: chainId, | ||
| proposer: superchainAddrRegistry.getAddress("Proposer", chainId) | ||
| }); | ||
|
|
||
| // Compute overrides: non-zero only if chain differs from standard | ||
| address l1PAOOverride = superchainAddrRegistry.getAddress("ProxyAdminOwner", chainId); | ||
| address challengerOverride = superchainAddrRegistry.getAddress("Challenger", chainId); | ||
|
|
||
| l1PAOOverride = l1PAOOverride != standardL1PAO ? l1PAOOverride : address(0); | ||
| challengerOverride = challengerOverride != standardChallenger ? challengerOverride : address(0); | ||
|
|
||
| string memory errors; | ||
| if (l1PAOOverride != address(0) || challengerOverride != address(0)) { | ||
| errors = STANDARD_VALIDATOR.validateWithOverrides({ | ||
| _input: input, | ||
| _allowFailure: true, | ||
| _overrides: IOPContractsManagerStandardValidator.ValidationOverrides({ | ||
| l1PAOMultisig: l1PAOOverride, | ||
| challenger: challengerOverride | ||
| }) | ||
| }); | ||
| } else { | ||
| errors = STANDARD_VALIDATOR.validate({_input: input, _allowFailure: true}); | ||
| } | ||
|
|
||
| string memory expErrors = upgrades[chainId].expectedValidationErrors; | ||
| require(errors.eq(expErrors), string.concat("Unexpected errors: ", errors, "; expected: ", expErrors)); | ||
| } |
Contributor
There was a problem hiding this comment.
Critical bug: The validation function has the same issue as _build - it validates ALL chains from the registry without checking if they have configurations. If a chain exists in the registry but not in the upgrades mapping, it will validate using default zero values.
What breaks: For chains without configurations, upgrades[chainId] returns default struct values (zero prestates, empty string for expectedValidationErrors). This will pass incorrect zero prestates to the validator and compare against an empty expected error string, causing validation failures or false positives.
Fix: Only validate chains that have configurations:
function _validate(VmSafe.AccountAccess[] memory, Action[] memory, address) internal view override {
SuperchainAddressRegistry.ChainInfo[] memory chains = superchainAddrRegistry.getChains();
address standardL1PAO = STANDARD_VALIDATOR.l1PAOMultisig();
address standardChallenger = STANDARD_VALIDATOR.challenger();
for (uint256 i = 0; i < chains.length; i++) {
uint256 chainId = chains[i].chainId;
// Skip chains without configurations
if (upgrades[chainId].chainId == 0) continue;
// ... rest of validation logic
}
}
Suggested change
| function _validate(VmSafe.AccountAccess[] memory, Action[] memory, address) internal view override { | |
| SuperchainAddressRegistry.ChainInfo[] memory chains = superchainAddrRegistry.getChains(); | |
| // Cache standard validator's expected values (same for all chains) | |
| address standardL1PAO = STANDARD_VALIDATOR.l1PAOMultisig(); | |
| address standardChallenger = STANDARD_VALIDATOR.challenger(); | |
| for (uint256 i = 0; i < chains.length; i++) { | |
| uint256 chainId = chains[i].chainId; | |
| IOPContractsManagerStandardValidator.ValidationInput memory input = IOPContractsManagerStandardValidator | |
| .ValidationInput({ | |
| sysCfg: ISystemConfig(superchainAddrRegistry.getAddress("SystemConfigProxy", chainId)), | |
| cannonPrestate: Claim.unwrap(upgrades[chainId].cannonPrestate), | |
| cannonKonaPrestate: Claim.unwrap(upgrades[chainId].cannonKonaPrestate), | |
| l2ChainID: chainId, | |
| proposer: superchainAddrRegistry.getAddress("Proposer", chainId) | |
| }); | |
| // Compute overrides: non-zero only if chain differs from standard | |
| address l1PAOOverride = superchainAddrRegistry.getAddress("ProxyAdminOwner", chainId); | |
| address challengerOverride = superchainAddrRegistry.getAddress("Challenger", chainId); | |
| l1PAOOverride = l1PAOOverride != standardL1PAO ? l1PAOOverride : address(0); | |
| challengerOverride = challengerOverride != standardChallenger ? challengerOverride : address(0); | |
| string memory errors; | |
| if (l1PAOOverride != address(0) || challengerOverride != address(0)) { | |
| errors = STANDARD_VALIDATOR.validateWithOverrides({ | |
| _input: input, | |
| _allowFailure: true, | |
| _overrides: IOPContractsManagerStandardValidator.ValidationOverrides({ | |
| l1PAOMultisig: l1PAOOverride, | |
| challenger: challengerOverride | |
| }) | |
| }); | |
| } else { | |
| errors = STANDARD_VALIDATOR.validate({_input: input, _allowFailure: true}); | |
| } | |
| string memory expErrors = upgrades[chainId].expectedValidationErrors; | |
| require(errors.eq(expErrors), string.concat("Unexpected errors: ", errors, "; expected: ", expErrors)); | |
| } | |
| function _validate(VmSafe.AccountAccess[] memory, Action[] memory, address) internal view override { | |
| SuperchainAddressRegistry.ChainInfo[] memory chains = superchainAddrRegistry.getChains(); | |
| // Cache standard validator's expected values (same for all chains) | |
| address standardL1PAO = STANDARD_VALIDATOR.l1PAOMultisig(); | |
| address standardChallenger = STANDARD_VALIDATOR.challenger(); | |
| for (uint256 i = 0; i < chains.length; i++) { | |
| uint256 chainId = chains[i].chainId; | |
| // Skip chains without configurations | |
| if (upgrades[chainId].chainId == 0) continue; | |
| IOPContractsManagerStandardValidator.ValidationInput memory input = IOPContractsManagerStandardValidator | |
| .ValidationInput({ | |
| sysCfg: ISystemConfig(superchainAddrRegistry.getAddress("SystemConfigProxy", chainId)), | |
| cannonPrestate: Claim.unwrap(upgrades[chainId].cannonPrestate), | |
| cannonKonaPrestate: Claim.unwrap(upgrades[chainId].cannonKonaPrestate), | |
| l2ChainID: chainId, | |
| proposer: superchainAddrRegistry.getAddress("Proposer", chainId) | |
| }); | |
| // Compute overrides: non-zero only if chain differs from standard | |
| address l1PAOOverride = superchainAddrRegistry.getAddress("ProxyAdminOwner", chainId); | |
| address challengerOverride = superchainAddrRegistry.getAddress("Challenger", chainId); | |
| l1PAOOverride = l1PAOOverride != standardL1PAO ? l1PAOOverride : address(0); | |
| challengerOverride = challengerOverride != standardChallenger ? challengerOverride : address(0); | |
| string memory errors; | |
| if (l1PAOOverride != address(0) || challengerOverride != address(0)) { | |
| errors = STANDARD_VALIDATOR.validateWithOverrides({ | |
| _input: input, | |
| _allowFailure: true, | |
| _overrides: IOPContractsManagerStandardValidator.ValidationOverrides({ | |
| l1PAOMultisig: l1PAOOverride, | |
| challenger: challengerOverride | |
| }) | |
| }); | |
| } else { | |
| errors = STANDARD_VALIDATOR.validate({_input: input, _allowFailure: true}); | |
| } | |
| string memory expErrors = upgrades[chainId].expectedValidationErrors; | |
| require(errors.eq(expErrors), string.concat("Unexpected errors: ", errors, "; expected: ", expErrors)); | |
| } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update prestate template for OPCMv600/U18