lambdaclass / lambdaclass/eth-agent

Magic numbers should be extracted to named constants

Open
#40 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code-quality low-priority
Dominant language
TypeScript
Stars
10
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Problem

Several magic numbers in the codebase reduce readability and maintainability.

Locations

  • src/protocol/account.ts:106 - 0x80000000 for hardened derivation
  • src/protocol/account.ts:279 - 64 for SHA-512 output length
  • Various other hardcoded values

Recommendation

Extract to named constants:

const BIP32_HARDENED_OFFSET = 0x80000000;
const SHA512_OUTPUT_LENGTH = 64;
const SECP256K1_CURVE_ORDER = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141n;

Priority

Low - Code quality improvement

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/protocol/account.ts at lines 106 and 279, then inspect the surrounding protocol code for the other hardcoded values mentioned in the issue. Extract the identified magic numbers into descriptive constants, including the hardened derivation offset and SHA-512 length, and verify existing behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.