Skip to content

Commit

Permalink
fix(protocol): channel out
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Nov 15, 2024
1 parent f40b499 commit 4075301
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
4 changes: 2 additions & 2 deletions crates/protocol/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloc::{vec, vec::Vec};
use alloy_primitives::{map::HashMap, Bytes};
use op_alloy_genesis::RollupConfig;

use crate::{block::BlockInfo, compress_brotli, frame::Frame, Batch};
use crate::{block::BlockInfo, frame::Frame, Batch};

/// The frame overhead.
const FRAME_V0_OVERHEAD: usize = 23;
Expand Down Expand Up @@ -75,7 +75,7 @@ impl<'a> ChannelOut<'a> {
return Err(ChannelOutError::ChannelClosed);
}

self.compressed = Some(compress_brotli(&buf).into());
self.compressed = Some(crate::compress_brotli(&buf).into());
Ok(())
}

Expand Down
23 changes: 1 addition & 22 deletions crates/protocol/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utility methods used by protocol types.

use alloc::vec::Vec;
use alloc::{boxed::Box, vec, vec::Vec};
use alloc_no_stdlib::*;
use alloy_consensus::TxType;
use alloy_primitives::B256;
Expand Down Expand Up @@ -39,27 +39,6 @@ pub fn compress_brotli(mut input: &[u8]) -> Vec<u8> {
output
}

// Create the buffers for compression.
// let mut u8_buffer = vec![0; 32 * 1024 * 1024].into_boxed_slice();
// let mut u16_buffer = vec![0; 1024 * 1024].into_boxed_slice();
// let mut i32_buffer = vec![0; 1024 * 1024].into_boxed_slice();
// let mut u32_buffer = vec![0; 1024 * 1024].into_boxed_slice();
// let mut u64_buffer = vec![0; 1024 * 1024].into_boxed_slice();
// let mut command_buffer = vec![Command::default(); 1024 * 1024].into_boxed_slice();
// let mut pdf_buffer = vec![PDF::default(); 1024 * 1024].into_boxed_slice();
// let mut static_buffer = vec![StaticCommand::default(); 1024 * 1024].into_boxed_slice();
// let mut hist_buffer = vec![HistogramLiteral::default(); 1024 * 1024].into_boxed_slice();
// let mut hcmd_buffer = vec![HistogramCommand::default(); 1024 * 1024].into_boxed_slice();
// let mut hdist_buffer = vec![HistogramDistance::default(); 1024 * 1024].into_boxed_slice();
// let mut hpair_buffer = vec![HistogramPair::default(); 1024 * 1024].into_boxed_slice();
// let mut ctx_buffer = vec![ContextType::default(); 1024 * 1024].into_boxed_slice();
// let mut huff_buffer = vec![HuffmanTree::default(); 1024 * 1024].into_boxed_slice();
// let mut zop_buffer = vec![ZopfliNode::default(); 1024 * 1024].into_boxed_slice();

// let hasher = UnionHasher::free(u8_allocator);
// let send_alloc = SendAlloc::new(u8_allocator, hasher);
// impl BrotliAlloc for StackAllocator<'_, u8, MemPool<'_, u8>> {}

/// Compresses the given bytes data using the Brotli compressor implemented
/// in the [`brotli`][brotli] crate.
///
Expand Down

0 comments on commit 4075301

Please sign in to comment.