@typeberry/trie
Advanced tools
Comparing version 0.0.1-b19c732 to 0.0.1-b25856a
986
index.js
@@ -17,2 +17,23 @@ 'use strict'; | ||
/** | ||
* @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a | ||
* specified unique token Token. It means that base type cannot be assigned to unique type by accident. | ||
* Good examples of opaque types include: | ||
* - JWTs or other tokens - these are special kinds of string used for authorization purposes. | ||
* If your app uses multiple types of tokens each should be a separate opaque type to avoid confusion | ||
* - Specific currencies - amount of different currencies shouldn't be mixed | ||
* - Bitcoin address - special kind of string | ||
* | ||
* `type GithubAccessToken = Opaque<string, "GithubAccessToken">;` | ||
* `type USD = Opaque<number, "USD">;` | ||
* `type PositiveNumber = Opaque<number, "PositiveNumber">; | ||
* | ||
* More: https://github.com/ts-essentials/ts-essentials/blob/master/lib/opaque/README.md | ||
* | ||
* Copyright (c) 2018-2019 Chris Kaczor (github.com/krzkaczor) | ||
*/ | ||
function asOpaqueType(v) { | ||
return v; | ||
} | ||
/** | ||
* A variable-length blob of bytes with a concise text representation. | ||
@@ -25,5 +46,4 @@ * | ||
constructor(data) { | ||
this.buffer = new Uint8Array([]); | ||
this.length = 0; | ||
this.buffer = data; | ||
this.raw = data; | ||
this.length = data.byteLength; | ||
@@ -35,11 +55,59 @@ } | ||
toString() { | ||
return bytesToHexString(this.buffer); | ||
return bytesToHexString(this.raw); | ||
} | ||
/** Decode contained bytes as string. */ | ||
asText() { | ||
const decoder = new TextDecoder(); | ||
return decoder.decode(this.raw); | ||
} | ||
/** Converts current type into some opaque extension. */ | ||
asOpaque() { | ||
return asOpaqueType(this); | ||
} | ||
/** Compare the sequence to another one. */ | ||
isEqualTo(other) { | ||
if (this.length !== other.length) { | ||
return false; | ||
} | ||
return u8ArraySameLengthEqual(this.raw, other.raw); | ||
} | ||
/** Compare the sequence to another one lexicographically. */ | ||
isLessThan(other) { | ||
const min = Math.min(this.length, other.length); | ||
const thisRaw = this.raw; | ||
const otherRaw = other.raw; | ||
for (let i = 0; i < min; i++) { | ||
if (thisRaw[i] < otherRaw[i]) { | ||
return true; | ||
} | ||
if (thisRaw[i] > otherRaw[i]) { | ||
return false; | ||
} | ||
} | ||
return this.length < other.length; | ||
} | ||
/** Create a new [`BytesBlob'] by converting given UTF-u encoded string into bytes. */ | ||
static blobFromString(v) { | ||
const encoder = new TextEncoder(); | ||
return BytesBlob.blobFrom(encoder.encode(v)); | ||
} | ||
/** Create a new [`BytesBlob`] from existing [`Uint8Array`]. */ | ||
static fromBlob(v) { | ||
static blobFrom(v) { | ||
return new BytesBlob(v); | ||
} | ||
/** Create a new [`BytesBlob`] by concatenating data from multiple `Uint8Array`s. */ | ||
static blobFromParts(v, ...rest) { | ||
const totalLength = v.length + rest.reduce((a, v) => a + v.length, 0); | ||
const buffer = new Uint8Array(totalLength); | ||
buffer.set(v, 0); | ||
let offset = v.length; | ||
for (const r of rest) { | ||
buffer.set(r, offset); | ||
offset += r.length; | ||
} | ||
return new BytesBlob(buffer); | ||
} | ||
/** Create a new [`BytesBlob`] from an array of bytes. */ | ||
static fromNumbers(v) { | ||
check(v.find((x) => (x & 0xff) !== x) === undefined, "BytesBlob.fromNumbers used with non-byte number array."); | ||
static blobFromNumbers(v) { | ||
check(v.find((x) => (x & 0xff) !== x) === undefined, "BytesBlob.blobFromNumbers used with non-byte number array."); | ||
const arr = new Uint8Array(v); | ||
@@ -73,24 +141,8 @@ return new BytesBlob(arr); | ||
*/ | ||
class Bytes { | ||
class Bytes extends BytesBlob { | ||
constructor(raw, len) { | ||
super(raw); | ||
check(raw.byteLength === len, `Given buffer has incorrect size ${raw.byteLength} vs expected ${len}`); | ||
this.raw = raw; | ||
this.length = len; | ||
} | ||
/** Return hex encoding of the sequence. */ | ||
toString() { | ||
return bytesToHexString(this.raw); | ||
} | ||
/** Compare the sequence to another one. */ | ||
isEqualTo(other) { | ||
if (this.length !== other.length) { | ||
return false; | ||
} | ||
for (let i = 0; i < this.length; i++) { | ||
if (this.raw[i] !== other.raw[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
/** Create new [`Bytes<X>`] given a backing buffer and it's length. */ | ||
@@ -100,2 +152,8 @@ static fromBlob(v, len) { | ||
} | ||
/** Create new [`Bytes<X>`] given an array of bytes and it's length. */ | ||
static fromNumbers(v, len) { | ||
check(v.find((x) => (x & 0xff) !== x) === undefined, "Bytes.fromNumbers used with non-byte number array."); | ||
const x = new Uint8Array(v); | ||
return new Bytes(x, len); | ||
} | ||
/** Create an empty [`Bytes<X>`] of given length. */ | ||
@@ -118,3 +176,3 @@ static zero(len) { | ||
const blob = BytesBlob.parseBlobNoPrefix(v); | ||
return new Bytes(blob.buffer, len); | ||
return new Bytes(blob.raw, len); | ||
} | ||
@@ -127,4 +185,9 @@ /** Parse a hex-encoded fixed-length bytes with `0x` prefix. */ | ||
const blob = BytesBlob.parseBlob(v); | ||
return new Bytes(blob.buffer, len); | ||
return new Bytes(blob.raw, len); | ||
} | ||
/** Compare the sequence to another one. */ | ||
isEqualTo(other) { | ||
check(this.length === other.length, "Comparing incorrectly typed bytes!"); | ||
return u8ArraySameLengthEqual(this.raw, other.raw); | ||
} | ||
} | ||
@@ -170,2 +233,10 @@ function byteFromString(s) { | ||
} | ||
function u8ArraySameLengthEqual(self, other) { | ||
for (let i = 0; i < self.length; i += 1) { | ||
if (self[i] !== other[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
@@ -229,11 +300,704 @@ /** | ||
/** Regular hash length */ | ||
const HASH_BYTES = 32; | ||
/** | ||
* Size of the output of the hash functions. | ||
* | ||
* https://graypaper.fluffylabs.dev/#/387103d/071401071f01 | ||
* | ||
*/ | ||
const HASH_SIZE = 32; | ||
var blake2b$1 = {exports: {}}; | ||
var nanoassert = assert$2; | ||
class AssertionError extends Error {} | ||
AssertionError.prototype.name = 'AssertionError'; | ||
/** | ||
* Minimal assert function | ||
* @param {any} t Value to check if falsy | ||
* @param {string=} m Optional assertion error message | ||
* @throws {AssertionError} | ||
*/ | ||
function assert$2 (t, m) { | ||
if (!t) { | ||
var err = new AssertionError(m); | ||
if (Error.captureStackTrace) Error.captureStackTrace(err, assert$2); | ||
throw err | ||
} | ||
} | ||
var blake2bWasm = {exports: {}}; | ||
function isBuffer (value) { | ||
return Buffer.isBuffer(value) || value instanceof Uint8Array | ||
} | ||
function isEncoding (encoding) { | ||
return Buffer.isEncoding(encoding) | ||
} | ||
function alloc (size, fill, encoding) { | ||
return Buffer.alloc(size, fill, encoding) | ||
} | ||
function allocUnsafe (size) { | ||
return Buffer.allocUnsafe(size) | ||
} | ||
function allocUnsafeSlow (size) { | ||
return Buffer.allocUnsafeSlow(size) | ||
} | ||
function byteLength (string, encoding) { | ||
return Buffer.byteLength(string, encoding) | ||
} | ||
function compare (a, b) { | ||
return Buffer.compare(a, b) | ||
} | ||
function concat (buffers, totalLength) { | ||
return Buffer.concat(buffers, totalLength) | ||
} | ||
function copy (source, target, targetStart, start, end) { | ||
return toBuffer(source).copy(target, targetStart, start, end) | ||
} | ||
function equals (a, b) { | ||
return toBuffer(a).equals(b) | ||
} | ||
function fill (buffer, value, offset, end, encoding) { | ||
return toBuffer(buffer).fill(value, offset, end, encoding) | ||
} | ||
function from (value, encodingOrOffset, length) { | ||
return Buffer.from(value, encodingOrOffset, length) | ||
} | ||
function includes (buffer, value, byteOffset, encoding) { | ||
return toBuffer(buffer).includes(value, byteOffset, encoding) | ||
} | ||
function indexOf (buffer, value, byfeOffset, encoding) { | ||
return toBuffer(buffer).indexOf(value, byfeOffset, encoding) | ||
} | ||
function lastIndexOf (buffer, value, byteOffset, encoding) { | ||
return toBuffer(buffer).lastIndexOf(value, byteOffset, encoding) | ||
} | ||
function swap16 (buffer) { | ||
return toBuffer(buffer).swap16() | ||
} | ||
function swap32 (buffer) { | ||
return toBuffer(buffer).swap32() | ||
} | ||
function swap64 (buffer) { | ||
return toBuffer(buffer).swap64() | ||
} | ||
function toBuffer (buffer) { | ||
if (Buffer.isBuffer(buffer)) return buffer | ||
return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
} | ||
function toString (buffer, encoding, start, end) { | ||
return toBuffer(buffer).toString(encoding, start, end) | ||
} | ||
function write (buffer, string, offset, length, encoding) { | ||
return toBuffer(buffer).write(string, offset, length, encoding) | ||
} | ||
function writeDoubleLE (buffer, value, offset) { | ||
return toBuffer(buffer).writeDoubleLE(value, offset) | ||
} | ||
function writeFloatLE (buffer, value, offset) { | ||
return toBuffer(buffer).writeFloatLE(value, offset) | ||
} | ||
function writeUInt32LE (buffer, value, offset) { | ||
return toBuffer(buffer).writeUInt32LE(value, offset) | ||
} | ||
function writeInt32LE (buffer, value, offset) { | ||
return toBuffer(buffer).writeInt32LE(value, offset) | ||
} | ||
function readDoubleLE (buffer, offset) { | ||
return toBuffer(buffer).readDoubleLE(offset) | ||
} | ||
function readFloatLE (buffer, offset) { | ||
return toBuffer(buffer).readFloatLE(offset) | ||
} | ||
function readUInt32LE (buffer, offset) { | ||
return toBuffer(buffer).readUInt32LE(offset) | ||
} | ||
function readInt32LE (buffer, offset) { | ||
return toBuffer(buffer).readInt32LE(offset) | ||
} | ||
var b4a$1 = { | ||
isBuffer, | ||
isEncoding, | ||
alloc, | ||
allocUnsafe, | ||
allocUnsafeSlow, | ||
byteLength, | ||
compare, | ||
concat, | ||
copy, | ||
equals, | ||
fill, | ||
from, | ||
includes, | ||
indexOf, | ||
lastIndexOf, | ||
swap16, | ||
swap32, | ||
swap64, | ||
toBuffer, | ||
toString, | ||
write, | ||
writeDoubleLE, | ||
writeFloatLE, | ||
writeUInt32LE, | ||
writeInt32LE, | ||
readDoubleLE, | ||
readFloatLE, | ||
readUInt32LE, | ||
readInt32LE | ||
}; | ||
var blake2b; | ||
var hasRequiredBlake2b; | ||
function requireBlake2b () { | ||
if (hasRequiredBlake2b) return blake2b; | ||
hasRequiredBlake2b = 1; | ||
var __commonJS = (cb, mod) => function __require() { | ||
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
}; | ||
var __toBinary = /* @__PURE__ */ (() => { | ||
var table = new Uint8Array(128); | ||
for (var i = 0; i < 64; i++) | ||
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i; | ||
return (base64) => { | ||
var n = base64.length, bytes2 = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0); | ||
for (var i2 = 0, j = 0; i2 < n; ) { | ||
var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)]; | ||
var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)]; | ||
bytes2[j++] = c0 << 2 | c1 >> 4; | ||
bytes2[j++] = c1 << 4 | c2 >> 2; | ||
bytes2[j++] = c2 << 6 | c3; | ||
} | ||
return bytes2; | ||
}; | ||
})(); | ||
// wasm-binary:./blake2b.wat | ||
var require_blake2b = __commonJS({ | ||
"wasm-binary:./blake2b.wat"(exports2, module2) { | ||
module2.exports = __toBinary("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBO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DCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs="); | ||
} | ||
}); | ||
// wasm-module:./blake2b.wat | ||
var bytes = require_blake2b(); | ||
var compiled = WebAssembly.compile(bytes); | ||
blake2b = async (imports) => { | ||
const instance = await WebAssembly.instantiate(await compiled, imports); | ||
return instance.exports; | ||
}; | ||
return blake2b; | ||
} | ||
var assert$1 = nanoassert; | ||
var b4a = b4a$1; | ||
var wasm = null; | ||
var wasmPromise = typeof WebAssembly !== "undefined" && requireBlake2b()().then(mod => { | ||
wasm = mod; | ||
}); | ||
var head = 64; | ||
var freeList = []; | ||
blake2bWasm.exports = Blake2b$1; | ||
var BYTES_MIN$1 = blake2bWasm.exports.BYTES_MIN = 16; | ||
var BYTES_MAX$1 = blake2bWasm.exports.BYTES_MAX = 64; | ||
blake2bWasm.exports.BYTES = 32; | ||
var KEYBYTES_MIN$1 = blake2bWasm.exports.KEYBYTES_MIN = 16; | ||
var KEYBYTES_MAX$1 = blake2bWasm.exports.KEYBYTES_MAX = 64; | ||
blake2bWasm.exports.KEYBYTES = 32; | ||
var SALTBYTES$1 = blake2bWasm.exports.SALTBYTES = 16; | ||
var PERSONALBYTES$1 = blake2bWasm.exports.PERSONALBYTES = 16; | ||
function Blake2b$1 (digestLength, key, salt, personal, noAssert) { | ||
if (!(this instanceof Blake2b$1)) return new Blake2b$1(digestLength, key, salt, personal, noAssert) | ||
if (!wasm) throw new Error('WASM not loaded. Wait for Blake2b.ready(cb)') | ||
if (!digestLength) digestLength = 32; | ||
if (noAssert !== true) { | ||
assert$1(digestLength >= BYTES_MIN$1, 'digestLength must be at least ' + BYTES_MIN$1 + ', was given ' + digestLength); | ||
assert$1(digestLength <= BYTES_MAX$1, 'digestLength must be at most ' + BYTES_MAX$1 + ', was given ' + digestLength); | ||
if (key != null) { | ||
assert$1(key instanceof Uint8Array, 'key must be Uint8Array or Buffer'); | ||
assert$1(key.length >= KEYBYTES_MIN$1, 'key must be at least ' + KEYBYTES_MIN$1 + ', was given ' + key.length); | ||
assert$1(key.length <= KEYBYTES_MAX$1, 'key must be at least ' + KEYBYTES_MAX$1 + ', was given ' + key.length); | ||
} | ||
if (salt != null) { | ||
assert$1(salt instanceof Uint8Array, 'salt must be Uint8Array or Buffer'); | ||
assert$1(salt.length === SALTBYTES$1, 'salt must be exactly ' + SALTBYTES$1 + ', was given ' + salt.length); | ||
} | ||
if (personal != null) { | ||
assert$1(personal instanceof Uint8Array, 'personal must be Uint8Array or Buffer'); | ||
assert$1(personal.length === PERSONALBYTES$1, 'personal must be exactly ' + PERSONALBYTES$1 + ', was given ' + personal.length); | ||
} | ||
} | ||
if (!freeList.length) { | ||
freeList.push(head); | ||
head += 216; | ||
} | ||
this.digestLength = digestLength; | ||
this.finalized = false; | ||
this.pointer = freeList.pop(); | ||
this._memory = new Uint8Array(wasm.memory.buffer); | ||
this._memory.fill(0, 0, 64); | ||
this._memory[0] = this.digestLength; | ||
this._memory[1] = key ? key.length : 0; | ||
this._memory[2] = 1; // fanout | ||
this._memory[3] = 1; // depth | ||
if (salt) this._memory.set(salt, 32); | ||
if (personal) this._memory.set(personal, 48); | ||
if (this.pointer + 216 > this._memory.length) this._realloc(this.pointer + 216); // we need 216 bytes for the state | ||
wasm.blake2b_init(this.pointer, this.digestLength); | ||
if (key) { | ||
this.update(key); | ||
this._memory.fill(0, head, head + key.length); // whiteout key | ||
this._memory[this.pointer + 200] = 128; | ||
} | ||
} | ||
Blake2b$1.prototype._realloc = function (size) { | ||
wasm.memory.grow(Math.max(0, Math.ceil(Math.abs(size - this._memory.length) / 65536))); | ||
this._memory = new Uint8Array(wasm.memory.buffer); | ||
}; | ||
Blake2b$1.prototype.update = function (input) { | ||
assert$1(this.finalized === false, 'Hash instance finalized'); | ||
assert$1(input instanceof Uint8Array, 'input must be Uint8Array or Buffer'); | ||
if (head + input.length > this._memory.length) this._realloc(head + input.length); | ||
this._memory.set(input, head); | ||
wasm.blake2b_update(this.pointer, head, head + input.length); | ||
return this | ||
}; | ||
Blake2b$1.prototype.digest = function (enc) { | ||
assert$1(this.finalized === false, 'Hash instance finalized'); | ||
this.finalized = true; | ||
freeList.push(this.pointer); | ||
wasm.blake2b_final(this.pointer); | ||
if (!enc || enc === 'binary') { | ||
return this._memory.slice(this.pointer + 128, this.pointer + 128 + this.digestLength) | ||
} | ||
if (typeof enc === 'string') { | ||
return b4a.toString(this._memory, enc, this.pointer + 128, this.pointer + 128 + this.digestLength) | ||
} | ||
assert$1(enc instanceof Uint8Array && enc.length >= this.digestLength, 'input must be Uint8Array or Buffer'); | ||
for (var i = 0; i < this.digestLength; i++) { | ||
enc[i] = this._memory[this.pointer + 128 + i]; | ||
} | ||
return enc | ||
}; | ||
// libsodium compat | ||
Blake2b$1.prototype.final = Blake2b$1.prototype.digest; | ||
Blake2b$1.WASM = wasm; | ||
Blake2b$1.SUPPORTED = typeof WebAssembly !== 'undefined'; | ||
Blake2b$1.ready = function (cb) { | ||
if (!cb) cb = noop; | ||
if (!wasmPromise) return cb(new Error('WebAssembly not supported')) | ||
return wasmPromise.then(() => cb(), cb) | ||
}; | ||
Blake2b$1.prototype.ready = Blake2b$1.ready; | ||
Blake2b$1.prototype.getPartialHash = function () { | ||
return this._memory.slice(this.pointer, this.pointer + 216); | ||
}; | ||
Blake2b$1.prototype.setPartialHash = function (ph) { | ||
this._memory.set(ph, this.pointer); | ||
}; | ||
function noop () {} | ||
var blake2bWasmExports = blake2bWasm.exports; | ||
var assert = nanoassert; | ||
var b2wasm = blake2bWasmExports; | ||
// 64-bit unsigned addition | ||
// Sets v[a,a+1] += v[b,b+1] | ||
// v should be a Uint32Array | ||
function ADD64AA (v, a, b) { | ||
var o0 = v[a] + v[b]; | ||
var o1 = v[a + 1] + v[b + 1]; | ||
if (o0 >= 0x100000000) { | ||
o1++; | ||
} | ||
v[a] = o0; | ||
v[a + 1] = o1; | ||
} | ||
// 64-bit unsigned addition | ||
// Sets v[a,a+1] += b | ||
// b0 is the low 32 bits of b, b1 represents the high 32 bits | ||
function ADD64AC (v, a, b0, b1) { | ||
var o0 = v[a] + b0; | ||
if (b0 < 0) { | ||
o0 += 0x100000000; | ||
} | ||
var o1 = v[a + 1] + b1; | ||
if (o0 >= 0x100000000) { | ||
o1++; | ||
} | ||
v[a] = o0; | ||
v[a + 1] = o1; | ||
} | ||
// Little-endian byte access | ||
function B2B_GET32 (arr, i) { | ||
return (arr[i] ^ | ||
(arr[i + 1] << 8) ^ | ||
(arr[i + 2] << 16) ^ | ||
(arr[i + 3] << 24)) | ||
} | ||
// G Mixing function | ||
// The ROTRs are inlined for speed | ||
function B2B_G (a, b, c, d, ix, iy) { | ||
var x0 = m[ix]; | ||
var x1 = m[ix + 1]; | ||
var y0 = m[iy]; | ||
var y1 = m[iy + 1]; | ||
ADD64AA(v, a, b); // v[a,a+1] += v[b,b+1] ... in JS we must store a uint64 as two uint32s | ||
ADD64AC(v, a, x0, x1); // v[a, a+1] += x ... x0 is the low 32 bits of x, x1 is the high 32 bits | ||
// v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits | ||
var xor0 = v[d] ^ v[a]; | ||
var xor1 = v[d + 1] ^ v[a + 1]; | ||
v[d] = xor1; | ||
v[d + 1] = xor0; | ||
ADD64AA(v, c, d); | ||
// v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits | ||
xor0 = v[b] ^ v[c]; | ||
xor1 = v[b + 1] ^ v[c + 1]; | ||
v[b] = (xor0 >>> 24) ^ (xor1 << 8); | ||
v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8); | ||
ADD64AA(v, a, b); | ||
ADD64AC(v, a, y0, y1); | ||
// v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits | ||
xor0 = v[d] ^ v[a]; | ||
xor1 = v[d + 1] ^ v[a + 1]; | ||
v[d] = (xor0 >>> 16) ^ (xor1 << 16); | ||
v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16); | ||
ADD64AA(v, c, d); | ||
// v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits | ||
xor0 = v[b] ^ v[c]; | ||
xor1 = v[b + 1] ^ v[c + 1]; | ||
v[b] = (xor1 >>> 31) ^ (xor0 << 1); | ||
v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1); | ||
} | ||
// Initialization Vector | ||
var BLAKE2B_IV32 = new Uint32Array([ | ||
0xF3BCC908, 0x6A09E667, 0x84CAA73B, 0xBB67AE85, | ||
0xFE94F82B, 0x3C6EF372, 0x5F1D36F1, 0xA54FF53A, | ||
0xADE682D1, 0x510E527F, 0x2B3E6C1F, 0x9B05688C, | ||
0xFB41BD6B, 0x1F83D9AB, 0x137E2179, 0x5BE0CD19 | ||
]); | ||
var SIGMA8 = [ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, | ||
11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, | ||
7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, | ||
9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, | ||
2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, | ||
12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, | ||
13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, | ||
6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, | ||
10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 | ||
]; | ||
// These are offsets into a uint64 buffer. | ||
// Multiply them all by 2 to make them offsets into a uint32 buffer, | ||
// because this is Javascript and we don't have uint64s | ||
var SIGMA82 = new Uint8Array(SIGMA8.map(function (x) { return x * 2 })); | ||
// Compression function. 'last' flag indicates last block. | ||
// Note we're representing 16 uint64s as 32 uint32s | ||
var v = new Uint32Array(32); | ||
var m = new Uint32Array(32); | ||
function blake2bCompress (ctx, last) { | ||
var i = 0; | ||
// init work variables | ||
for (i = 0; i < 16; i++) { | ||
v[i] = ctx.h[i]; | ||
v[i + 16] = BLAKE2B_IV32[i]; | ||
} | ||
// low 64 bits of offset | ||
v[24] = v[24] ^ ctx.t; | ||
v[25] = v[25] ^ (ctx.t / 0x100000000); | ||
// high 64 bits not supported, offset may not be higher than 2**53-1 | ||
// last block flag set ? | ||
if (last) { | ||
v[28] = ~v[28]; | ||
v[29] = ~v[29]; | ||
} | ||
// get little-endian words | ||
for (i = 0; i < 32; i++) { | ||
m[i] = B2B_GET32(ctx.b, 4 * i); | ||
} | ||
// twelve rounds of mixing | ||
for (i = 0; i < 12; i++) { | ||
B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1]); | ||
B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3]); | ||
B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5]); | ||
B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7]); | ||
B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9]); | ||
B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11]); | ||
B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13]); | ||
B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15]); | ||
} | ||
for (i = 0; i < 16; i++) { | ||
ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16]; | ||
} | ||
} | ||
// reusable parameter_block | ||
var parameter_block = new Uint8Array([ | ||
0, 0, 0, 0, // 0: outlen, keylen, fanout, depth | ||
0, 0, 0, 0, // 4: leaf length, sequential mode | ||
0, 0, 0, 0, // 8: node offset | ||
0, 0, 0, 0, // 12: node offset | ||
0, 0, 0, 0, // 16: node depth, inner length, rfu | ||
0, 0, 0, 0, // 20: rfu | ||
0, 0, 0, 0, // 24: rfu | ||
0, 0, 0, 0, // 28: rfu | ||
0, 0, 0, 0, // 32: salt | ||
0, 0, 0, 0, // 36: salt | ||
0, 0, 0, 0, // 40: salt | ||
0, 0, 0, 0, // 44: salt | ||
0, 0, 0, 0, // 48: personal | ||
0, 0, 0, 0, // 52: personal | ||
0, 0, 0, 0, // 56: personal | ||
0, 0, 0, 0 // 60: personal | ||
]); | ||
// Creates a BLAKE2b hashing context | ||
// Requires an output length between 1 and 64 bytes | ||
// Takes an optional Uint8Array key | ||
function Blake2b (outlen, key, salt, personal) { | ||
// zero out parameter_block before usage | ||
parameter_block.fill(0); | ||
// state, 'param block' | ||
this.b = new Uint8Array(128); | ||
this.h = new Uint32Array(16); | ||
this.t = 0; // input count | ||
this.c = 0; // pointer within buffer | ||
this.outlen = outlen; // output length in bytes | ||
parameter_block[0] = outlen; | ||
if (key) parameter_block[1] = key.length; | ||
parameter_block[2] = 1; // fanout | ||
parameter_block[3] = 1; // depth | ||
if (salt) parameter_block.set(salt, 32); | ||
if (personal) parameter_block.set(personal, 48); | ||
// initialize hash state | ||
for (var i = 0; i < 16; i++) { | ||
this.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameter_block, i * 4); | ||
} | ||
// key the hash, if applicable | ||
if (key) { | ||
blake2bUpdate(this, key); | ||
// at the end | ||
this.c = 128; | ||
} | ||
} | ||
Blake2b.prototype.update = function (input) { | ||
assert(input instanceof Uint8Array, 'input must be Uint8Array or Buffer'); | ||
blake2bUpdate(this, input); | ||
return this | ||
}; | ||
Blake2b.prototype.digest = function (out) { | ||
var buf = (!out || out === 'binary' || out === 'hex') ? new Uint8Array(this.outlen) : out; | ||
assert(buf instanceof Uint8Array, 'out must be "binary", "hex", Uint8Array, or Buffer'); | ||
assert(buf.length >= this.outlen, 'out must have at least outlen bytes of space'); | ||
blake2bFinal(this, buf); | ||
if (out === 'hex') return hexSlice(buf) | ||
return buf | ||
}; | ||
Blake2b.prototype.final = Blake2b.prototype.digest; | ||
Blake2b.ready = function (cb) { | ||
b2wasm.ready(function () { | ||
cb(); // ignore the error | ||
}); | ||
}; | ||
// Updates a BLAKE2b streaming hash | ||
// Requires hash context and Uint8Array (byte array) | ||
function blake2bUpdate (ctx, input) { | ||
for (var i = 0; i < input.length; i++) { | ||
if (ctx.c === 128) { // buffer full ? | ||
ctx.t += ctx.c; // add counters | ||
blake2bCompress(ctx, false); // compress (not last) | ||
ctx.c = 0; // counter to zero | ||
} | ||
ctx.b[ctx.c++] = input[i]; | ||
} | ||
} | ||
// Completes a BLAKE2b streaming hash | ||
// Returns a Uint8Array containing the message digest | ||
function blake2bFinal (ctx, out) { | ||
ctx.t += ctx.c; // mark last block offset | ||
while (ctx.c < 128) { // fill up with zeros | ||
ctx.b[ctx.c++] = 0; | ||
} | ||
blake2bCompress(ctx, true); // final block flag = 1 | ||
for (var i = 0; i < ctx.outlen; i++) { | ||
out[i] = ctx.h[i >> 2] >> (8 * (i & 3)); | ||
} | ||
return out | ||
} | ||
function hexSlice (buf) { | ||
var str = ''; | ||
for (var i = 0; i < buf.length; i++) str += toHex(buf[i]); | ||
return str | ||
} | ||
function toHex (n) { | ||
if (n < 16) return '0' + n.toString(16) | ||
return n.toString(16) | ||
} | ||
var Proto = Blake2b; | ||
blake2b$1.exports = function createHash (outlen, key, salt, personal, noAssert) { | ||
if (noAssert !== true) { | ||
assert(outlen >= BYTES_MIN, 'outlen must be at least ' + BYTES_MIN + ', was given ' + outlen); | ||
assert(outlen <= BYTES_MAX, 'outlen must be at most ' + BYTES_MAX + ', was given ' + outlen); | ||
if (key != null) { | ||
assert(key instanceof Uint8Array, 'key must be Uint8Array or Buffer'); | ||
assert(key.length >= KEYBYTES_MIN, 'key must be at least ' + KEYBYTES_MIN + ', was given ' + key.length); | ||
assert(key.length <= KEYBYTES_MAX, 'key must be at most ' + KEYBYTES_MAX + ', was given ' + key.length); | ||
} | ||
if (salt != null) { | ||
assert(salt instanceof Uint8Array, 'salt must be Uint8Array or Buffer'); | ||
assert(salt.length === SALTBYTES, 'salt must be exactly ' + SALTBYTES + ', was given ' + salt.length); | ||
} | ||
if (personal != null) { | ||
assert(personal instanceof Uint8Array, 'personal must be Uint8Array or Buffer'); | ||
assert(personal.length === PERSONALBYTES, 'personal must be exactly ' + PERSONALBYTES + ', was given ' + personal.length); | ||
} | ||
} | ||
return new Proto(outlen, key, salt, personal) | ||
}; | ||
blake2b$1.exports.ready = function (cb) { | ||
b2wasm.ready(function () { // ignore errors | ||
cb(); | ||
}); | ||
}; | ||
blake2b$1.exports.WASM_SUPPORTED = b2wasm.SUPPORTED; | ||
blake2b$1.exports.WASM_LOADED = false; | ||
var BYTES_MIN = blake2b$1.exports.BYTES_MIN = 16; | ||
var BYTES_MAX = blake2b$1.exports.BYTES_MAX = 64; | ||
blake2b$1.exports.BYTES = 32; | ||
var KEYBYTES_MIN = blake2b$1.exports.KEYBYTES_MIN = 16; | ||
var KEYBYTES_MAX = blake2b$1.exports.KEYBYTES_MAX = 64; | ||
blake2b$1.exports.KEYBYTES = 32; | ||
var SALTBYTES = blake2b$1.exports.SALTBYTES = 16; | ||
var PERSONALBYTES = blake2b$1.exports.PERSONALBYTES = 16; | ||
b2wasm.ready(function (err) { | ||
if (!err) { | ||
blake2b$1.exports.WASM_LOADED = true; | ||
blake2b$1.exports = b2wasm; | ||
} | ||
}); | ||
const FIRST_BIT_SET = 0b10_00_00_00; | ||
const FIRST_BIT_SET_NEG = 0b01_11_11_11; | ||
const FIRST_TWO_BITS_SET = 0b11_00_00_00; | ||
const FIRST_TWO_BITS_SET_NEG = 0b00_11_11_11; | ||
/** Value nodes have the key truncated to 31 bytes. */ | ||
const TRUNCATED_KEY_BYTES = 31; | ||
const TRUNCATED_KEY_BITS = TRUNCATED_KEY_BYTES * 8; | ||
function parseInputKey(v) { | ||
if (v.length === HASH_SIZE * 2) { | ||
return Bytes.parseBytesNoPrefix(v, HASH_SIZE).asOpaque(); | ||
} | ||
return Bytes.parseBytesNoPrefix(v, TRUNCATED_KEY_BYTES).asOpaque(); | ||
} | ||
/** | ||
* The kind of the trie node. | ||
*/ | ||
var NodeType; | ||
exports.NodeType = void 0; | ||
(function (NodeType) { | ||
@@ -246,3 +1010,3 @@ /** Branch node (left & right subtree hashes) */ | ||
NodeType[NodeType["EmbedLeaf"] = 2] = "EmbedLeaf"; | ||
})(NodeType || (NodeType = {})); | ||
})(exports.NodeType || (exports.NodeType = {})); | ||
/** | ||
@@ -271,19 +1035,20 @@ * A representation of an unidentified raw trie node. | ||
class TrieNode { | ||
constructor() { | ||
/** Exactly 512 bits / 64 bytes */ | ||
this.data = new Uint8Array(64); | ||
constructor( | ||
/** Exactly 512 bits / 64 bytes */ | ||
data = new Uint8Array(64)) { | ||
this.data = data; | ||
} | ||
/** Returns the type of the node */ | ||
getNodeType() { | ||
if ((this.data[0] & 0b1) === 0b0) { | ||
return NodeType.Branch; | ||
if ((this.data[0] & FIRST_BIT_SET) === 0) { | ||
return exports.NodeType.Branch; | ||
} | ||
if ((this.data[0] & 0b11) === 0b11) { | ||
return NodeType.EmbedLeaf; | ||
if ((this.data[0] & FIRST_TWO_BITS_SET) === FIRST_TWO_BITS_SET) { | ||
return exports.NodeType.Leaf; | ||
} | ||
return NodeType.Leaf; | ||
return exports.NodeType.EmbedLeaf; | ||
} | ||
/** View this node as a branch node */ | ||
asBranchNode() { | ||
check(this.getNodeType() === NodeType.Branch); | ||
check(this.getNodeType() === exports.NodeType.Branch); | ||
return new BranchNode(this); | ||
@@ -293,3 +1058,3 @@ } | ||
asLeafNode() { | ||
check(this.getNodeType() !== NodeType.Branch); | ||
check(this.getNodeType() !== exports.NodeType.Branch); | ||
return new LeafNode(this); | ||
@@ -318,5 +1083,5 @@ } | ||
node.data.set(left.raw, 0); | ||
node.data.set(right.raw, HASH_BYTES); | ||
node.data.set(right.raw, HASH_SIZE); | ||
// set the first bit to 0 (branch node) | ||
node.data[0] &= 0b1111_1110; | ||
node.data[0] &= FIRST_BIT_SET_NEG; | ||
return new BranchNode(node); | ||
@@ -326,7 +1091,7 @@ } | ||
getLeft() { | ||
return Bytes.fromBlob(this.node.data.subarray(0, HASH_BYTES), HASH_BYTES); | ||
return Bytes.fromBlob(this.node.data.subarray(0, HASH_SIZE), HASH_SIZE).asOpaque(); | ||
} | ||
/** Get the hash of the right sub-trie. */ | ||
getRight() { | ||
return Bytes.fromBlob(this.node.data.subarray(HASH_BYTES), HASH_BYTES); | ||
return Bytes.fromBlob(this.node.data.subarray(HASH_SIZE), HASH_SIZE).asOpaque(); | ||
} | ||
@@ -359,12 +1124,11 @@ } | ||
// The value will fit in the leaf itself. | ||
if (value.length <= HASH_BYTES) { | ||
node.data[0] = value.length << 2; | ||
node.data[0] |= 0b01; | ||
if (value.length <= HASH_SIZE) { | ||
node.data[0] = FIRST_BIT_SET | value.length; | ||
// truncate & copy the key | ||
node.data.set(key.raw.subarray(0, TRUNCATED_KEY_BYTES), 1); | ||
// copy the value | ||
node.data.set(value.buffer, TRUNCATED_KEY_BYTES + 1); | ||
node.data.set(value.raw, TRUNCATED_KEY_BYTES + 1); | ||
} | ||
else { | ||
node.data[0] = 0b11; | ||
node.data[0] = FIRST_TWO_BITS_SET; | ||
// truncate & copy the key | ||
@@ -379,3 +1143,3 @@ node.data.set(key.raw.subarray(0, TRUNCATED_KEY_BYTES), 1); | ||
getKey() { | ||
return Bytes.fromBlob(this.node.data.subarray(1, TRUNCATED_KEY_BYTES + 1), TRUNCATED_KEY_BYTES); | ||
return Bytes.fromBlob(this.node.data.subarray(1, TRUNCATED_KEY_BYTES + 1), TRUNCATED_KEY_BYTES).asOpaque(); | ||
} | ||
@@ -389,4 +1153,5 @@ /** | ||
getValueLength() { | ||
const firstByte = this.node.data[0] >> 2; | ||
return firstByte; | ||
const firstByte = this.node.data[0]; | ||
// we only store values up to `HASH_SIZE`, so they fit on the last 6 bits. | ||
return firstByte & FIRST_TWO_BITS_SET_NEG; | ||
} | ||
@@ -401,3 +1166,3 @@ /** | ||
const len = this.getValueLength(); | ||
return BytesBlob.fromBlob(this.node.data.subarray(HASH_BYTES, HASH_BYTES + len)); | ||
return BytesBlob.blobFrom(this.node.data.subarray(HASH_SIZE, HASH_SIZE + len)); | ||
} | ||
@@ -411,6 +1176,53 @@ /** | ||
getValueHash() { | ||
return Bytes.fromBlob(this.node.data.subarray(HASH_BYTES), HASH_BYTES); | ||
return Bytes.fromBlob(this.node.data.subarray(HASH_SIZE), HASH_SIZE).asOpaque(); | ||
} | ||
} | ||
/** A map which uses hashes as keys. */ | ||
class HashDictionary { | ||
constructor() { | ||
// TODO [ToDr] [crit] We can't use `TrieHash` directly in the map, | ||
// because of the way it's being compared. Hence having `string` here. | ||
// This has to be benchmarked and re-written to a custom map most likely. | ||
this.map = new Map(); | ||
} | ||
/** Return number of items in the dictionary. */ | ||
get size() { | ||
return this.map.size; | ||
} | ||
/** Return true if the key is present in the dictionary. */ | ||
has(key) { | ||
return this.map.has(key.toString()); | ||
} | ||
/** Get the value under given key or `null` if the value is not present. */ | ||
get(key) { | ||
return this.map.get(key.toString())?.[1]; | ||
} | ||
/** Insert/overwrite the value at given key. */ | ||
set(key, value) { | ||
this.map.set(key.toString(), [key, value]); | ||
} | ||
/** Remove the key and any value from the dictionary. */ | ||
delete(key) { | ||
this.map.delete(key.toString()); | ||
} | ||
/** it allows to use HashDictionary in for-of loop */ | ||
*[Symbol.iterator]() { | ||
for (const value of this.map.values()) { | ||
yield value; | ||
} | ||
} | ||
} | ||
/** A return value of some comparator. */ | ||
var Ordering; | ||
(function (Ordering) { | ||
/** `self < other` */ | ||
Ordering[Ordering["Less"] = -1] = "Less"; | ||
/** `self === other` */ | ||
Ordering[Ordering["Equal"] = 0] = "Equal"; | ||
/** `self > other` */ | ||
Ordering[Ordering["Greater"] = 1] = "Greater"; | ||
})(Ordering || (Ordering = {})); | ||
/** | ||
@@ -422,7 +1234,8 @@ * An abstraction over read-only nodes storage. | ||
this.hasher = hasher; | ||
this.nodes = new Map(); | ||
this.nodes = new HashDictionary(); | ||
} | ||
get(hash) { | ||
const key = NodesDb.hashCompatStr(hash); | ||
return this.nodes.get(key) ?? null; | ||
return NodesDb.withHashCompat(hash, (key) => { | ||
return this.nodes.get(key) ?? null; | ||
}); | ||
} | ||
@@ -436,14 +1249,14 @@ hashNode(n) { | ||
* Before calling `toString` the first bit is set to 0, to maintain compatibility | ||
* with branch nodes, which have the left subtree stripped out of the first bit (since it's | ||
* a branch node identifier). | ||
* with branch nodes, which have the left subtree stripped out of the first bit | ||
* (since it's a branch node identifier). | ||
* | ||
*/ | ||
static hashCompatStr(hash) { | ||
static withHashCompat(hash, exe) { | ||
const prevValue = hash.raw[0]; | ||
hash.raw[0] &= 0b1111_1110; | ||
const hashString = hash.toString(); | ||
hash.raw[0] &= FIRST_BIT_SET_NEG; | ||
const returnValue = exe(hash); | ||
// restore the original byte, so that we have correct value in case it | ||
// ends up in the right part of the subtree. | ||
hash.raw[0] = prevValue; | ||
return hashString; | ||
return returnValue; | ||
} | ||
@@ -456,9 +1269,11 @@ } | ||
remove(hash) { | ||
const key = NodesDb.hashCompatStr(hash); | ||
this.nodes.delete(key); | ||
return NodesDb.withHashCompat(hash, (key) => { | ||
this.nodes.delete(key); | ||
}); | ||
} | ||
insert(node, hash) { | ||
const h = hash ?? this.hashNode(node); | ||
const key = NodesDb.hashCompatStr(h); | ||
this.nodes.set(key, node); | ||
NodesDb.withHashCompat(h, (key) => { | ||
this.nodes.set(key, node); | ||
}); | ||
return h; | ||
@@ -473,2 +1288,3 @@ } | ||
constructor(nodes) { | ||
// TODO [ToDr] Consider using HashDictionary? | ||
this.flat = new Map(); | ||
@@ -479,10 +1295,18 @@ this.root = null; | ||
set(key, value, maybeValueHash) { | ||
this.flat.set(key.toString(), value); | ||
const valueHash = maybeValueHash ?? this.nodes.hasher.hashConcat(value.buffer); | ||
const truncatedKey = Bytes.fromBlob(key.raw.subarray(0, TRUNCATED_KEY_BYTES), TRUNCATED_KEY_BYTES); | ||
this.flat.set(truncatedKey.toString(), value); | ||
const valueHash = maybeValueHash ?? this.nodes.hasher.hashConcat(value.raw); | ||
const leafNode = LeafNode.fromValue(key, value, valueHash); | ||
this.root = trieInsert(this.root, this.nodes, leafNode); | ||
} | ||
getRoot() { | ||
remove(_) { | ||
// TODO [ToDr] implement me. | ||
throw new Error("Removing from the trie not implemented yet."); | ||
} | ||
getRootNode() { | ||
return this.root; | ||
} | ||
getRootHash() { | ||
if (this.root === null) { | ||
return Bytes.zero(HASH_BYTES); | ||
return Bytes.zero(HASH_SIZE).asOpaque(); | ||
} | ||
@@ -556,3 +1380,3 @@ return this.nodes.hashNode(this.root); | ||
const kind = currentNode.getNodeType(); | ||
if (kind !== NodeType.Branch) { | ||
if (kind !== exports.NodeType.Branch) { | ||
// we found a leaf that needs to be merged with the one being inserted. | ||
@@ -570,3 +1394,3 @@ const leaf = currentNode.asLeafNode(); | ||
if (nextNode === null) { | ||
if (nextHash.isEqualTo(Bytes.zero(HASH_BYTES))) { | ||
if (nextHash.isEqualTo(Bytes.zero(HASH_SIZE))) { | ||
return traversedPath; | ||
@@ -618,3 +1442,3 @@ } | ||
// Now construct the common branches, and insert zero hash in place of other sub-trees. | ||
const zero = Bytes.zero(HASH_BYTES); | ||
const zero = Bytes.zero(HASH_SIZE).asOpaque(); | ||
// In case we move the leaf from left to right it's hash needs to be re-calculated (missing bit). | ||
@@ -651,7 +1475,7 @@ // TODO [ToDr] [opti] might be better to store the original bit value instead of recalculating. | ||
check(bitIndex < TRUNCATED_KEY_BITS); | ||
const byte = bitIndex >> 3; | ||
const byte = bitIndex >>> 3; | ||
const bit = bitIndex - (byte << 3); | ||
const mask = 1 << bit; | ||
const mask = 0b10_00_00_00 >>> bit; | ||
const val = key.raw[byte] & mask; | ||
return val > 0; | ||
return val !== 0; | ||
} | ||
@@ -663,3 +1487,3 @@ function trieStringify(root, nodes) { | ||
const kind = root.getNodeType(); | ||
if (kind === NodeType.Branch) { | ||
if (kind === exports.NodeType.Branch) { | ||
const branch = root.asBranchNode(); | ||
@@ -686,4 +1510,10 @@ const leftHash = branch.getLeft(); | ||
exports.BitVec = BitVec; | ||
exports.BranchNode = BranchNode; | ||
exports.Bytes = Bytes; | ||
exports.BytesBlob = BytesBlob; | ||
exports.InMemoryTrie = InMemoryTrie; | ||
exports.LeafNode = LeafNode; | ||
exports.NodesDb = NodesDb; | ||
exports.TrieNode = TrieNode; | ||
exports.WriteableNodesDb = WriteableNodesDb; | ||
exports.parseInputKey = parseInputKey; |
{ | ||
"name": "@typeberry/trie", | ||
"version": "0.0.1-b19c732", | ||
"version": "0.0.1-b25856a", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "author": "Fluffy Labs", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
80239
1969
3