Skip to content

Commit

Permalink
Rename ProtocolOpsTxRef -> ProtocolTxEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibek Pandey committed Jan 23, 2025
1 parent 501dbc9 commit fcf9d7c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions crates/consensus-logic/src/l1_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn check_for_da_batch(
blockdata: &BlockData,
seq_pubkey: Option<XOnlyPublicKey>,
) -> Vec<BatchCheckpointWithCommitment> {
let protocol_ops_txs = blockdata.protocol_ops_txs();
let protocol_ops_txs = blockdata.protocol_txs();

Check warning on line 134 in crates/consensus-logic/src/l1_handler.rs

View check run for this annotation

Codecov / codecov/patch

crates/consensus-logic/src/l1_handler.rs#L134

Added line #L134 was not covered by tests

let signed_checkpts = protocol_ops_txs.iter().flat_map(|txref| {
txref.proto_ops().iter().filter_map(|op| match op {
Expand Down Expand Up @@ -240,7 +240,7 @@ fn generate_block_manifest(block: &Block, epoch: u64) -> L1BlockManifest {

fn generate_l1txs(blockdata: &BlockData) -> Vec<L1Tx> {
blockdata
.protocol_ops_txs()
.protocol_txs()

Check warning on line 243 in crates/consensus-logic/src/l1_handler.rs

View check run for this annotation

Codecov / codecov/patch

crates/consensus-logic/src/l1_handler.rs#L243

Added line #L243 was not covered by tests
.iter()
.map(|ops_txs| {
generate_l1_tx(
Expand Down
6 changes: 3 additions & 3 deletions crates/l1tx/src/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod visitor;
pub use types::TxFilterConfig;
use visitor::OpsVisitor;

use super::messages::ProtocolOpsTxRef;
use super::messages::ProtocolTxEntry;
use crate::{
deposit::{deposit_request::extract_deposit_request_info, deposit_tx::extract_deposit_info},
envelope::parser::parse_envelope_payloads,
Expand All @@ -25,14 +25,14 @@ pub fn filter_protocol_op_tx_refs<V: OpsVisitor>(
params: &RollupParams,
filter_config: &TxFilterConfig,
ops_visitor: &V,
) -> Vec<ProtocolOpsTxRef> {
) -> Vec<ProtocolTxEntry> {
block
.txdata
.iter()
.enumerate()
.map(|(i, tx)| {
let protocol_ops = extract_protocol_ops(tx, params, filter_config, ops_visitor);
ProtocolOpsTxRef::new(i as u32, protocol_ops)
ProtocolTxEntry::new(i as u32, protocol_ops)
})
// Filter out tx refs which do not contain protocol ops
.filter(|txref| !txref.proto_ops().is_empty())
Expand Down
22 changes: 11 additions & 11 deletions crates/l1tx/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ pub enum L1Event {
/// Core protocol specific bitcoin transaction reference. A bitcoin transaction can have multiple
/// operations relevant to protocol. This is used in the context of [`BlockData`].
#[derive(Clone, Debug, BorshSerialize, BorshDeserialize)]
pub struct ProtocolOpsTxRef {
pub struct ProtocolTxEntry {
/// Index of the transaction in the block
index: u32,
/// The operation that is to be applied on data
proto_ops: Vec<ProtocolOperation>,
}

impl ProtocolOpsTxRef {
/// Creates a new [`ProtocolOpsTxRef`]
impl ProtocolTxEntry {
/// Creates a new [`ProtocolTxEntry`]
pub fn new(index: u32, proto_ops: Vec<ProtocolOperation>) -> Self {
Self { index, proto_ops }
}
Expand All @@ -50,29 +50,29 @@ impl ProtocolOpsTxRef {
pub struct BlockData {
block_num: u64,
block: Block,
/// Transactions in the block that are relevant to rollup
protocol_ops_txs: Vec<ProtocolOpsTxRef>,
/// Transactions in the block that contain protocol operations
protocol_txs: Vec<ProtocolTxEntry>,
}

impl BlockData {
pub fn new(block_num: u64, block: Block, protocol_ops_txs: Vec<ProtocolOpsTxRef>) -> Self {
pub fn new(block_num: u64, block: Block, protocol_txs: Vec<ProtocolTxEntry>) -> Self {

Check warning on line 58 in crates/l1tx/src/messages.rs

View check run for this annotation

Codecov / codecov/patch

crates/l1tx/src/messages.rs#L58

Added line #L58 was not covered by tests
Self {
block_num,
block,
protocol_ops_txs,
protocol_txs,

Check warning on line 62 in crates/l1tx/src/messages.rs

View check run for this annotation

Codecov / codecov/patch

crates/l1tx/src/messages.rs#L62

Added line #L62 was not covered by tests
}
}

pub fn block(&self) -> &Block {
&self.block
}

pub fn protocol_ops_tx_idxs(&self) -> impl Iterator<Item = u32> + '_ {
self.protocol_ops_txs.iter().map(|v| v.index)
pub fn protocol_tx_idxs(&self) -> impl Iterator<Item = u32> + '_ {
self.protocol_txs.iter().map(|v| v.index)

Check warning on line 71 in crates/l1tx/src/messages.rs

View check run for this annotation

Codecov / codecov/patch

crates/l1tx/src/messages.rs#L70-L71

Added lines #L70 - L71 were not covered by tests
}

pub fn protocol_ops_txs(&self) -> &[ProtocolOpsTxRef] {
&self.protocol_ops_txs
pub fn protocol_txs(&self) -> &[ProtocolTxEntry] {
&self.protocol_txs

Check warning on line 75 in crates/l1tx/src/messages.rs

View check run for this annotation

Codecov / codecov/patch

crates/l1tx/src/messages.rs#L74-L75

Added lines #L74 - L75 were not covered by tests
}

pub fn block_num(&self) -> u64 {
Expand Down

0 comments on commit fcf9d7c

Please sign in to comment.