@vtechcom/hexcore 2.0.0-beta.1
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/CHANGELOG.md +127 -0
- package/LICENSE +201 -0
- package/README.md +283 -0
- package/dist/app.module.js +55 -0
- package/dist/app.module.js.map +1 -0
- package/dist/auth.js +151 -0
- package/dist/auth.js.map +1 -0
- package/dist/chain/cost-models.js +81 -0
- package/dist/chain/cost-models.js.map +1 -0
- package/dist/chain/provider.js +269 -0
- package/dist/chain/provider.js.map +1 -0
- package/dist/chain/socket.js +48 -0
- package/dist/chain/socket.js.map +1 -0
- package/dist/cli/doctor.js +43 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/hexcore.js +435 -0
- package/dist/cli/hexcore.js.map +1 -0
- package/dist/common/auth.guard.js +66 -0
- package/dist/common/auth.guard.js.map +1 -0
- package/dist/common/http.js +171 -0
- package/dist/common/http.js.map +1 -0
- package/dist/common/zod-validation.pipe.js +47 -0
- package/dist/common/zod-validation.pipe.js.map +1 -0
- package/dist/config.js +354 -0
- package/dist/config.js.map +1 -0
- package/dist/config.module.js +35 -0
- package/dist/config.module.js.map +1 -0
- package/dist/controllers/cardano.controller.js +173 -0
- package/dist/controllers/cardano.controller.js.map +1 -0
- package/dist/controllers/heads.controller.js +225 -0
- package/dist/controllers/heads.controller.js.map +1 -0
- package/dist/controllers/setup.controller.js +127 -0
- package/dist/controllers/setup.controller.js.map +1 -0
- package/dist/controllers/system.controller.js +153 -0
- package/dist/controllers/system.controller.js.map +1 -0
- package/dist/db/database.module.js +73 -0
- package/dist/db/database.module.js.map +1 -0
- package/dist/db/index.js +135 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/repositories.js +220 -0
- package/dist/db/repositories.js.map +1 -0
- package/dist/docker/container-stats.js +134 -0
- package/dist/docker/container-stats.js.map +1 -0
- package/dist/docker/docker.service.js +335 -0
- package/dist/docker/docker.service.js.map +1 -0
- package/dist/hydra/argv.js +172 -0
- package/dist/hydra/argv.js.map +1 -0
- package/dist/hydra/blockfrost-keys.js +15 -0
- package/dist/hydra/blockfrost-keys.js.map +1 -0
- package/dist/hydra/boot-progress.js +165 -0
- package/dist/hydra/boot-progress.js.map +1 -0
- package/dist/hydra/capabilities.js +131 -0
- package/dist/hydra/capabilities.js.map +1 -0
- package/dist/hydra/head.service.js +1072 -0
- package/dist/hydra/head.service.js.map +1 -0
- package/dist/hydra/keys.js +301 -0
- package/dist/hydra/keys.js.map +1 -0
- package/dist/hydra/node-monitor.service.js +265 -0
- package/dist/hydra/node-monitor.service.js.map +1 -0
- package/dist/hydra/ws-client.js +177 -0
- package/dist/hydra/ws-client.js.map +1 -0
- package/dist/main.js +106 -0
- package/dist/main.js.map +1 -0
- package/dist/preflight.js +215 -0
- package/dist/preflight.js.map +1 -0
- package/dist/settings.js +243 -0
- package/dist/settings.js.map +1 -0
- package/dist/setup.service.js +257 -0
- package/dist/setup.service.js.map +1 -0
- package/dist/version.js +46 -0
- package/dist/version.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/api.d.ts +730 -0
- package/node_modules/@hexcore/shared/dist/cjs/api.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/api.js +358 -0
- package/node_modules/@hexcore/shared/dist/cjs/api.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/domain.d.ts +298 -0
- package/node_modules/@hexcore/shared/dist/cjs/domain.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/domain.js +49 -0
- package/node_modules/@hexcore/shared/dist/cjs/domain.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.d.ts +279 -0
- package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.js +453 -0
- package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/index.d.ts +7 -0
- package/node_modules/@hexcore/shared/dist/cjs/index.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/index.js +23 -0
- package/node_modules/@hexcore/shared/dist/cjs/index.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/naming.d.ts +118 -0
- package/node_modules/@hexcore/shared/dist/cjs/naming.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/naming.js +103 -0
- package/node_modules/@hexcore/shared/dist/cjs/naming.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/offline.d.ts +73 -0
- package/node_modules/@hexcore/shared/dist/cjs/offline.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/offline.js +80 -0
- package/node_modules/@hexcore/shared/dist/cjs/offline.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/protocol-params.d.ts +79 -0
- package/node_modules/@hexcore/shared/dist/cjs/protocol-params.d.ts.map +1 -0
- package/node_modules/@hexcore/shared/dist/cjs/protocol-params.js +223 -0
- package/node_modules/@hexcore/shared/dist/cjs/protocol-params.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/api.js +355 -0
- package/node_modules/@hexcore/shared/dist/esm/api.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/domain.js +46 -0
- package/node_modules/@hexcore/shared/dist/esm/domain.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/hydra-versions.js +441 -0
- package/node_modules/@hexcore/shared/dist/esm/hydra-versions.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/index.js +7 -0
- package/node_modules/@hexcore/shared/dist/esm/index.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/naming.js +95 -0
- package/node_modules/@hexcore/shared/dist/esm/naming.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/offline.js +75 -0
- package/node_modules/@hexcore/shared/dist/esm/offline.js.map +1 -0
- package/node_modules/@hexcore/shared/dist/esm/package.json +3 -0
- package/node_modules/@hexcore/shared/dist/esm/protocol-params.js +217 -0
- package/node_modules/@hexcore/shared/dist/esm/protocol-params.js.map +1 -0
- package/node_modules/@hexcore/shared/package.json +15 -0
- package/package.json +67 -0
- package/web/200.html +23 -0
- package/web/404.html +23 -0
- package/web/_nuxt/2MxohCD-.js +1 -0
- package/web/_nuxt/4pFXjB_u.js +1 -0
- package/web/_nuxt/B-v0dEQX.js +1 -0
- package/web/_nuxt/B4yE3U25.js +1 -0
- package/web/_nuxt/BFh8Ai0L.js +1 -0
- package/web/_nuxt/BgPn4NJH.js +1 -0
- package/web/_nuxt/Bj1xviSh.js +1 -0
- package/web/_nuxt/BnotlrL7.js +1 -0
- package/web/_nuxt/C1YRg2ic.js +1 -0
- package/web/_nuxt/CGD7MYQH.js +1 -0
- package/web/_nuxt/CQcG7Bu4.js +1 -0
- package/web/_nuxt/CS3KqpH_.js +1 -0
- package/web/_nuxt/CT-yt694.js +1 -0
- package/web/_nuxt/CZK6xUH-.js +1 -0
- package/web/_nuxt/CcdyYRYz.js +1 -0
- package/web/_nuxt/CePNTU1S.js +1 -0
- package/web/_nuxt/CgPLsCeU.js +5 -0
- package/web/_nuxt/CkCrahXt.js +1 -0
- package/web/_nuxt/CnOqDT9k.js +3 -0
- package/web/_nuxt/CqsSss-D.js +1 -0
- package/web/_nuxt/Cr8dL64Q.js +1 -0
- package/web/_nuxt/D3CwzwU0.js +1 -0
- package/web/_nuxt/DDANn6-H.js +1 -0
- package/web/_nuxt/DDl9uKIA.js +1 -0
- package/web/_nuxt/DL9i0ayn.js +1 -0
- package/web/_nuxt/DLNoK9BC.js +1 -0
- package/web/_nuxt/DLztFeOQ.js +1 -0
- package/web/_nuxt/DPihKXdt.js +1 -0
- package/web/_nuxt/DXyr6Naa.js +1 -0
- package/web/_nuxt/DeDg5p0D.js +1 -0
- package/web/_nuxt/DgDlQiDU.js +1 -0
- package/web/_nuxt/DyPI7qJE.js +30 -0
- package/web/_nuxt/LGfPBi70.js +1 -0
- package/web/_nuxt/Onf26W-r.js +1 -0
- package/web/_nuxt/QZNQe_OX.js +1 -0
- package/web/_nuxt/Y8IJM-iz.js +1 -0
- package/web/_nuxt/YUGC0nt0.js +1 -0
- package/web/_nuxt/builds/latest.json +1 -0
- package/web/_nuxt/builds/meta/7e461629-93e2-4694-b237-6d5c6a85c97c.json +1 -0
- package/web/_nuxt/builds/meta/dev.json +1 -0
- package/web/_nuxt/entry.BxsAxZxf.css +1 -0
- package/web/_nuxt/error-404.XbtAw-qw.css +1 -0
- package/web/_nuxt/error-500.CNHVltWM.css +1 -0
- package/web/_nuxt/rS90pPZ_.js +1 -0
- package/web/_nuxt/rhEiP908.js +1 -0
- package/web/_nuxt/vSj9Ec0g.js +1 -0
- package/web/_nuxt/woNjBJMN.js +1 -0
- package/web/favicon.svg +28 -0
- package/web/heads/index.html +23 -0
- package/web/heads/new/index.html +23 -0
- package/web/index.html +23 -0
- package/web/login/index.html +23 -0
- package/web/logo.svg +56 -0
- package/web/settings/index.html +23 -0
- package/web/setup/index.html +23 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic naming + path conventions.
|
|
4
|
+
*
|
|
5
|
+
* v1 derived container names from the DB primary key of the node, which meant
|
|
6
|
+
* you could not tell which head a container belonged to without a DB lookup,
|
|
7
|
+
* and recreating a head produced unpredictable names. v2 names everything from
|
|
8
|
+
* (headId, nodeIndex) so the whole layout is reproducible and greppable.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.PORTS_PER_NODE = exports.PORT_BASE = exports.containerHeadPaths = exports.CONTAINER_DATA_DIR = exports.headPaths = exports.LABEL_INSTALL = exports.LABEL_NODE_INDEX = exports.LABEL_NODE_ID = exports.LABEL_HEAD_ID = exports.LABEL_MANAGED = exports.DOCKER_NETWORK = exports.CONTAINER_PREFIX = void 0;
|
|
12
|
+
exports.nodeContainerName = nodeContainerName;
|
|
13
|
+
exports.headDirName = headDirName;
|
|
14
|
+
exports.portsForSlot = portsForSlot;
|
|
15
|
+
exports.CONTAINER_PREFIX = 'hexcore';
|
|
16
|
+
exports.DOCKER_NETWORK = 'hexcore-net';
|
|
17
|
+
exports.LABEL_MANAGED = 'io.hexcore.managed';
|
|
18
|
+
exports.LABEL_HEAD_ID = 'io.hexcore.head-id';
|
|
19
|
+
exports.LABEL_NODE_ID = 'io.hexcore.node-id';
|
|
20
|
+
exports.LABEL_NODE_INDEX = 'io.hexcore.node-index';
|
|
21
|
+
/**
|
|
22
|
+
* Which Hexcore installation owns this container.
|
|
23
|
+
*
|
|
24
|
+
* `LABEL_MANAGED` says "Hexcore made this" and nothing more, so it cannot tell
|
|
25
|
+
* two installations apart — and more than one is normal: a developer running
|
|
26
|
+
* the repo has one state dir, an `npm i -g hexcore` on the same machine has
|
|
27
|
+
* another, and both talk to the same Docker daemon. A bulk operation matched on
|
|
28
|
+
* `LABEL_MANAGED` alone therefore reaches across installations, which is how
|
|
29
|
+
* `hexcore clean` destroyed the containers of a head it had never heard of.
|
|
30
|
+
*
|
|
31
|
+
* The value is a random id kept in the state dir, so it identifies the state
|
|
32
|
+
* dir rather than the machine, the user or the checkout.
|
|
33
|
+
*/
|
|
34
|
+
exports.LABEL_INSTALL = 'io.hexcore.install';
|
|
35
|
+
/** e.g. head 3, index 0 -> `hexcore-h3-n0` (also the Hydra --node-id and DNS name). */
|
|
36
|
+
function nodeContainerName(headId, nodeIndex) {
|
|
37
|
+
return `${exports.CONTAINER_PREFIX}-h${headId}-n${nodeIndex}`;
|
|
38
|
+
}
|
|
39
|
+
function headDirName(headId) {
|
|
40
|
+
return `head-${headId}`;
|
|
41
|
+
}
|
|
42
|
+
/** Layout under the state dir: heads/head-1/{keys,persistence,...} */
|
|
43
|
+
const headPaths = (stateDir, headId) => {
|
|
44
|
+
const root = `${trimSlash(stateDir)}/heads/${headDirName(headId)}`;
|
|
45
|
+
return {
|
|
46
|
+
root,
|
|
47
|
+
keys: `${root}/keys`,
|
|
48
|
+
persistence: `${root}/persistence`,
|
|
49
|
+
protocolParameters: `${root}/protocol-parameters.json`,
|
|
50
|
+
/**
|
|
51
|
+
* Offline mode only. `--initial-utxo` is the L2 ledger's entire
|
|
52
|
+
* starting state and `--ledger-genesis` the simulated L1's block-time
|
|
53
|
+
* parameters; both are written at start, next to everything else the
|
|
54
|
+
* head owns, so deleting the head takes them with it.
|
|
55
|
+
*/
|
|
56
|
+
initialUtxo: `${root}/initial-utxo.json`,
|
|
57
|
+
ledgerGenesis: `${root}/shelley-genesis.json`,
|
|
58
|
+
/**
|
|
59
|
+
* Written by v2 up to the per-node keys change, and still removed on
|
|
60
|
+
* every start so a stale project id does not sit on disk unused.
|
|
61
|
+
*/
|
|
62
|
+
legacyBlockfrostToken: `${root}/blockfrost.txt`,
|
|
63
|
+
/**
|
|
64
|
+
* One token file per node: hydra-node takes `--blockfrost FILE`, so a
|
|
65
|
+
* per-node key can only be expressed as a per-node file. Nodes sharing
|
|
66
|
+
* a key simply get the same contents written to each of theirs.
|
|
67
|
+
*/
|
|
68
|
+
nodeBlockfrostToken: (nodeIndex) => `${root}/blockfrost-n${nodeIndex}.txt`,
|
|
69
|
+
nodePersistence: (nodeIndex) => `${root}/persistence/n${nodeIndex}`,
|
|
70
|
+
nodeKeys: (nodeIndex) => ({
|
|
71
|
+
hydraSk: `${root}/keys/n${nodeIndex}.hydra.sk`,
|
|
72
|
+
hydraVk: `${root}/keys/n${nodeIndex}.hydra.vk`,
|
|
73
|
+
cardanoSk: `${root}/keys/n${nodeIndex}.cardano.sk`,
|
|
74
|
+
cardanoVk: `${root}/keys/n${nodeIndex}.cardano.vk`,
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
exports.headPaths = headPaths;
|
|
79
|
+
/**
|
|
80
|
+
* Same layout as seen from inside the container, where the state dir is always
|
|
81
|
+
* bind-mounted at /data. Keeping the two in lockstep avoids the class of bug
|
|
82
|
+
* where a host path leaks into a container argument.
|
|
83
|
+
*/
|
|
84
|
+
exports.CONTAINER_DATA_DIR = '/data';
|
|
85
|
+
const containerHeadPaths = (headId) => (0, exports.headPaths)(exports.CONTAINER_DATA_DIR, headId);
|
|
86
|
+
exports.containerHeadPaths = containerHeadPaths;
|
|
87
|
+
function trimSlash(p) {
|
|
88
|
+
return p.replace(/\/+$/, '');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Port allocation. Each node gets a contiguous triple so a head of N nodes
|
|
92
|
+
* occupies a predictable, non-overlapping range:
|
|
93
|
+
* api = base + slot*10
|
|
94
|
+
* p2p = base + slot*10 + 1
|
|
95
|
+
* monitoring = base + slot*10 + 2
|
|
96
|
+
*/
|
|
97
|
+
exports.PORT_BASE = 14000;
|
|
98
|
+
exports.PORTS_PER_NODE = 10;
|
|
99
|
+
function portsForSlot(slot, base = exports.PORT_BASE) {
|
|
100
|
+
const start = base + slot * exports.PORTS_PER_NODE;
|
|
101
|
+
return { api: start, p2p: start + 1, monitoring: start + 2 };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.js","sourceRoot":"","sources":["../../src/naming.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAyBH,8CAEC;AAED,kCAEC;AAmED,oCAGC;AAnGY,QAAA,gBAAgB,GAAG,SAAS,CAAC;AAC7B,QAAA,cAAc,GAAG,aAAa,CAAC;AAE/B,QAAA,aAAa,GAAG,oBAAoB,CAAC;AACrC,QAAA,aAAa,GAAG,oBAAoB,CAAC;AACrC,QAAA,aAAa,GAAG,oBAAoB,CAAC;AACrC,QAAA,gBAAgB,GAAG,uBAAuB,CAAC;AACxD;;;;;;;;;;;;GAYG;AACU,QAAA,aAAa,GAAG,oBAAoB,CAAC;AAElD,uFAAuF;AACvF,SAAgB,iBAAiB,CAAC,MAAc,EAAE,SAAiB;IAC/D,OAAO,GAAG,wBAAgB,KAAK,MAAM,KAAK,SA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AAA/E,QAAA,kBAAkB,sBAA6D;AAE5F,SAAS,SAAS,CAAC,CAAS;IACxB,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;GAMG;AACU,QAAA,SAAS,GAAG,KAAK,CAAC;AAClB,QAAA,cAAc,GAAG,EAAE,CAAC;AAQjC,SAAgB,YAAY,CAAC,IAAY,EAAE,IAAI,GAAG,iBAAS;IACvD,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,sBAAc,CAAC;IAC3C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,UAAU,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline mode.
|
|
3
|
+
*
|
|
4
|
+
* hydra-node can run with its layer-1 interface disabled entirely: no chain to
|
|
5
|
+
* observe, no scripts to publish, no funds to commit. The head opens
|
|
6
|
+
* immediately with a UTxO set handed to it on disk, which makes it the fastest
|
|
7
|
+
* way to develop against the Hydra API — and the only way to run one without a
|
|
8
|
+
* Blockfrost key or a cardano-node socket.
|
|
9
|
+
*
|
|
10
|
+
* The flags are mutually exclusive with the online ones (`--offline-head-seed`
|
|
11
|
+
* is a different branch of hydra-node's option parser than
|
|
12
|
+
* `--mainnet`/`--node-socket`/`--blockfrost`), so an offline head is a distinct
|
|
13
|
+
* chain backend here rather than a checkbox on an online one. Passing an online
|
|
14
|
+
* flag alongside `--offline-head-seed` aborts option parsing and the container
|
|
15
|
+
* dies before it logs anything useful.
|
|
16
|
+
*
|
|
17
|
+
* Reference layout this mirrors: infra/preprod-offline in the graveyard repo —
|
|
18
|
+
* `--offline-head-seed` + `--initial-utxo` + `--ledger-genesis`, no
|
|
19
|
+
* contestation or deposit period, single node.
|
|
20
|
+
*/
|
|
21
|
+
/** `--offline-head-seed` takes 32 bytes as hex. */
|
|
22
|
+
export declare const OFFLINE_HEAD_SEED_BYTES = 32;
|
|
23
|
+
/**
|
|
24
|
+
* How many nodes an offline head may run.
|
|
25
|
+
*
|
|
26
|
+
* Offline mode is multi-party: `--peer` and `--hydra-verification-key` sit
|
|
27
|
+
* outside hydra-node's chain-config group, so the nodes form a Head over the
|
|
28
|
+
* same network layer an online head uses. Only the Cardano key options are
|
|
29
|
+
* online-only, and offline peers authorise nothing on chain, so they are simply
|
|
30
|
+
* not passed.
|
|
31
|
+
*
|
|
32
|
+
* The cap is lower than an online head's ten because every node runs on this
|
|
33
|
+
* one machine with no L1 to spread the load over, and each brings an embedded
|
|
34
|
+
* etcd. Five is enough for the multi-party flows worth rehearsing offline
|
|
35
|
+
* without turning a laptop into the bottleneck under test.
|
|
36
|
+
*/
|
|
37
|
+
export declare const MAX_OFFLINE_NODES = 5;
|
|
38
|
+
/** Lovelace seeded to each node's own address when no UTxO file is supplied. */
|
|
39
|
+
export declare const DEFAULT_OFFLINE_SEED_LOVELACE = 20000000000;
|
|
40
|
+
/** A hex seed is exactly 32 bytes, lowercase or upper. */
|
|
41
|
+
export declare const offlineHeadSeedPattern: RegExp;
|
|
42
|
+
/**
|
|
43
|
+
* Seed derived from the head id when the operator names none.
|
|
44
|
+
*
|
|
45
|
+
* It only has to be stable and unique per head: hydra-node derives the offline
|
|
46
|
+
* head id from it, and every node of the same head must agree. Deriving it from
|
|
47
|
+
* the row id gives both properties for free and keeps two offline heads on one
|
|
48
|
+
* machine from colliding — which they would if everyone kept the `…0001` from
|
|
49
|
+
* the reference config.
|
|
50
|
+
*/
|
|
51
|
+
export declare function defaultOfflineHeadSeed(headId: number): string;
|
|
52
|
+
export interface OfflineUtxoEntry {
|
|
53
|
+
address: string;
|
|
54
|
+
/**
|
|
55
|
+
* Plain number, not a string: the file is JSON that hydra-node reads as
|
|
56
|
+
* JSON, so the value has to survive as a number anyway. The schema bounds
|
|
57
|
+
* it below Number.MAX_SAFE_INTEGER — well above any seed worth using, and
|
|
58
|
+
* far enough from Cardano's 45e15 total supply that no rounding is possible.
|
|
59
|
+
*/
|
|
60
|
+
lovelace: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The `--initial-utxo` file: the L2 ledger's entire starting state.
|
|
64
|
+
*
|
|
65
|
+
* Keys are TxIn references that no L1 transaction produced — offline mode never
|
|
66
|
+
* checks them against a chain. A zero tx id with one output index per node is
|
|
67
|
+
* what the reference config uses, and it keeps the file readable.
|
|
68
|
+
*
|
|
69
|
+
* Addresses are the nodes' own generated (or imported) Cardano addresses, so
|
|
70
|
+
* the operator already holds the signing keys for everything in the head.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildInitialUtxo(entries: OfflineUtxoEntry[]): Record<string, unknown>;
|
|
73
|
+
//# sourceMappingURL=offline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline.d.ts","sourceRoot":"","sources":["../../src/offline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,gFAAgF;AAChF,eAAO,MAAM,6BAA6B,cAAiB,CAAC;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,QAAsB,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUrF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Offline mode.
|
|
4
|
+
*
|
|
5
|
+
* hydra-node can run with its layer-1 interface disabled entirely: no chain to
|
|
6
|
+
* observe, no scripts to publish, no funds to commit. The head opens
|
|
7
|
+
* immediately with a UTxO set handed to it on disk, which makes it the fastest
|
|
8
|
+
* way to develop against the Hydra API — and the only way to run one without a
|
|
9
|
+
* Blockfrost key or a cardano-node socket.
|
|
10
|
+
*
|
|
11
|
+
* The flags are mutually exclusive with the online ones (`--offline-head-seed`
|
|
12
|
+
* is a different branch of hydra-node's option parser than
|
|
13
|
+
* `--mainnet`/`--node-socket`/`--blockfrost`), so an offline head is a distinct
|
|
14
|
+
* chain backend here rather than a checkbox on an online one. Passing an online
|
|
15
|
+
* flag alongside `--offline-head-seed` aborts option parsing and the container
|
|
16
|
+
* dies before it logs anything useful.
|
|
17
|
+
*
|
|
18
|
+
* Reference layout this mirrors: infra/preprod-offline in the graveyard repo —
|
|
19
|
+
* `--offline-head-seed` + `--initial-utxo` + `--ledger-genesis`, no
|
|
20
|
+
* contestation or deposit period, single node.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.offlineHeadSeedPattern = exports.DEFAULT_OFFLINE_SEED_LOVELACE = exports.MAX_OFFLINE_NODES = exports.OFFLINE_HEAD_SEED_BYTES = void 0;
|
|
24
|
+
exports.defaultOfflineHeadSeed = defaultOfflineHeadSeed;
|
|
25
|
+
exports.buildInitialUtxo = buildInitialUtxo;
|
|
26
|
+
/** `--offline-head-seed` takes 32 bytes as hex. */
|
|
27
|
+
exports.OFFLINE_HEAD_SEED_BYTES = 32;
|
|
28
|
+
/**
|
|
29
|
+
* How many nodes an offline head may run.
|
|
30
|
+
*
|
|
31
|
+
* Offline mode is multi-party: `--peer` and `--hydra-verification-key` sit
|
|
32
|
+
* outside hydra-node's chain-config group, so the nodes form a Head over the
|
|
33
|
+
* same network layer an online head uses. Only the Cardano key options are
|
|
34
|
+
* online-only, and offline peers authorise nothing on chain, so they are simply
|
|
35
|
+
* not passed.
|
|
36
|
+
*
|
|
37
|
+
* The cap is lower than an online head's ten because every node runs on this
|
|
38
|
+
* one machine with no L1 to spread the load over, and each brings an embedded
|
|
39
|
+
* etcd. Five is enough for the multi-party flows worth rehearsing offline
|
|
40
|
+
* without turning a laptop into the bottleneck under test.
|
|
41
|
+
*/
|
|
42
|
+
exports.MAX_OFFLINE_NODES = 5;
|
|
43
|
+
/** Lovelace seeded to each node's own address when no UTxO file is supplied. */
|
|
44
|
+
exports.DEFAULT_OFFLINE_SEED_LOVELACE = 20_000_000_000;
|
|
45
|
+
/** A hex seed is exactly 32 bytes, lowercase or upper. */
|
|
46
|
+
exports.offlineHeadSeedPattern = /^[0-9a-fA-F]{64}$/;
|
|
47
|
+
/**
|
|
48
|
+
* Seed derived from the head id when the operator names none.
|
|
49
|
+
*
|
|
50
|
+
* It only has to be stable and unique per head: hydra-node derives the offline
|
|
51
|
+
* head id from it, and every node of the same head must agree. Deriving it from
|
|
52
|
+
* the row id gives both properties for free and keeps two offline heads on one
|
|
53
|
+
* machine from colliding — which they would if everyone kept the `…0001` from
|
|
54
|
+
* the reference config.
|
|
55
|
+
*/
|
|
56
|
+
function defaultOfflineHeadSeed(headId) {
|
|
57
|
+
return headId.toString(16).padStart(exports.OFFLINE_HEAD_SEED_BYTES * 2, '0');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The `--initial-utxo` file: the L2 ledger's entire starting state.
|
|
61
|
+
*
|
|
62
|
+
* Keys are TxIn references that no L1 transaction produced — offline mode never
|
|
63
|
+
* checks them against a chain. A zero tx id with one output index per node is
|
|
64
|
+
* what the reference config uses, and it keeps the file readable.
|
|
65
|
+
*
|
|
66
|
+
* Addresses are the nodes' own generated (or imported) Cardano addresses, so
|
|
67
|
+
* the operator already holds the signing keys for everything in the head.
|
|
68
|
+
*/
|
|
69
|
+
function buildInitialUtxo(entries) {
|
|
70
|
+
const txId = '0'.repeat(64);
|
|
71
|
+
const utxo = {};
|
|
72
|
+
entries.forEach((entry, index) => {
|
|
73
|
+
utxo[`${txId}#${index}`] = {
|
|
74
|
+
address: entry.address,
|
|
75
|
+
value: { lovelace: entry.lovelace },
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
return utxo;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=offline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline.js","sourceRoot":"","sources":["../../src/offline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAoCH,wDAEC;AAuBD,4CAUC;AArED,mDAAmD;AACtC,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACU,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEnC,gFAAgF;AACnE,QAAA,6BAA6B,GAAG,cAAc,CAAC;AAE5D,0DAA0D;AAC7C,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,MAAc;IACjD,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,+BAAuB,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1E,CAAC;AAaD;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAAC,OAA2B;IACxD,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC7B,IAAI,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,GAAG;YACvB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;SACtC,CAAC;IACN,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editing the L2 ledger's protocol parameters.
|
|
3
|
+
*
|
|
4
|
+
* A Head runs its own ledger, and `--ledger-protocol-parameters` is the file
|
|
5
|
+
* that bounds it: transaction size, execution units, fees. Up to now the
|
|
6
|
+
* control-plane fetched those from the chain and the only way to change one was
|
|
7
|
+
* to POST a raw `protocolParameters` object no UI ever produced.
|
|
8
|
+
*
|
|
9
|
+
* Two things make hand-editing that object hazardous, and both are why this
|
|
10
|
+
* module exists rather than a plain textarea:
|
|
11
|
+
*
|
|
12
|
+
* 1. **Overrides merge at the TOP level only** (`{...fetched, ...overrides}`).
|
|
13
|
+
* Sending `{maxTxExecutionUnits: {memory: 20000000}}` therefore does not
|
|
14
|
+
* raise the memory budget — it replaces the whole object and drops `steps`,
|
|
15
|
+
* and hydra-node then fails to decode its own ledger config. Every editable
|
|
16
|
+
* field here declares the top-level key it belongs to, and `writeParam`
|
|
17
|
+
* rewrites that key whole.
|
|
18
|
+
* 2. **What is worth pinning is a small subset.** Overriding a value that the
|
|
19
|
+
* chain later changes at a hard fork silently freezes this head on the old
|
|
20
|
+
* one, so the UI diffs against a freshly fetched baseline and stores only
|
|
21
|
+
* what the operator actually moved.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Major protocol version of the current Cardano era.
|
|
25
|
+
*
|
|
26
|
+
* Bumped to 11 by the Plomin-line hard fork. It matters here because
|
|
27
|
+
* hydra-node's ledger refuses a transaction built for an era it does not
|
|
28
|
+
* recognise, so a baseline still claiming 10 makes every L2 transaction fail
|
|
29
|
+
* with an era mismatch that points nowhere near this file. Live parameters come
|
|
30
|
+
* from the chain and carry the real number; this is only the fallback used when
|
|
31
|
+
* nothing can be fetched.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CURRENT_PROTOCOL_MAJOR = 11;
|
|
34
|
+
export type ProtocolParamGroup = 'limits' | 'plutus' | 'fees' | 'version';
|
|
35
|
+
export interface ProtocolParamField {
|
|
36
|
+
/** Dot path into the parameters object, e.g. `maxTxExecutionUnits.memory`. */
|
|
37
|
+
path: string;
|
|
38
|
+
label: string;
|
|
39
|
+
group: ProtocolParamGroup;
|
|
40
|
+
/** Integers are sent as integers; a decimal field keeps its fractional part. */
|
|
41
|
+
kind: 'integer' | 'decimal';
|
|
42
|
+
hint: string;
|
|
43
|
+
/**
|
|
44
|
+
* True for the fields `applyL2Defaults` zeroes on purpose — a Head is not a
|
|
45
|
+
* chain, so it charges no fees and holds no deposits. Editing one is
|
|
46
|
+
* allowed (a head that wants realistic fee accounting is a real use case),
|
|
47
|
+
* but the UI says what the zero was for.
|
|
48
|
+
*/
|
|
49
|
+
l2Zeroed?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The parameters worth exposing, in the order they are shown.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately not the full set: cost models are 200-element arrays, the voting
|
|
55
|
+
* thresholds and treasury knobs are governance-only and mean nothing inside a
|
|
56
|
+
* Head. Anything absent is still reachable through the raw JSON escape hatch.
|
|
57
|
+
*/
|
|
58
|
+
export declare const PROTOCOL_PARAM_FIELDS: readonly ProtocolParamField[];
|
|
59
|
+
export declare const PROTOCOL_PARAM_GROUP_LABELS: Record<ProtocolParamGroup, string>;
|
|
60
|
+
/** Value at a dot path, or undefined when any segment is missing. */
|
|
61
|
+
export declare function readParam(params: Record<string, unknown>, path: string): unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Set a dot path, cloning every object along the way.
|
|
64
|
+
*
|
|
65
|
+
* Cloning is what makes the diff below trustworthy: mutating the fetched
|
|
66
|
+
* baseline in place would make it equal to the edit, and the change would then
|
|
67
|
+
* be dropped as "unchanged" instead of being sent as an override.
|
|
68
|
+
*/
|
|
69
|
+
export declare function writeParam(params: Record<string, unknown>, path: string, value: unknown): Record<string, unknown>;
|
|
70
|
+
/**
|
|
71
|
+
* Top-level keys whose value differs from the baseline.
|
|
72
|
+
*
|
|
73
|
+
* Whole keys, never partial objects — see the merge caveat at the top of this
|
|
74
|
+
* file. Comparison is by serialised value, which is exact for the numbers,
|
|
75
|
+
* small objects and arrays protocol parameters are made of, and cheap enough
|
|
76
|
+
* for the ~30 keys involved.
|
|
77
|
+
*/
|
|
78
|
+
export declare function diffProtocolParameters(baseline: Record<string, unknown>, edited: Record<string, unknown>): Record<string, unknown>;
|
|
79
|
+
//# sourceMappingURL=protocol-params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-params.d.ts","sourceRoot":"","sources":["../../src/protocol-params.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IAC/B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,kBAAkB,CAAC;IAC1B,gFAAgF;IAChF,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EA8H9D,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAK1E,CAAC;AAEF,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOhF;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQjH;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Editing the L2 ledger's protocol parameters.
|
|
4
|
+
*
|
|
5
|
+
* A Head runs its own ledger, and `--ledger-protocol-parameters` is the file
|
|
6
|
+
* that bounds it: transaction size, execution units, fees. Up to now the
|
|
7
|
+
* control-plane fetched those from the chain and the only way to change one was
|
|
8
|
+
* to POST a raw `protocolParameters` object no UI ever produced.
|
|
9
|
+
*
|
|
10
|
+
* Two things make hand-editing that object hazardous, and both are why this
|
|
11
|
+
* module exists rather than a plain textarea:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Overrides merge at the TOP level only** (`{...fetched, ...overrides}`).
|
|
14
|
+
* Sending `{maxTxExecutionUnits: {memory: 20000000}}` therefore does not
|
|
15
|
+
* raise the memory budget — it replaces the whole object and drops `steps`,
|
|
16
|
+
* and hydra-node then fails to decode its own ledger config. Every editable
|
|
17
|
+
* field here declares the top-level key it belongs to, and `writeParam`
|
|
18
|
+
* rewrites that key whole.
|
|
19
|
+
* 2. **What is worth pinning is a small subset.** Overriding a value that the
|
|
20
|
+
* chain later changes at a hard fork silently freezes this head on the old
|
|
21
|
+
* one, so the UI diffs against a freshly fetched baseline and stores only
|
|
22
|
+
* what the operator actually moved.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.PROTOCOL_PARAM_GROUP_LABELS = exports.PROTOCOL_PARAM_FIELDS = exports.CURRENT_PROTOCOL_MAJOR = void 0;
|
|
26
|
+
exports.readParam = readParam;
|
|
27
|
+
exports.writeParam = writeParam;
|
|
28
|
+
exports.diffProtocolParameters = diffProtocolParameters;
|
|
29
|
+
/**
|
|
30
|
+
* Major protocol version of the current Cardano era.
|
|
31
|
+
*
|
|
32
|
+
* Bumped to 11 by the Plomin-line hard fork. It matters here because
|
|
33
|
+
* hydra-node's ledger refuses a transaction built for an era it does not
|
|
34
|
+
* recognise, so a baseline still claiming 10 makes every L2 transaction fail
|
|
35
|
+
* with an era mismatch that points nowhere near this file. Live parameters come
|
|
36
|
+
* from the chain and carry the real number; this is only the fallback used when
|
|
37
|
+
* nothing can be fetched.
|
|
38
|
+
*/
|
|
39
|
+
exports.CURRENT_PROTOCOL_MAJOR = 11;
|
|
40
|
+
/**
|
|
41
|
+
* The parameters worth exposing, in the order they are shown.
|
|
42
|
+
*
|
|
43
|
+
* Deliberately not the full set: cost models are 200-element arrays, the voting
|
|
44
|
+
* thresholds and treasury knobs are governance-only and mean nothing inside a
|
|
45
|
+
* Head. Anything absent is still reachable through the raw JSON escape hatch.
|
|
46
|
+
*/
|
|
47
|
+
exports.PROTOCOL_PARAM_FIELDS = [
|
|
48
|
+
{
|
|
49
|
+
path: 'maxTxSize',
|
|
50
|
+
label: 'Max transaction size (bytes)',
|
|
51
|
+
group: 'limits',
|
|
52
|
+
kind: 'integer',
|
|
53
|
+
hint: 'Largest L2 transaction the head will accept. Raising it is the usual fix for a batch that will not fit.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
path: 'maxValueSize',
|
|
57
|
+
label: 'Max value size (bytes)',
|
|
58
|
+
group: 'limits',
|
|
59
|
+
kind: 'integer',
|
|
60
|
+
hint: 'Serialised size limit of one output’s value — the ceiling on how many native assets a UTxO can carry.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
path: 'maxBlockBodySize',
|
|
64
|
+
label: 'Max block body size (bytes)',
|
|
65
|
+
group: 'limits',
|
|
66
|
+
kind: 'integer',
|
|
67
|
+
hint: 'Bounds a snapshot’s worth of transactions.',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
path: 'maxCollateralInputs',
|
|
71
|
+
label: 'Max collateral inputs',
|
|
72
|
+
group: 'limits',
|
|
73
|
+
kind: 'integer',
|
|
74
|
+
hint: 'How many inputs a script transaction may pledge as collateral.',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
path: 'collateralPercentage',
|
|
78
|
+
label: 'Collateral percentage',
|
|
79
|
+
group: 'limits',
|
|
80
|
+
kind: 'integer',
|
|
81
|
+
hint: 'Collateral required as a percentage of the fee. Meaningless while fees are zero.',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
path: 'maxTxExecutionUnits.memory',
|
|
85
|
+
label: 'Max tx execution memory',
|
|
86
|
+
group: 'plutus',
|
|
87
|
+
kind: 'integer',
|
|
88
|
+
hint: 'Plutus memory budget for one transaction. The limit a heavy validator hits first.',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
path: 'maxTxExecutionUnits.steps',
|
|
92
|
+
label: 'Max tx execution steps',
|
|
93
|
+
group: 'plutus',
|
|
94
|
+
kind: 'integer',
|
|
95
|
+
hint: 'Plutus CPU budget for one transaction.',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
path: 'maxBlockExecutionUnits.memory',
|
|
99
|
+
label: 'Max block execution memory',
|
|
100
|
+
group: 'plutus',
|
|
101
|
+
kind: 'integer',
|
|
102
|
+
hint: 'Aggregate Plutus memory across a block.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
path: 'maxBlockExecutionUnits.steps',
|
|
106
|
+
label: 'Max block execution steps',
|
|
107
|
+
group: 'plutus',
|
|
108
|
+
kind: 'integer',
|
|
109
|
+
hint: 'Aggregate Plutus CPU across a block.',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
path: 'executionUnitPrices.priceMemory',
|
|
113
|
+
label: 'Price per memory unit',
|
|
114
|
+
group: 'plutus',
|
|
115
|
+
kind: 'decimal',
|
|
116
|
+
// Deliberately NOT in applyL2Defaults, so the chain's real prices are
|
|
117
|
+
// what a head gets unless someone changes them here. Setting both to 0
|
|
118
|
+
// is what makes script execution free inside the head.
|
|
119
|
+
hint: 'Converts Plutus memory into fee. Set this and the step price to 0 to make scripts free on L2.',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
path: 'executionUnitPrices.priceSteps',
|
|
123
|
+
label: 'Price per CPU step',
|
|
124
|
+
group: 'plutus',
|
|
125
|
+
kind: 'decimal',
|
|
126
|
+
hint: 'Converts Plutus CPU into fee. Kept at the chain’s value unless you zero it.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
path: 'txFeeFixed',
|
|
130
|
+
label: 'Fixed fee (lovelace)',
|
|
131
|
+
group: 'fees',
|
|
132
|
+
kind: 'integer',
|
|
133
|
+
hint: 'Flat part of the fee. Zeroed on L2 — a head that charges fees needs somewhere for them to go.',
|
|
134
|
+
l2Zeroed: true,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
path: 'txFeePerByte',
|
|
138
|
+
label: 'Fee per byte (lovelace)',
|
|
139
|
+
group: 'fees',
|
|
140
|
+
kind: 'integer',
|
|
141
|
+
hint: 'Size-proportional part of the fee. Zeroed on L2.',
|
|
142
|
+
l2Zeroed: true,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
path: 'utxoCostPerByte',
|
|
146
|
+
label: 'UTxO cost per byte (lovelace)',
|
|
147
|
+
group: 'fees',
|
|
148
|
+
kind: 'integer',
|
|
149
|
+
hint: 'Min-ADA per byte of output. Zeroed on L2 so small outputs are not rejected inside the head.',
|
|
150
|
+
l2Zeroed: true,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
path: 'minFeeRefScriptCostPerByte',
|
|
154
|
+
label: 'Reference script cost per byte',
|
|
155
|
+
group: 'fees',
|
|
156
|
+
kind: 'integer',
|
|
157
|
+
hint: 'Surcharge for reference scripts, by size.',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
path: 'protocolVersion.major',
|
|
161
|
+
label: 'Protocol version (major)',
|
|
162
|
+
group: 'version',
|
|
163
|
+
kind: 'integer',
|
|
164
|
+
hint: `Ledger era the head validates against. ${exports.CURRENT_PROTOCOL_MAJOR} is current; lowering it rejects transactions built for the live chain.`,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
path: 'protocolVersion.minor',
|
|
168
|
+
label: 'Protocol version (minor)',
|
|
169
|
+
group: 'version',
|
|
170
|
+
kind: 'integer',
|
|
171
|
+
hint: 'Minor version, almost always 0.',
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
exports.PROTOCOL_PARAM_GROUP_LABELS = {
|
|
175
|
+
limits: 'Ledger limits',
|
|
176
|
+
plutus: 'Plutus execution budgets',
|
|
177
|
+
fees: 'Fees and deposits',
|
|
178
|
+
version: 'Protocol version',
|
|
179
|
+
};
|
|
180
|
+
/** Value at a dot path, or undefined when any segment is missing. */
|
|
181
|
+
function readParam(params, path) {
|
|
182
|
+
let cursor = params;
|
|
183
|
+
for (const segment of path.split('.')) {
|
|
184
|
+
if (cursor === null || typeof cursor !== 'object')
|
|
185
|
+
return undefined;
|
|
186
|
+
cursor = cursor[segment];
|
|
187
|
+
}
|
|
188
|
+
return cursor;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Set a dot path, cloning every object along the way.
|
|
192
|
+
*
|
|
193
|
+
* Cloning is what makes the diff below trustworthy: mutating the fetched
|
|
194
|
+
* baseline in place would make it equal to the edit, and the change would then
|
|
195
|
+
* be dropped as "unchanged" instead of being sent as an override.
|
|
196
|
+
*/
|
|
197
|
+
function writeParam(params, path, value) {
|
|
198
|
+
const [head, ...rest] = path.split('.');
|
|
199
|
+
if (head === undefined)
|
|
200
|
+
return params;
|
|
201
|
+
if (rest.length === 0)
|
|
202
|
+
return { ...params, [head]: value };
|
|
203
|
+
const child = params[head];
|
|
204
|
+
const base = child !== null && typeof child === 'object' ? child : {};
|
|
205
|
+
return { ...params, [head]: writeParam(base, rest.join('.'), value) };
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Top-level keys whose value differs from the baseline.
|
|
209
|
+
*
|
|
210
|
+
* Whole keys, never partial objects — see the merge caveat at the top of this
|
|
211
|
+
* file. Comparison is by serialised value, which is exact for the numbers,
|
|
212
|
+
* small objects and arrays protocol parameters are made of, and cheap enough
|
|
213
|
+
* for the ~30 keys involved.
|
|
214
|
+
*/
|
|
215
|
+
function diffProtocolParameters(baseline, edited) {
|
|
216
|
+
const overrides = {};
|
|
217
|
+
for (const key of Object.keys(edited)) {
|
|
218
|
+
if (JSON.stringify(edited[key]) !== JSON.stringify(baseline[key]))
|
|
219
|
+
overrides[key] = edited[key];
|
|
220
|
+
}
|
|
221
|
+
return overrides;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=protocol-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-params.js","sourceRoot":"","sources":["../../src/protocol-params.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAgLH,8BAOC;AASD,gCAQC;AAUD,wDASC;AAzND;;;;;;;;;GASG;AACU,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAqBzC;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAkC;IAChE;QACI,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,8BAA8B;QACrC,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,yGAAyG;KAClH;IACD;QACI,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,wBAAwB;QAC/B,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,uGAAuG;KAChH;IACD;QACI,IAAI,EAA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