This branch contains a proof-of-concept exploration of representing
the RLP (gmser_rlp) and gmserialization layers using ASN.1 with
DER encoding.
Goals of the experiment:
- Model the static serialization templates and dynamic types in ASN.1.
- Demonstrate reliable detection of legacy RLP data vs. new DER data
(first byte >= 0xC0 for RLP lists vs. 0x30 for DER SEQUENCE).
- Evaluate wire-size overhead of standard DER TLV encoding compared
to the extremely compact RLP prefix encoding.
- Verify that the DER path produces deterministic output suitable
for hashing (idempotent serialization).
Key files:
- GajumaruSerialization.asn -- the ASN.1 schema
- GajumaruSerialization.{erl,hrl} -- generated encoder/decoder
- detect_demo.erl, size_comparison.erl -- supporting test code
Findings (high level):
- Detection via first byte works cleanly.
- DER is fully deterministic for hashing when the same value is given.
- Small objects pay a significant size overhead (often 3-6x) due to
TLV tags/lengths and field names in the generic path.
- Concrete SEQUENCE definitions are much more compact than the
generic templateFields representation.
- Large payloads have acceptable relative overhead.
This is NOT production code. It was created to answer feasibility
questions around ASN.1 modeling, format detection, determinism,
and size characteristics.
Branch created from uw-new-acs for isolated experimentation.
Extended-auth account ids use an {account, Subtype} tag. These helpers
let callers test account membership and extract the 32-byte pubkey
without pattern-matching on specialize/1 results.
I noticed that the 'hash' serialization type wasn't in the `known_type()` set, although it was supported otherwise.
This PR adds it to the `known_type()` and also exports the type `gmser_api_encoder:known_type()`.
Also, some more tests are added to try to detect this sort of thing in the future.
Co-authored-by: Ulf Wiger <ulf@wiger.net>
Reviewed-on: #56
gmser_dyn no longer tries to compress output by omitting type tags.
Decoding streams using custom template codes can either use 'strict'
decoding, in which case matching templates must be registered on the
decoding end; in `strict => false` mode, the stream can still be decoded
without valudation if the custom template is missing.
This packages the library for deployment on zx (migrating from the old otpr-aeserialization-* line).
It also adds a native Erlang fallback to invokation of the Blake2 algorithm, picking enacl if it is present, but proceeding with eblake2 if not.
Reviewed-on: #45
Reviewed-by: dimitar.p.ivanov <dimitarivanov@qpq.swiss>
Reviewed-by: Ulf Wiger <ulfwiger@qpq.swiss>
Co-authored-by: Craig Everett <zxq9@zxq9.com>
Co-committed-by: Craig Everett <zxq9@zxq9.com>
Removed the oracle type references and updated the dependency list to point to git.qpq.swiss.
Reviewed-on: #43
Co-authored-by: Craig Everett <zxq9@zxq9.com>
Co-committed-by: Craig Everett <zxq9@zxq9.com>