From 83b116aea7ae86ce7d13fce9d4077abcb2d3e05c Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Fri, 30 Aug 2024 02:17:08 +0800 Subject: [PATCH] chore(reth-etl): use constant (#10614) --- crates/etl/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/etl/src/lib.rs b/crates/etl/src/lib.rs index 57db6473dfc3..3f978fabeee2 100644 --- a/crates/etl/src/lib.rs +++ b/crates/etl/src/lib.rs @@ -21,6 +21,9 @@ use std::{ path::{Path, PathBuf}, }; +/// Key len and Value len encode use [`usize::to_be_bytes()`] the length is 8. +const KV_LEN: usize = 8; + use rayon::prelude::*; use reth_db_api::table::{Compress, Encode, Key, Value}; use tempfile::{NamedTempFile, TempDir}; @@ -256,8 +259,8 @@ impl EtlFile { return Ok(None) } - let mut buffer_key_length = [0; 8]; - let mut buffer_value_length = [0; 8]; + let mut buffer_key_length = [0; KV_LEN]; + let mut buffer_value_length = [0; KV_LEN]; self.file.read_exact(&mut buffer_key_length)?; self.file.read_exact(&mut buffer_value_length)?;