Summary
Optional fields such as base_fee, base_fee_trend, and base_fee_moment are decoded based on
remaining payload length instead of explicit presence flags.
Vulnerability details
let mut this = Self { block_round: Decodable::decode(buf)?, epoch: Decodable::decode(buf)?, qc: Decodable::decode(buf)?, author: Decodable::decode(buf)?, seq_num: Decodable::decode(buf)?, timestamp_ns: Decodable::decode(buf)?, round_signature: Decodable::decode(buf)?, delayed_execution_results: Decodable::decode(buf)?, execution_inputs: Decodable::decode(buf)?, block_body_id: Decodable::decode(buf)?, base_fee: None, base_fee_trend: None, base_fee_moment: None,};
if starting_len - buf.len() < rlp_header.payload_length { this.base_fee = Some(Decodable::decode(buf)?);}
if starting_len - buf.len() < rlp_header.payload_length { this.base_fee_trend = Some(Decodable::decode(buf)?);}Impact
If field coupling changes in the future, a trailing value intended for one optional field can be misinterpreted as another during decoding.
Recommendation
Use explicit presence markers or a structure that encodes field presence unambiguously.