Skip to content

Commit

Permalink
resolve merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
CeciliaZ030 committed Jan 24, 2024
1 parent e386e29 commit c35f9e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion lib/src/builder/execute/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use zeth_primitives::{
},
trie::MptNode,
Bloom, Bytes, RlpBytes,
Bloom, Bytes, RlpBytes,
};

use super::{ethereum, TxExecStrategy};
Expand Down
2 changes: 1 addition & 1 deletion lib/src/optimism/batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use alloc::{
collections::{BinaryHeap, VecDeque},
collections::{BinaryHeap, VecDeque, BTreeMap},
vec::Vec,
};
use core::cmp::{Ordering, Reverse};
Expand Down
16 changes: 7 additions & 9 deletions lib/src/optimism/batcher_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// use std::io::Read;

use alloc::{
format,
collections::{BTreeMap, VecDeque},
vec::Vec,
};
Expand Down Expand Up @@ -312,10 +313,8 @@ impl Channel {

let mut channel_data = decompressed.as_slice();
while !channel_data.is_empty() {
let mut batch = Batch::decode(&mut channel_data)
.map_err(|e| anyhow!(AlloyRlpError::from(e)))
.context("failed to decode batch data")?;
batch.inclusion_block_number = l1_block_number;
let batch = Batch::decode(&mut channel_data)
.with_context(|| format!("failed to decode batch {}", batches.len()))?;

batches.push(BatchWithInclusion {
essence: batch.0,
Expand All @@ -336,13 +335,12 @@ impl Channel {
// types of attack (where a small compressed input decompresses to a humongous amount
// of data). If the decompressed data exceeds the limit, things proceeds as though the
// channel contained only the first MAX_RLP_BYTES_PER_CHANNEL decompressed bytes."
let mut decompressed = Vec::new();
Decoder::new(compressed.as_slice())
let mut buf = Vec::new();
Decoder::new(data)
.map_err(|e| anyhow!(Core2Error::from(e)))?
.take(MAX_RLP_BYTES_PER_CHANNEL)
.read_to_end(&mut decompressed)
.map_err(|e| anyhow!(Core2Error::from(e)))
.context("failed to decompress")?;
.read_to_end(&mut buf)
.map_err(|e| anyhow!(Core2Error::from(e)))?;

Ok(buf)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::{io, io::Read};
use core2::{io, io::Read};

/// An adaptor that chains multiple readers together.
pub struct MultiReader<I, R> {
Expand Down

0 comments on commit c35f9e0

Please sign in to comment.