Skip to content

Commit

Permalink
can not ban LegacyVersion yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Pyattaev committed Feb 4, 2025
1 parent 97b5712 commit 814abfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gossip/src/crds_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Sanitize for CrdsData {
}
val.sanitize()
}
CrdsData::LegacyVersion(_) => Err(SanitizeError::InvalidValue),
CrdsData::LegacyVersion(version) => version.sanitize(),
CrdsData::Version(version) => version.sanitize(),
CrdsData::NodeInstance(node) => node.sanitize(),
CrdsData::DuplicateShred(ix, shred) => {
Expand Down
15 changes: 3 additions & 12 deletions gossip/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,9 @@ impl Sanitize for Protocol {
}
}
Protocol::PullResponse(_, val) => {
// PullResponse is allowed to carry anything in its CrdsData, except for deprecated fields
for v in val {
match v.data() {
CrdsData::LegacyVersion(_) => {
return Err(SanitizeError::InvalidValue);
}
_ => {
v.sanitize()?;
}
}
}
Ok(())
// PullResponse is allowed to carry anything in its CrdsData, including deprecated Crds
// such that a deprecated Crds does not get pulled and then rejected.
val.sanitize()
}
Protocol::PushMessage(_, val) => {
//Push is allowed to carry anything in its CrdsData, except for deprecated fields
Expand Down

0 comments on commit 814abfa

Please sign in to comment.