Upgrade ethereum-types to 0.16 (drops rand 0.7 chain)#3440
Open
peilun-conflux wants to merge 1 commit intoConflux-Chain:masterfrom
Open
Upgrade ethereum-types to 0.16 (drops rand 0.7 chain)#3440peilun-conflux wants to merge 1 commit intoConflux-Chain:masterfrom
peilun-conflux wants to merge 1 commit intoConflux-Chain:masterfrom
Conversation
Bumps the workspace's parity-common stack to current versions: - ethereum-types 0.9 -> 0.16.0 (uses primitive-types 0.14, fixed-hash 0.8) - rlp 0.4.0 -> 0.6 (with impl-rlp 0.4) - keccak-hash 0.5 -> 0.12 Removes the ethereum-types -> ethbloom -> fixed-hash 0.5/0.6 -> rand 0.7 dependency chain entirely. Rand 0.7 still appears transitively via parity-secp256k1, parity-ws, jsonrpc-pubsub, and cfxkey dev-deps, which are deferred to follow-up PRs. Mechanical migrations forced by the bumps: - uint 0.10 changed `to_big_endian`/`to_little_endian` from writing into a caller buffer to returning `[u8; N]`. Call sites rewritten to `buf.copy_from_slice(&x.to_big_endian())` or to consume the returned array directly. - uint 0.10 removed `From<[u8; N]>` and `From<&[u8]>` for U-types. `U256::from(&bytes)` -> `U256::from_big_endian(&bytes)` everywhere. - rlp 0.5+ removed `RlpStream::drain()` (the backing buffer became `BytesMut`). Replaced with `.out()` plus `.to_vec()` where callers return `Vec<u8>`. - `RlpStream::out()` / `rlp::encode()` now return `BytesMut` instead of `Vec<u8>`; added `.to_vec()` at boundaries where the API contract is `Vec<u8>`. Threading `BytesMut` end-to-end through `Message::encode`, `DatabaseEncodable::db_encode`, and `Block::encode_*` would avoid the extra copy on network/DB hot paths and is left as follow-up. Small adjacent cleanups: - `Context::transient_storage_at` now takes `&[u8]` (was `&Vec<u8>`) to match the sister `storage_at`. - Use the existing `cfx_types::u256_to_h256_be` helper in gasometer instead of the raw `H256(x.to_big_endian())` tuple constructor. tools/evm-spec-tester tracks the workspace change: `rlp = 0.6` plus the same uint 0.10 rewrites. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
duplicate of #3247 |
Contributor
Author
|
Fix the issue by following #3254 phased plan. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps the workspace's parity-common stack, removing the
ethereum-types → ethbloom → fixed-hash → rand 0.7transitive chain:ethereum-types0.9 → 0.16.0rlp0.4.0 → 0.6keccak-hash0.5 → 0.12Stacked on #3439 — merge that first.
Rand 0.7 status after this PR
Eliminated:
fixed-hash 0.5/0.6(viaethereum-types/ethbloom).Once #3438, #3439, and this PR all land, the only remaining rand 0.7 sources are
parity-wsandjsonrpc-pubsub.Mechanical migrations forced by the bumps
to_big_endian/to_little_endianreturn[u8; N]now. Rewrote call sites tobuf.copy_from_slice(&x.to_big_endian())or consume the returned array directly.From<[u8; N]>/From<&[u8]>for U-types removed.U256::from(&bytes)→U256::from_big_endian(&bytes).RlpStream::drain()removed; backing buffer becameBytesMut. Replaced with.out()(+.to_vec()where callers returnVec<u8>).RlpStream::out()/rlp::encode()returnBytesMut(wasVec<u8>). Added.to_vec()atVec<u8>-returning boundaries.Adjacent cleanups
Context::transient_storage_atsignature:&Vec<u8>→&[u8](matchesstorage_at).cfx_types::u256_to_h256_behelper in gasometer instead of rawH256(x.to_big_endian()).Follow-ups (not in this PR)
BytesMutend-to-end throughMessage::encode,DatabaseEncodable::db_encode,Block::encode_*— eliminates ~15.to_vec()copies on network/DB hot paths.Context::set_storage/transient_set_storageto take[u8; 32]— eliminates per-SSTORE/TSTORE heap allocation.🤖 Generated with Claude Code
This change is