Skip to content

v2.0.0a1 release

Pre-release
Pre-release
Compare
Choose a tag to compare
@arjanz arjanz released this 17 Jul 09:23
· 8 commits to v2 since this release

New from the ground up object based implementation in stead of parsing of type strings, which improves performance, flexibility and readability.

Benchmark of a MetadataV14 SCALE blob of 246kB

metadata_obj = MetadataVersioned.new()
metadata_obj.decode(ScaleBytes(metadata_fixture_dict['V14']))

# Execution time: 0.11408376693725586 seconds

Version 1 equivalent:

metadata_obj = runtime_config.create_scale_object("MetadataVersioned")
metadata_obj.decode(ScaleBytes(metadata_fixture_dict['V14']))

# Execution time: 0.40303683280944824 seconds

Other type examples

obj = Tuple(Compact(U32), Compact(U32)).new()
obj.decode(ScaleBytes("0x0c00"))

SlotNumber = U64
VrfOutput = Array(U8, 32)
VrfProof = Array(U8, 64)
RawAuraPreDigest = Struct(slot_number=U64)
RawBabePreDigestPrimary = Struct(authority_index=U32, slot_number=SlotNumber, vrf_output=VrfOutput, vrf_proof=VrfProof)
RawBabePreDigestSecondaryPlain = Struct(authority_index=U32, slot_number=SlotNumber)
RawBabePreDigestSecondaryVRF = Struct(authority_index=U32, slot_number=SlotNumber, vrf_output=VrfOutput, vrf_proof=VrfProof)
RawBabePreDigest = Enum(Phantom=None, Primary=RawBabePreDigestPrimary, SecondaryPlain=RawBabePreDigestSecondaryPlain, SecondaryVRF=RawBabePreDigestSecondaryVRF)