Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xearl4 opened this issue Aug 30, 2024 · 0 comments

Comments

@xearl4
Copy link

xearl4 commented Aug 30, 2024

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.

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

No branches or pull requests

1 participant