paritytech / parity-common

Collection of crates used in Parity projects
https://www.paritytech.io/
Apache License 2.0
282 stars 213 forks source link

rlp - test failures on 32-bit #802

Closed plugwash closed 8 months ago

plugwash commented 9 months ago

Debian CI is reporting test failures for the rlp crate on 32-bit architectures. The tests in question expect errors and get errors, but the errors received are not the ones expected.

164s ---- length_overflow stdout ----
164s thread 'length_overflow' panicked at 'assertion failed: `(left == right)`
164s   left: `Err(RlpInvalidLength)`,
164s  right: `Err(RlpIsTooBig)`', tests/tests.rs:27:5

164s ---- test_rlp_list_length_overflow stdout ----
164s thread 'test_rlp_list_length_overflow' panicked at 'assertion failed: `(left == right)`
164s   left: `Err(RlpIsTooShort)`,
164s  right: `Err(RlpIsTooBig)`', tests/tests.rs:592:5
Fabian-Gruenbichler commented 9 months ago

patch from #808 works according to Debian CI: https://ci.debian.net/packages/r/rust-rlp/testing/i386/

alternatively, the condition could also be using usize::BITS directly, feel free to adapt as you see fit - the input values should be valid for whichever check you choose ;)