Skip to content

refactor: prefix private members with underscore#861

Merged
zerosnacks merged 1 commit into
masterfrom
docs/private-underscore-prefix
May 13, 2026
Merged

refactor: prefix private members with underscore#861
zerosnacks merged 1 commit into
masterfrom
docs/private-underscore-prefix

Conversation

@zerosnacks
Copy link
Copy Markdown
Member

@zerosnacks zerosnacks commented May 13, 2026

Towards #653

Addresses the second goal of #653 ("Mark private variables and functions with underscore prefix") by aligning the remaining files with the convention already used in StdAssertions.sol, StdInvariant.sol, and StdConfig.sol.

No public/internal/external function signatures or behavior changed — all renames are limited to private members.

Renamed private state variables / helper functions

  • StdChains: _stdChainsInitialized, _chains, _defaultRpcUrls, _idToAlias, _fallbackToDefaultRpcUrls, _initializeStdChains, _getChainWithUpdatedRpcUrl, _setChainWithDefaultRpcUrl
  • StdCheats: _gasMeteringOff, _stdstore, _console2_log_StdCheats
  • StdStorage: _read, _bytesToBytes32, _flatten
  • StdStyle: _styleConcat
  • StdUtils: _addressFromLast20Bytes, _console2_log_StdUtils

Renamed private constants

  • StdAssertions: _FAILED_SLOT
  • StdCheats: _UINT256_MAX, _CONSOLE2_ADDRESS
  • StdConfig: _NUM_TYPES
  • StdMath: _INT256_MIN
  • StdUtils: _UINT256_MAX, _INT256_MIN_ABS, _SECP256K1_ORDER, _CONSOLE2_ADDRESS

Exclusions

  • The vm private constant — universal alias across forge-std and broader user code.
  • UINT256_MAX in StdStorage.sol — declared without an explicit visibility modifier, which defaults to internal in Solidity, so it is out of scope for this PR.
  • internal constants in Base.sol and StdConstants.sol — out of scope.

Verification

forge build and forge test both pass (202/202 tests).

@zerosnacks zerosnacks force-pushed the docs/private-underscore-prefix branch from 04eb7ce to d2b5232 Compare May 13, 2026 09:00
Aligns with the convention already used in StdAssertions, StdInvariant, and StdConfig, and addresses the second goal of #653.

Renamed private state variables and helper functions:
- StdChains: _stdChainsInitialized, _chains, _defaultRpcUrls, _idToAlias, _fallbackToDefaultRpcUrls, _initializeStdChains, _getChainWithUpdatedRpcUrl, _setChainWithDefaultRpcUrl
- StdCheats: _gasMeteringOff, _stdstore, _console2_log_StdCheats
- StdStorage: _read, _bytesToBytes32, _flatten
- StdStyle: _styleConcat
- StdUtils: _addressFromLast20Bytes, _console2_log_StdUtils

Renamed private constants:
- StdAssertions: _FAILED_SLOT
- StdCheats: _UINT256_MAX, _CONSOLE2_ADDRESS
- StdConfig: _NUM_TYPES
- StdMath: _INT256_MIN
- StdUtils: _UINT256_MAX, _INT256_MIN_ABS, _SECP256K1_ORDER, _CONSOLE2_ADDRESS

Excluded: 'vm' private constant (universal alias across forge-std).
Amp-Thread-ID: https://ampcode.com/threads/T-019e207d-61e2-7644-94cb-9a8861834bb5
Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-019e207d-61e2-7644-94cb-9a8861834bb5
Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-019e207d-61e2-7644-94cb-9a8861834bb5
Co-authored-by: Amp <[email protected]>
@zerosnacks zerosnacks force-pushed the docs/private-underscore-prefix branch from d2b5232 to a8353d2 Compare May 13, 2026 09:01
@zerosnacks zerosnacks marked this pull request as ready for review May 13, 2026 09:24
Copy link
Copy Markdown
Contributor

@mablr mablr left a comment

Choose a reason for hiding this comment

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

nice

@zerosnacks zerosnacks merged commit c90c02f into master May 13, 2026
20 checks passed
@zerosnacks zerosnacks deleted the docs/private-underscore-prefix branch May 13, 2026 10:03
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.

2 participants