Skip to content

refactor: add missing Copy derive to small value types#818

Open
wangzishuai1987 wants to merge 1 commit into
jarchain:masterfrom
wangzishuai1987:refactor/add-missing-copy-derive
Open

refactor: add missing Copy derive to small value types#818
wangzishuai1987 wants to merge 1 commit into
jarchain:masterfrom
wangzishuai1987:refactor/add-missing-copy-derive

Conversation

@wangzishuai1987
Copy link
Copy Markdown

Summary

Contributes to #186 — eliminate code duplication and improve type ergonomics.

Several structs and enums have all-Copy fields but only derive Clone, forcing unnecessary clones when Copy semantics would suffice.

Changes

Type Crate Fields Added
ExitReason javm Halt/Trap/Panic/OutOfGas/PageFault(u32)/HostCall(u32)/Ecall Copy
ServiceInfo grey-state Hash + Gas (both Copy) Copy
CoreStats grey-state eight u64 fields Copy
ReportedPackage grey-state two Hash fields Copy

Testing

Compiles cleanly. No behavior changes — pure refactoring.

@github-actions
Copy link
Copy Markdown
Contributor

Genesis Review

Comparison targets:

How to review

Post a comment with the following format (rank from best to worst):

/review
difficulty: <commit1>, <commit2>, ..., <commitN>, currentPR
novelty: <commit1>, <commit2>, ..., <commitN>, currentPR
design: <commit1>, <commit2>, ..., <commitN>, currentPR
verdict: merge

Use the short commit hashes above and currentPR for this PR.
Each line ranks all comparison targets + this PR from best to worst.

To meta-review another reviewer's comment, react with 👍 or 👎.

Several structs/enums have all-Copy fields but only derive Clone,
forcing unnecessary heap allocations when only Copy semantics are
needed:

- ExitReason (javm): all variants are no-data or u32
- ServiceInfo (grey-state): Hash + Gas, both Copy
- CoreStats (grey-state): eight u64 fields
- ReportedPackage (grey-state): two Hash fields

No behavior changes — pure refactoring.

Contributes to jarchain#186.
@wangzishuai1987 wangzishuai1987 force-pushed the refactor/add-missing-copy-derive branch from 1d742d3 to f8662e3 Compare April 29, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant