Skip to content

Commit

Permalink
node-data: remove iteration check from msg deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
fed-franz committed Dec 20, 2024
1 parent 977df39 commit 8b06e89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
10 changes: 1 addition & 9 deletions node-data/src/ledger/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use serde::Serialize;

use super::*;
use crate::message::{ConsensusHeader, MESSAGE_MAX_ITER};
use crate::message::ConsensusHeader;

pub type Seed = Signature;
#[derive(Eq, PartialEq, Clone, Serialize)]
Expand Down Expand Up @@ -154,14 +154,6 @@ impl Header {
let gas_limit = Self::read_u64_le(r)?;
let iteration = Self::read_u8(r)?;

// Iteration is 0-based
if iteration >= MESSAGE_MAX_ITER {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Invalid iteration {iteration})"),
));
}

let prev_block_cert = Attestation::read(r)?;
let failed_iterations = IterationsInfo::read(r)?;

Expand Down
11 changes: 0 additions & 11 deletions node-data/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ use crate::{bls, ledger, Serializable, StepName};
pub const TOPIC_FIELD_POS: usize = 1 + 2 + 2;
pub const PROTOCOL_VERSION: Version = Version(1, 0, 2);

/// Max value for iteration.
pub const MESSAGE_MAX_ITER: u8 = 50;

/// Block version
pub const BLOCK_HEADER_VERSION: u8 = 1;

Expand Down Expand Up @@ -370,14 +367,6 @@ impl Serializable for ConsensusHeader {
let round = Self::read_u64_le(r)?;
let iteration = Self::read_u8(r)?;

// Iteration is 0-based
if iteration >= MESSAGE_MAX_ITER {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Invalid iteration {iteration})"),
));
}

Ok(ConsensusHeader {
prev_block_hash,
round,
Expand Down

0 comments on commit 8b06e89

Please sign in to comment.