Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
prajwolrg committed Jan 29, 2025
1 parent 768605c commit f24b345
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bin/strata-client/src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ impl StrataSequencerApiServer for SequencerServerImpl {
verify_proof(&checkpoint, &proof_receipt, self.params.rollup())
.map_err(|e| Error::InvalidProof(idx, e.to_string()))?;

entry.proof = proof_receipt;
entry.proof = proof_receipt.proof().clone();

Check warning on line 801 in bin/strata-client/src/rpc_server.rs

View check run for this annotation

Codecov / codecov/patch

bin/strata-client/src/rpc_server.rs#L801

Added line #L801 was not covered by tests
entry.proving_status = CheckpointProvingStatus::ProofReady;

debug!(%idx, "Proof is pending, setting proof reaedy");
Expand Down
4 changes: 2 additions & 2 deletions crates/consensus-logic/src/csm/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ fn apply_action<D: Database>(
batch_ckp.batch_info().clone(),
batch_ckp.batch_transition().clone(),

Check warning on line 318 in crates/consensus-logic/src/csm/worker.rs

View check run for this annotation

Codecov / codecov/patch

crates/consensus-logic/src/csm/worker.rs#L318

Added line #L318 was not covered by tests
batch_ckp.bootstrap_state().clone(),
batch_ckp.get_proof_receipt(),
batch_ckp.proof().clone(),

Check warning on line 320 in crates/consensus-logic/src/csm/worker.rs

View check run for this annotation

Codecov / codecov/patch

crates/consensus-logic/src/csm/worker.rs#L320

Added line #L320 was not covered by tests
pstatus,
cstatus,
Some(c.commitment.clone().into()),
Expand All @@ -338,7 +338,7 @@ fn apply_action<D: Database>(
batch_ckp.batch_info().clone(),
batch_ckp.batch_transition().clone(),

Check warning on line 339 in crates/consensus-logic/src/csm/worker.rs

View check run for this annotation

Codecov / codecov/patch

crates/consensus-logic/src/csm/worker.rs#L339

Added line #L339 was not covered by tests
batch_ckp.bootstrap_state().clone(),
batch_ckp.get_proof_receipt(),
batch_ckp.proof().clone(),

Check warning on line 341 in crates/consensus-logic/src/csm/worker.rs

View check run for this annotation

Codecov / codecov/patch

crates/consensus-logic/src/csm/worker.rs#L341

Added line #L341 was not covered by tests
pstatus,
cstatus,
Some(c.commitment.clone().into()),
Expand Down
4 changes: 1 addition & 3 deletions crates/consensus-logic/src/duty/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@ impl BlockSigningDuty {
#[derive(Clone, Debug, BorshSerialize)]
pub struct BatchCheckpointDuty {
/// Checkpoint/batch info
///
/// This is not proven
batch_info: BatchInfo,

/// Checkpoint/batch transition which needs to be proven
batch_transition: BatchTransition,

/// Bootstrapping info based on which the `info` will be verified
/// Bootstrapping state based on which the `batch_transition` will be verified
bootstrap_state: BootstrapState,
}

Expand Down
13 changes: 7 additions & 6 deletions crates/db/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use strata_primitives::{
use strata_state::batch::{
BatchCheckpoint, BatchInfo, BatchTransition, BootstrapState, CommitmentInfo,
};
use strata_zkvm::ProofReceipt;
use strata_zkvm::Proof;

/// Represents an intent to publish to some DA, which will be bundled for efficiency.
#[derive(Debug, Clone, PartialEq, BorshSerialize, BorshDeserialize, Arbitrary)]
Expand Down Expand Up @@ -189,14 +189,15 @@ pub struct CheckpointEntry {
/// Info related to the batch
pub batch_info: BatchInfo,

/// Transition data for L1 and L2 states, which is verified by the proof.
pub batch_transition: BatchTransition,

/// Includes the initial and final hashed state of both the `L1StateTransition` and
/// `L2StateTransition` that happened in this batch
pub bootstrap: BootstrapState,

/// Proof with public values
pub proof: ProofReceipt,
/// Proof
pub proof: Proof,

/// Proving Status
pub proving_status: CheckpointProvingStatus,
Expand All @@ -213,7 +214,7 @@ impl CheckpointEntry {
batch_info: BatchInfo,
batch_transition: BatchTransition,

Check warning on line 215 in crates/db/src/types.rs

View check run for this annotation

Codecov / codecov/patch

crates/db/src/types.rs#L215

Added line #L215 was not covered by tests
bootstrap: BootstrapState,
proof: ProofReceipt,
proof: Proof,

Check warning on line 217 in crates/db/src/types.rs

View check run for this annotation

Codecov / codecov/patch

crates/db/src/types.rs#L217

Added line #L217 was not covered by tests
proving_status: CheckpointProvingStatus,
confirmation_status: CheckpointConfStatus,
commitment: Option<CheckpointCommitment>,
Expand All @@ -234,7 +235,7 @@ impl CheckpointEntry {
self.batch_info,
self.batch_transition,
self.bootstrap,
self.proof.proof().clone(),
self.proof,
)

Check warning on line 239 in crates/db/src/types.rs

View check run for this annotation

Codecov / codecov/patch

crates/db/src/types.rs#L234-L239

Added lines #L234 - L239 were not covered by tests
}

Expand All @@ -248,7 +249,7 @@ impl CheckpointEntry {
info,
transition,

Check warning on line 250 in crates/db/src/types.rs

View check run for this annotation

Codecov / codecov/patch

crates/db/src/types.rs#L250

Added line #L250 was not covered by tests
bootstrap,
ProofReceipt::default(),
Proof::default(),

Check warning on line 252 in crates/db/src/types.rs

View check run for this annotation

Codecov / codecov/patch

crates/db/src/types.rs#L252

Added line #L252 was not covered by tests
CheckpointProvingStatus::PendingProof,
CheckpointConfStatus::Pending,
None,
Expand Down
29 changes: 18 additions & 11 deletions crates/state/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ use strata_zkvm::{Proof, ProofReceipt, PublicValues};

use crate::id::L2BlockId;

/// Public parameters for batch proof to be posted to DA.
/// Will be updated as prover specs evolve.
/// Consolidates all information required to describe and verify a batch checkpoint.
/// This includes metadata about the batch, the state transitions, bootstrap info,
/// and the proof itself. The proof verifies that the transition in [`BatchTransition`]
/// is valid for the batch described by [`BatchInfo`].
#[derive(
Clone, Debug, PartialEq, Eq, Arbitrary, BorshDeserialize, BorshSerialize, Deserialize, Serialize,
)]
pub struct BatchCheckpoint {
/// Information regarding the current batch checkpoint
batch_info: BatchInfo,

/// Transition data for L1 and L2 states, which is verified by the proof.
transition: BatchTransition,

/// Bootstrap info based on which the checkpoint transition and proof is verified
Expand Down Expand Up @@ -124,6 +127,8 @@ impl From<SignedBatchCheckpoint> for BatchCheckpoint {
}
}

/// Contains metadata describing a batch checkpoint, including the L1 and L2 height ranges
/// it covers and the final L2 block ID in that range.
#[derive(
Clone, Debug, Eq, PartialEq, Arbitrary, BorshDeserialize, BorshSerialize, Deserialize, Serialize,
)]
Expand All @@ -141,26 +146,28 @@ pub struct BatchInfo {
pub l2_blockid: L2BlockId,
}

/// Describes state transitions for both L1 and L2, along with a commitment to the
/// rollup parameters. The proof associated with the batch verifies this transition.
#[derive(
Clone, Debug, Eq, PartialEq, Arbitrary, BorshDeserialize, BorshSerialize, Deserialize, Serialize,

Check warning on line 152 in crates/state/src/batch.rs

View check run for this annotation

Codecov / codecov/patch

crates/state/src/batch.rs#L152

Added line #L152 was not covered by tests
)]
pub struct BatchTransition {
/// The inclusive hash range of `HeaderVerificationState` for L1 blocks.
/// This represents the transition of L1 state from the starting state to the
/// ending state. The hash is computed via
/// [`super::l1::HeaderVerificationState::compute_hash`].
///
/// Represents a transition from the starting L1 state to the ending L1 state.
/// The hash is computed via [`super::l1::HeaderVerificationState::compute_hash`].
pub l1_transition: (Buf32, Buf32),

/// The inclusive hash range of `Chainstate` for L2 blocks.
/// This represents the transition of L2 state from the starting state to the
/// ending state. The state root is computed via
/// [`super::chain_state::Chainstate::compute_state_root`].
///
/// Represents a transition from the starting L2 state to the ending L2 state.
/// The state root is computed via [`super::chain_state::Chainstate::compute_state_root`].
pub l2_transition: (Buf32, Buf32),

/// Commitment of the `RollupParams` calculated by
/// [`strata_primitives::params::RollupParams::compute_hash`]
/// A commitment to the `RollupParams`, as computed by
/// [`strata_primitives::params::RollupParams::compute_hash`].
///
/// The transition should be valid against this parameters
/// This indicates that the transition is valid under these rollup parameters.
pub rollup_params_commitment: Buf32,
}

Expand Down

0 comments on commit f24b345

Please sign in to comment.