Skip to content

Commit

Permalink
Rename PayloadSpec -> BlobSpec, PayloadDest -> BlobDest
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibek Pandey committed Jan 14, 2025
1 parent cb4d847 commit 1c48b76
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions bin/strata-client/src/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use strata_primitives::{
bridge::{OperatorIdx, PublickeyTable},
buf::Buf32,
hash,
l1::payload::{L1Payload, PayloadDest, PayloadIntent},
l1::payload::{BlobDest, L1Payload, PayloadIntent},
params::Params,
};
use strata_rpc_api::{
Expand Down Expand Up @@ -736,7 +736,7 @@ impl StrataSequencerApiServer for SequencerServerImpl {
async fn submit_da_blob(&self, blob: HexBytes) -> RpcResult<()> {
let commitment = hash::raw(&blob.0);
let payload = L1Payload::new_da(blob.0);
let blobintent = PayloadIntent::new(PayloadDest::L1, commitment, payload);
let blobintent = PayloadIntent::new(BlobDest::L1, commitment, payload);
// NOTE: It would be nice to return reveal txid from the submit method. But creation of txs
// is deferred to signer in the writer module
if let Err(e) = self.envelope_handle.submit_intent_async(blobintent).await {
Expand Down
6 changes: 3 additions & 3 deletions crates/btcio/src/writer/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use strata_db::{
types::{L1TxStatus, PayloadEntry, PayloadL1Status},
};
use strata_primitives::{
l1::payload::{PayloadDest, PayloadIntent},
l1::payload::{BlobDest, PayloadIntent},
params::Params,
};
use strata_status::StatusChannel;
Expand Down Expand Up @@ -35,7 +35,7 @@ impl EnvelopeHandle {
}

pub fn submit_intent(&self, intent: PayloadIntent) -> anyhow::Result<()> {
if intent.dest() != PayloadDest::L1 {
if intent.dest() != BlobDest::L1 {
warn!(commitment = %intent.commitment(), "Received intent not meant for L1");
return Ok(());
}
Expand All @@ -57,7 +57,7 @@ impl EnvelopeHandle {
}

pub async fn submit_intent_async(&self, intent: PayloadIntent) -> anyhow::Result<()> {
if intent.dest() != PayloadDest::L1 {
if intent.dest() != BlobDest::L1 {
warn!(commitment = %intent.commitment(), "Received intent not meant for L1");
return Ok(());
}
Expand Down
4 changes: 2 additions & 2 deletions crates/consensus-logic/src/duty/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use strata_db::traits::*;
use strata_eectl::engine::ExecEngineCtl;
use strata_primitives::{
buf::{Buf32, Buf64},
l1::payload::{L1Payload, PayloadDest, PayloadIntent},
l1::payload::{BlobDest, L1Payload, PayloadIntent},
params::Params,
};
use strata_state::{batch::SignedBatchCheckpoint, client_state::ClientState, prelude::*};
Expand Down Expand Up @@ -424,7 +424,7 @@ fn perform_duty<D: Database, E: ExecEngineCtl>(
let payload_data =
borsh::to_vec(&signed_checkpoint).map_err(|e| Error::Other(e.to_string()))?;
let payload = L1Payload::new_checkpoint(payload_data);
let blob_intent = PayloadIntent::new(PayloadDest::L1, checkpoint_hash, payload);
let blob_intent = PayloadIntent::new(BlobDest::L1, checkpoint_hash, payload);

info!(signed_checkpoint = ?signed_checkpoint, "signed checkpoint");
info!(blob_intent = ?blob_intent, "sending blob intent");
Expand Down
24 changes: 12 additions & 12 deletions crates/primitives/src/l1/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ use crate::{buf::Buf32, hash};
)]
#[borsh(use_discriminant = true)]
#[repr(u8)]
pub enum PayloadDest {
pub enum BlobDest {
/// If we expect the DA to be on the L1 chain that we settle to. This is
/// always the strongest DA layer we have access to.
L1 = 0,
}

/// Manual `Arbitrary` impl so that we always generate L1 DA if we add future
/// ones that would work in totally different ways.
impl<'a> Arbitrary<'a> for PayloadDest {
impl<'a> Arbitrary<'a> for BlobDest {
fn arbitrary(_u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
Ok(Self::L1)
}
Expand All @@ -57,18 +57,18 @@ impl<'a> Arbitrary<'a> for PayloadDest {
Serialize,
Deserialize,
)]
pub struct PayloadSpec {
pub struct BlobSpec {
/// Target settlement layer we're expecting the DA on.
dest: PayloadDest,
dest: BlobDest,

/// Commitment to the payload (probably just a hash or a
/// merkle root) that we expect to see committed to DA.
commitment: Buf32,
}

impl PayloadSpec {
impl BlobSpec {
/// The target we expect the DA payload to be stored on.
pub fn dest(&self) -> PayloadDest {
pub fn dest(&self) -> BlobDest {
self.dest
}

Expand All @@ -77,7 +77,7 @@ impl PayloadSpec {
&self.commitment
}

fn new(dest: PayloadDest, commitment: Buf32) -> Self {
fn new(dest: BlobDest, commitment: Buf32) -> Self {
Self { dest, commitment }
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ pub enum L1PayloadType {
#[derive(Clone, Debug, Eq, PartialEq, Arbitrary, BorshDeserialize, BorshSerialize)]
pub struct PayloadIntent {
/// The destination for this payload.
dest: PayloadDest,
dest: BlobDest,

/// Commitment to the payload.
commitment: Buf32,
Expand All @@ -141,7 +141,7 @@ pub struct PayloadIntent {
}

impl PayloadIntent {
pub fn new(dest: PayloadDest, commitment: Buf32, payload: L1Payload) -> Self {
pub fn new(dest: BlobDest, commitment: Buf32, payload: L1Payload) -> Self {
Self {
dest,
commitment,
Expand All @@ -150,7 +150,7 @@ impl PayloadIntent {
}

/// The target we expect the DA payload to be stored on.
pub fn dest(&self) -> PayloadDest {
pub fn dest(&self) -> BlobDest {
self.dest
}

Expand All @@ -168,7 +168,7 @@ impl PayloadIntent {

/// Generates the spec from the relevant parts of the payload intent that
/// uniquely refers to the payload data.
pub fn to_spec(&self) -> PayloadSpec {
PayloadSpec::new(self.dest, self.commitment)
pub fn to_spec(&self) -> BlobSpec {
BlobSpec::new(self.dest, self.commitment)
}
}
4 changes: 2 additions & 2 deletions crates/state/src/exec_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use arbitrary::Arbitrary;
use borsh::{BorshDeserialize, BorshSerialize};
use strata_primitives::{buf::Buf32, l1::payload::PayloadSpec};
use strata_primitives::{buf::Buf32, l1::payload::BlobSpec};

use crate::{bridge_ops, exec_update, forced_inclusion, state_queue::StateQueue};

Expand All @@ -19,7 +19,7 @@ pub struct ExecEnvState {
/// seen on the corresponding DA layer yet.
///
/// This must always be sorted.
waiting_da_blobs: Vec<PayloadSpec>,
waiting_da_blobs: Vec<BlobSpec>,

/// Deposits that have been queued by something but haven't been accepted in
/// an update yet. The sequencer should be processing these as soon as
Expand Down
6 changes: 3 additions & 3 deletions crates/state/src/exec_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use arbitrary::Arbitrary;
use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Deserialize, Serialize};
use strata_primitives::{
buf::Buf32, evm_exec::create_evm_extra_payload, prelude::payload::PayloadSpec,
buf::Buf32, evm_exec::create_evm_extra_payload, prelude::payload::BlobSpec,
};

use crate::{
Expand Down Expand Up @@ -125,7 +125,7 @@ pub struct UpdateOutput {
/// DA blobs that we expect to see on L1. This may be empty, probably is
/// only set near the end of the range of blocks in a batch since we only
/// assert these in a per-batch frequency.
da_blobs: Vec<PayloadSpec>,
da_blobs: Vec<BlobSpec>,
}

impl UpdateOutput {
Expand All @@ -150,7 +150,7 @@ impl UpdateOutput {
&self.withdrawals
}

pub fn da_blobs(&self) -> &[PayloadSpec] {
pub fn da_blobs(&self) -> &[BlobSpec] {
&self.da_blobs
}
}
Expand Down

0 comments on commit 1c48b76

Please sign in to comment.