Skip to content

v1.0.5-p1 Better CBOR<->JSONB conversion

Latest
Compare
Choose a tag to compare
@Fell-x27 Fell-x27 released this 22 Feb 22:41
· 2 commits to master since this release

This is quite an important release for several reasons:

KOIOS Collaboration & CIP-88 Support

Our friends at KOIOS came up with the idea of implementing a function for convenient validation of key registration according to their proposed CIP-88 standard. This release owes its existence to that collaboration.

It has a rather unusual tag: v1.0.5-p1, where p1 stands for "phase 1". This is a full-fledged release, not a beta—it is simply divided into two phases.

  • Phase 1 introduces the implementation of tools_verify_cip88_pool_key_registration as an SQL procedure that utilizes multiple calls to native code instead of a fully native implementation. Essentially, this is a prototype, but one that is production-ready and fully tested.
  • Phase 2 (v1.0.5-p2) will provide the same functionality but as a purely native implementation, without changing the function signature. The only difference will be improved performance. 🚀

CBOR<->JSONB Improvements

During development, we uncovered several inconsistencies in repeated CBOR<->JSONB serialization and deserialization, which have now been fixed. This makes the release not just important but also highly beneficial.

  1. Enhanced CBOR->JSONB Encoder

    • The encoder now properly serializes bytea as hex-encoded rather than a hex-like string.
    • This makes CBOR output more compact.
    • It also aligns the serialization process with cardano-cli.
  2. Fixing JSONB Bytearray Handling

    • JSONB does not have a native bytearray type; it is always passed as a hex-encoded string, which, in some cases, was still stored as text.
    • This limitation has been successfully worked around, making the handling more robust than ever.
  3. New Function: cbor_decode_jsonb_hex2bytea

    • Correct encoding of bytea into CBOR is important, but so is correct decoding.
    • Instead of modifying the existing cbor_decode_jsonb function (which could introduce regressions for users), a new function, cbor_decode_jsonb_hex2bytea, was introduced to handle this properly.

Release Notes:

  1. Fixed the issue with \u{0} characters in property keys;
  2. JSONB->CBOR conversion now follows the same rules as cardano-cli;
  3. JSONB->CBOR conversion now correctly handles bytearray transfer between formats;
  4. CBOR->JSONB conversion now allows handling bytearray transfer between formats with cbor_decode_jsonb_hex2bytea function;
  5. Refactoring, lots of refactoring, and some optimizations;
  6. Added a function tools_verify_cip88_pool_key_registration;
  7. README.md update;
  8. Tests update;
  9. Migrations update;

Documentation - link
Installation/update guide - link