From a0168001541765e79cc2f1112516b8864366a9d8 Mon Sep 17 00:00:00 2001 From: hanako mumei <81144685+2501babe@users.noreply.github.com> Date: Thu, 18 Jul 2024 03:32:39 -0700 Subject: [PATCH] address nits --- sdk/program/src/vote/state/mod.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sdk/program/src/vote/state/mod.rs b/sdk/program/src/vote/state/mod.rs index 9d048f46bdae35..dd69f60dbac64c 100644 --- a/sdk/program/src/vote/state/mod.rs +++ b/sdk/program/src/vote/state/mod.rs @@ -528,12 +528,6 @@ impl VoteState { _ => Err(InstructionError::InvalidAccountData), }?; - // if cursor overruns the input, it produces null bytes and continues to advance `position` - // this check ensures we do not accept such a malformed input erroneously - if cursor.position() > input.len() as u64 { - return Err(InstructionError::InvalidAccountData); - } - Ok(()) } @@ -1177,7 +1171,14 @@ mod tests { let test_res = VoteState::deserialize_into(&raw_data, &mut test_vote_state); let bincode_res = bincode::deserialize::(&raw_data); - assert_eq!(test_res.is_ok(), bincode_res.is_ok()); + if test_res.is_err() { + assert!(bincode_res.is_err()); + } else { + assert_eq!( + VoteStateVersions::new_current(test_vote_state), + bincode_res.unwrap() + ); + } } }