Skip to content

Commit

Permalink
Merge pull request #3 from bobanetwork/op-succinct-upstream
Browse files Browse the repository at this point in the history
Fix docker context
  • Loading branch information
boyuan-chen authored Dec 12, 2024
2 parents c6a5929 + 766638d commit 512297b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
1 change: 1 addition & 0 deletions book/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [L2 Node Setup](./advanced/node-setup.md)
- [Block Data CLI Tool](./advanced/block-data.md)
- [Proposer](./advanced/proposer.md)
- [Kurtosis](./advanced/kurtosis.md)
- [Upgrade to a new `op-succinct` version](./advanced/upgrade.md)
- [`OPSuccinctL2OutputOracle`](./contracts/intro.md)
- [Configuration](./contracts/configuration.md)
Expand Down
6 changes: 3 additions & 3 deletions book/contracts/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ You can configure additional parameters when deploying or upgrading the `OPSucci
| `STARTING_BLOCK_NUMBER` | Default: The finalized block number on L2. The block number to initialize the contract from. OP Succinct will start proving state roots from this block number. |
| `SUBMISSION_INTERVAL` | Default: `1000`. The minimum interval in L2 blocks at which checkpoints must be submitted. An aggregation proof can be posted for any range larger than this interval. |
| `FINALIZATION_PERIOD_SECS` | Default: `3600` (1 hour). The time period (in seconds) after which a proposed output becomes finalized and withdrawals can be processed. |
| `PROPOSER` | Default: The address of the account associated with `PRIVATE_KEY`. An Ethereum address authorized to submit proofs. Set to `address(0)` to allow permissionless submissions. **Note: Use `addProposer` and `removeProposer` functions to update the list of approved proposers.** |
| `CHALLENGER` | Default: `address(0)`, no one can dispute proofs. Ethereum address authorized to dispute proofs. |
| `OWNER` | Default: The address of the account associated with `PRIVATE_KEY`. Ethereum address authorized to update the `aggregationVkey`, `rangeVkeyCommitment`, `verifier`, and `rollupConfigHash` parameters. Can also transfer ownership of the contract and update the approved proposers. In a production setting, set to the governance smart contract or multi-sig of the chain. |
| `PROPOSER` | Default: The address of the account associated with `PRIVATE_KEY`. If `PRIVATE_KEY` is not set, `address(0)`. An Ethereum address authorized to submit proofs. Set to `address(0)` to allow permissionless submissions. **Note: Use `addProposer` and `removeProposer` functions to update the list of approved proposers.** |
| `CHALLENGER` | Default: The address of the account associated with `PRIVATE_KEY`. If `PRIVATE_KEY` is not set, `address(0)`. Ethereum address authorized to dispute proofs. Set to `address(0)` for no challenging. |
| `OWNER` | Default: The address of the account associated with `PRIVATE_KEY`. If `PRIVATE_KEY` is not set, `address(0)`. Ethereum address authorized to update the `aggregationVkey`, `rangeVkeyCommitment`, `verifier`, and `rollupConfigHash` parameters. Can also transfer ownership of the contract and update the approved proposers. In a production setting, set to the governance smart contract or multi-sig of the chain. |
2 changes: 1 addition & 1 deletion book/contracts/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Similar to the `L2OutputOracle` contract, the `OPSuccinctL2OutputOracle` is mana

## 1. Decide on the target `OPSuccinctL2OutputOracle` contract code

### (Recommanded) Using `OPSuccinctL2OutputOracle` from a release
### (Recommended) Using `OPSuccinctL2OutputOracle` from a release

Check out the latest release of `op-succinct` from [here](https://github.com/succinctlabs/op-succinct/releases). You can always find the latest version of the `OPSuccinctL2OutputOracle` on the latest release.

Expand Down
2 changes: 1 addition & 1 deletion proposer/op/proposer/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (l *L2OutputSubmitter) GetRangeProofBoundaries(ctx context.Context) error {
// splitting algorithm. Otherwise, we use the simple range splitting algorithm.
safeDBActivated, err := l.isSafeDBActivated(ctx, rollupClient)
if err != nil {
return fmt.Errorf("failed to check if safeDB is activated: %w", err)
l.Log.Warn("safeDB is not activated. Using simple range splitting algorithm.", "err", err)
}

var spans []Span
Expand Down
2 changes: 1 addition & 1 deletion proposer/succinct/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ async fn request_mock_span_proof(
// Start the server and native client with a timeout.
// Note: Ideally, the server should call out to a separate process that executes the native
// host, and return an ID that the client can poll on to check if the proof was submitted.
let mut witnessgen_executor = WitnessGenExecutor::default();
let mut witnessgen_executor = WitnessGenExecutor::new(WITNESSGEN_TIMEOUT, RunContext::Docker);
witnessgen_executor.spawn_witnessgen(&host_cli).await?;
// Log any errors from running the witness generation process.
let res = witnessgen_executor.flush().await;
Expand Down
30 changes: 18 additions & 12 deletions scripts/utils/bin/fetch_rollup_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ struct L2OOConfig {
range_vkey_commitment: String,
}

/// If the environment variable is set for the address, return it. Otherwise, return the address associated with the private key. If the private key is not set, return the zero address.
fn get_address(env_var: &str) -> String {
let private_key = env::var("PRIVATE_KEY").unwrap_or_else(|_| B256::ZERO.to_string());

env::var(env_var).unwrap_or_else(|_| {
if private_key == B256::ZERO.to_string() {
Address::ZERO.to_string()
} else {
let signer: PrivateKeySigner = private_key.parse().unwrap();
signer.address().to_string()
}
})
}

/// Update the L2OO config with the rollup config hash and other relevant data before the contract is deployed.
///
/// Specifically, updates the following fields in `opsuccinctl2ooconfig.json`:
Expand Down Expand Up @@ -102,18 +116,10 @@ async fn update_l2oo_config() -> Result<()> {
.map(|p| p.parse().unwrap())
.unwrap_or(DEFAULT_FINALIZATION_PERIOD_SECS);

let private_key = env::var("PRIVATE_KEY").unwrap_or_else(|_| B256::ZERO.to_string());
let (proposer, owner) = if private_key == B256::ZERO.to_string() {
(Address::ZERO.to_string(), Address::ZERO.to_string())
} else {
let signer: PrivateKeySigner = private_key.parse().expect("Failed to parse private key");
let signer_address = signer.address().to_string();
(
env::var("PROPOSER").unwrap_or(signer_address.clone()),
env::var("OWNER").unwrap_or(signer_address),
)
};
let challenger = env::var("CHALLENGER").unwrap_or(Address::ZERO.to_string());
// Default to the address associated with the private key if the environment variable is not set. If private key is not set, default to zero address.
let proposer = get_address("PROPOSER");
let owner = get_address("OWNER");
let challenger = get_address("CHALLENGER");

let prover = ProverClient::new();
let (_, agg_vkey) = prover.setup(AGG_ELF);
Expand Down

0 comments on commit 512297b

Please sign in to comment.