feat: Delete EVMStrategyEncoder (this is now unnecessary)

Moved ple_encode into utils.rs

--- don't change below this line ---
ENG-4306 Took 5 minutes
This commit is contained in:
Diana Carvalho
2025-04-04 15:47:30 +01:00
parent f12bebcdfb
commit 6430c99d76
2 changed files with 20 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
use std::{cmp::max, sync::Arc};
use alloy_primitives::{aliases::U24, keccak256, Address, FixedBytes, Keccak256, U256, U8};
use alloy_sol_types::SolValue;
use num_bigint::BigUint;
use tokio::runtime::{Handle, Runtime};
use tycho_common::Bytes;
@@ -133,6 +134,22 @@ pub fn get_runtime() -> Result<(Handle, Option<Arc<Runtime>>), EncodingError> {
}
}
}
/// Uses prefix-length encoding to efficient encode action data.
///
/// Prefix-length encoding is a data encoding method where the beginning of a data segment
/// (the "prefix") contains information about the length of the following data.
pub fn ple_encode(action_data_array: Vec<Vec<u8>>) -> Vec<u8> {
let mut encoded_action_data: Vec<u8> = Vec::new();
for action_data in action_data_array {
let args = (encoded_action_data, action_data.len() as u16, action_data);
encoded_action_data = args.abi_encode_packed();
}
encoded_action_data
}
#[cfg(test)]
mod tests {
use num_bigint::BigUint;