Skip to content

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

@xearl4

Description

@xearl4

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 Chia-Network/chia-blockchain#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions