Chia-Network / Chia-Network/pool-reference

Request JSONs need to be pre-processed to prefix bytes with leading `0x` if not present

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

Nobody has claimed this yet.

Dominant language
Python
Stars
428
Forks
189
PR merge metrics
No merged PRs in 30d

Description

With chia-blockchain moving to chia_rs, bytes values parsed from JSON are now enforced to have a leading 0x: https://github.com/Chia-Network/chia_rs/blob/main/crates/chia-protocol/src/bytes.rs#L97-L101. According to https://github.com/Chia-Network/chia-blockchain/issues/13623, this enforcement is the expected and desired behaviour.

The Chia Pool Protocol 1.0 specification, however, allows bytes to be sent without leading 0x: "All bytes values are encoded as hex with optional 0x in front" (https://github.com/Chia-Network/pool-reference/blob/main/SPECIFICATION.md#https-endpoints-summary).

There are farmer implementations in the wild which send some values without a 0x prefix.

Thus, parsing of all JSON request payloads (PostFarmerRequest, PutFarmerRequest, and PostPartialRequest) needs to be adjusted to pre-process the JSON payload and prepend 0x in bytes field where the 0x is not present.

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

Locate the JSON parsing entry points for PostFarmerRequest, PutFarmerRequest, and PostPartialRequest, then read how their bytes fields are currently decoded. Pre-process each request payload so bytes without a leading 0x are accepted while existing prefixes remain valid; done means all three request types handle both forms consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.