unit-tests-todo.md
This plan lists TypeScript files in the Shardeum project that currently lack unit test coverage, organized from simplest to most complex.
You can reference specific tasks by their numbers. For example:
/home/marc/work/shardeum/src/utils/constants.ts - Simple constants file (10 lines)/home/marc/work/shardeum/src/utils/versions.ts - Version reading utility (28 lines)/home/marc/work/shardeum/src/types/DevAccount.ts - Simple type definitions (40 lines)/home/marc/work/shardeum/src/storage/utils/sqlOpertors.ts - SQL operators utility/home/marc/work/shardeum/src/shardeum/shardeumTypes.ts - Type definitions and interfaces/home/marc/work/shardeum/src/types/NodeAccount.ts - Node account type definitions (107 lines)/home/marc/work/shardeum/src/evm_v2/opcodes/codes.ts - Opcode constants/home/marc/work/shardeum/src/evm_v2/exceptions.ts - Exception definitions/home/marc/work/shardeum/src/utils/index.ts - Utility exports/home/marc/work/shardeum/src/state/index.ts - State exports/home/marc/work/shardeum/src/storage/models/index.ts - Model exports/home/marc/work/shardeum/src/state/cache/index.ts - Cache exports/home/marc/work/shardeum/src/debug/state/index.ts - Debug state exports/home/marc/work/shardeum/src/config/index.ts - Configuration exports/home/marc/work/shardeum/src/evm_v2/index.ts - EVM exports/home/marc/work/shardeum/src/vm_v7/index.ts - VM exports/home/marc/work/shardeum/src/evm_v2/opcodes/index.ts - Opcode exports/home/marc/work/shardeum/src/evm_v2/precompiles/index.ts - Precompiles exports/home/marc/work/shardeum/src/versioning/migrations/1.9.1.ts - Version migration/home/marc/work/shardeum/src/versioning/migrations/1.10.2.ts - Version migration/home/marc/work/shardeum/src/versioning/migrations/1.11.2.ts - Version migration/home/marc/work/shardeum/src/versioning/migrations/1.11.3.ts - Version migration/home/marc/work/shardeum/src/versioning/migrations/1.15.4.ts - Version migration/home/marc/work/shardeum/src/versioning/migrations/1.16.3.ts - Version migration/home/marc/work/shardeum/src/storage/models/accountsEntry.ts - Account entry model/home/marc/work/shardeum/src/storage/models/riAccountsCache.ts - Cache model/home/marc/work/shardeum/src/vm_v7/bloom/index.ts - Bloom filter utilities/home/marc/work/shardeum/src/utils/customMerge.ts - Custom merge utility/home/marc/work/shardeum/src/utils/ContinuationLocalStorage.ts - CLS utility/home/marc/work/shardeum/src/utils/RequestContext.ts - Request context utility/home/marc/work/shardeum/src/evm_v2/memory.ts - EVM memory management/home/marc/work/shardeum/src/evm_v2/stack.ts - EVM stack implementation/home/marc/work/shardeum/src/evm_v2/transientStorage.ts - Transient storage/home/marc/work/shardeum/src/evm_v2/eof.ts - EOF validation/home/marc/work/shardeum/src/evm_v2/journal.ts - State journal/home/marc/work/shardeum/src/evm_v2/message.ts - EVM message handling/home/marc/work/shardeum/src/evm_v2/precompiles/01-ecrecover.ts - ECRECOVER precompile/home/marc/work/shardeum/src/evm_v2/precompiles/02-sha256.ts - SHA256 precompile/home/marc/work/shardeum/src/evm_v2/precompiles/03-ripemd160.ts - RIPEMD160 precompile/home/marc/work/shardeum/src/evm_v2/precompiles/04-identity.ts - Identity precompile/home/marc/work/shardeum/src/evm_v2/precompiles/05-modexp.ts - MODEXP precompile/home/marc/work/shardeum/src/evm_v2/precompiles/06-ecadd.ts - ECADD precompile/home/marc/work/shardeum/src/evm_v2/precompiles/07-ecmul.ts - ECMUL precompile/home/marc/work/shardeum/src/evm_v2/precompiles/08-ecpairing.ts - ECPAIRING precompile/home/marc/work/shardeum/src/evm_v2/precompiles/09-blake2f.ts - BLAKE2F precompile/home/marc/work/shardeum/src/evm_v2/precompiles/0a-kzg-point-evaluation.ts - KZG precompile/home/marc/work/shardeum/src/tx/penalty/violation.ts - Violation handling/home/marc/work/shardeum/src/tx/penalty/penaltyFunctions.ts - Penalty calculations/home/marc/work/shardeum/src/tx/staking/verifyStake.ts - Stake verification/home/marc/work/shardeum/src/setup/validateTxnFields.ts - Transaction field validation/home/marc/work/shardeum/src/utils/requests.ts - HTTP request utilities/home/marc/work/shardeum/src/utils/transaction.ts - Transaction utilities/home/marc/work/shardeum/src/utils/multisig.ts - Multisig utilities/home/marc/work/shardeum/src/handlers/adminCertificate.ts - Admin certificate handling/home/marc/work/shardeum/src/middleware/externalApiMiddleware.ts - API middleware/home/marc/work/shardeum/src/storage/riAccountsCache.ts - Account cache implementation/home/marc/work/shardeum/src/state/cache/originalStorageCache.ts - Storage cache/home/marc/work/shardeum/src/storage/sqlite3storage.ts - SQLite storage layer/home/marc/work/shardeum/src/debug/trace/traceStorageMap.ts - Trace storage mapping/home/marc/work/shardeum/src/debug/trace/traceDataFactory.ts - Trace data factory/home/marc/work/shardeum/src/debug/db/index.ts - Debug database utilities/home/marc/work/shardeum/src/setup/environment.ts - Environment setup/home/marc/work/shardeum/src/setup/ticket-manager/index.ts - Ticket manager/home/marc/work/shardeum/src/versioning/index.ts - Versioning system/home/marc/work/shardeum/src/evm_v2/opcodes/util.ts - Opcode utilities/home/marc/work/shardeum/src/evm_v2/opcodes/gas.ts - Gas calculations/home/marc/work/shardeum/src/evm_v2/opcodes/EIP1283.ts - EIP-1283 implementation/home/marc/work/shardeum/src/evm_v2/opcodes/EIP2200.ts - EIP-2200 implementation/home/marc/work/shardeum/src/evm_v2/opcodes/EIP2929.ts - EIP-2929 implementation/home/marc/work/shardeum/src/evm_v2/opcodes/functions.ts - Opcode functions/home/marc/work/shardeum/src/evm_v2/interpreter.ts - EVM interpreter/home/marc/work/shardeum/src/evm_v2/evm.ts - Main EVM implementation (947 lines)/home/marc/work/shardeum/src/state/transactionState.ts - Transaction state management/home/marc/work/shardeum/src/state/shardeumState.ts - Core state implementation (926 lines)/home/marc/work/shardeum/src/debug/state/shardeumState.ts - Debug state implementation/home/marc/work/shardeum/src/debug/state/transactionState.ts - Debug transaction state/home/marc/work/shardeum/src/vm_v7/buildBlock.ts - Block building logic/home/marc/work/shardeum/src/vm_v7/runBlock.ts - Block execution/home/marc/work/shardeum/src/vm_v7/runTx.ts - Transaction execution (674 lines)/home/marc/work/shardeum/src/vm_v7/vm.ts - VM implementation/home/marc/work/shardeum/src/tx/penalty/transaction.ts - Penalty transaction processing/home/marc/work/shardeum/src/setup/validateTransaction.ts - Transaction validation/home/marc/work/shardeum/src/setup/sync.ts - Sync mechanism/home/marc/work/shardeum/src/debug/replayTX.ts - Transaction replay functionality/home/marc/work/shardeum/src/debug/estimateGas/estimateGas.ts - Gas estimation/home/marc/work/shardeum/src/debug/evmSetup/index.ts - EVM setup for debugging/home/marc/work/shardeum/src/debug/block/blockchain.ts - Debug blockchain/home/marc/work/shardeum/src/shardeum/debugRestoreAccounts.ts - Account restoration (252 lines)/home/marc/work/shardeum/src/block/blockchain.ts - Blockchain implementation/home/marc/work/shardeum/src/setup/index.ts - Main setup moduleStart with Simple Files: Begin with type definitions and constants as they are easiest to test and provide quick wins.
Focus on Utilities Next: Utility functions typically have clear inputs/outputs making them straightforward to test.
Test Critical Path: Prioritize testing transaction processing, state management, and EVM implementation as these are core to the system.
Use Existing Test Patterns: Follow patterns from existing test files in the codebase for consistency.
Mock Dependencies: For complex files, create appropriate mocks for external dependencies.
Coverage Goals: Aim for at least 80% coverage for utility files and 90%+ for critical business logic.
debug/ directory may be lower priority as they're development tools/home/marc/.claude/tasks/unit-tests-todo.md