Skip to content

Conversation

@iostat
Copy link
Contributor

@iostat iostat commented Dec 18, 2025

Description

Addresses the clippy::{large_enum_variants,result_large_err} lints introduced by the 1.92 upgrade. Some enum variants were boxed where it made sense, others we're allowed as the size difference between the largest/second-largest wasn't too big to warrant a larger refactor.

Removes the --allow clippy::{large_enum_variants,result_large_err} from make lint[-beta]

Additionally, the --allow unused was changed to --allow unused_assignments, which is the more specific lint that was triggering #1893. Seeing as that's likely a compiler bug, we're keeping that issue open. However, --allow unused did allow some dead_code to slip through the cracks, so that's been addressed here too.

Related Issue(s)

Closes #1895

Type of Change

  • Refactoring (no functional changes)
  • Performance improvement (potentially! some multi-kb structures were moved from stack to heap)

Testing

Code should compile and CI should pass. There are no functional changes in this PR.

Changelog Entry

  • Fixed: CI: Remove clippy exceptions for large enum/err variants added as part of the Rust 1.92 upgrade

@github-actions
Copy link

github-actions bot commented Dec 18, 2025

OCaml Reference Validation Results

Repository: https://github.com/MinaProtocol/mina.git
Branch: compatible
Status: ❌ Validation failed

Click to see full validation output
Checking OCaml references against https://github.com/MinaProtocol/mina.git (branch: compatible)
Fetching current commit from compatible...
Current OCaml commit: 831d7a0d622e703e0a61d5a7d1480b70e30531c8

Validating references...
========================
✓ VALID: crates/ledger/src/account/account.rs -> src/lib/mina_base/account.ml L:201-224
  ⚠ STALE COMMIT: fc6be4c58091c761f827c858229c2edf9519e941 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
❌ INVALID: crates/ledger/src/scan_state/transaction_logic/for_tests.rs
   Code at L:2285-2285 differs between commit 5da42ccd72e791f164d4d200cf1ce300262873b3 and current branch
   Referenced: https://github.com/MinaProtocol/mina/blob/5da42ccd72e791f164d4d200cf1ce300262873b3/src/lib/transaction_logic/mina_transaction_logic.ml#L2285-L2285
   Current:    https://github.com/MinaProtocol/mina/blob/compatible/src/lib/transaction_logic/mina_transaction_logic.ml#L2285-L2285
❌ INVALID: crates/ledger/src/scan_state/transaction_logic/for_tests.rs
   Code at L:2351-2356 differs between commit 5da42ccd72e791f164d4d200cf1ce300262873b3 and current branch
   Referenced: https://github.com/MinaProtocol/mina/blob/5da42ccd72e791f164d4d200cf1ce300262873b3/src/lib/transaction_logic/mina_transaction_logic.ml#L2351-L2356
   Current:    https://github.com/MinaProtocol/mina/blob/compatible/src/lib/transaction_logic/mina_transaction_logic.ml#L2351-L2356
❌ INVALID: crates/ledger/src/scan_state/transaction_logic/for_tests.rs
   Code at L:2407 differs between commit 5da42ccd72e791f164d4d200cf1ce300262873b3 and current branch
   Referenced: https://github.com/MinaProtocol/mina/blob/5da42ccd72e791f164d4d200cf1ce300262873b3/src/lib/transaction_logic/mina_transaction_logic.ml#L2407-L2407
   Current:    https://github.com/MinaProtocol/mina/blob/compatible/src/lib/transaction_logic/mina_transaction_logic.ml#L2407-L2407
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/mina_base/transaction_status.ml L:9-51
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/mina_base/transaction_status.ml L:452-454
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/mina_base/with_status.ml L:6-10
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/mina_base/fee_transfer.ml L:76-80
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/mina_base/fee_transfer.ml L:68-69
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/mina_base/coinbase.ml L:17-21
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/mod.rs -> src/lib/transaction/transaction.ml L:8-11
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/signed_command.rs -> src/lib/mina_base/signed_command_payload.ml L:34-48
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/signed_command.rs -> src/lib/mina_base/stake_delegation.ml L:11-13
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/signed_command.rs -> src/lib/mina_base/signed_command_payload.ml L:179-181
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/signed_command.rs -> src/lib/mina_base/signed_command_payload.ml L:239-243
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)
✓ VALID: crates/ledger/src/scan_state/transaction_logic/signed_command.rs -> src/lib/mina_base/signed_command_payload.ml L:352-362
  ⚠ STALE COMMIT: 5da42ccd72e791f164d4d200cf1ce300262873b3 (current: 831d7a0d622e703e0a61d5a7d1480b70e30531c8)

Summary
=======
Total references found: 16
Valid references: 13
Invalid references: 3
Stale commits: 13

❌ Validation failed: 3 invalid reference(s) found

iostat added a commit that referenced this pull request Dec 18, 2025
@github-actions
Copy link

github-actions bot commented Dec 18, 2025

⚠️ Code Reference Verification Failed

The documentation contains code references that do not match the current state of the codebase on the develop branch.

Issues Found

  • website/docs/developers/referencing-code-in-documentation.md:36 - File not found: ledger/src/scan_state/transaction_logic/valid.rs

Action Required

The code referenced in the documentation must be merged to develop before documentation can be added/modified.

Please follow this workflow:

  1. Merge the code changes to develop first (this PR or a separate code PR)
  2. Create a follow-up PR with the documentation updates that reference the merged code
  3. The verification will pass once the code is available on develop

See the documentation guidelines for more information about the two-PR workflow.

iostat added a commit that referenced this pull request Dec 18, 2025
@iostat iostat force-pushed the io/1.92-fix-clippies branch from 676b5d2 to 4aa73c1 Compare December 18, 2025 15:55
iostat added a commit that referenced this pull request Dec 18, 2025
@iostat iostat force-pushed the io/1.92-fix-clippies branch from 4aa73c1 to 2d00bf6 Compare December 18, 2025 16:09
@iostat iostat force-pushed the io/1.92-fix-clippies branch from 2d00bf6 to db82285 Compare December 18, 2025 17:34
@iostat iostat enabled auto-merge December 18, 2025 21:42
--allow clippy::large_enum_variant \
--allow clippy::result-large-err \
--allow unused
--allow unused_assignments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no... for the whole thing!?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I actually don't know the difference between unused_assignments vs unused)


/// External worker input.
#[derive(Debug, BinProtRead, BinProtWrite)]
#[expect(clippy::large_enum_variant, reason = "This enum is only used in tests")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put this behind a feature flag if it's only used in tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to change in this PR, but can you create an issue before resolving the comment?

Ok(snark_work::spec::Work::Transition((statement, witness)))
Ok(snark_work::spec::Work::Transition((
statement,
Box::new(witness),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to hear your opinion on this, but when it comes to wrapper types like this, I prefer to use witness.into(). That way, changes are minimized if we decide to have any other wrapper or anything like that.

(not a change for this PR, just interested in your thoughts)


/// External worker input.
#[derive(Debug, BinProtRead, BinProtWrite)]
#[expect(clippy::large_enum_variant, reason = "This enum is only used in tests")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment

pub type EventSourceActionWithMeta = redux::ActionWithMeta<EventSourceAction>;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[expect(clippy::large_enum_variant, reason = "This enum extends super::Event")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I'm not sure if I agree with this one. This should almost certainly be boxed, no?

Also... a nit... but... I would say "wraps," not "extends"

/// reason this type is private while functions wrapping the whole call
/// to the service are exposed as the service's methods.
#[allow(dead_code)] // TODO
#[expect(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect?

.map(|jobs| {
let jobs = jobs.collect::<Vec<JobValueWithIndex<'_>>>();
let mut iter = jobs.iter().peekable();
let iter = jobs.iter().peekable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

*state = Self::LedgerLoadSuccess {
time: meta.time(),
data: data.clone(),
data: *data.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really!? Clone::clone should always return an owned type, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nvm... data is &Box

let rpc_state = &state.p2p.get_ready_peer(peer_id)?.channels.rpc;
if *req_id == rpc_state.pending_local_rpc_id()? {
return Some(format!("Request: {}", rpc_state.pending_local_rpc()?));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gross... but it was gross before... I just couldn't look at it without commenting

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yikes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Clippy: Address large struct/enum variants

3 participants