Repository navigation
fix(spammer): reject --mix weight totals that overflow u32 - #362
kutluhaneth46 wants to merge 1 commit into
Conversation
TxTypeMix parsed each weight as u32 but summed them with wrapping/panic-prone addition. Validate the aggregate with checked addition in FromStr and Config::validate, and make generator selection consume the checked total so invalid CLI mixes fail with a normal --mix error instead of overflowing.
5631155 to
c3e2af0
Compare
|
@kutluhaneth46, this appears to reopen the same #352 implementation scope that you previously closed in #355 after acknowledging that my public claim came first. For clarity, the chronology is already documented in #355: I claimed #352 first with the exact scope (overflow-safe aggregate handling, configuration-boundary rejection, and focused regression coverage), and you later wrote that my claim was visible first, that #355 covered the same scope, and that you were closing it so I could complete the work I had claimed. PR #362 again says "Fixes #352" and implements substantially that same scope: checked aggregate addition, rejection in "FromStr" / "Config::validate", and overflow regression tests. Reopening the same implementation under a new PR number after explicitly closing the earlier duplicate does not resolve the coordination issue. Please close #362 as well, or explain what materially changed in the chronology/scope since your acknowledgement on #355. I am continuing the work I publicly claimed first, and I’d like us to keep the contribution history and coordination transparent for maintainers. |
Summary
Fixes #352.
--mix transfer=4294967295,legacy=1parses successfully today because each weight is a validu32, then panics inTxTypeMix::total_weight()duringConfig::validate()(attempt to add with overflow, exit 101).Changes
TxTypeMix::checked_total_weight()usingchecked_add.FromStrandConfig::validate()with a clear--mixerror.select_tx_typeconsume the checked total so generation cannot rely on overflowing arithmetic.u32::MAX, multi-field overflow, and programmaticConfig::validate()(error, not panic).Test plan
cargo test -p spammer tx_type_mix_(and related config overflow test)