//tvix/store: nixbase32 behaves odd for invalid encodings

#235
Opened by flokli at 2022-12-30T13·02+00

When adding support for nixbase32 to //tvix, we used the data_encoding and some initial byte reversing on top, instead of re-implementing all from scratch.

While it seems to behave correctly in our common default "store path encoding cases", there's some confusing/mismatching behaviour when comparing to the go-nix implementation.

Currently, the following tests ported from go-nix were commented out (when landing cl/7683) :

failures:
    nixbase32::tests::decode::invalid_encoding_2
    nixbase32::tests::decode::one_byte
    nixbase32::tests::encode::one_byte

We should dig deeper on why this behaves differently, and check which one is wrong.

  1. This doesn't seem to be limited to these "invalid" encodings, but various byte sizes.

    Unfortunately, it also currently encodes 32 bytes (seen in sha256 digests) wrongly, as can be seen in cl/7934.

    flokli at 2023-01-26T13·52+00

  2. This will be fixed by https://cl.tvl.fyi/c/depot/+/7934

    flokli at 2023-01-26T17·34+00

  3. That CL hit master, this can be closed.

    flokli at 2023-02-01T15·55+00

  4. flokli closed this issue at 2023-02-01T15·55+00