Remove OutInstruction's data field

It makes sense for networks which support arbitrary data to do as part of their
address. This reduces the ability to perform DoSs, achieves better performance,
and better uses the type system (as now networks we don't support data on don't
have a data field).

Updates the Ethereum address definition in serai-client accordingly
This commit is contained in:
Luke Parker
2024-09-15 12:48:09 -04:00
parent 39be23d807
commit eb9bce6862
18 changed files with 121 additions and 150 deletions

View File

@@ -4,7 +4,6 @@ use std::collections::HashMap;
use scale::Decode;
use serai_db::{Get, DbTxn, Db};
use serai_primitives::MAX_DATA_LEN;
use serai_in_instructions_primitives::{
Shorthand, RefundableInInstruction, InInstruction, InInstructionWithBalance,
};
@@ -56,16 +55,6 @@ fn in_instruction_from_output<S: ScannerFeed>(
let presumed_origin = output.presumed_origin();
let mut data = output.data();
let max_data_len = usize::try_from(MAX_DATA_LEN).unwrap();
if data.len() > max_data_len {
log::info!(
"data in output {} exceeded MAX_DATA_LEN ({MAX_DATA_LEN}): {}. skipping",
hex::encode(output.id()),
data.len(),
);
return (presumed_origin, None);
}
let shorthand = match Shorthand::decode(&mut data) {
Ok(shorthand) => shorthand,
Err(e) => {