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

feat: raas deployment fixes #143

Merged
merged 18 commits into from
Oct 7, 2024
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions book/getting-started/l2-output-oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ Submitting verification for [lib/optimism/packages/contracts-bedrock/src/univers

In these deployment logs, `0x9b520F7d8031d45Eb8A1D9fE911038576931ab95` is the address of the Proxy contract for the `OPSuccinctL2OutputOracle`. This deployed Proxy contract will keep track of the state roots of the OP Stack chain.

#### Configure Environment

To use a configurable environment, pass the `ENV_FILE` flag with the path to your `.env` file. By default this is the `.env` in your root directory.

```bash
ENV_FILE=.env.new forge script script/OPSuccinctDeployer.s.sol:OPSuccinctDeployer ...
```

### 6) Add Proxy Address to `.env`

Add the address for the `OPSuccinctL2OutputOracle` proxy contract to the `.env` file in the root directory.
Expand Down
48 changes: 48 additions & 0 deletions configs/10/rollup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"genesis": {
"l1": {
"number": 17422590,
"hash": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108"
},
"l2": {
"number": 105235063,
"hash": "0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3"
},
"l2_time": 1686068903,
"system_config": {
"batcherAddr": "0x6887246668a3b87F54DeB3b94Ba47a6f63F32985",
"overhead": "0xbc",
"scalar": "0xa6fe0",
"gasLimit": 30000000,
"baseFeeScalar": null,
"blobBaseFeeScalar": null,
"eip1559Denominator": null,
"eip1559Elasticity": null
}
},
"block_time": 2,
"max_sequencer_drift": 600,
"seq_window_size": 3600,
"channel_timeout": 300,
"granite_channel_timeout": 50,
"l1_chain_id": 1,
"l2_chain_id": 10,
"base_fee_params": {
"max_change_denominator": "0x32",
"elasticity_multiplier": "0x6"
},
"canyon_base_fee_params": {
"max_change_denominator": "0xfa",
"elasticity_multiplier": "0x6"
},
"regolith_time": 0,
"canyon_time": 1704992401,
"delta_time": 1708560000,
"ecotone_time": 1710374401,
"fjord_time": 1720627201,
"granite_time": 1726070401,
"batch_inbox_address": "0xFF00000000000000000000000000000000000010",
"deposit_contract_address": "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed",
"l1_system_config_address": "0x229047fed2591dbec1eF1118d64F7aF3dB9EB290",
"protocol_versions_address": "0x0000000000000000000000000000000000000000"
}
8 changes: 4 additions & 4 deletions contracts/opsuccinctl2ooconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"owner": "0xDEd0000E32f8F40414d3ab3a830f735a3553E18e",
"proposer": "0xDEd0000E32f8F40414d3ab3a830f735a3553E18e",
"rollupConfigHash": "0x50efb1261373319cd7ba429612d9a18e585627618ec04560e7d27ba7e36d4c05",
"startingBlockNumber": 2299525,
"startingOutputRoot": "0x02eaaec341031b9f19b16b8570ad0f3ed4c1ce96b353ee24f1ef8c8c1ba3398f",
"startingTimestamp": 1728086402,
"startingBlockNumber": 2388661,
"startingOutputRoot": "0x8ef839cbbc8228ec45ac3a17a1dc7323c0b6aff59e3f9b27a5374dcefedb4417",
"startingTimestamp": 1728264674,
"submissionInterval": 1000,
"verifierGateway": "0x3B6041173B80E77f038f3F2C0f9744f04837185e",
"aggregationVkey": "0x00e4dc504bcd3355a4bf7382ba15d74e058aa144948edb753879055d243ebad0",
"rangeVkeyCommitment": "0x58660c1a1ab2cc77620b051a4d9006883dcb81fa5a856f654bbc5f8739d83868"
"rangeVkeyCommitment": "0x33a4ae25566346bb578b113564a7b67e359a22ea59016fdc49e0054f19228e96"
}
30 changes: 0 additions & 30 deletions contracts/test/OPSuccinctL2OutputOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,4 @@ contract OPSuccinctL2OutputOracleTest is Test, Utils {
l2oo.checkpointBlockHash(L1_BLOCK_NUM, L1_HEAD);
l2oo.proposeL2Output(claimedOutputRoot, claimedL2BlockNum, L1_HEAD, L1_BLOCK_NUM, proof);
}

function testOPSuccinctL2OOFailsWithWrongParams() public {
config.startingOutputRoot = STARTING_OUTPUT_ROOT;
config.startingTimestamp = STARTING_TIMESTAMP;
l2oo = OPSuccinctL2OutputOracle(deployWithConfig(config));

vm.setBlockhash(L1_BLOCK_NUM, L1_HEAD);
l2oo.checkpointBlockHash(L1_BLOCK_NUM, L1_HEAD);
vm.warp(block.timestamp * 2);

vm.startPrank(l2oo.PROPOSER());

// fails with wrong claimed output root
vm.expectRevert();
l2oo.proposeL2Output(bytes32(0), claimedL2BlockNum, L1_HEAD, L1_BLOCK_NUM, proof);

// fails with wrong claimed block num
vm.expectRevert();
l2oo.proposeL2Output(claimedOutputRoot, claimedL2BlockNum + 1, L1_HEAD, L1_BLOCK_NUM, proof);

// fails with wrong L1 head
vm.setBlockhash(L1_BLOCK_NUM, keccak256(""));
l2oo.checkpointBlockHash(L1_BLOCK_NUM, keccak256(""));
vm.expectRevert();
l2oo.proposeL2Output(claimedOutputRoot, claimedL2BlockNum, keccak256(""), L1_BLOCK_NUM, proof);

// fails with wrong proof
vm.expectRevert();
l2oo.proposeL2Output(claimedOutputRoot, claimedL2BlockNum, L1_HEAD, L1_BLOCK_NUM, "");
}
}
34 changes: 19 additions & 15 deletions contracts/test/helpers/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,26 @@ contract Utils is Test, JSONDecoder {
// If we are spoofing the admin (used in testing), start prank.
if (_spoofedAdmin != address(0)) vm.startPrank(_spoofedAdmin);

Proxy(payable(l2OutputOracleProxy)).upgradeToAndCall(
impl,
abi.encodeCall(
OPSuccinctL2OutputOracle.initialize,
(
cfg.submissionInterval,
cfg.l2BlockTime,
cfg.startingBlockNumber,
cfg.startingTimestamp,
cfg.proposer,
cfg.challenger,
cfg.finalizationPeriod,
initParams
)
bytes memory upgradeCalldata = abi.encodeCall(
OPSuccinctL2OutputOracle.initialize,
(
cfg.submissionInterval,
cfg.l2BlockTime,
cfg.startingBlockNumber,
cfg.startingTimestamp,
cfg.proposer,
cfg.challenger,
cfg.finalizationPeriod,
initParams
)
);

// Raw calldata for an upgrade call by a multisig.
bytes memory multisigCalldata = abi.encodeWithSelector(Proxy.upgradeToAndCall.selector, impl, upgradeCalldata);
console.log("Raw calldata for the upgrade call:");
console.logBytes(multisigCalldata);

Proxy(payable(l2OutputOracleProxy)).upgradeToAndCall(impl, upgradeCalldata);
}

// Read the config from the json file.
Expand All @@ -74,7 +78,7 @@ contract Utils is Test, JSONDecoder {
// This script updates the rollup config hash and the block number in the config.
function updateRollupConfig() public {
// If ENV_FILE is set, pass it to the fetch-rollup-config binary.
string memory envFile = vm.envOr("ENV_FILE", string(".env.conduit"));
string memory envFile = vm.envOr("ENV_FILE", string(".env"));

// Build the fetch-rollup-config binary. Use the quiet flag to suppress build output.
string[] memory inputs = new string[](6);
Expand Down
Binary file modified elf/fault-proof-elf
Binary file not shown.
Binary file modified elf/range-elf
Binary file not shown.
4 changes: 2 additions & 2 deletions programs/range/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn main() {

// The initial payload requires block derivation.
println!("cycle-tracker-report-start: payload-derivation");
let mut payload = driver.produce_payloads().await.unwrap();
let mut payload = driver.produce_payload().await.unwrap();
println!("cycle-tracker-report-end: payload-derivation");

println!("cycle-tracker-start: execution-instantiation");
Expand Down Expand Up @@ -180,7 +180,7 @@ fn main() {

println!("cycle-tracker-report-start: payload-derivation");
// Produce the next payload. If a span batch boundary is passed, the driver will step until the next batch.
payload = driver.produce_payloads().await.unwrap();
payload = driver.produce_payload().await.unwrap();
println!("cycle-tracker-report-end: payload-derivation");
}

Expand Down
8 changes: 7 additions & 1 deletion proposer/op/proposer/prove.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ func (l *L2OutputSubmitter) ProcessPendingProofs() error {

timeout := uint64(time.Now().Unix()) > req.ProofRequestTime+l.DriverSetup.Cfg.ProofTimeout
if timeout || status == "PROOF_UNCLAIMED" {
if timeout {
l.Log.Info("proof timed out", "id", req.ProverRequestID)
} else {
l.Log.Info("proof unclaimed", "id", req.ProverRequestID)
}
// update status in db to "FAILED"
l.Log.Info("proof timed out", "id", req.ProverRequestID)
err = l.db.UpdateProofStatus(req.ID, "FAILED")
if err != nil {
l.Log.Error("failed to update failed proof status", "err", err)
Expand Down Expand Up @@ -213,6 +217,8 @@ func (l *L2OutputSubmitter) DeriveAggProofs(ctx context.Context) error {

// Request a proof from the OP Succinct server.
func (l *L2OutputSubmitter) RequestOPSuccinctProof(p ent.ProofRequest) error {
// TODO: Subtract 1 from the start block to get the previous confirmed block. The start block of the new span proof
// should be the same as the end block of the previous span proof.
prevConfirmedBlock := p.StartBlock - 1
var proofId string
var err error
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn main() {
// Note: Don't comment this out, because the Docker program depends on the native program
// for range being built.
build_native_program(program);
build_zkvm_program(program);
// build_zkvm_program(program);
}

// build_zkvm_program("aggregation");
Expand Down
Loading
Loading