From 4075301190d183c0253470096d87133613892c43 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 15 Nov 2024 14:58:04 -0500 Subject: [PATCH] fix(protocol): channel out --- crates/protocol/src/channel.rs | 4 ++-- crates/protocol/src/utils.rs | 23 +---------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/crates/protocol/src/channel.rs b/crates/protocol/src/channel.rs index beadf8623..d17c17f67 100644 --- a/crates/protocol/src/channel.rs +++ b/crates/protocol/src/channel.rs @@ -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; @@ -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(()) } diff --git a/crates/protocol/src/utils.rs b/crates/protocol/src/utils.rs index 11f928f0b..7b74dce85 100644 --- a/crates/protocol/src/utils.rs +++ b/crates/protocol/src/utils.rs @@ -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; @@ -39,27 +39,6 @@ pub fn compress_brotli(mut input: &[u8]) -> Vec { 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. ///