Skip to content

Commit 32d2b05

Browse files
mbaxterajsutton
andauthored
opcm-standard-validator: Re-enable tests for v2 contracts, validate proposer (#17955)
* Add proposer field to StandarValidator.ValidationInput * Update deploy to save PDG address depending on v2 feature flag * Start working on tests * Fix test that mocks a prestate value * Move helpers into shared library * Cut unnecessary bytes utils * Update StandardValidator to check proposer * Start updating tests to mock gameArgs * Add game arg mocking helpers to DisputeGames.sol * Add mock helpers for remaining game args * Delete unused library * Fix new asr and weth mock helpers * Reorganize gameArg offsets * Add tests for invalid weth, asr addresses * Add tests for invalid game args * Update expected dispute game version * Fix stack-too-deep error * Inject correct gametype for v2 games * Fix handling of errors * Pull game implementation handling into a helper method * Skip gameType tests for v2 contracts * Cut unused event * Fix proposer value in upgrade tests * Remove unused import * Bump contract versions * Run pre-pr * Sticter testing: pull challenger, proposer values before upgrading * Revert change to comment * Make var naming more consistent * Update semver-lock * Avoid name conflict. * Major version bump since ValidationInput changed. --------- Co-authored-by: Adrian Sutton <[email protected]>
1 parent 8c18391 commit 32d2b05

File tree

11 files changed

+605
-199
lines changed

11 files changed

+605
-199
lines changed

packages/contracts-bedrock/interfaces/L1/IOPContractsManagerStandardValidator.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ interface IOPContractsManagerStandardValidator {
2727
ISystemConfig sysCfg;
2828
bytes32 absolutePrestate;
2929
uint256 l2ChainID;
30+
address proposer;
3031
}
3132

3233
struct ValidationOverrides {

packages/contracts-bedrock/scripts/deploy/Deploy.s.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { StandardConstants } from "scripts/deploy/StandardConstants.sol";
2222
// Libraries
2323
import { Types } from "scripts/libraries/Types.sol";
2424
import { Duration } from "src/dispute/lib/LibUDT.sol";
25+
import { DevFeatures } from "src/libraries/DevFeatures.sol";
2526
import { GameType, Claim, GameTypes, Proposal, Hash } from "src/dispute/lib/Types.sol";
2627

2728
// Interfaces
@@ -292,6 +293,9 @@ contract Deploy is Deployer {
292293
artifacts.save("OPContractsManager", address(dio.opcm));
293294
artifacts.save("DelayedWETHImpl", address(dio.delayedWETHImpl));
294295
artifacts.save("PreimageOracle", address(dio.preimageOracleSingleton));
296+
if (DevFeatures.isDevFeatureEnabled(dio.opcm.devFeatureBitmap(), DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) {
297+
artifacts.save("PermissionedDisputeGame", address(dio.permissionedDisputeGameV2Impl));
298+
}
295299

296300
// Get a contract set from the implementation addresses which were just deployed.
297301
Types.ContractSet memory impls = ChainAssertions.dioToContractSet(dio);
@@ -357,9 +361,11 @@ contract Deploy is Deployer {
357361
artifacts.save("DisputeGameFactoryProxy", address(deployOutput.disputeGameFactoryProxy));
358362
artifacts.save("PermissionedDelayedWETHProxy", address(deployOutput.delayedWETHPermissionedGameProxy));
359363
artifacts.save("AnchorStateRegistryProxy", address(deployOutput.anchorStateRegistryProxy));
360-
artifacts.save("PermissionedDisputeGame", address(deployOutput.permissionedDisputeGame));
361364
artifacts.save("OptimismPortalProxy", address(deployOutput.optimismPortalProxy));
362365
artifacts.save("OptimismPortal2Proxy", address(deployOutput.optimismPortalProxy));
366+
if (!DevFeatures.isDevFeatureEnabled(opcm.devFeatureBitmap(), DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) {
367+
artifacts.save("PermissionedDisputeGame", address(deployOutput.permissionedDisputeGame));
368+
}
363369

364370
// Check if the permissionless game implementation is already set
365371
IDisputeGameFactory factory = IDisputeGameFactory(artifacts.mustGetAddress("DisputeGameFactoryProxy"));

packages/contracts-bedrock/snapshots/abi/OPContractsManager.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,11 @@
847847
"internalType": "uint256",
848848
"name": "l2ChainID",
849849
"type": "uint256"
850+
},
851+
{
852+
"internalType": "address",
853+
"name": "proposer",
854+
"type": "address"
850855
}
851856
],
852857
"internalType": "struct OPContractsManagerStandardValidator.ValidationInput",
@@ -893,6 +898,11 @@
893898
"internalType": "uint256",
894899
"name": "l2ChainID",
895900
"type": "uint256"
901+
},
902+
{
903+
"internalType": "address",
904+
"name": "proposer",
905+
"type": "address"
896906
}
897907
],
898908
"internalType": "struct OPContractsManagerStandardValidator.ValidationInput",

packages/contracts-bedrock/snapshots/abi/OPContractsManagerStandardValidator.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@
354354
"internalType": "uint256",
355355
"name": "l2ChainID",
356356
"type": "uint256"
357+
},
358+
{
359+
"internalType": "address",
360+
"name": "proposer",
361+
"type": "address"
357362
}
358363
],
359364
"internalType": "struct OPContractsManagerStandardValidator.ValidationInput",
@@ -400,6 +405,11 @@
400405
"internalType": "uint256",
401406
"name": "l2ChainID",
402407
"type": "uint256"
408+
},
409+
{
410+
"internalType": "address",
411+
"name": "proposer",
412+
"type": "address"
403413
}
404414
],
405415
"internalType": "struct OPContractsManagerStandardValidator.ValidationInput",

packages/contracts-bedrock/snapshots/semver-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"sourceCodeHash": "0xfca613b5d055ffc4c3cbccb0773ddb9030abedc1aa6508c9e2e7727cc0cd617b"
2121
},
2222
"src/L1/OPContractsManager.sol:OPContractsManager": {
23-
"initCodeHash": "0x1a1de93a1e15a32fd621b572211bd1ceccf82d5d2b936e0aa337ea7593c1ce19",
24-
"sourceCodeHash": "0xbe7ceb48b39fc1d6c311b9d6dd9095ee72fa5cf82f72d27ec4511c97c01b02aa"
23+
"initCodeHash": "0x0fec1db69fa99c31c4b13140bceee87419b8d3342cc952063a7a268242f3a199",
24+
"sourceCodeHash": "0x2b0abd0e179a5449be392b301677554fa1d4f93af1083baa23f43ccf3cac9d02"
2525
},
2626
"src/L1/OPContractsManagerStandardValidator.sol:OPContractsManagerStandardValidator": {
27-
"initCodeHash": "0x2eaa345ba05582c67b40a1eb7ec9d54823aa08468e697e2d6c04bb74cc574abc",
28-
"sourceCodeHash": "0x30d7e4243a3bab7fea8504be2cd24f2c5ab3335b802d62282a374a458a08feec"
27+
"initCodeHash": "0xe0e6d892d38211dc0165ca00dc1e8aa558eb7a1240560260e23262f066f6be72",
28+
"sourceCodeHash": "0xe40f42a857c9b0905db4c91d61073d9dd572a6bc49921c5ee6e875cf54dc9407"
2929
},
3030
"src/L1/OptimismPortal2.sol:OptimismPortal2": {
3131
"initCodeHash": "0x5bf576ea7f566e402a997204988471fc9b971410aa9dff8fe810b10baf6b7456",

packages/contracts-bedrock/src/L1/OPContractsManager.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,9 +2153,9 @@ contract OPContractsManager is ISemver {
21532153

21542154
// -------- Constants and Variables --------
21552155

2156-
/// @custom:semver 4.6.0
2156+
/// @custom:semver 5.0.0
21572157
function version() public pure virtual returns (string memory) {
2158-
return "4.6.0";
2158+
return "5.0.0";
21592159
}
21602160

21612161
OPContractsManagerGameTypeAdder public immutable opcmGameTypeAdder;

0 commit comments

Comments
 (0)