Skip to content
Open
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
6 changes: 4 additions & 2 deletions deploy-config/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
"l2GenesisBlockGasLimit": "0x17D7840",
"l2OutputOracleStartingBlockNumber": 1,
"l2OutputOracleStartingTimestamp": 1,
"multiproofBlockInterval": 100,
"multiproofSlowBlockInterval": 100,
"multiproofConfigHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"multiproofFastBlockInterval": 1000,
"multiproofFastIntermediateBlockInterval": 100,
"multiproofGameType": 621,
"multiproofGenesisBlockNumber": 0,
"multiproofIntermediateBlockInterval": 10,
"multiproofSlowIntermediateBlockInterval": 10,
"multiproofGenesisOutputRoot": "0x0000000000000000000000000000000000000000000000000000000000000001",
"nitroValidator": "0x0000000000000000000000000000000000000000",
"operatorFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000",
Expand Down
7 changes: 5 additions & 2 deletions interfaces/L1/proofs/IAggregateVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ interface IAggregateVerifier is IDisputeGame {
function L2_GENESIS_BLOCK_NUMBER() external view returns (uint256);
function L2_GENESIS_TIMESTAMP() external view returns (uint64);
function L2_BLOCK_TIME() external view returns (uint64);
function BLOCK_INTERVAL() external view returns (uint256);
function INTERMEDIATE_BLOCK_INTERVAL() external view returns (uint256);
function SLOW_BLOCK_INTERVAL() external view returns (uint256);
function SLOW_INTERMEDIATE_BLOCK_INTERVAL() external view returns (uint256);
function FAST_BLOCK_INTERVAL() external view returns (uint256);
function FAST_INTERMEDIATE_BLOCK_INTERVAL() external view returns (uint256);
function intervalsForStartingBlock(uint256 startingBlock) external view returns (uint256, uint256);

function startingOutputRoot() external view returns (Proposal memory);
function bondRecipient() external view returns (address);
Expand Down
12 changes: 8 additions & 4 deletions scripts/deploy/DeployConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ contract DeployConfig is Script {
uint256 public l2GenesisTimestamp;
uint256 public l2OutputOracleStartingBlockNumber;
uint256 public l2OutputOracleStartingTimestamp;
uint256 public multiproofBlockInterval;
uint256 public multiproofSlowBlockInterval;
uint256 public multiproofFastBlockInterval;
uint256 public multiproofFastIntermediateBlockInterval;
uint256 public multiproofGameType;
uint256 public multiproofGenesisBlockNumber;
uint256 public multiproofIntermediateBlockInterval;
uint256 public multiproofSlowIntermediateBlockInterval;
uint256 public operatorFeeVaultMinimumWithdrawalAmount;
uint256 public operatorFeeVaultWithdrawalNetwork;
uint256 public proofMaturityDelaySeconds;
Expand Down Expand Up @@ -115,10 +117,12 @@ contract DeployConfig is Script {
l2OutputOracleStartingTimestamp = _json.readUint("$.l2OutputOracleStartingTimestamp");
l2GenesisBlockNumber = _json.readUintOr("$.l2GenesisBlockNumber", 0);
l2GenesisTimestamp = _json.readUintOr("$.l2GenesisTimestamp", 0);
multiproofBlockInterval = _json.readUintOr("$.multiproofBlockInterval", 100);
multiproofSlowBlockInterval = _json.readUintOr("$.multiproofSlowBlockInterval", 100);
multiproofFastBlockInterval = _json.readUintOr("$.multiproofFastBlockInterval", 1000);
multiproofFastIntermediateBlockInterval = _json.readUintOr("$.multiproofFastIntermediateBlockInterval", 100);
multiproofGameType = _json.readUintOr("$.multiproofGameType", 621);
multiproofGenesisBlockNumber = _json.readUintOr("$.multiproofGenesisBlockNumber", 0);
multiproofIntermediateBlockInterval = _json.readUintOr("$.multiproofIntermediateBlockInterval", 10);
multiproofSlowIntermediateBlockInterval = _json.readUintOr("$.multiproofSlowIntermediateBlockInterval", 10);
operatorFeeVaultMinimumWithdrawalAmount = _json.readUint("$.operatorFeeVaultMinimumWithdrawalAmount");
operatorFeeVaultWithdrawalNetwork = _json.readUint("$.operatorFeeVaultWithdrawalNetwork");
proofMaturityDelaySeconds = _json.readUintOr("$.proofMaturityDelaySeconds", 0);
Expand Down
39 changes: 26 additions & 13 deletions scripts/deploy/SystemDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ contract SystemDeploy is Script {
uint256 multiproofGameType;
address nitroValidator;
AggregateVerifier.ScheduleConfig scheduleConfig;
uint256 multiproofBlockInterval;
uint256 multiproofIntermediateBlockInterval;
uint256 multiproofSlowBlockInterval;
uint256 multiproofSlowIntermediateBlockInterval;
uint256 multiproofFastBlockInterval;
uint256 multiproofFastIntermediateBlockInterval;
ISP1Verifier sp1Verifier;
address teeProposer;
address teeChallenger;
Expand Down Expand Up @@ -128,8 +130,10 @@ contract SystemDeploy is Script {
bytes32 multiproofConfigHash;
uint256 l2ChainId;
AggregateVerifier.ScheduleConfig scheduleConfig;
uint256 multiproofBlockInterval;
uint256 multiproofIntermediateBlockInterval;
uint256 multiproofSlowBlockInterval;
uint256 multiproofSlowIntermediateBlockInterval;
uint256 multiproofFastBlockInterval;
uint256 multiproofFastIntermediateBlockInterval;
}

struct MultiproofOutput {
Expand Down Expand Up @@ -267,8 +271,10 @@ contract SystemDeploy is Script {
multiproofGameType: cfg.multiproofGameType(),
nitroValidator: cfg.nitroValidator(),
scheduleConfig: _configuredScheduleConfig(),
multiproofBlockInterval: cfg.multiproofBlockInterval(),
multiproofIntermediateBlockInterval: cfg.multiproofIntermediateBlockInterval(),
multiproofSlowBlockInterval: cfg.multiproofSlowBlockInterval(),
multiproofSlowIntermediateBlockInterval: cfg.multiproofSlowIntermediateBlockInterval(),
multiproofFastBlockInterval: cfg.multiproofFastBlockInterval(),
multiproofFastIntermediateBlockInterval: cfg.multiproofFastIntermediateBlockInterval(),
sp1Verifier: ISP1Verifier(cfg.sp1Verifier()),
teeProposer: cfg.teeProposer(),
teeChallenger: cfg.teeChallenger(),
Expand Down Expand Up @@ -1055,8 +1061,10 @@ contract SystemDeploy is Script {
multiproofConfigHash: _input.multiproofConfigHash,
l2ChainId: _opChainInput.l2ChainId,
scheduleConfig: scheduleConfig,
multiproofBlockInterval: _input.multiproofBlockInterval,
multiproofIntermediateBlockInterval: _input.multiproofIntermediateBlockInterval
multiproofSlowBlockInterval: _input.multiproofSlowBlockInterval,
multiproofSlowIntermediateBlockInterval: _input.multiproofSlowIntermediateBlockInterval,
multiproofFastBlockInterval: _input.multiproofFastBlockInterval,
multiproofFastIntermediateBlockInterval: _input.multiproofFastIntermediateBlockInterval
})
);

Expand Down Expand Up @@ -1084,8 +1092,12 @@ contract SystemDeploy is Script {
AggregateVerifier.ZkHashes(_input.zkRangeHash, _input.zkAggregationHash),
_input.multiproofConfigHash,
_input.l2ChainId,
_input.multiproofBlockInterval,
_input.multiproofIntermediateBlockInterval,
AggregateVerifier.IntervalConfig({
slowBlockInterval: _input.multiproofSlowBlockInterval,
slowIntermediateBlockInterval: _input.multiproofSlowIntermediateBlockInterval,
fastBlockInterval: _input.multiproofFastBlockInterval,
fastIntermediateBlockInterval: _input.multiproofFastIntermediateBlockInterval
}),
_input.scheduleConfig
)
)
Expand Down Expand Up @@ -1128,12 +1140,13 @@ contract SystemDeploy is Script {
require(address(_input.sp1Verifier) != address(0), "SystemDeploy: sp1Verifier not set");
DeployUtils.assertValidContractAddress(_input.nitroValidator);
DeployUtils.assertValidContractAddress(address(_input.sp1Verifier));
require(_input.multiproofBlockInterval != 0, "SystemDeploy: multiproof block interval not set");
require(_input.multiproofSlowBlockInterval != 0, "SystemDeploy: multiproof block interval not set");
require(
_input.multiproofIntermediateBlockInterval != 0, "SystemDeploy: multiproof intermediate interval not set"
_input.multiproofSlowIntermediateBlockInterval != 0,
"SystemDeploy: multiproof intermediate interval not set"
);
require(
_input.multiproofBlockInterval % _input.multiproofIntermediateBlockInterval == 0,
_input.multiproofSlowBlockInterval % _input.multiproofSlowIntermediateBlockInterval == 0,
"SystemDeploy: invalid multiproof block intervals"
);
require(_input.teeProposer != address(0), "SystemDeploy: teeProposer not set");
Expand Down
6 changes: 2 additions & 4 deletions scripts/multiproof/DeployDevBase.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ abstract contract DeployDevBase is Script {
zkHashes,
cfg.multiproofConfigHash(),
cfg.l2ChainId(),
_blockInterval(),
_intermediateBlockInterval(),
_intervalConfig(),
AggregateVerifier.ScheduleConfig({
protocolVersions: IProtocolVersions(address(protocolVersionsProxy)),
genesisBlockNumber: cfg.l2GenesisBlockNumber(),
Expand Down Expand Up @@ -159,8 +158,7 @@ abstract contract DeployDevBase is Script {
console.log("Deployment saved to:", outPath);
}

function _blockInterval() internal pure virtual returns (uint256);
function _intermediateBlockInterval() internal pure virtual returns (uint256);
function _intervalConfig() internal pure virtual returns (AggregateVerifier.IntervalConfig memory);
function _initBond() internal pure virtual returns (uint256);
function _outputSuffix() internal pure virtual returns (string memory);
function _deployTEERegistryImpl() internal virtual returns (address);
Expand Down
21 changes: 13 additions & 8 deletions scripts/multiproof/DeployDevNoNitro.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,27 @@ import { INitroValidator } from "interfaces/L1/proofs/tee/INitroValidator.sol";
import { DevTEEProverRegistry } from "test/mocks/MockDevTEEProverRegistry.sol";
import { MockNitroValidator } from "test/mocks/MockNitroValidator.sol";

import { AggregateVerifier } from "src/L1/proofs/AggregateVerifier.sol";

import { DeployDevBase } from "./DeployDevBase.s.sol";

/// @title DeployDevNoNitro
/// @notice Development deployment using DevTEEProverRegistry, which bypasses AWS Nitro attestation
/// validation. See scripts/multiproof/README.md for usage. Not for production.
contract DeployDevNoNitro is DeployDevBase {
uint256 public constant BLOCK_INTERVAL = 100;
uint256 public constant INTERMEDIATE_BLOCK_INTERVAL = 10;
uint256 public constant SLOW_BLOCK_INTERVAL = 100;
uint256 public constant SLOW_INTERMEDIATE_BLOCK_INTERVAL = 10;
uint256 public constant FAST_BLOCK_INTERVAL = 1000;
uint256 public constant FAST_INTERMEDIATE_BLOCK_INTERVAL = 100;
uint256 public constant INIT_BOND = 0.001 ether;

function _blockInterval() internal pure override returns (uint256) {
return BLOCK_INTERVAL;
}

function _intermediateBlockInterval() internal pure override returns (uint256) {
return INTERMEDIATE_BLOCK_INTERVAL;
function _intervalConfig() internal pure override returns (AggregateVerifier.IntervalConfig memory) {
return AggregateVerifier.IntervalConfig({
slowBlockInterval: SLOW_BLOCK_INTERVAL,
slowIntermediateBlockInterval: SLOW_INTERMEDIATE_BLOCK_INTERVAL,
fastBlockInterval: FAST_BLOCK_INTERVAL,
fastIntermediateBlockInterval: FAST_INTERMEDIATE_BLOCK_INTERVAL
});
}

function _initBond() internal pure override returns (uint256) {
Expand Down
21 changes: 13 additions & 8 deletions scripts/multiproof/DeployDevWithNitro.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { IDisputeGameFactory } from "interfaces/L1/proofs/IDisputeGameFactory.so
import { INitroValidator } from "interfaces/L1/proofs/tee/INitroValidator.sol";
import { TEEProverRegistry } from "src/L1/proofs/tee/TEEProverRegistry.sol";

import { AggregateVerifier } from "src/L1/proofs/AggregateVerifier.sol";

import { DeployDevBase } from "./DeployDevBase.s.sol";

/// @title DeployDevWithNitro
Expand All @@ -17,18 +19,21 @@ import { DeployDevBase } from "./DeployDevBase.s.sol";
/// then set `nitroValidator` in the deploy config. AWS Nitro attestations are only valid
/// for 60 minutes, and the certificate chain must be cached before registerSigner() is called.
contract DeployDevWithNitro is DeployDevBase {
uint256 public constant BLOCK_INTERVAL = 600;
uint256 public constant INTERMEDIATE_BLOCK_INTERVAL = 30;
uint256 public constant SLOW_BLOCK_INTERVAL = 600;
uint256 public constant SLOW_INTERMEDIATE_BLOCK_INTERVAL = 30;
uint256 public constant FAST_BLOCK_INTERVAL = 6000;
uint256 public constant FAST_INTERMEDIATE_BLOCK_INTERVAL = 300;
uint256 public constant INIT_BOND = 0.00001 ether;

address public nitroValidatorAddr;

function _blockInterval() internal pure override returns (uint256) {
return BLOCK_INTERVAL;
}

function _intermediateBlockInterval() internal pure override returns (uint256) {
return INTERMEDIATE_BLOCK_INTERVAL;
function _intervalConfig() internal pure override returns (AggregateVerifier.IntervalConfig memory) {
return AggregateVerifier.IntervalConfig({
slowBlockInterval: SLOW_BLOCK_INTERVAL,
slowIntermediateBlockInterval: SLOW_INTERMEDIATE_BLOCK_INTERVAL,
fastBlockInterval: FAST_BLOCK_INTERVAL,
fastIntermediateBlockInterval: FAST_INTERMEDIATE_BLOCK_INTERVAL
});
}

function _initBond() internal pure override returns (uint256) {
Expand Down
4 changes: 3 additions & 1 deletion scripts/multiproof/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ Games are created using `ProofType.ZK` with the `MockVerifier` (deployed by both

### Step 1: Set the anchor state

Pick an anchor block far enough behind the L2 tip to cover all the games you want to create. Each game covers `BLOCK_INTERVAL` (600) L2 blocks, so for 500 games you need 300,000 blocks of headroom.
Pick an anchor block far enough behind the L2 tip to cover all the games you want to create. Each game covers one block interval of L2 blocks — 600 on slow (pre-Cobalt) blocks, 6,000 on fast (post-Cobalt) ones — so for 500 slow-block games you need 300,000 blocks of headroom.

`SeedGames.s.sol` reads the interval off the deployed `AggregateVerifier` and picks the side that matches the anchor block, so nothing needs changing here for Cobalt. The contract exposes the two pairs as `SLOW_BLOCK_INTERVAL` / `SLOW_INTERMEDIATE_BLOCK_INTERVAL` and `FAST_BLOCK_INTERVAL` / `FAST_INTERMEDIATE_BLOCK_INTERVAL`. `generate-roots.sh` cannot see the chain, so pass `BLOCK_INTERVAL=6000 INTERMEDIATE_BLOCK_INTERVAL=300` when seeding a devnet on which Cobalt is already active; seeding will abort on a mismatched roots file rather than create bad games.

```bash
# Calculate an anchor block 300,000 blocks behind the L2 tip
Expand Down
Loading
Loading