dfinity / dfinity/candid

Nat & Int do not support binary encoders

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

Nobody has claimed this yet.

Dominant language
Rust
Stars
301
Forks
85
Avg merge
1h 4m
Merged PRs (30d)
4

Description

Nat & Int use deserialize_any in their de-serialization implementation: https://github.com/dfinity/candid/blob/master/rust/candid/src/types/number.rs#L155 https://github.com/dfinity/candid/blob/master/rust/candid/src/types/number.rs#L205

most binary encoding libraries do not support deserialize_any, example

bincode: https://github.com/bincode-org/bincode
postcard: https://github.com/jamesmunns/postcard

Is using BigUint/BigInt the only way?

Contributor guide

Open the contributing guide

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

Start with rust/candid/src/types/number.rs at the Nat and Int deserialization implementations linked in the issue. Compare their use of deserialize_any with the constraints of bincode and postcard, and define a supported approach that works for binary encoders; done means Nat and Int can deserialize through those encoders without requiring an unspecified alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.