Skip to content

wallet: Validate Bitcoin Core state types - #12

Open
BenWestgate wants to merge 1 commit into
reviewability-v1from
codex/v1-core-state-validation
Open

BenWestgate wants to merge 1 commit into
reviewability-v1from
codex/v1-core-state-validation

Conversation

@BenWestgate

Copy link
Copy Markdown
Owner

What

  • require exact nonnegative integer types for Core transaction, keypool, and
    unlock fields
  • require an exact integer zero when verifying walletlock
  • cover RPC failure, unsuccessful lock verification, and malformed boolean or
    string state

Why

Python treats booleans as integers, so values such as False previously passed
numeric zero checks. Core RPC responses are untrusted and wallet eligibility and
relocking must fail closed. This adapts
Rob1Ham/python-codex32#10
and closes the same type-confusion path in final relock verification.

Validation

  • python -m pytest -q — 864 passed
  • python -O -m pytest -q — 864 passed
  • Ruff check and format checks
  • strict mypy
  • python tools/differential_wallet.py --verify — 768 records matched

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f60a4600e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/codex32/_bitcoin_core.py Outdated
Require exact nonnegative integer types for wallet counts and unlock state,
including final relock verification. This prevents booleans and malformed RPC
values from passing numeric equality checks.

Security: fail closed on untrusted Bitcoin Core state while preserving valid
encrypted and unencrypted wallet flows.

Validation: python -m pytest -q; python -O -m pytest -q; Ruff check and format;
strict mypy; differential_wallet.py --verify.
@BenWestgate
BenWestgate force-pushed the codex/v1-core-state-validation branch from 3f60a46 to d574d1e Compare September 21, 2026 09:14
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@BenWestgate BenWestgate added gate: adversarial review Resolve, merge, or explicitly defer before the next full adversarial review. area: security Security invariants, hardening, and security-sensitive boundaries. area: wallet/core Wallet integration and Bitcoin Core boundaries. bug Something isn't working labels Sep 24, 2026
@BenWestgate

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: d574d1e309

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BenWestgate BenWestgate left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

AI-generated review (Claude), posted at the maintainer's request.

ACK d574d1e

  • type(x) is int closes the False == 0 path for eligibility and the relock check; an absent unlocked_until still means unencrypted.
  • Merges cleanly with #57.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: security Security invariants, hardening, and security-sensitive boundaries. area: wallet/core Wallet integration and Bitcoin Core boundaries. bug Something isn't working gate: adversarial review Resolve, merge, or explicitly defer before the next full adversarial review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant