remove VoteState::deserialize() from sbf builds (#30515)

the existing deserialize implementation overruns the sbf stack and is unusable in a program context
this silences a warning to that effect which all solana_program importers receive

closes #30188
This commit is contained in:
hana 2023-02-25 16:10:08 -08:00 committed by GitHub
parent cbcd3ef27e
commit bd49b984e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -2,6 +2,8 @@
#[cfg(test)]
use crate::epoch_schedule::MAX_LEADER_SCHEDULE_EPOCH_OFFSET;
#[cfg(not(target_os = "solana"))]
use bincode::deserialize;
use {
crate::{
clock::{Epoch, Slot, UnixTimestamp},
@ -12,7 +14,7 @@ use {
sysvar::clock::Clock,
vote::{authorized_voters::AuthorizedVoters, error::VoteError},
},
bincode::{deserialize, serialize_into, ErrorKind},
bincode::{serialize_into, ErrorKind},
serde_derive::{Deserialize, Serialize},
std::{collections::VecDeque, fmt::Debug},
};
@ -303,10 +305,15 @@ impl VoteState {
3731 // see test_vote_state_size_of.
}
pub fn deserialize(input: &[u8]) -> Result<Self, InstructionError> {
deserialize::<VoteStateVersions>(input)
.map(|versioned| versioned.convert_to_current())
.map_err(|_| InstructionError::InvalidAccountData)
pub fn deserialize(_input: &[u8]) -> Result<Self, InstructionError> {
#[cfg(not(target_os = "solana"))]
{
deserialize::<VoteStateVersions>(_input)
.map(|versioned| versioned.convert_to_current())
.map_err(|_| InstructionError::InvalidAccountData)
}
#[cfg(target_os = "solana")]
unimplemented!();
}
pub fn serialize(