refactor(vara.eth/malachite-core): concretize BlockPayload, drop <P> generic#5506
Draft
grishasobol wants to merge 4 commits into
Draft
refactor(vara.eth/malachite-core): concretize BlockPayload, drop <P> generic#5506grishasobol wants to merge 4 commits into
grishasobol wants to merge 4 commits into
Conversation
733e281 to
eca538f
Compare
…generic
Replace the marker `BlockPayload` trait + blanket impl with a concrete
versioned struct `BlockPayload { version: u16, bytes: LimitedVec<u8, 1_024_000> }`,
and drop the `<P>` type parameter from `Block`, `Externalities`,
`MalachiteService`, `State`, `Store`, `BlockEntry`. The new
`BlockPayload` type and its constants (`BLOCK_PAYLOAD_VERSION`,
`MAX_BLOCK_PAYLOAD_BYTES`) live in `ethexe-common` so the executor
side can consume them without a back-dep on the consensus layer;
`ethexe-malachite-core` picks them up from there.
Application-level encoding/decoding of `ethexe_common::malachite::Transactions`
moves entirely to ethexe-malachite (the service crate) where it's
wrapped into `BlockPayload` before crossing the core boundary. The
1000 KiB byte cap keeps the encoded block under the 1 MiB engine
ceiling and turns oversize payloads into decode-time errors at the
wire.
Fixes #5505
fbd5c67 to
d3341a6
Compare
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
BlockPayloadtrait + blanket impl with concreteBlockPayload { version: u16, bytes: LimitedVec<u8, 1_024_000> }and drop<P>fromBlock,Externalities,MalachiteService,State,Store,BlockEntry.ethexe_common::malachite::Transactionsmoves to ethexe-malachite (service); core stays application-agnostic and ships an opaque versioned byte string.LimitedVeccap turns oversize payloads into decode-time errors before the 1 MiB engine ceiling can be hit silently.Fixes #5505.
Test plan
cargo nextest run -p ethexe-malachite-core— 57/57 pass (includes newblock_payload_*regressions for size cap + decode rejection).cargo nextest run -p ethexe-malachite— 56/56 pass.cargo fmt,cargo clippy --tests -p ethexe-malachite-core -p ethexe-malachite— clean.🤖 Generated with Claude Code