@typeberry/lib 0.0.5-6e657f4 → 0.0.5-cdbb94a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/index.d.ts +30 -28
- package/index.cjs +17538 -0
- package/index.d.ts +556 -453
- package/index.js +927 -867
- package/package.json +9 -2
package/index.d.ts
CHANGED
|
@@ -4474,6 +4474,9 @@ declare namespace bandersnatch_d_exports {
|
|
|
4474
4474
|
}
|
|
4475
4475
|
/* tslint:disable */
|
|
4476
4476
|
/* eslint-disable */
|
|
4477
|
+
/**
|
|
4478
|
+
* Generate ring commitment given concatenation of ring keys.
|
|
4479
|
+
*/
|
|
4477
4480
|
declare function ring_commitment(keys: Uint8Array): Uint8Array;
|
|
4478
4481
|
/**
|
|
4479
4482
|
* Derive Private and Public Key from Seed
|
|
@@ -4487,21 +4490,21 @@ declare function derive_public_key(seed: Uint8Array): Uint8Array;
|
|
|
4487
4490
|
* or
|
|
4488
4491
|
* https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
|
|
4489
4492
|
*/
|
|
4490
|
-
declare function verify_seal(
|
|
4493
|
+
declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
4491
4494
|
/**
|
|
4492
4495
|
* Verify multiple tickets at once as defined in:
|
|
4493
4496
|
* https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
|
|
4494
4497
|
*
|
|
4495
4498
|
* NOTE: the aux_data of VRF function is empty!
|
|
4496
4499
|
*/
|
|
4497
|
-
declare function batch_verify_tickets(
|
|
4500
|
+
declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
|
|
4498
4501
|
type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
4499
4502
|
interface InitOutput$2 {
|
|
4500
4503
|
readonly memory: WebAssembly.Memory;
|
|
4501
4504
|
readonly ring_commitment: (a: number, b: number) => [number, number];
|
|
4502
4505
|
readonly derive_public_key: (a: number, b: number) => [number, number];
|
|
4503
|
-
readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number
|
|
4504
|
-
readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
4506
|
+
readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
4507
|
+
readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
4505
4508
|
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
4506
4509
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
4507
4510
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
@@ -7852,6 +7855,173 @@ declare class JipChainSpec extends WithDebug {
|
|
|
7852
7855
|
}
|
|
7853
7856
|
}
|
|
7854
7857
|
|
|
7858
|
+
declare enum Level {
|
|
7859
|
+
INSANE = 1,
|
|
7860
|
+
TRACE = 2,
|
|
7861
|
+
LOG = 3,
|
|
7862
|
+
INFO = 4,
|
|
7863
|
+
WARN = 5,
|
|
7864
|
+
ERROR = 6,
|
|
7865
|
+
}
|
|
7866
|
+
|
|
7867
|
+
type Options = {
|
|
7868
|
+
defaultLevel: Level;
|
|
7869
|
+
workingDir: string;
|
|
7870
|
+
modules: Map<string, Level>;
|
|
7871
|
+
};
|
|
7872
|
+
|
|
7873
|
+
/**
|
|
7874
|
+
* A function to parse logger definition (including modules) given as a string.
|
|
7875
|
+
*
|
|
7876
|
+
* Examples
|
|
7877
|
+
* - `info` - setup default logging level to `info`.
|
|
7878
|
+
* - `trace` - default logging level set to `trace`.
|
|
7879
|
+
* - `debug;consensus=trace` - default level is set to `debug/log`, but consensus is in trace mode.
|
|
7880
|
+
*/
|
|
7881
|
+
declare function parseLoggerOptions(input: string, defaultLevel: Level, workingDir?: string): Options {
|
|
7882
|
+
const modules = new Map<string, Level>();
|
|
7883
|
+
const parts = input.toLowerCase().split(",");
|
|
7884
|
+
let defLevel = defaultLevel;
|
|
7885
|
+
|
|
7886
|
+
for (const p of parts) {
|
|
7887
|
+
const clean = p.trim();
|
|
7888
|
+
// skip empty objects (forgotten `,` removed)
|
|
7889
|
+
if (clean.length === 0) {
|
|
7890
|
+
continue;
|
|
7891
|
+
}
|
|
7892
|
+
// we just have the default level
|
|
7893
|
+
if (clean.includes("=")) {
|
|
7894
|
+
const [mod, lvl] = clean.split("=");
|
|
7895
|
+
modules.set(mod.trim(), parseLevel(lvl.trim()));
|
|
7896
|
+
} else {
|
|
7897
|
+
defLevel = parseLevel(clean);
|
|
7898
|
+
}
|
|
7899
|
+
}
|
|
7900
|
+
|
|
7901
|
+
// TODO [ToDr] Fix dirname for workers.
|
|
7902
|
+
const myDir = (import.meta.dirname ?? "").split("/");
|
|
7903
|
+
myDir.pop();
|
|
7904
|
+
myDir.pop();
|
|
7905
|
+
return {
|
|
7906
|
+
defaultLevel: defLevel,
|
|
7907
|
+
modules,
|
|
7908
|
+
workingDir: workingDir ?? myDir.join("/"),
|
|
7909
|
+
};
|
|
7910
|
+
}
|
|
7911
|
+
|
|
7912
|
+
declare const GLOBAL_CONFIG = {
|
|
7913
|
+
options: DEFAULT_OPTIONS,
|
|
7914
|
+
transport: ConsoleTransport.create(DEFAULT_OPTIONS.defaultLevel, DEFAULT_OPTIONS),
|
|
7915
|
+
};
|
|
7916
|
+
|
|
7917
|
+
/**
|
|
7918
|
+
* A logger instance.
|
|
7919
|
+
*/
|
|
7920
|
+
declare class Logger {
|
|
7921
|
+
/**
|
|
7922
|
+
* Create a new logger instance given filename and an optional module name.
|
|
7923
|
+
*
|
|
7924
|
+
* If the module name is not given, `fileName` becomes the module name.
|
|
7925
|
+
* The module name can be composed from multiple parts separated with `/`.
|
|
7926
|
+
*
|
|
7927
|
+
* The logger will use a global configuration which can be changed using
|
|
7928
|
+
* [`configureLogger`] function.
|
|
7929
|
+
*/
|
|
7930
|
+
static new(fileName?: string, moduleName?: string) {
|
|
7931
|
+
const fName = fileName ?? "unknown";
|
|
7932
|
+
const module = moduleName ?? fName;
|
|
7933
|
+
return new Logger(module.padStart(8, " "), GLOBAL_CONFIG);
|
|
7934
|
+
}
|
|
7935
|
+
|
|
7936
|
+
/**
|
|
7937
|
+
* Return currently configured level for given module. */
|
|
7938
|
+
static getLevel(moduleName: string): Level {
|
|
7939
|
+
return findLevel(GLOBAL_CONFIG.options, moduleName);
|
|
7940
|
+
}
|
|
7941
|
+
|
|
7942
|
+
/**
|
|
7943
|
+
* Global configuration of all loggers.
|
|
7944
|
+
*
|
|
7945
|
+
* One can specify a default logging level (only logs with level >= default will be printed).
|
|
7946
|
+
* It's also possible to configure per-module logging level that takes precedence
|
|
7947
|
+
* over the default one.
|
|
7948
|
+
*
|
|
7949
|
+
* Changing the options affects all previously created loggers.
|
|
7950
|
+
*/
|
|
7951
|
+
static configureAllFromOptions(options: Options) {
|
|
7952
|
+
// find minimal level to optimise logging in case
|
|
7953
|
+
// we don't care about low-level logs.
|
|
7954
|
+
const minimalLevel = Array.from(options.modules.values()).reduce((level, modLevel) => {
|
|
7955
|
+
return level < modLevel ? level : modLevel;
|
|
7956
|
+
}, options.defaultLevel);
|
|
7957
|
+
|
|
7958
|
+
const transport = ConsoleTransport.create(minimalLevel, options);
|
|
7959
|
+
|
|
7960
|
+
// set the global config
|
|
7961
|
+
GLOBAL_CONFIG.options = options;
|
|
7962
|
+
GLOBAL_CONFIG.transport = transport;
|
|
7963
|
+
}
|
|
7964
|
+
|
|
7965
|
+
/**
|
|
7966
|
+
* Global configuration of all loggers.
|
|
7967
|
+
*
|
|
7968
|
+
* Parse configuration options from an input string typically obtained
|
|
7969
|
+
* from environment variable `JAM_LOG`.
|
|
7970
|
+
*/
|
|
7971
|
+
static configureAll(input: string, defaultLevel: Level, workingDir?: string) {
|
|
7972
|
+
const options = parseLoggerOptions(input, defaultLevel, workingDir);
|
|
7973
|
+
Logger.configureAllFromOptions(options);
|
|
7974
|
+
}
|
|
7975
|
+
|
|
7976
|
+
private constructor(
|
|
7977
|
+
private readonly moduleName: string,
|
|
7978
|
+
private readonly config: typeof GLOBAL_CONFIG,
|
|
7979
|
+
) {}
|
|
7980
|
+
|
|
7981
|
+
/** Log a message with `INSANE` level. */
|
|
7982
|
+
insane(val: string) {
|
|
7983
|
+
this.config.transport.insane(this.moduleName, val);
|
|
7984
|
+
}
|
|
7985
|
+
|
|
7986
|
+
/** Log a message with `TRACE` level. */
|
|
7987
|
+
trace(val: string) {
|
|
7988
|
+
this.config.transport.trace(this.moduleName, val);
|
|
7989
|
+
}
|
|
7990
|
+
|
|
7991
|
+
/** Log a message with `DEBUG`/`LOG` level. */
|
|
7992
|
+
log(val: string) {
|
|
7993
|
+
this.config.transport.log(this.moduleName, val);
|
|
7994
|
+
}
|
|
7995
|
+
|
|
7996
|
+
/** Log a message with `INFO` level. */
|
|
7997
|
+
info(val: string) {
|
|
7998
|
+
this.config.transport.info(this.moduleName, val);
|
|
7999
|
+
}
|
|
8000
|
+
|
|
8001
|
+
/** Log a message with `WARN` level. */
|
|
8002
|
+
warn(val: string) {
|
|
8003
|
+
this.config.transport.warn(this.moduleName, val);
|
|
8004
|
+
}
|
|
8005
|
+
|
|
8006
|
+
/** Log a message with `ERROR` level. */
|
|
8007
|
+
error(val: string) {
|
|
8008
|
+
this.config.transport.error(this.moduleName, val);
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
|
|
8012
|
+
type index$g_Level = Level;
|
|
8013
|
+
declare const index$g_Level: typeof Level;
|
|
8014
|
+
type index$g_Logger = Logger;
|
|
8015
|
+
declare const index$g_Logger: typeof Logger;
|
|
8016
|
+
declare const index$g_parseLoggerOptions: typeof parseLoggerOptions;
|
|
8017
|
+
declare namespace index$g {
|
|
8018
|
+
export {
|
|
8019
|
+
index$g_Level as Level,
|
|
8020
|
+
index$g_Logger as Logger,
|
|
8021
|
+
index$g_parseLoggerOptions as parseLoggerOptions,
|
|
8022
|
+
};
|
|
8023
|
+
}
|
|
8024
|
+
|
|
7855
8025
|
/** Block authorship options. */
|
|
7856
8026
|
declare class AuthorshipOptions {
|
|
7857
8027
|
static fromJson = json.object<JsonObject<AuthorshipOptions>, AuthorshipOptions>(
|
|
@@ -7871,6 +8041,8 @@ declare class AuthorshipOptions {
|
|
|
7871
8041
|
) {}
|
|
7872
8042
|
}
|
|
7873
8043
|
|
|
8044
|
+
declare const logger$1 = Logger.new(import.meta.filename, "config");
|
|
8045
|
+
|
|
7874
8046
|
/** Development config. Will accept unsealed blocks for now. */
|
|
7875
8047
|
declare const DEV_CONFIG = "dev";
|
|
7876
8048
|
/** Default config file. */
|
|
@@ -7932,14 +8104,17 @@ declare class NodeConfiguration {
|
|
|
7932
8104
|
|
|
7933
8105
|
declare function loadConfig(configPath: string): NodeConfiguration {
|
|
7934
8106
|
if (configPath === DEFAULT_CONFIG) {
|
|
8107
|
+
logger.log("🔧 Loading DEFAULT config");
|
|
7935
8108
|
return parseFromJson(configs.default, NodeConfiguration.fromJson);
|
|
7936
8109
|
}
|
|
7937
8110
|
|
|
7938
8111
|
if (configPath === DEV_CONFIG) {
|
|
8112
|
+
logger.log("🔧 Loading DEV config");
|
|
7939
8113
|
return parseFromJson(configs.dev, NodeConfiguration.fromJson);
|
|
7940
8114
|
}
|
|
7941
8115
|
|
|
7942
8116
|
try {
|
|
8117
|
+
logger.log(`🔧 Loading config from ${configPath}`);
|
|
7943
8118
|
const configFile = fs.readFileSync(configPath, "utf8");
|
|
7944
8119
|
const parsed = JSON.parse(configFile);
|
|
7945
8120
|
return parseFromJson(parsed, NodeConfiguration.fromJson);
|
|
@@ -7948,29 +8123,30 @@ declare function loadConfig(configPath: string): NodeConfiguration {
|
|
|
7948
8123
|
}
|
|
7949
8124
|
}
|
|
7950
8125
|
|
|
7951
|
-
declare const index$
|
|
7952
|
-
declare const index$
|
|
7953
|
-
type index$
|
|
7954
|
-
declare const index$
|
|
7955
|
-
type index$
|
|
7956
|
-
declare const index$
|
|
7957
|
-
declare const index$
|
|
7958
|
-
type index$
|
|
7959
|
-
declare const index$
|
|
7960
|
-
declare const index$
|
|
7961
|
-
declare const index$
|
|
7962
|
-
declare const index$
|
|
7963
|
-
declare namespace index$
|
|
8126
|
+
declare const index$f_DEFAULT_CONFIG: typeof DEFAULT_CONFIG;
|
|
8127
|
+
declare const index$f_DEV_CONFIG: typeof DEV_CONFIG;
|
|
8128
|
+
type index$f_JipChainSpec = JipChainSpec;
|
|
8129
|
+
declare const index$f_JipChainSpec: typeof JipChainSpec;
|
|
8130
|
+
type index$f_KnownChainSpec = KnownChainSpec;
|
|
8131
|
+
declare const index$f_KnownChainSpec: typeof KnownChainSpec;
|
|
8132
|
+
declare const index$f_NODE_DEFAULTS: typeof NODE_DEFAULTS;
|
|
8133
|
+
type index$f_NodeConfiguration = NodeConfiguration;
|
|
8134
|
+
declare const index$f_NodeConfiguration: typeof NodeConfiguration;
|
|
8135
|
+
declare const index$f_knownChainSpecFromJson: typeof knownChainSpecFromJson;
|
|
8136
|
+
declare const index$f_loadConfig: typeof loadConfig;
|
|
8137
|
+
declare const index$f_parseBootnode: typeof parseBootnode;
|
|
8138
|
+
declare namespace index$f {
|
|
7964
8139
|
export {
|
|
7965
|
-
index$
|
|
7966
|
-
index$
|
|
7967
|
-
index$
|
|
7968
|
-
index$
|
|
7969
|
-
index$
|
|
7970
|
-
index$
|
|
7971
|
-
index$
|
|
7972
|
-
index$
|
|
7973
|
-
|
|
8140
|
+
index$f_DEFAULT_CONFIG as DEFAULT_CONFIG,
|
|
8141
|
+
index$f_DEV_CONFIG as DEV_CONFIG,
|
|
8142
|
+
index$f_JipChainSpec as JipChainSpec,
|
|
8143
|
+
index$f_KnownChainSpec as KnownChainSpec,
|
|
8144
|
+
index$f_NODE_DEFAULTS as NODE_DEFAULTS,
|
|
8145
|
+
index$f_NodeConfiguration as NodeConfiguration,
|
|
8146
|
+
index$f_knownChainSpecFromJson as knownChainSpecFromJson,
|
|
8147
|
+
index$f_loadConfig as loadConfig,
|
|
8148
|
+
logger$1 as logger,
|
|
8149
|
+
index$f_parseBootnode as parseBootnode,
|
|
7974
8150
|
};
|
|
7975
8151
|
}
|
|
7976
8152
|
|
|
@@ -8357,7 +8533,9 @@ declare class WriteableNodesDb extends NodesDb {
|
|
|
8357
8533
|
}
|
|
8358
8534
|
}
|
|
8359
8535
|
|
|
8360
|
-
|
|
8536
|
+
/** Compare two trie `LeafNode`s only by their key. */
|
|
8537
|
+
declare const leafComparator = (x: LeafNode, y: LeafNode) => x.getKey().compare(y.getKey());
|
|
8538
|
+
declare const zero = Bytes.zero(HASH_SIZE).asOpaque();
|
|
8361
8539
|
|
|
8362
8540
|
declare class InMemoryTrie {
|
|
8363
8541
|
/** Create an empty in-memory trie. */
|
|
@@ -8366,10 +8544,87 @@ declare class InMemoryTrie {
|
|
|
8366
8544
|
}
|
|
8367
8545
|
|
|
8368
8546
|
/** Given a collection of leaves, compute the state root. */
|
|
8369
|
-
static computeStateRoot(hasher: TrieHasher, leaves:
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8547
|
+
static computeStateRoot(hasher: TrieHasher, leaves: SortedSet<LeafNode>): TrieNodeHash {
|
|
8548
|
+
const sorted = leaves.slice();
|
|
8549
|
+
const firstSorted = sorted.shift();
|
|
8550
|
+
if (firstSorted === undefined) {
|
|
8551
|
+
return zero;
|
|
8552
|
+
}
|
|
8553
|
+
|
|
8554
|
+
const nodes = [
|
|
8555
|
+
{
|
|
8556
|
+
leaf: firstSorted,
|
|
8557
|
+
sharedBitsWithPrev: 0,
|
|
8558
|
+
},
|
|
8559
|
+
];
|
|
8560
|
+
let last = nodes[0];
|
|
8561
|
+
// first we go through all of the sorted leaves and figure out how much in common
|
|
8562
|
+
// they have with the previous node.
|
|
8563
|
+
// If the shared-prefix drops, it means we are going up in depth (i.e. we are in different branch).
|
|
8564
|
+
for (const leaf of sorted) {
|
|
8565
|
+
const sharedBitsCount = findSharedPrefix(leaf.getKey(), last.leaf.getKey());
|
|
8566
|
+
last = {
|
|
8567
|
+
leaf,
|
|
8568
|
+
sharedBitsWithPrev: sharedBitsCount,
|
|
8569
|
+
};
|
|
8570
|
+
nodes.push(last);
|
|
8571
|
+
}
|
|
8572
|
+
// Now we will go backwards and hash them together (or create branch nodes).
|
|
8573
|
+
nodes.reverse();
|
|
8574
|
+
const stack: TrieNodeHash[] = [];
|
|
8575
|
+
let currentDepth = 0;
|
|
8576
|
+
const lastNode = nodes.length === 1 ? undefined : nodes[nodes.length - 1];
|
|
8577
|
+
for (const node of nodes) {
|
|
8578
|
+
const isLastNode = node === lastNode;
|
|
8579
|
+
const key = node.leaf.getKey();
|
|
8580
|
+
const prevDepth = currentDepth;
|
|
8581
|
+
currentDepth = node.sharedBitsWithPrev;
|
|
8582
|
+
|
|
8583
|
+
// first push all missing right-hand zero nodes.
|
|
8584
|
+
// Handle the case if all nodes are on the left side and we need one more top-level
|
|
8585
|
+
// extra.
|
|
8586
|
+
const startDepth = isLastNode ? prevDepth : prevDepth + 1;
|
|
8587
|
+
for (let i = startDepth; i <= currentDepth; i++) {
|
|
8588
|
+
if (getBit(key, i) === false) {
|
|
8589
|
+
stack.push(zero);
|
|
8590
|
+
}
|
|
8591
|
+
}
|
|
8592
|
+
|
|
8593
|
+
// now let's push the hash of the current leaf
|
|
8594
|
+
const hash = hasher.hashConcat(node.leaf.node.raw);
|
|
8595
|
+
stack.push(hash);
|
|
8596
|
+
// we are going further down, so no need to merge anything
|
|
8597
|
+
if (prevDepth < currentDepth) {
|
|
8598
|
+
continue;
|
|
8599
|
+
}
|
|
8600
|
+
// jumping back to some lower depth, we need to merge what we have on the stack.
|
|
8601
|
+
// we need to handle a case where we have no nodes on the top-most left side.
|
|
8602
|
+
// in such case we just add extra zero on the left.
|
|
8603
|
+
const endDepth = isLastNode ? currentDepth - 1 : currentDepth;
|
|
8604
|
+
for (let i = prevDepth; i > endDepth; i--) {
|
|
8605
|
+
if (getBit(key, i) === true) {
|
|
8606
|
+
stack.push(zero);
|
|
8607
|
+
}
|
|
8608
|
+
const current = stack.pop() ?? zero;
|
|
8609
|
+
const next = stack.pop() ?? zero;
|
|
8610
|
+
const branchNode = BranchNode.fromSubNodes(current, next);
|
|
8611
|
+
const hash = hasher.hashConcat(branchNode.node.raw);
|
|
8612
|
+
stack.push(hash);
|
|
8613
|
+
}
|
|
8614
|
+
}
|
|
8615
|
+
|
|
8616
|
+
return stack.pop() ?? zero;
|
|
8617
|
+
}
|
|
8618
|
+
|
|
8619
|
+
/**
|
|
8620
|
+
* Construct a `LeafNode` from given `key` and `value`.
|
|
8621
|
+
*
|
|
8622
|
+
* NOTE: for large value it WILL NOT be embedded in the leaf node,
|
|
8623
|
+
* and should rather be stored separately.
|
|
8624
|
+
*/
|
|
8625
|
+
static constructLeaf(hasher: TrieHasher, key: InputKey, value: BytesBlob, maybeValueHash?: ValueHash) {
|
|
8626
|
+
const valueHash = () => maybeValueHash ?? hasher.hashConcat(value.raw).asOpaque();
|
|
8627
|
+
return LeafNode.fromValue(key, value, valueHash);
|
|
8373
8628
|
}
|
|
8374
8629
|
|
|
8375
8630
|
/**
|
|
@@ -8387,11 +8642,6 @@ declare class InMemoryTrie {
|
|
|
8387
8642
|
return new InMemoryTrie(nodes, root);
|
|
8388
8643
|
}
|
|
8389
8644
|
|
|
8390
|
-
static constructLeaf(hasher: TrieHasher, key: InputKey, value: BytesBlob, maybeValueHash?: ValueHash) {
|
|
8391
|
-
const valueHash = () => maybeValueHash ?? hasher.hashConcat(value.raw).asOpaque();
|
|
8392
|
-
return LeafNode.fromValue(key, value, valueHash);
|
|
8393
|
-
}
|
|
8394
|
-
|
|
8395
8645
|
private constructor(
|
|
8396
8646
|
// Exposed for trie-visualiser
|
|
8397
8647
|
public readonly nodes: WriteableNodesDb,
|
|
@@ -8518,7 +8768,7 @@ declare function findNodeToReplace(root: TrieNode, nodes: NodesDb, key: Truncate
|
|
|
8518
8768
|
|
|
8519
8769
|
const nextNode = nodes.get(nextHash);
|
|
8520
8770
|
if (nextNode === null) {
|
|
8521
|
-
if (nextHash.isEqualTo(
|
|
8771
|
+
if (nextHash.isEqualTo(zero)) {
|
|
8522
8772
|
return traversedPath;
|
|
8523
8773
|
}
|
|
8524
8774
|
|
|
@@ -8654,40 +8904,72 @@ declare function trieStringify(root: TrieNode | null, nodes: NodesDb): string {
|
|
|
8654
8904
|
return `\nLeaf('${leaf.getKey().toString()}',${value})`;
|
|
8655
8905
|
}
|
|
8656
8906
|
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
declare const index$
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8907
|
+
declare function findSharedPrefix(a: TruncatedStateKey, b: TruncatedStateKey) {
|
|
8908
|
+
for (let i = 0; i < TRUNCATED_HASH_SIZE; i++) {
|
|
8909
|
+
const diff = a.raw[i] ^ b.raw[i];
|
|
8910
|
+
if (diff === 0) {
|
|
8911
|
+
continue;
|
|
8912
|
+
}
|
|
8913
|
+
// check how many bits match
|
|
8914
|
+
for (const [mask, matchingBits] of bitLookup) {
|
|
8915
|
+
if ((mask & diff) !== 0) {
|
|
8916
|
+
return i * 8 + matchingBits;
|
|
8917
|
+
}
|
|
8918
|
+
}
|
|
8919
|
+
return i;
|
|
8920
|
+
}
|
|
8921
|
+
return TRUNCATED_HASH_SIZE * 8;
|
|
8922
|
+
}
|
|
8923
|
+
|
|
8924
|
+
declare const bitLookup = [
|
|
8925
|
+
[0b10000000, 0],
|
|
8926
|
+
[0b01000000, 1],
|
|
8927
|
+
[0b00100000, 2],
|
|
8928
|
+
[0b00010000, 3],
|
|
8929
|
+
[0b00001000, 4],
|
|
8930
|
+
[0b00000100, 5],
|
|
8931
|
+
[0b00000010, 6],
|
|
8932
|
+
[0b00000001, 7],
|
|
8933
|
+
[0b00000000, 8],
|
|
8934
|
+
];
|
|
8935
|
+
|
|
8936
|
+
type index$e_BranchNode = BranchNode;
|
|
8937
|
+
declare const index$e_BranchNode: typeof BranchNode;
|
|
8938
|
+
type index$e_InMemoryTrie = InMemoryTrie;
|
|
8939
|
+
declare const index$e_InMemoryTrie: typeof InMemoryTrie;
|
|
8940
|
+
type index$e_InputKey = InputKey;
|
|
8941
|
+
type index$e_LeafNode = LeafNode;
|
|
8942
|
+
declare const index$e_LeafNode: typeof LeafNode;
|
|
8943
|
+
type index$e_NodeType = NodeType;
|
|
8944
|
+
declare const index$e_NodeType: typeof NodeType;
|
|
8945
|
+
type index$e_NodesDb = NodesDb;
|
|
8946
|
+
declare const index$e_NodesDb: typeof NodesDb;
|
|
8947
|
+
declare const index$e_TRIE_NODE_BYTES: typeof TRIE_NODE_BYTES;
|
|
8948
|
+
declare const index$e_TRUNCATED_KEY_BITS: typeof TRUNCATED_KEY_BITS;
|
|
8949
|
+
type index$e_TRUNCATED_KEY_BYTES = TRUNCATED_KEY_BYTES;
|
|
8950
|
+
type index$e_TraversedPath = TraversedPath;
|
|
8951
|
+
declare const index$e_TraversedPath: typeof TraversedPath;
|
|
8952
|
+
type index$e_TrieHasher = TrieHasher;
|
|
8953
|
+
type index$e_TrieNode = TrieNode;
|
|
8954
|
+
declare const index$e_TrieNode: typeof TrieNode;
|
|
8955
|
+
type index$e_TrieNodeHash = TrieNodeHash;
|
|
8956
|
+
type index$e_TruncatedStateKey = TruncatedStateKey;
|
|
8957
|
+
type index$e_ValueHash = ValueHash;
|
|
8958
|
+
type index$e_WriteableNodesDb = WriteableNodesDb;
|
|
8959
|
+
declare const index$e_WriteableNodesDb: typeof WriteableNodesDb;
|
|
8960
|
+
declare const index$e_bitLookup: typeof bitLookup;
|
|
8961
|
+
declare const index$e_createSubtreeForBothLeaves: typeof createSubtreeForBothLeaves;
|
|
8962
|
+
declare const index$e_findNodeToReplace: typeof findNodeToReplace;
|
|
8963
|
+
declare const index$e_findSharedPrefix: typeof findSharedPrefix;
|
|
8964
|
+
declare const index$e_getBit: typeof getBit;
|
|
8965
|
+
declare const index$e_leafComparator: typeof leafComparator;
|
|
8966
|
+
declare const index$e_parseInputKey: typeof parseInputKey;
|
|
8967
|
+
declare const index$e_trieInsert: typeof trieInsert;
|
|
8968
|
+
declare const index$e_trieStringify: typeof trieStringify;
|
|
8969
|
+
declare const index$e_zero: typeof zero;
|
|
8970
|
+
declare namespace index$e {
|
|
8971
|
+
export { index$e_BranchNode as BranchNode, index$e_InMemoryTrie as InMemoryTrie, index$e_LeafNode as LeafNode, index$e_NodeType as NodeType, index$e_NodesDb as NodesDb, index$e_TRIE_NODE_BYTES as TRIE_NODE_BYTES, index$e_TRUNCATED_KEY_BITS as TRUNCATED_KEY_BITS, index$e_TraversedPath as TraversedPath, index$e_TrieNode as TrieNode, index$e_WriteableNodesDb as WriteableNodesDb, index$e_bitLookup as bitLookup, index$e_createSubtreeForBothLeaves as createSubtreeForBothLeaves, index$e_findNodeToReplace as findNodeToReplace, index$e_findSharedPrefix as findSharedPrefix, index$e_getBit as getBit, index$e_leafComparator as leafComparator, index$e_parseInputKey as parseInputKey, index$e_trieInsert as trieInsert, index$e_trieStringify as trieStringify, index$e_zero as zero };
|
|
8972
|
+
export type { index$e_InputKey as InputKey, StateKey$1 as StateKey, index$e_TRUNCATED_KEY_BYTES as TRUNCATED_KEY_BYTES, index$e_TrieHasher as TrieHasher, index$e_TrieNodeHash as TrieNodeHash, index$e_TruncatedStateKey as TruncatedStateKey, index$e_ValueHash as ValueHash };
|
|
8691
8973
|
}
|
|
8692
8974
|
|
|
8693
8975
|
/**
|
|
@@ -9129,16 +9411,16 @@ declare class Mountain<H extends OpaqueHash> {
|
|
|
9129
9411
|
}
|
|
9130
9412
|
}
|
|
9131
9413
|
|
|
9132
|
-
type index$
|
|
9133
|
-
declare const index$
|
|
9134
|
-
type index$
|
|
9135
|
-
type index$
|
|
9136
|
-
type index$
|
|
9137
|
-
declare const index$
|
|
9138
|
-
declare const index$
|
|
9139
|
-
declare namespace index$
|
|
9140
|
-
export { index$
|
|
9141
|
-
export type { index$
|
|
9414
|
+
type index$d_MerkleMountainRange<H extends OpaqueHash> = MerkleMountainRange<H>;
|
|
9415
|
+
declare const index$d_MerkleMountainRange: typeof MerkleMountainRange;
|
|
9416
|
+
type index$d_MmrHasher<H extends OpaqueHash> = MmrHasher<H>;
|
|
9417
|
+
type index$d_MmrPeaks<H extends OpaqueHash> = MmrPeaks<H>;
|
|
9418
|
+
type index$d_Mountain<H extends OpaqueHash> = Mountain<H>;
|
|
9419
|
+
declare const index$d_Mountain: typeof Mountain;
|
|
9420
|
+
declare const index$d_SUPER_PEAK_STRING: typeof SUPER_PEAK_STRING;
|
|
9421
|
+
declare namespace index$d {
|
|
9422
|
+
export { index$d_MerkleMountainRange as MerkleMountainRange, index$d_Mountain as Mountain, index$d_SUPER_PEAK_STRING as SUPER_PEAK_STRING };
|
|
9423
|
+
export type { index$d_MmrHasher as MmrHasher, index$d_MmrPeaks as MmrPeaks };
|
|
9142
9424
|
}
|
|
9143
9425
|
|
|
9144
9426
|
/**
|
|
@@ -10836,103 +11118,103 @@ type FieldNames<T> = {
|
|
|
10836
11118
|
[K in keyof T]: T[K] extends Function ? never : K;
|
|
10837
11119
|
}[keyof T];
|
|
10838
11120
|
|
|
10839
|
-
type index$
|
|
10840
|
-
declare const index$
|
|
10841
|
-
type index$
|
|
10842
|
-
declare const index$
|
|
10843
|
-
type index$
|
|
10844
|
-
declare const index$
|
|
10845
|
-
declare const index$
|
|
10846
|
-
type index$
|
|
10847
|
-
declare const index$
|
|
10848
|
-
type index$
|
|
10849
|
-
type index$
|
|
10850
|
-
declare const index$
|
|
10851
|
-
type index$
|
|
10852
|
-
declare const index$
|
|
10853
|
-
declare const index$
|
|
10854
|
-
declare const index$
|
|
10855
|
-
type index$
|
|
10856
|
-
type index$
|
|
10857
|
-
type index$
|
|
10858
|
-
type index$
|
|
10859
|
-
declare const index$
|
|
10860
|
-
type index$
|
|
10861
|
-
declare const index$
|
|
10862
|
-
type index$
|
|
10863
|
-
type index$
|
|
10864
|
-
declare const index$
|
|
10865
|
-
type index$
|
|
10866
|
-
declare const index$
|
|
10867
|
-
type index$
|
|
10868
|
-
type index$
|
|
10869
|
-
type index$
|
|
10870
|
-
declare const index$
|
|
10871
|
-
type index$
|
|
10872
|
-
declare const index$
|
|
10873
|
-
type index$
|
|
10874
|
-
declare const index$
|
|
10875
|
-
type index$
|
|
10876
|
-
declare const index$
|
|
10877
|
-
type index$
|
|
10878
|
-
declare const index$
|
|
10879
|
-
type index$
|
|
10880
|
-
type index$
|
|
10881
|
-
declare const index$
|
|
10882
|
-
type index$
|
|
10883
|
-
declare const index$
|
|
10884
|
-
type index$
|
|
10885
|
-
type index$
|
|
10886
|
-
declare const index$
|
|
10887
|
-
type index$
|
|
10888
|
-
type index$
|
|
10889
|
-
type index$
|
|
10890
|
-
declare const index$
|
|
10891
|
-
type index$
|
|
10892
|
-
type index$
|
|
10893
|
-
type index$
|
|
10894
|
-
declare const index$
|
|
10895
|
-
type index$
|
|
10896
|
-
declare const index$
|
|
10897
|
-
type index$
|
|
10898
|
-
type index$
|
|
10899
|
-
declare const index$
|
|
10900
|
-
type index$
|
|
10901
|
-
declare const index$
|
|
10902
|
-
type index$
|
|
10903
|
-
declare const index$
|
|
10904
|
-
type index$
|
|
10905
|
-
declare const index$
|
|
10906
|
-
type index$
|
|
10907
|
-
declare const index$
|
|
10908
|
-
type index$
|
|
10909
|
-
declare const index$
|
|
10910
|
-
type index$
|
|
10911
|
-
declare const index$
|
|
10912
|
-
type index$
|
|
10913
|
-
type index$
|
|
10914
|
-
declare const index$
|
|
10915
|
-
type index$
|
|
10916
|
-
declare const index$
|
|
10917
|
-
declare const index$
|
|
10918
|
-
declare const index$
|
|
10919
|
-
declare const index$
|
|
10920
|
-
declare const index$
|
|
10921
|
-
declare const index$
|
|
10922
|
-
declare const index$
|
|
10923
|
-
declare const index$
|
|
10924
|
-
declare const index$
|
|
10925
|
-
declare const index$
|
|
10926
|
-
declare const index$
|
|
10927
|
-
declare const index$
|
|
10928
|
-
declare const index$
|
|
10929
|
-
declare const index$
|
|
10930
|
-
declare const index$
|
|
10931
|
-
declare const index$
|
|
10932
|
-
declare const index$
|
|
10933
|
-
declare namespace index$
|
|
10934
|
-
export { index$
|
|
10935
|
-
export type { index$
|
|
11121
|
+
type index$c_AccumulationOutput = AccumulationOutput;
|
|
11122
|
+
declare const index$c_AccumulationOutput: typeof AccumulationOutput;
|
|
11123
|
+
type index$c_AutoAccumulate = AutoAccumulate;
|
|
11124
|
+
declare const index$c_AutoAccumulate: typeof AutoAccumulate;
|
|
11125
|
+
type index$c_AvailabilityAssignment = AvailabilityAssignment;
|
|
11126
|
+
declare const index$c_AvailabilityAssignment: typeof AvailabilityAssignment;
|
|
11127
|
+
declare const index$c_BASE_SERVICE_BALANCE: typeof BASE_SERVICE_BALANCE;
|
|
11128
|
+
type index$c_BlockState = BlockState;
|
|
11129
|
+
declare const index$c_BlockState: typeof BlockState;
|
|
11130
|
+
type index$c_BlocksState = BlocksState;
|
|
11131
|
+
type index$c_CoreStatistics = CoreStatistics;
|
|
11132
|
+
declare const index$c_CoreStatistics: typeof CoreStatistics;
|
|
11133
|
+
type index$c_DisputesRecords = DisputesRecords;
|
|
11134
|
+
declare const index$c_DisputesRecords: typeof DisputesRecords;
|
|
11135
|
+
declare const index$c_ELECTIVE_BYTE_BALANCE: typeof ELECTIVE_BYTE_BALANCE;
|
|
11136
|
+
declare const index$c_ELECTIVE_ITEM_BALANCE: typeof ELECTIVE_ITEM_BALANCE;
|
|
11137
|
+
type index$c_ENTROPY_ENTRIES = ENTROPY_ENTRIES;
|
|
11138
|
+
type index$c_EnumerableState = EnumerableState;
|
|
11139
|
+
type index$c_FieldNames<T> = FieldNames<T>;
|
|
11140
|
+
type index$c_InMemoryService = InMemoryService;
|
|
11141
|
+
declare const index$c_InMemoryService: typeof InMemoryService;
|
|
11142
|
+
type index$c_InMemoryState = InMemoryState;
|
|
11143
|
+
declare const index$c_InMemoryState: typeof InMemoryState;
|
|
11144
|
+
type index$c_InMemoryStateFields = InMemoryStateFields;
|
|
11145
|
+
type index$c_LookupHistoryItem = LookupHistoryItem;
|
|
11146
|
+
declare const index$c_LookupHistoryItem: typeof LookupHistoryItem;
|
|
11147
|
+
type index$c_LookupHistorySlots = LookupHistorySlots;
|
|
11148
|
+
declare const index$c_MAX_LOOKUP_HISTORY_SLOTS: typeof MAX_LOOKUP_HISTORY_SLOTS;
|
|
11149
|
+
type index$c_MAX_RECENT_HISTORY = MAX_RECENT_HISTORY;
|
|
11150
|
+
type index$c_PerCore<T> = PerCore<T>;
|
|
11151
|
+
type index$c_PreimageItem = PreimageItem;
|
|
11152
|
+
declare const index$c_PreimageItem: typeof PreimageItem;
|
|
11153
|
+
type index$c_PrivilegedServices = PrivilegedServices;
|
|
11154
|
+
declare const index$c_PrivilegedServices: typeof PrivilegedServices;
|
|
11155
|
+
type index$c_RecentBlocks = RecentBlocks;
|
|
11156
|
+
declare const index$c_RecentBlocks: typeof RecentBlocks;
|
|
11157
|
+
type index$c_RecentBlocksHistory = RecentBlocksHistory;
|
|
11158
|
+
declare const index$c_RecentBlocksHistory: typeof RecentBlocksHistory;
|
|
11159
|
+
type index$c_SafroleData = SafroleData;
|
|
11160
|
+
declare const index$c_SafroleData: typeof SafroleData;
|
|
11161
|
+
type index$c_SafroleSealingKeys = SafroleSealingKeys;
|
|
11162
|
+
type index$c_SafroleSealingKeysData = SafroleSealingKeysData;
|
|
11163
|
+
declare const index$c_SafroleSealingKeysData: typeof SafroleSealingKeysData;
|
|
11164
|
+
type index$c_SafroleSealingKeysKind = SafroleSealingKeysKind;
|
|
11165
|
+
declare const index$c_SafroleSealingKeysKind: typeof SafroleSealingKeysKind;
|
|
11166
|
+
type index$c_Service = Service;
|
|
11167
|
+
type index$c_ServiceAccountInfo = ServiceAccountInfo;
|
|
11168
|
+
declare const index$c_ServiceAccountInfo: typeof ServiceAccountInfo;
|
|
11169
|
+
type index$c_ServiceData = ServiceData;
|
|
11170
|
+
type index$c_ServiceEntries = ServiceEntries;
|
|
11171
|
+
type index$c_ServiceStatistics = ServiceStatistics;
|
|
11172
|
+
declare const index$c_ServiceStatistics: typeof ServiceStatistics;
|
|
11173
|
+
type index$c_ServicesUpdate = ServicesUpdate;
|
|
11174
|
+
type index$c_State = State;
|
|
11175
|
+
type index$c_StatisticsData = StatisticsData;
|
|
11176
|
+
declare const index$c_StatisticsData: typeof StatisticsData;
|
|
11177
|
+
type index$c_StorageItem = StorageItem;
|
|
11178
|
+
declare const index$c_StorageItem: typeof StorageItem;
|
|
11179
|
+
type index$c_StorageKey = StorageKey;
|
|
11180
|
+
type index$c_UpdateError = UpdateError;
|
|
11181
|
+
declare const index$c_UpdateError: typeof UpdateError;
|
|
11182
|
+
type index$c_UpdatePreimage = UpdatePreimage;
|
|
11183
|
+
declare const index$c_UpdatePreimage: typeof UpdatePreimage;
|
|
11184
|
+
type index$c_UpdatePreimageKind = UpdatePreimageKind;
|
|
11185
|
+
declare const index$c_UpdatePreimageKind: typeof UpdatePreimageKind;
|
|
11186
|
+
type index$c_UpdateService = UpdateService;
|
|
11187
|
+
declare const index$c_UpdateService: typeof UpdateService;
|
|
11188
|
+
type index$c_UpdateServiceKind = UpdateServiceKind;
|
|
11189
|
+
declare const index$c_UpdateServiceKind: typeof UpdateServiceKind;
|
|
11190
|
+
type index$c_UpdateStorage = UpdateStorage;
|
|
11191
|
+
declare const index$c_UpdateStorage: typeof UpdateStorage;
|
|
11192
|
+
type index$c_UpdateStorageKind = UpdateStorageKind;
|
|
11193
|
+
declare const index$c_UpdateStorageKind: typeof UpdateStorageKind;
|
|
11194
|
+
type index$c_VALIDATOR_META_BYTES = VALIDATOR_META_BYTES;
|
|
11195
|
+
type index$c_ValidatorData = ValidatorData;
|
|
11196
|
+
declare const index$c_ValidatorData: typeof ValidatorData;
|
|
11197
|
+
type index$c_ValidatorStatistics = ValidatorStatistics;
|
|
11198
|
+
declare const index$c_ValidatorStatistics: typeof ValidatorStatistics;
|
|
11199
|
+
declare const index$c_accumulationOutputComparator: typeof accumulationOutputComparator;
|
|
11200
|
+
declare const index$c_codecBandersnatchKey: typeof codecBandersnatchKey;
|
|
11201
|
+
declare const index$c_codecPerCore: typeof codecPerCore;
|
|
11202
|
+
declare const index$c_codecServiceId: typeof codecServiceId;
|
|
11203
|
+
declare const index$c_codecVarGas: typeof codecVarGas;
|
|
11204
|
+
declare const index$c_codecVarU16: typeof codecVarU16;
|
|
11205
|
+
declare const index$c_codecWithHash: typeof codecWithHash;
|
|
11206
|
+
declare const index$c_hashComparator: typeof hashComparator;
|
|
11207
|
+
declare const index$c_ignoreValueWithDefault: typeof ignoreValueWithDefault;
|
|
11208
|
+
declare const index$c_serviceDataCodec: typeof serviceDataCodec;
|
|
11209
|
+
declare const index$c_serviceEntriesCodec: typeof serviceEntriesCodec;
|
|
11210
|
+
declare const index$c_sortedSetCodec: typeof sortedSetCodec;
|
|
11211
|
+
declare const index$c_tryAsLookupHistorySlots: typeof tryAsLookupHistorySlots;
|
|
11212
|
+
declare const index$c_tryAsPerCore: typeof tryAsPerCore;
|
|
11213
|
+
declare const index$c_workReportsSortedSetCodec: typeof workReportsSortedSetCodec;
|
|
11214
|
+
declare const index$c_zeroSizeHint: typeof zeroSizeHint;
|
|
11215
|
+
declare namespace index$c {
|
|
11216
|
+
export { index$c_AccumulationOutput as AccumulationOutput, index$c_AutoAccumulate as AutoAccumulate, index$c_AvailabilityAssignment as AvailabilityAssignment, index$c_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$c_BlockState as BlockState, index$c_CoreStatistics as CoreStatistics, index$c_DisputesRecords as DisputesRecords, index$c_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$c_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$c_InMemoryService as InMemoryService, index$c_InMemoryState as InMemoryState, index$c_LookupHistoryItem as LookupHistoryItem, index$c_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$c_PreimageItem as PreimageItem, index$c_PrivilegedServices as PrivilegedServices, index$c_RecentBlocks as RecentBlocks, index$c_RecentBlocksHistory as RecentBlocksHistory, index$c_SafroleData as SafroleData, index$c_SafroleSealingKeysData as SafroleSealingKeysData, index$c_SafroleSealingKeysKind as SafroleSealingKeysKind, index$c_ServiceAccountInfo as ServiceAccountInfo, index$c_ServiceStatistics as ServiceStatistics, index$c_StatisticsData as StatisticsData, index$c_StorageItem as StorageItem, index$c_UpdateError as UpdateError, index$c_UpdatePreimage as UpdatePreimage, index$c_UpdatePreimageKind as UpdatePreimageKind, index$c_UpdateService as UpdateService, index$c_UpdateServiceKind as UpdateServiceKind, index$c_UpdateStorage as UpdateStorage, index$c_UpdateStorageKind as UpdateStorageKind, index$c_ValidatorData as ValidatorData, index$c_ValidatorStatistics as ValidatorStatistics, index$c_accumulationOutputComparator as accumulationOutputComparator, index$c_codecBandersnatchKey as codecBandersnatchKey, index$c_codecPerCore as codecPerCore, index$c_codecServiceId as codecServiceId, index$c_codecVarGas as codecVarGas, index$c_codecVarU16 as codecVarU16, index$c_codecWithHash as codecWithHash, index$c_hashComparator as hashComparator, index$c_ignoreValueWithDefault as ignoreValueWithDefault, index$c_serviceDataCodec as serviceDataCodec, index$c_serviceEntriesCodec as serviceEntriesCodec, index$c_sortedSetCodec as sortedSetCodec, index$c_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$c_tryAsPerCore as tryAsPerCore, index$c_workReportsSortedSetCodec as workReportsSortedSetCodec, index$c_zeroSizeHint as zeroSizeHint };
|
|
11217
|
+
export type { index$c_BlocksState as BlocksState, index$c_ENTROPY_ENTRIES as ENTROPY_ENTRIES, index$c_EnumerableState as EnumerableState, index$c_FieldNames as FieldNames, index$c_InMemoryStateFields as InMemoryStateFields, index$c_LookupHistorySlots as LookupHistorySlots, index$c_MAX_RECENT_HISTORY as MAX_RECENT_HISTORY, index$c_PerCore as PerCore, index$c_SafroleSealingKeys as SafroleSealingKeys, index$c_Service as Service, index$c_ServiceData as ServiceData, index$c_ServiceEntries as ServiceEntries, index$c_ServicesUpdate as ServicesUpdate, index$c_State as State, index$c_StorageKey as StorageKey, index$c_VALIDATOR_META_BYTES as VALIDATOR_META_BYTES };
|
|
10936
11218
|
}
|
|
10937
11219
|
|
|
10938
11220
|
type StateKey = Opaque<OpaqueHash, "stateKey">;
|
|
@@ -11521,8 +11803,6 @@ declare class StateEntries {
|
|
|
11521
11803
|
return new StateEntries(TruncatedHashDictionary.fromEntries(entries));
|
|
11522
11804
|
}
|
|
11523
11805
|
|
|
11524
|
-
private trieCache: InMemoryTrie | null = null;
|
|
11525
|
-
|
|
11526
11806
|
private constructor(private readonly entries: TruncatedHashDictionary<StateKey, BytesBlob>) {}
|
|
11527
11807
|
|
|
11528
11808
|
/** When comparing, we can safely ignore `trieCache` and just use entries. */
|
|
@@ -11534,18 +11814,6 @@ declare class StateEntries {
|
|
|
11534
11814
|
return this.entries[Symbol.iterator]();
|
|
11535
11815
|
}
|
|
11536
11816
|
|
|
11537
|
-
/** Construct the trie from given set of state entries. */
|
|
11538
|
-
public getTrie(): InMemoryTrie {
|
|
11539
|
-
if (this.trieCache === null) {
|
|
11540
|
-
const trie = InMemoryTrie.empty(blake2bTrieHasher);
|
|
11541
|
-
for (const [key, value] of this.entries) {
|
|
11542
|
-
trie.set(key.asOpaque(), value);
|
|
11543
|
-
}
|
|
11544
|
-
this.trieCache = trie;
|
|
11545
|
-
}
|
|
11546
|
-
return this.trieCache;
|
|
11547
|
-
}
|
|
11548
|
-
|
|
11549
11817
|
/** Retrieve value of some serialized key (if present). */
|
|
11550
11818
|
get(key: StateKey): BytesBlob | null {
|
|
11551
11819
|
return this.entries.get(key) ?? null;
|
|
@@ -11553,8 +11821,6 @@ declare class StateEntries {
|
|
|
11553
11821
|
|
|
11554
11822
|
/** Modify underlying entries dictionary with given update. */
|
|
11555
11823
|
applyUpdate(stateEntriesUpdate: Iterable<StateEntryUpdate>) {
|
|
11556
|
-
// NOTE since we are altering the structure, we need to reset the cache.
|
|
11557
|
-
this.trieCache = null;
|
|
11558
11824
|
for (const [action, key, value] of stateEntriesUpdate) {
|
|
11559
11825
|
if (action === StateEntryUpdateAction.Insert) {
|
|
11560
11826
|
this.entries.set(key, value);
|
|
@@ -11568,10 +11834,12 @@ declare class StateEntries {
|
|
|
11568
11834
|
|
|
11569
11835
|
/** https://graypaper.fluffylabs.dev/#/68eaa1f/391600391600?v=0.6.4 */
|
|
11570
11836
|
getRootHash(): StateRootHash {
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11837
|
+
const leaves: SortedSet<LeafNode> = SortedSet.fromArray(leafComparator);
|
|
11838
|
+
for (const [key, value] of this) {
|
|
11839
|
+
leaves.insert(InMemoryTrie.constructLeaf(blake2bTrieHasher, key.asOpaque(), value));
|
|
11840
|
+
}
|
|
11841
|
+
|
|
11842
|
+
return InMemoryTrie.computeStateRoot(blake2bTrieHasher, leaves).asOpaque();
|
|
11575
11843
|
}
|
|
11576
11844
|
}
|
|
11577
11845
|
|
|
@@ -11884,44 +12152,44 @@ declare function loadState(spec: ChainSpec, entries: Iterable<[StateKey | Trunca
|
|
|
11884
12152
|
* hashmap of `key -> value` entries.
|
|
11885
12153
|
*/
|
|
11886
12154
|
|
|
11887
|
-
declare const index$
|
|
11888
|
-
type index$
|
|
11889
|
-
type index$
|
|
11890
|
-
type index$
|
|
11891
|
-
declare const index$
|
|
11892
|
-
type index$
|
|
11893
|
-
declare const index$
|
|
11894
|
-
type index$
|
|
11895
|
-
type index$
|
|
11896
|
-
type index$
|
|
11897
|
-
declare const index$
|
|
11898
|
-
type index$
|
|
11899
|
-
type index$
|
|
11900
|
-
declare const index$
|
|
11901
|
-
type index$
|
|
11902
|
-
type index$
|
|
11903
|
-
declare const index$
|
|
11904
|
-
declare const index$
|
|
11905
|
-
declare const index$
|
|
11906
|
-
declare const index$
|
|
11907
|
-
declare const index$
|
|
11908
|
-
declare const index$
|
|
11909
|
-
declare const index$
|
|
11910
|
-
declare const index$
|
|
11911
|
-
declare const index$
|
|
11912
|
-
declare const index$
|
|
11913
|
-
import index$
|
|
11914
|
-
declare const index$
|
|
11915
|
-
declare const index$
|
|
11916
|
-
declare const index$
|
|
11917
|
-
declare const index$
|
|
11918
|
-
declare const index$
|
|
11919
|
-
declare const index$
|
|
11920
|
-
declare const index$
|
|
11921
|
-
import index$
|
|
11922
|
-
declare namespace index$
|
|
11923
|
-
export { index$
|
|
11924
|
-
export type { index$
|
|
12155
|
+
declare const index$b_EMPTY_BLOB: typeof EMPTY_BLOB;
|
|
12156
|
+
type index$b_EncodeFun = EncodeFun;
|
|
12157
|
+
type index$b_KeyAndCodec<T> = KeyAndCodec<T>;
|
|
12158
|
+
type index$b_SerializedService = SerializedService;
|
|
12159
|
+
declare const index$b_SerializedService: typeof SerializedService;
|
|
12160
|
+
type index$b_SerializedState<T extends SerializedStateBackend = SerializedStateBackend> = SerializedState<T>;
|
|
12161
|
+
declare const index$b_SerializedState: typeof SerializedState;
|
|
12162
|
+
type index$b_SerializedStateBackend = SerializedStateBackend;
|
|
12163
|
+
type index$b_StateCodec<T> = StateCodec<T>;
|
|
12164
|
+
type index$b_StateEntries = StateEntries;
|
|
12165
|
+
declare const index$b_StateEntries: typeof StateEntries;
|
|
12166
|
+
type index$b_StateEntryUpdate = StateEntryUpdate;
|
|
12167
|
+
type index$b_StateEntryUpdateAction = StateEntryUpdateAction;
|
|
12168
|
+
declare const index$b_StateEntryUpdateAction: typeof StateEntryUpdateAction;
|
|
12169
|
+
type index$b_StateKey = StateKey;
|
|
12170
|
+
type index$b_StateKeyIdx = StateKeyIdx;
|
|
12171
|
+
declare const index$b_StateKeyIdx: typeof StateKeyIdx;
|
|
12172
|
+
declare const index$b_TYPICAL_STATE_ITEMS: typeof TYPICAL_STATE_ITEMS;
|
|
12173
|
+
declare const index$b_TYPICAL_STATE_ITEM_LEN: typeof TYPICAL_STATE_ITEM_LEN;
|
|
12174
|
+
declare const index$b_U32_BYTES: typeof U32_BYTES;
|
|
12175
|
+
declare const index$b_binaryMerkleization: typeof binaryMerkleization;
|
|
12176
|
+
declare const index$b_convertInMemoryStateToDictionary: typeof convertInMemoryStateToDictionary;
|
|
12177
|
+
declare const index$b_dumpCodec: typeof dumpCodec;
|
|
12178
|
+
declare const index$b_getSafroleData: typeof getSafroleData;
|
|
12179
|
+
declare const index$b_legacyServiceNested: typeof legacyServiceNested;
|
|
12180
|
+
declare const index$b_loadState: typeof loadState;
|
|
12181
|
+
import index$b_serialize = serialize;
|
|
12182
|
+
declare const index$b_serializeBasicKeys: typeof serializeBasicKeys;
|
|
12183
|
+
declare const index$b_serializePreimages: typeof serializePreimages;
|
|
12184
|
+
declare const index$b_serializeRemovedServices: typeof serializeRemovedServices;
|
|
12185
|
+
declare const index$b_serializeServiceUpdates: typeof serializeServiceUpdates;
|
|
12186
|
+
declare const index$b_serializeStateUpdate: typeof serializeStateUpdate;
|
|
12187
|
+
declare const index$b_serializeStorage: typeof serializeStorage;
|
|
12188
|
+
declare const index$b_stateEntriesSequenceCodec: typeof stateEntriesSequenceCodec;
|
|
12189
|
+
import index$b_stateKeys = stateKeys;
|
|
12190
|
+
declare namespace index$b {
|
|
12191
|
+
export { index$b_EMPTY_BLOB as EMPTY_BLOB, index$b_SerializedService as SerializedService, index$b_SerializedState as SerializedState, index$b_StateEntries as StateEntries, index$b_StateEntryUpdateAction as StateEntryUpdateAction, index$b_StateKeyIdx as StateKeyIdx, index$b_TYPICAL_STATE_ITEMS as TYPICAL_STATE_ITEMS, index$b_TYPICAL_STATE_ITEM_LEN as TYPICAL_STATE_ITEM_LEN, index$b_U32_BYTES as U32_BYTES, index$b_binaryMerkleization as binaryMerkleization, index$b_convertInMemoryStateToDictionary as convertInMemoryStateToDictionary, index$b_dumpCodec as dumpCodec, index$b_getSafroleData as getSafroleData, index$b_legacyServiceNested as legacyServiceNested, index$b_loadState as loadState, index$b_serialize as serialize, index$b_serializeBasicKeys as serializeBasicKeys, index$b_serializePreimages as serializePreimages, index$b_serializeRemovedServices as serializeRemovedServices, index$b_serializeServiceUpdates as serializeServiceUpdates, index$b_serializeStateUpdate as serializeStateUpdate, index$b_serializeStorage as serializeStorage, index$b_stateEntriesSequenceCodec as stateEntriesSequenceCodec, index$b_stateKeys as stateKeys };
|
|
12192
|
+
export type { index$b_EncodeFun as EncodeFun, index$b_KeyAndCodec as KeyAndCodec, index$b_SerializedStateBackend as SerializedStateBackend, index$b_StateCodec as StateCodec, index$b_StateEntryUpdate as StateEntryUpdate, index$b_StateKey as StateKey };
|
|
11925
12193
|
}
|
|
11926
12194
|
|
|
11927
12195
|
/** Error during `LeafDb` creation. */
|
|
@@ -11958,13 +12226,13 @@ declare class LeafDb implements SerializedStateBackend {
|
|
|
11958
12226
|
);
|
|
11959
12227
|
}
|
|
11960
12228
|
|
|
11961
|
-
const leaves
|
|
12229
|
+
const leaves = SortedSet.fromArray(leafComparator, []);
|
|
11962
12230
|
for (const nodeData of blob.chunks(TRIE_NODE_BYTES)) {
|
|
11963
12231
|
const node = new TrieNode(nodeData.raw);
|
|
11964
12232
|
if (node.getNodeType() === NodeType.Branch) {
|
|
11965
12233
|
return Result.error(LeafDbError.InvalidLeafData, `Branch node detected: ${nodeData}`);
|
|
11966
12234
|
}
|
|
11967
|
-
leaves.
|
|
12235
|
+
leaves.insert(node.asLeafNode());
|
|
11968
12236
|
}
|
|
11969
12237
|
|
|
11970
12238
|
return Result.ok(new LeafDb(leaves, db));
|
|
@@ -11974,11 +12242,11 @@ declare class LeafDb implements SerializedStateBackend {
|
|
|
11974
12242
|
private readonly lookup: TruncatedHashDictionary<StateKey, Lookup>;
|
|
11975
12243
|
|
|
11976
12244
|
private constructor(
|
|
11977
|
-
public readonly leaves:
|
|
12245
|
+
public readonly leaves: SortedSet<LeafNode>,
|
|
11978
12246
|
public readonly db: ValuesDb,
|
|
11979
12247
|
) {
|
|
11980
12248
|
this.lookup = TruncatedHashDictionary.fromEntries(
|
|
11981
|
-
leaves.map((leaf) => {
|
|
12249
|
+
leaves.array.map((leaf) => {
|
|
11982
12250
|
const key: StateKey = leaf.getKey().asOpaque();
|
|
11983
12251
|
const value: Lookup = leaf.hasEmbeddedValue()
|
|
11984
12252
|
? {
|
|
@@ -12129,25 +12397,25 @@ declare class InMemoryStates implements StatesDb<InMemoryState> {
|
|
|
12129
12397
|
}
|
|
12130
12398
|
}
|
|
12131
12399
|
|
|
12132
|
-
type index$
|
|
12133
|
-
type index$
|
|
12134
|
-
declare const index$
|
|
12135
|
-
type index$
|
|
12136
|
-
declare const index$
|
|
12137
|
-
type index$
|
|
12138
|
-
declare const index$
|
|
12139
|
-
type index$
|
|
12140
|
-
declare const index$
|
|
12141
|
-
type index$
|
|
12142
|
-
type index$
|
|
12143
|
-
declare const index$
|
|
12144
|
-
type index$
|
|
12145
|
-
declare const index$
|
|
12146
|
-
type index$
|
|
12147
|
-
type index$
|
|
12148
|
-
declare namespace index$
|
|
12149
|
-
export { index$
|
|
12150
|
-
export type { index$
|
|
12400
|
+
type index$a_BlocksDb = BlocksDb;
|
|
12401
|
+
type index$a_InMemoryBlocks = InMemoryBlocks;
|
|
12402
|
+
declare const index$a_InMemoryBlocks: typeof InMemoryBlocks;
|
|
12403
|
+
type index$a_InMemoryStates = InMemoryStates;
|
|
12404
|
+
declare const index$a_InMemoryStates: typeof InMemoryStates;
|
|
12405
|
+
type index$a_LeafDb = LeafDb;
|
|
12406
|
+
declare const index$a_LeafDb: typeof LeafDb;
|
|
12407
|
+
type index$a_LeafDbError = LeafDbError;
|
|
12408
|
+
declare const index$a_LeafDbError: typeof LeafDbError;
|
|
12409
|
+
type index$a_Lookup = Lookup;
|
|
12410
|
+
type index$a_LookupKind = LookupKind;
|
|
12411
|
+
declare const index$a_LookupKind: typeof LookupKind;
|
|
12412
|
+
type index$a_StateUpdateError = StateUpdateError;
|
|
12413
|
+
declare const index$a_StateUpdateError: typeof StateUpdateError;
|
|
12414
|
+
type index$a_StatesDb<T extends State = State> = StatesDb<T>;
|
|
12415
|
+
type index$a_ValuesDb = ValuesDb;
|
|
12416
|
+
declare namespace index$a {
|
|
12417
|
+
export { index$a_InMemoryBlocks as InMemoryBlocks, index$a_InMemoryStates as InMemoryStates, index$a_LeafDb as LeafDb, index$a_LeafDbError as LeafDbError, index$a_LookupKind as LookupKind, index$a_StateUpdateError as StateUpdateError };
|
|
12418
|
+
export type { index$a_BlocksDb as BlocksDb, index$a_Lookup as Lookup, index$a_StatesDb as StatesDb, index$a_ValuesDb as ValuesDb };
|
|
12151
12419
|
}
|
|
12152
12420
|
|
|
12153
12421
|
/**
|
|
@@ -12566,30 +12834,30 @@ declare const initEc = async () => {
|
|
|
12566
12834
|
await init.reedSolomon();
|
|
12567
12835
|
};
|
|
12568
12836
|
|
|
12569
|
-
declare const index$
|
|
12570
|
-
declare const index$
|
|
12571
|
-
type index$
|
|
12572
|
-
type index$
|
|
12573
|
-
type index$
|
|
12574
|
-
declare const index$
|
|
12575
|
-
type index$
|
|
12576
|
-
declare const index$
|
|
12577
|
-
declare const index$
|
|
12578
|
-
declare const index$
|
|
12579
|
-
declare const index$
|
|
12580
|
-
declare const index$
|
|
12581
|
-
declare const index$
|
|
12582
|
-
declare const index$
|
|
12583
|
-
declare const index$
|
|
12584
|
-
declare const index$
|
|
12585
|
-
declare const index$
|
|
12586
|
-
declare const index$
|
|
12587
|
-
declare const index$
|
|
12588
|
-
declare const index$
|
|
12589
|
-
declare const index$
|
|
12590
|
-
declare namespace index$
|
|
12591
|
-
export { index$
|
|
12592
|
-
export type { index$
|
|
12837
|
+
declare const index$9_HALF_POINT_SIZE: typeof HALF_POINT_SIZE;
|
|
12838
|
+
declare const index$9_N_CHUNKS_REDUNDANCY: typeof N_CHUNKS_REDUNDANCY;
|
|
12839
|
+
type index$9_N_CHUNKS_REQUIRED = N_CHUNKS_REQUIRED;
|
|
12840
|
+
type index$9_N_CHUNKS_TOTAL = N_CHUNKS_TOTAL;
|
|
12841
|
+
type index$9_PIECE_SIZE = PIECE_SIZE;
|
|
12842
|
+
declare const index$9_POINT_ALIGNMENT: typeof POINT_ALIGNMENT;
|
|
12843
|
+
type index$9_POINT_LENGTH = POINT_LENGTH;
|
|
12844
|
+
declare const index$9_chunkingFunction: typeof chunkingFunction;
|
|
12845
|
+
declare const index$9_chunksToShards: typeof chunksToShards;
|
|
12846
|
+
declare const index$9_decodeData: typeof decodeData;
|
|
12847
|
+
declare const index$9_decodeDataAndTrim: typeof decodeDataAndTrim;
|
|
12848
|
+
declare const index$9_decodePiece: typeof decodePiece;
|
|
12849
|
+
declare const index$9_encodePoints: typeof encodePoints;
|
|
12850
|
+
declare const index$9_initEc: typeof initEc;
|
|
12851
|
+
declare const index$9_join: typeof join;
|
|
12852
|
+
declare const index$9_lace: typeof lace;
|
|
12853
|
+
declare const index$9_padAndEncodeData: typeof padAndEncodeData;
|
|
12854
|
+
declare const index$9_shardsToChunks: typeof shardsToChunks;
|
|
12855
|
+
declare const index$9_split: typeof split;
|
|
12856
|
+
declare const index$9_transpose: typeof transpose;
|
|
12857
|
+
declare const index$9_unzip: typeof unzip;
|
|
12858
|
+
declare namespace index$9 {
|
|
12859
|
+
export { index$9_HALF_POINT_SIZE as HALF_POINT_SIZE, index$9_N_CHUNKS_REDUNDANCY as N_CHUNKS_REDUNDANCY, index$9_POINT_ALIGNMENT as POINT_ALIGNMENT, index$9_chunkingFunction as chunkingFunction, index$9_chunksToShards as chunksToShards, index$9_decodeData as decodeData, index$9_decodeDataAndTrim as decodeDataAndTrim, index$9_decodePiece as decodePiece, index$9_encodePoints as encodePoints, index$9_initEc as initEc, index$9_join as join, index$9_lace as lace, index$9_padAndEncodeData as padAndEncodeData, index$9_shardsToChunks as shardsToChunks, index$9_split as split, index$9_transpose as transpose, index$9_unzip as unzip };
|
|
12860
|
+
export type { index$9_N_CHUNKS_REQUIRED as N_CHUNKS_REQUIRED, index$9_N_CHUNKS_TOTAL as N_CHUNKS_TOTAL, index$9_PIECE_SIZE as PIECE_SIZE, index$9_POINT_LENGTH as POINT_LENGTH };
|
|
12593
12861
|
}
|
|
12594
12862
|
|
|
12595
12863
|
/** Size of the transfer memo. */
|
|
@@ -12932,173 +13200,6 @@ interface GasCounter {
|
|
|
12932
13200
|
sub(g: Gas): boolean;
|
|
12933
13201
|
}
|
|
12934
13202
|
|
|
12935
|
-
declare enum Level {
|
|
12936
|
-
INSANE = 1,
|
|
12937
|
-
TRACE = 2,
|
|
12938
|
-
LOG = 3,
|
|
12939
|
-
INFO = 4,
|
|
12940
|
-
WARN = 5,
|
|
12941
|
-
ERROR = 6,
|
|
12942
|
-
}
|
|
12943
|
-
|
|
12944
|
-
type Options = {
|
|
12945
|
-
defaultLevel: Level;
|
|
12946
|
-
workingDir: string;
|
|
12947
|
-
modules: Map<string, Level>;
|
|
12948
|
-
};
|
|
12949
|
-
|
|
12950
|
-
/**
|
|
12951
|
-
* A function to parse logger definition (including modules) given as a string.
|
|
12952
|
-
*
|
|
12953
|
-
* Examples
|
|
12954
|
-
* - `info` - setup default logging level to `info`.
|
|
12955
|
-
* - `trace` - default logging level set to `trace`.
|
|
12956
|
-
* - `debug;consensus=trace` - default level is set to `debug/log`, but consensus is in trace mode.
|
|
12957
|
-
*/
|
|
12958
|
-
declare function parseLoggerOptions(input: string, defaultLevel: Level, workingDir?: string): Options {
|
|
12959
|
-
const modules = new Map<string, Level>();
|
|
12960
|
-
const parts = input.toLowerCase().split(",");
|
|
12961
|
-
let defLevel = defaultLevel;
|
|
12962
|
-
|
|
12963
|
-
for (const p of parts) {
|
|
12964
|
-
const clean = p.trim();
|
|
12965
|
-
// skip empty objects (forgotten `,` removed)
|
|
12966
|
-
if (clean.length === 0) {
|
|
12967
|
-
continue;
|
|
12968
|
-
}
|
|
12969
|
-
// we just have the default level
|
|
12970
|
-
if (clean.includes("=")) {
|
|
12971
|
-
const [mod, lvl] = clean.split("=");
|
|
12972
|
-
modules.set(mod.trim(), parseLevel(lvl.trim()));
|
|
12973
|
-
} else {
|
|
12974
|
-
defLevel = parseLevel(clean);
|
|
12975
|
-
}
|
|
12976
|
-
}
|
|
12977
|
-
|
|
12978
|
-
// TODO [ToDr] Fix dirname for workers.
|
|
12979
|
-
const myDir = (import.meta.dirname ?? "").split("/");
|
|
12980
|
-
myDir.pop();
|
|
12981
|
-
myDir.pop();
|
|
12982
|
-
return {
|
|
12983
|
-
defaultLevel: defLevel,
|
|
12984
|
-
modules,
|
|
12985
|
-
workingDir: workingDir ?? myDir.join("/"),
|
|
12986
|
-
};
|
|
12987
|
-
}
|
|
12988
|
-
|
|
12989
|
-
declare const GLOBAL_CONFIG = {
|
|
12990
|
-
options: DEFAULT_OPTIONS,
|
|
12991
|
-
transport: ConsoleTransport.create(DEFAULT_OPTIONS.defaultLevel, DEFAULT_OPTIONS),
|
|
12992
|
-
};
|
|
12993
|
-
|
|
12994
|
-
/**
|
|
12995
|
-
* A logger instance.
|
|
12996
|
-
*/
|
|
12997
|
-
declare class Logger {
|
|
12998
|
-
/**
|
|
12999
|
-
* Create a new logger instance given filename and an optional module name.
|
|
13000
|
-
*
|
|
13001
|
-
* If the module name is not given, `fileName` becomes the module name.
|
|
13002
|
-
* The module name can be composed from multiple parts separated with `/`.
|
|
13003
|
-
*
|
|
13004
|
-
* The logger will use a global configuration which can be changed using
|
|
13005
|
-
* [`configureLogger`] function.
|
|
13006
|
-
*/
|
|
13007
|
-
static new(fileName?: string, moduleName?: string) {
|
|
13008
|
-
const fName = fileName ?? "unknown";
|
|
13009
|
-
return new Logger(moduleName ?? fName, fName, GLOBAL_CONFIG);
|
|
13010
|
-
}
|
|
13011
|
-
|
|
13012
|
-
/**
|
|
13013
|
-
* Return currently configured level for given module. */
|
|
13014
|
-
static getLevel(moduleName: string): Level {
|
|
13015
|
-
return findLevel(GLOBAL_CONFIG.options, moduleName);
|
|
13016
|
-
}
|
|
13017
|
-
|
|
13018
|
-
/**
|
|
13019
|
-
* Global configuration of all loggers.
|
|
13020
|
-
*
|
|
13021
|
-
* One can specify a default logging level (only logs with level >= default will be printed).
|
|
13022
|
-
* It's also possible to configure per-module logging level that takes precedence
|
|
13023
|
-
* over the default one.
|
|
13024
|
-
*
|
|
13025
|
-
* Changing the options affects all previously created loggers.
|
|
13026
|
-
*/
|
|
13027
|
-
static configureAllFromOptions(options: Options) {
|
|
13028
|
-
// find minimal level to optimise logging in case
|
|
13029
|
-
// we don't care about low-level logs.
|
|
13030
|
-
const minimalLevel = Array.from(options.modules.values()).reduce((level, modLevel) => {
|
|
13031
|
-
return level < modLevel ? level : modLevel;
|
|
13032
|
-
}, options.defaultLevel);
|
|
13033
|
-
|
|
13034
|
-
const transport = ConsoleTransport.create(minimalLevel, options);
|
|
13035
|
-
|
|
13036
|
-
// set the global config
|
|
13037
|
-
GLOBAL_CONFIG.options = options;
|
|
13038
|
-
GLOBAL_CONFIG.transport = transport;
|
|
13039
|
-
}
|
|
13040
|
-
|
|
13041
|
-
/**
|
|
13042
|
-
* Global configuration of all loggers.
|
|
13043
|
-
*
|
|
13044
|
-
* Parse configuration options from an input string typically obtained
|
|
13045
|
-
* from environment variable `JAM_LOG`.
|
|
13046
|
-
*/
|
|
13047
|
-
static configureAll(input: string, defaultLevel: Level, workingDir?: string) {
|
|
13048
|
-
const options = parseLoggerOptions(input, defaultLevel, workingDir);
|
|
13049
|
-
Logger.configureAllFromOptions(options);
|
|
13050
|
-
}
|
|
13051
|
-
|
|
13052
|
-
constructor(
|
|
13053
|
-
private readonly moduleName: string,
|
|
13054
|
-
private readonly fileName: string,
|
|
13055
|
-
private readonly config: typeof GLOBAL_CONFIG,
|
|
13056
|
-
) {}
|
|
13057
|
-
|
|
13058
|
-
/** Log a message with `INSANE` level. */
|
|
13059
|
-
insane(val: string) {
|
|
13060
|
-
this.config.transport.insane(this.moduleName, val);
|
|
13061
|
-
}
|
|
13062
|
-
|
|
13063
|
-
/** Log a message with `TRACE` level. */
|
|
13064
|
-
trace(val: string) {
|
|
13065
|
-
this.config.transport.trace(this.moduleName, val);
|
|
13066
|
-
}
|
|
13067
|
-
|
|
13068
|
-
/** Log a message with `DEBUG`/`LOG` level. */
|
|
13069
|
-
log(val: string) {
|
|
13070
|
-
this.config.transport.log(this.moduleName, val);
|
|
13071
|
-
}
|
|
13072
|
-
|
|
13073
|
-
/** Log a message with `INFO` level. */
|
|
13074
|
-
info(val: string) {
|
|
13075
|
-
this.config.transport.info(this.moduleName, val);
|
|
13076
|
-
}
|
|
13077
|
-
|
|
13078
|
-
/** Log a message with `WARN` level. */
|
|
13079
|
-
warn(val: string) {
|
|
13080
|
-
this.config.transport.warn(this.moduleName, val);
|
|
13081
|
-
}
|
|
13082
|
-
|
|
13083
|
-
/** Log a message with `ERROR` level. */
|
|
13084
|
-
error(val: string) {
|
|
13085
|
-
this.config.transport.error(this.moduleName, val);
|
|
13086
|
-
}
|
|
13087
|
-
}
|
|
13088
|
-
|
|
13089
|
-
type index$9_Level = Level;
|
|
13090
|
-
declare const index$9_Level: typeof Level;
|
|
13091
|
-
type index$9_Logger = Logger;
|
|
13092
|
-
declare const index$9_Logger: typeof Logger;
|
|
13093
|
-
declare const index$9_parseLoggerOptions: typeof parseLoggerOptions;
|
|
13094
|
-
declare namespace index$9 {
|
|
13095
|
-
export {
|
|
13096
|
-
index$9_Level as Level,
|
|
13097
|
-
index$9_Logger as Logger,
|
|
13098
|
-
index$9_parseLoggerOptions as parseLoggerOptions,
|
|
13099
|
-
};
|
|
13100
|
-
}
|
|
13101
|
-
|
|
13102
13203
|
/**
|
|
13103
13204
|
* Mask class is an implementation of skip function defined in GP.
|
|
13104
13205
|
*
|
|
@@ -14342,6 +14443,8 @@ declare enum AccessType {
|
|
|
14342
14443
|
WRITE = 1,
|
|
14343
14444
|
}
|
|
14344
14445
|
|
|
14446
|
+
// const logger = Logger.new(import.meta.filename, "pvm:mem");
|
|
14447
|
+
|
|
14345
14448
|
declare class Memory {
|
|
14346
14449
|
static fromInitialMemory(initialMemoryState: InitialMemoryState) {
|
|
14347
14450
|
return new Memory(
|
|
@@ -14378,7 +14481,7 @@ declare class Memory {
|
|
|
14378
14481
|
return Result.ok(OK);
|
|
14379
14482
|
}
|
|
14380
14483
|
|
|
14381
|
-
logger.insane(`MEM[${address}] <- ${BytesBlob.blobFrom(bytes)}`);
|
|
14484
|
+
// logger.insane(`MEM[${address}] <- ${BytesBlob.blobFrom(bytes)}`);
|
|
14382
14485
|
const pagesResult = this.getPages(address, bytes.length, AccessType.WRITE);
|
|
14383
14486
|
|
|
14384
14487
|
if (pagesResult.isError) {
|
|
@@ -14467,7 +14570,7 @@ declare class Memory {
|
|
|
14467
14570
|
bytesLeft -= bytesToRead;
|
|
14468
14571
|
}
|
|
14469
14572
|
|
|
14470
|
-
logger.insane(`MEM[${startAddress}] => ${BytesBlob.blobFrom(result)}`);
|
|
14573
|
+
// logger.insane(`MEM[${startAddress}] => ${BytesBlob.blobFrom(result)}`);
|
|
14471
14574
|
return Result.ok(OK);
|
|
14472
14575
|
}
|
|
14473
14576
|
|
|
@@ -19108,4 +19211,4 @@ declare namespace index {
|
|
|
19108
19211
|
export type { index_PreimagesInput as PreimagesInput, index_PreimagesState as PreimagesState, index_PreimagesStateUpdate as PreimagesStateUpdate };
|
|
19109
19212
|
}
|
|
19110
19213
|
|
|
19111
|
-
export { index$j as block, index$h as block_json, index$q as bytes, index$o as codec, index$m as collections, index$k as config, index$
|
|
19214
|
+
export { index$j as block, index$h as block_json, index$q as bytes, index$o as codec, index$m as collections, index$k as config, index$f as config_node, index$l as crypto, index$a as database, index$9 as erasure_coding, index$n as hash, index$6 as jam_host_calls, index$i as json_parser, index$g as logger, index$d as mmr, index$p as numbers, index$r as ordering, index$3 as pvm, index$7 as pvm_host_calls, index$8 as pvm_interpreter, index$4 as pvm_program, index$5 as pvm_spi_decoder, index$2 as shuffling, index$c as state, index$1 as state_json, index$b as state_merkleization, index as transition, index$e as trie, index$s as utils };
|