feat(eth-wire): improve Capability arbitrary implementation (#14011)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
VolodymyrBg
2025-01-27 19:08:56 +02:00
committed by GitHub
parent 0e2f79c3de
commit 2cdde508d0

View File

@ -90,9 +90,9 @@ impl From<EthVersion> for Capability {
#[cfg(any(test, feature = "arbitrary"))]
impl<'a> arbitrary::Arbitrary<'a> for Capability {
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
let version = u.int_in_range(0..=32)?; // TODO: What's the max?
let name = String::arbitrary(u)?; // TODO: what possible values?
Ok(Self::new(name, version))
let version = u.int_in_range(66..=69)?; // Valid eth protocol versions are 66-69
// Only generate valid eth protocol name for now since it's the only supported protocol
Ok(Self::new_static("eth", version))
}
}