-
Notifications
You must be signed in to change notification settings - Fork 1.7k
updater: fix static id hashes initialization #10755
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't H256::from_slice
only accepts 32-lenth slices?
Otherwise, LGTM. I couldn't find any other places where this bug could occur
It currently does and that is the problem, since |
Yeah, I meant as the argument type? So that we could catch this at compile time. |
Ah, you mean |
Yeah sure, but we could also have a |
Fair enough, but you can create it from |
Yeah sure.. But what I meant is that it would be better to not have a possible |
…me-parent * master: updater: fix static id hashes initialization (#10755) Use fewer threads for snapshotting (#10752) Die error_chain, die (#10747) Fix deprectation warnings on nightly (#10746) fix docker tags for publishing (#10741) DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) ethcore: enable ECIP-1054 for classic (#10731)
I get what you're trying to say, but it would also require changing conversions to uint for consistency, which would in turn imply a bunch of breaking changes and new releases, which I'm not sure is justified atm :p |
The change to panic with the wrong size is pretty new and before it was resizing the slice to the proper size, so old code might expect that behaviour. I agree with the change, but runtime panics like this are bad. Presumably any new code written will have tests in place to catch the panics but that's far from satisfying. The name We can:
Personally I'm tending to 3) tbh, but I'd like to hear more voices. |
* master: updater: fix static id hashes initialization (#10755) Use fewer threads for snapshotting (#10752) Die error_chain, die (#10747) Fix deprectation warnings on nightly (#10746) fix docker tags for publishing (#10741) DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) ethcore: enable ECIP-1054 for classic (#10731) Stop breaking out of loop if a non-canonical hash is found (#10729) Refactor Clique stepping (#10691) Use RUSTFLAGS to set the optimization level (#10719) SecretStore: non-blocking wait of session completion (#10303) removed secret_store folder (#10722) SecretStore: expose restore_key_public in HTTP API (#10241) Revert "enable lto for release builds (#10717)" (#10721) enable lto for release builds (#10717) Merge `Notifier` and `TransactionsPoolNotifier` (#10591)
But why did we change the behavior in the first place? |
paritytech/parity-common@ef4a8d8 EDIT: and before that it was paritytech/parity-common@9dec8ff#diff-058ba728d97e352f0db6a91ab02dc64bR86 |
Yeah, I would vote for having |
* master: Enable aesni (#10756) remove support of old SS db formats (#10757) [devp2p] Don't use `rust-crypto` (#10714) updater: fix static id hashes initialization (#10755) Use fewer threads for snapshotting (#10752) Die error_chain, die (#10747) Fix deprectation warnings on nightly (#10746) fix docker tags for publishing (#10741) DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) ethcore: enable ECIP-1054 for classic (#10731) Stop breaking out of loop if a non-canonical hash is found (#10729) Refactor Clique stepping (#10691) Use RUSTFLAGS to set the optimization level (#10719) SecretStore: non-blocking wait of session completion (#10303) removed secret_store folder (#10722) SecretStore: expose restore_key_public in HTTP API (#10241) Revert "enable lto for release builds (#10717)" (#10721) enable lto for release builds (#10717) Merge `Notifier` and `TransactionsPoolNotifier` (#10591)
…-even * master: [devp2p] Update to 2018 edition (#10716) Add a way to signal shutdown to snapshotting threads (#10744) Enable aesni (#10756) remove support of old SS db formats (#10757) [devp2p] Don't use `rust-crypto` (#10714) updater: fix static id hashes initialization (#10755) Use fewer threads for snapshotting (#10752) Die error_chain, die (#10747) Fix deprectation warnings on nightly (#10746) fix docker tags for publishing (#10741) DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) ethcore: enable ECIP-1054 for classic (#10731)
…p/chore/aura-log-validator-set-in-epoch-manager * dp/chore/aura-warn-when-validators-is-1-or-even: [devp2p] Update to 2018 edition (#10716) Add a way to signal shutdown to snapshotting threads (#10744) Enable aesni (#10756) remove support of old SS db formats (#10757) [devp2p] Don't use `rust-crypto` (#10714) updater: fix static id hashes initialization (#10755) Use fewer threads for snapshotting (#10752) Die error_chain, die (#10747) Fix deprectation warnings on nightly (#10746) fix docker tags for publishing (#10741) Update ethcore/src/engines/validator_set/simple_list.rs DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) ethcore: enable ECIP-1054 for classic (#10731)
Might help with #10085 (comment).
The bug was introduced in #10670.
Previously we used to pad short bytes with zeros when converting them to H256:
https://github.com/paritytech/parity-common/blob/e16441a8421d2e39a2e91a40f30a6b01cbaee00e/fixed-hash/src/hash.rs#L105-L111
But in the latest version of fixed-hash there is a length check and a panic.
I'm not really sure if there are other places in our codebase where we rely on the hash string being resized automatically when converting to
H256
.