fix: look up quorum by actual quorum_index not by array position#406
fix: look up quorum by actual quorum_index not by array position#406xdustinface merged 1 commit intov0.42-devfrom
quorum_index not by array position#406Conversation
📝 WalkthroughWalkthroughThe changes improve quorum lookup reliability by replacing direct index-based array access with field-based lookup, and introducing proper error handling for missing quorum indices. The Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| let lock_data = hex::decode("01018d53e7997ead57409750942af0d5e0aafc06f852a9a52308f4781b6a8220298f00000000c6f9d8c63dd15937ea70aaddb7890daad42c91bf6818e2bf76d183d6f2d9215b4b5f84978fad9dde7ab52bdcc0674be891e9029cc1ef0cb01200000000000000a27c98836c4c04653ab81eb4e07ddfc2c8c2c1036b75247969c05a4f25451cd78913a971f1899d9f2bddec9cf8e0104004f72f20c2856453e5aa3bcd2a8200670ec28feda38f67cc400fc72ef1966956656ec0765478c9d16e9a9e470c07f9ed").expect("expected valid hex"); | ||
| let lock: InstantLock = deserialize(lock_data.as_slice()).expect("expected to deserialize"); | ||
|
|
There was a problem hiding this comment.
extract both strings as constants in the tests module (if decode is defined as constant, extract the whole call but i dont expect it to be const tbh)
There was a problem hiding this comment.
This is a fix PR following the existing pattern. Should be cleaned up separately, will just add noise.
There was a problem hiding this comment.
idk what pattern you are talking about tbh, what ever, not a big deal
There was a problem hiding this comment.
Ah haha i though you want to consolidate all other places where those two are used in tests. If thats not it im not sure why you wanted me to move them.
| pub fn is_lock_quorum_lookup_by_quorum_index_not_array_position() { | ||
| let block_hex = | ||
| include_str!("../../../tests/data/test_DML_diffs/masternode_list_engine.hex"); | ||
| let data = hex::decode(block_hex).expect("decode hex"); |
There was a problem hiding this comment.
you can also extract this string though
|
|
||
| let lock_data = hex::decode("01018d53e7997ead57409750942af0d5e0aafc06f852a9a52308f4781b6a8220298f00000000c6f9d8c63dd15937ea70aaddb7890daad42c91bf6818e2bf76d183d6f2d9215b4b5f84978fad9dde7ab52bdcc0674be891e9029cc1ef0cb01200000000000000a27c98836c4c04653ab81eb4e07ddfc2c8c2c1036b75247969c05a4f25451cd78913a971f1899d9f2bddec9cf8e0104004f72f20c2856453e5aa3bcd2a8200670ec28feda38f67cc400fc72ef1966956656ec0765478c9d16e9a9e470c07f9ed").expect("expected valid hex"); | ||
| let lock: InstantLock = deserialize(lock_data.as_slice()).expect("expected to deserialize"); | ||
|
|
There was a problem hiding this comment.
idk what pattern you are talking about tbh, what ever, not a big deal
We currently look up the quorums by their position in the vector which leads to invalid quroums being selected for IS verification. This PR changes it to look up by actual quorum index.
Summary by CodeRabbit
Bug Fixes
Tests