-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Issue
Multiple magic numbers are hardcoded throughout the transforms crate, making the code less readable and maintainable.
Current State
Several magic numbers without clear meaning:
1024
instack_noise.rs:49
(EVM stack limit)64
indetection.rs:260
(auxdata scan window)0x5b
indetection.rs:333
(JUMPDEST opcode)32_000
and200
inobfuscate.rs:203
(gas calculation)
Proposed Solution
Replace with named constants:
const EVM_STACK_LIMIT: usize = 1024;
const AUXDATA_SCAN_WINDOW: usize = 64;
const JUMPDEST_OPCODE: u8 = 0x5b;
const BASE_GAS_COST: u64 = 32_000;
const GAS_PER_BYTE: u64 = 200;
Benefits
- Improved code readability
- Self-documenting code
- Easier to modify values in the future
- Reduced chance of typos
Files to Modify
crates/transforms/src/stack_noise.rs
crates/core/src/detection.rs
crates/cli/src/commands/obfuscate.rs
Priority
Low - Code quality improvement