Skip to content

fix: preserve explicit zero order salt - #4

Draft
korowant wants to merge 1 commit into
PredictDotFun:mainfrom
korowant:agent/preserve-zero-order-salt
Draft

korowant wants to merge 1 commit into
PredictDotFun:mainfrom
korowant:agent/preserve-zero-order-salt

Conversation

@korowant

@korowant korowant commented Aug 2, 2026

Copy link
Copy Markdown

What changed

  • preserve an explicitly supplied salt=0 when building an order
  • add regression coverage for the zero-salt case

Why

BuildOrderInput.salt accepts integers, including zero, but data.salt or self._generate_salt() treated zero as if no salt had been supplied. The builder then substituted a generated salt, changing the serialized order and its typed-data hash from the caller's intent.

The new explicit None check distinguishes an omitted salt from a valid zero value.

Impact

Callers can reliably build deterministic orders with a zero salt. Existing behavior for omitted and non-zero salts is unchanged.

Validation

  • PYTHONPATH=src pytest -q — 134 passed
  • ruff check src/predict_sdk/order_builder.py tests/test_order_builder.py — passed
  • git diff --check — passed

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