Skip to content

refactor: expand all abbreviated identifiers to full words#4

Closed
tcoratger wants to merge 2 commits into
mainfrom
refactor/expand-abbreviations-in-identifiers
Closed

refactor: expand all abbreviated identifiers to full words#4
tcoratger wants to merge 2 commits into
mainfrom
refactor/expand-abbreviations-in-identifiers

Conversation

@tcoratger
Copy link
Copy Markdown
Owner

Motivation

A reference specification should read as explicitly as possible. Abbreviated identifiers (att_data, validator_id, msg, sk, …) make the spec ambiguous. This PR spells every abbreviated identifier out in full across src/, tests/, and the packages/ testing framework — ~282 distinct renames over 172 files — and codifies the convention as a rule in CLAUDE.md.

What changed

Identifiers only (variables, parameters, functions, methods, classes, attributes, constants) — never on-the-wire strings.

  • validator_idvalidator_index (the domain-correct term)
  • attattestation, msgmessage, sigsignature, sksecret_key, pk/pubkeypublic_key
  • idxindex, prevprevious, currcurrent, aggaggregate, propproposal, connconnection, privkeyprivate_key, lenlength
  • Function/method/class names too: split_by_msgsplit_by_message, PubkeyPublicKey, get_attestation_pubkeyget_attestation_public_key
  • MSG_LEN_FEMESSAGE_LENGTH_FIELD_ELEMENTS

Deliberately kept (verified case-by-case)

  • Canonical protocol IDs: peer_id, node_id, protocol_id, subnet_id, stream_id
  • ENR fields attnets / seq, the num_* prefix, the reqresp libp2p name
  • Library/stdlib APIs: argparse dest=, model_config, tmp_path, CERT_NONE, …
  • External symbols, e.g. functions imported from lean_multisig_py

Format-affecting notes

Internal config/fixture string keys were updated to stay consistent with the renamed fields. Test vectors regenerate, but cross-client tooling may reference these:

  • Genesis YAML keys: attestation_pubkey/proposal_pubkeyattestation_public_key/proposal_public_key
  • Validator registry manifest keys (*_pubkey_hex, *_privkey_file*_public_key_hex, *_private_key_file)
  • One metrics coverage-section label: "agg_start_new""aggregate_start_new"

Verification

just check passes (ruff, format, ty type-check, codespell, mdformat). Unit tests / fill were not run here — recommend uv run pytest and uv run fill before merge since field renames affect generated fixtures.

🤖 Generated with Claude Code

tcoratger and others added 2 commits May 29, 2026 18:24
A reference specification should be as explicit as possible, so every
abbreviated identifier is spelled out in full across src, tests, and the
packages/ testing framework (~282 distinct renames over 172 files).

Highlights:
- validator_id -> validator_index (the domain-correct term)
- att -> attestation, msg -> message, sig -> signature, sk -> secret_key,
  pk/pubkey -> public_key, idx -> index, prev -> previous, agg -> aggregate,
  prop -> proposal, conn -> connection, privkey -> private_key, len -> length
- function/method/class names too (split_by_msg -> split_by_message,
  Pubkey -> PublicKey, get_attestation_pubkey -> get_attestation_public_key)
- MSG_LEN_FE -> MESSAGE_LENGTH_FIELD_ELEMENTS

Kept verbatim: canonical protocol IDs (peer_id, node_id, protocol_id,
subnet_id, stream_id), ENR fields (attnets, seq), num_* prefixes, the
reqresp protocol name, library APIs (argparse dest, model_config, tmp_path),
and external symbols (e.g. lean_multisig_py functions).

Internal config/fixture string keys were updated to match the renamed
fields (genesis YAML keys, validator registry manifest keys, one metrics
coverage-section label).

Adds a NO ABBREVIATIONS IN IDENTIFIERS rule to CLAUDE.md documenting the
convention and its canonical exceptions.

just check passes (ruff, format, ty, codespell, mdformat).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Test assertions and fixtures that referenced identifiers via strings were
not updated by the identifier rename (parametrize argument-name lists,
f-string YAML manifest keys, an exception-match pattern):

- parametrize names byte_len/leaf_parts_len -> byte_length/leaf_parts_length
- bootstrap ValidatorManifest YAML keys -> *_public_key_hex / *_private_key_file
- Type-2 aggregate error message assertion -> "expected 2 public keys, got 1"

Full unit suite (3084 tests) passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger
Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR against leanEthereum/leanSpec: leanEthereum#800

@tcoratger tcoratger closed this May 29, 2026
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