@ocap/chain-node 0.0.0-stage → 1.32.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/README.md +234 -2
- package/esm/access-log.d.mts +34 -0
- package/esm/access-log.mjs +71 -0
- package/esm/config-consistency.d.mts +59 -0
- package/esm/config-consistency.mjs +220 -0
- package/esm/env.d.mts +32 -0
- package/esm/env.mjs +218 -0
- package/esm/follower-config.d.mts +25 -0
- package/esm/follower-config.mjs +57 -0
- package/esm/index.d.mts +7 -0
- package/esm/index.mjs +7 -0
- package/esm/standalone-env.d.mts +92 -0
- package/esm/standalone-env.mjs +152 -0
- package/esm/start-chain-node.d.mts +14 -0
- package/esm/start-chain-node.mjs +1107 -0
- package/esm/test-hooks-token.d.mts +12 -0
- package/esm/test-hooks-token.mjs +21 -0
- package/esm/testing.d.mts +13 -0
- package/esm/testing.mjs +23 -0
- package/esm/types.d.mts +310 -0
- package/esm/types.mjs +1 -0
- package/lib/_virtual/rolldown_runtime.cjs +29 -0
- package/lib/access-log.cjs +73 -0
- package/lib/access-log.d.cts +34 -0
- package/lib/config-consistency.cjs +227 -0
- package/lib/config-consistency.d.cts +59 -0
- package/lib/env.cjs +221 -0
- package/lib/env.d.cts +32 -0
- package/lib/follower-config.cjs +63 -0
- package/lib/follower-config.d.cts +25 -0
- package/lib/index.cjs +32 -0
- package/lib/index.d.cts +7 -0
- package/lib/standalone-env.cjs +165 -0
- package/lib/standalone-env.d.cts +92 -0
- package/lib/start-chain-node.cjs +1116 -0
- package/lib/start-chain-node.d.cts +14 -0
- package/lib/test-hooks-token.cjs +24 -0
- package/lib/test-hooks-token.d.cts +12 -0
- package/lib/testing.cjs +23 -0
- package/lib/testing.d.cts +13 -0
- package/lib/types.cjs +0 -0
- package/lib/types.d.cts +310 -0
- package/package.json +78 -4
package/lib/index.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BLOCKLET_ENV_CHAIN_FALLBACKS, BlockletEnvLeftovers, DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS, DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS, FutureTimestampGuardConfig, STANDALONE_ENV_MARKERS, TChainConfigCheckMode, TRANSACTION_SWITCH_ENV, TransactionSwitches, findBlockletEnvLeftovers, formatBlockletEnvLeftoversWarning, parseNonNegativeNumberEnv, resolveConfigCheckModeFromEnv, resolveConfigCheckTimeoutMsFromEnv, resolveFutureTimestampGuardFromEnv, resolveTransactionSwitchesFromEnv, resolveTrustedSubject } from "./standalone-env.cjs";
|
|
2
|
+
import { CONSENSUS_CONFIG_KEYS, ConfigDifference, VerifyFollowerConfigOptions, VerifyFollowerConfigResult, diffConsensusConfig, fetchUpstreamChainConfig, formatConfigDifferences, normalizeConsensusConfig, verifyFollowerConfigAgainstUpstream } from "./config-consistency.cjs";
|
|
3
|
+
import { ChainAppHookContext, ChainNodeHandle, ChainNodeProfile, ChainNodeRoleConfig, ChainNodeSegmentPublisher, ChainNodeSignerConfig, ChainNodeTestHooks, ChainNodeTestHooksInput, ChainProfile, ChainProfileBase, FollowerRoleConfig, FollowerSyncTestController, FollowerUpstreamInterceptorContext, HotStuffValidatorRoleConfig, ILedgerHealthStatus, ILedgerLeaseOptions, PublicKeyOnlyValidatorSignerConfig, RunningChainNode, StartChainNodeOptions, TNodeRetentionMode, TrustedAccountConfig, ValidatorRoleConfig, ValidatorSignerConfig } from "./types.cjs";
|
|
4
|
+
import { InstallProcessSignalHandlersOptions, installProcessSignalHandlers, leaseConfigFromEnv, roleConfigFromEnv } from "./env.cjs";
|
|
5
|
+
import { isCompleteChainConfig, rehydrateFollowerChainConfig, toResolverConfig } from "./follower-config.cjs";
|
|
6
|
+
import { startChainNode } from "./start-chain-node.cjs";
|
|
7
|
+
export { BLOCKLET_ENV_CHAIN_FALLBACKS, type BlockletEnvLeftovers, CONSENSUS_CONFIG_KEYS, type ChainAppHookContext, type ChainNodeHandle, type ChainNodeProfile, type ChainNodeRoleConfig, type ChainNodeSegmentPublisher, type ChainNodeSignerConfig, type ChainNodeTestHooks, type ChainNodeTestHooksInput, type ChainProfile, type ChainProfileBase, type ConfigDifference, DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS, DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS, type FollowerRoleConfig, type FollowerSyncTestController, type FollowerUpstreamInterceptorContext, type FutureTimestampGuardConfig, type HotStuffValidatorRoleConfig, type ILedgerHealthStatus, type ILedgerLeaseOptions, type InstallProcessSignalHandlersOptions, type PublicKeyOnlyValidatorSignerConfig, type RunningChainNode, STANDALONE_ENV_MARKERS, type StartChainNodeOptions, type TChainConfigCheckMode, type TNodeRetentionMode, TRANSACTION_SWITCH_ENV, type TransactionSwitches, type TrustedAccountConfig, type ValidatorRoleConfig, type ValidatorSignerConfig, type VerifyFollowerConfigOptions, type VerifyFollowerConfigResult, diffConsensusConfig, fetchUpstreamChainConfig, findBlockletEnvLeftovers, formatBlockletEnvLeftoversWarning, formatConfigDifferences, installProcessSignalHandlers, isCompleteChainConfig, leaseConfigFromEnv, normalizeConsensusConfig, parseNonNegativeNumberEnv, rehydrateFollowerChainConfig, resolveConfigCheckModeFromEnv, resolveConfigCheckTimeoutMsFromEnv, resolveFutureTimestampGuardFromEnv, resolveTransactionSwitchesFromEnv, resolveTrustedSubject, roleConfigFromEnv, startChainNode, toResolverConfig, verifyFollowerConfigAgainstUpstream };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let _arcblock_did = require("@arcblock/did");
|
|
3
|
+
|
|
4
|
+
//#region src/standalone-env.ts
|
|
5
|
+
/**
|
|
6
|
+
* Standalone (non-Blocklet-Server) env helpers shared by the chain apps (#1923, docs/ops/chain-env-mapping.md).
|
|
7
|
+
*
|
|
8
|
+
* Kept free of runtime imports beyond `@arcblock/did` so app key-derivation code can require this module
|
|
9
|
+
* (`@ocap/chain-node/lib/standalone-env.js`) without loading the node runtime.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Standalone replacement for the Blocklet Server app DID that seeds the trusted-storage wallet.
|
|
13
|
+
* Returns '' when unset/blank so callers fall back to BLOCKLET_APP_PID / BLOCKLET_APP_ID / moderator exactly as
|
|
14
|
+
* before. The subject is hashed as a raw string by `fromAppDid`, so a `did:abt:` prefix or a typo would silently
|
|
15
|
+
* yield a different trusted key: only a bare, valid DID address is accepted.
|
|
16
|
+
*/
|
|
17
|
+
function resolveTrustedSubject(env = process.env) {
|
|
18
|
+
const subject = String(env.CHAIN_TRUSTED_SUBJECT || "").trim();
|
|
19
|
+
if (!subject) return "";
|
|
20
|
+
if (/^did:/i.test(subject) || !(0, _arcblock_did.isValid)(subject)) throw new Error("Invalid CHAIN_TRUSTED_SUBJECT: must be a bare DID address (no \"did:abt:\" prefix)");
|
|
21
|
+
return subject;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Standalone-only replacements for Blocklet Server variables. Blocklet Server sets none of them on beta or main
|
|
25
|
+
* (checked against both live process envs), so seeing one means the operator runs (or migrates to) a standalone
|
|
26
|
+
* env file. `CHAIN_VAULT_PSK` is deliberately not a marker: main's blocklet.yml declares it, so it is present there.
|
|
27
|
+
*/
|
|
28
|
+
const STANDALONE_ENV_MARKERS = [
|
|
29
|
+
"CHAIN_DATA_DIR",
|
|
30
|
+
"CHAIN_PORT",
|
|
31
|
+
"CHAIN_SK",
|
|
32
|
+
"CHAIN_MODERATOR_PK",
|
|
33
|
+
"CHAIN_TRUSTED_SUBJECT"
|
|
34
|
+
];
|
|
35
|
+
/** Blocklet Server variables both chain apps still read as fallbacks behind a CHAIN_* variable. */
|
|
36
|
+
const BLOCKLET_ENV_CHAIN_FALLBACKS = new Set([
|
|
37
|
+
"BLOCKLET_APP_ASK",
|
|
38
|
+
"BLOCKLET_APP_DIR",
|
|
39
|
+
"BLOCKLET_APP_ID",
|
|
40
|
+
"BLOCKLET_APP_PID",
|
|
41
|
+
"BLOCKLET_APP_PK",
|
|
42
|
+
"BLOCKLET_APP_PPK",
|
|
43
|
+
"BLOCKLET_APP_PSK",
|
|
44
|
+
"BLOCKLET_APP_SK",
|
|
45
|
+
"BLOCKLET_DATA_DIR",
|
|
46
|
+
"BLOCKLET_PORT"
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* Detect a standalone env that still carries Blocklet Server variables, so two key sources are never mixed
|
|
50
|
+
* silently. Returns null under Blocklet Server (no standalone marker) and for a clean standalone env.
|
|
51
|
+
* Only variable names are returned, never values.
|
|
52
|
+
*/
|
|
53
|
+
function findBlockletEnvLeftovers(env = process.env, { readByChain = BLOCKLET_ENV_CHAIN_FALLBACKS } = {}) {
|
|
54
|
+
const isSet = (k) => String(env[k] ?? "").trim() !== "";
|
|
55
|
+
const standaloneMarkers = STANDALONE_ENV_MARKERS.filter(isSet);
|
|
56
|
+
if (!standaloneMarkers.length) return null;
|
|
57
|
+
const leftovers = Object.keys(env).filter((k) => /^(BLOCKLET_|ABT_NODE_)/.test(k) && isSet(k)).sort();
|
|
58
|
+
if (!leftovers.length) return null;
|
|
59
|
+
const read = new Set(readByChain);
|
|
60
|
+
return {
|
|
61
|
+
standaloneMarkers,
|
|
62
|
+
leftovers,
|
|
63
|
+
readByChain: leftovers.filter((k) => read.has(k))
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function formatBlockletEnvLeftoversWarning({ standaloneMarkers, leftovers, readByChain }) {
|
|
67
|
+
const read = readByChain.length ? ` ${readByChain.join(", ")} still feed key/path fallbacks when the CHAIN_* equivalent is unset.` : "";
|
|
68
|
+
return `[chain] standalone env (${standaloneMarkers.join(", ")}) also carries Blocklet Server variables: ${leftovers.join(", ")}.${read} Remove them so CHAIN_* is the only source (docs/ops/chain-env-mapping.md, #1923)`;
|
|
69
|
+
}
|
|
70
|
+
/** Env names of the `transaction.*` master switches a chain app maps into its chain config. */
|
|
71
|
+
const TRANSACTION_SWITCH_ENV = {
|
|
72
|
+
bridge: "CHAIN_TX_BRIDGE_ENABLED",
|
|
73
|
+
rollupV1: "CHAIN_TX_ROLLUP_V1_ENABLED"
|
|
74
|
+
};
|
|
75
|
+
/** `1`/`true` -> true, `0`/`false` -> false, unset/blank -> undefined; anything else fails startup. */
|
|
76
|
+
function parseStrictBoolEnv(env, name) {
|
|
77
|
+
const raw = String(env[name] ?? "").trim().toLowerCase();
|
|
78
|
+
if (!raw) return void 0;
|
|
79
|
+
if (raw === "1" || raw === "true") return true;
|
|
80
|
+
if (raw === "0" || raw === "false") return false;
|
|
81
|
+
throw new Error(`Invalid ${name}="${env[name]}": expected 1/true or 0/false (or leave it empty for the default)`);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* `transaction.bridge` / `transaction.rollupV1` from env. Only explicitly set switches are returned, so an env
|
|
85
|
+
* without them leaves the chain config exactly as before (bridge absent = disabled, rollupV1 absent = enabled).
|
|
86
|
+
*/
|
|
87
|
+
function resolveTransactionSwitchesFromEnv(env = process.env) {
|
|
88
|
+
const out = {};
|
|
89
|
+
const bridge = parseStrictBoolEnv(env, TRANSACTION_SWITCH_ENV.bridge);
|
|
90
|
+
if (bridge !== void 0) out.bridge = { enabled: bridge };
|
|
91
|
+
const rollupV1 = parseStrictBoolEnv(env, TRANSACTION_SWITCH_ENV.rollupV1);
|
|
92
|
+
if (rollupV1 !== void 0) out.rollupV1 = { enabled: rollupV1 };
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* `CHAIN_CONFIG_CHECK`: what a follower does with the startup comparison of its consensus config against the
|
|
97
|
+
* upstream leader's `getConfig` (`off` default: no request at all; `warn`: log differences and start; `enforce`:
|
|
98
|
+
* refuse to start on any difference or when the upstream cannot be asked).
|
|
99
|
+
*/
|
|
100
|
+
function resolveConfigCheckModeFromEnv(env = process.env) {
|
|
101
|
+
const raw = String(env.CHAIN_CONFIG_CHECK ?? "").trim().toLowerCase();
|
|
102
|
+
if (!raw) return "off";
|
|
103
|
+
if (raw === "off" || raw === "warn" || raw === "enforce") return raw;
|
|
104
|
+
throw new Error(`Invalid CHAIN_CONFIG_CHECK="${env.CHAIN_CONFIG_CHECK}": expected off, warn or enforce`);
|
|
105
|
+
}
|
|
106
|
+
const DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS = 60;
|
|
107
|
+
/**
|
|
108
|
+
* `CHAIN_CONFIG_CHECK_TIMEOUT_SEC` (non-negative integer seconds, default 60): how long `enforce` keeps retrying an
|
|
109
|
+
* unreachable / bad upstream before it decides (start with a warning on existing local state, refuse when fresh).
|
|
110
|
+
*/
|
|
111
|
+
function resolveConfigCheckTimeoutMsFromEnv(env = process.env) {
|
|
112
|
+
const raw = env.CHAIN_CONFIG_CHECK_TIMEOUT_SEC;
|
|
113
|
+
if (raw === void 0 || raw === "") return DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS * 1e3;
|
|
114
|
+
if (!/^(?:0|[1-9]\d*)$/.test(raw) || !Number.isSafeInteger(Number(raw) * 1e3)) throw new Error(`Invalid CHAIN_CONFIG_CHECK_TIMEOUT_SEC="${raw}": expected a non-negative integer (seconds)`);
|
|
115
|
+
return Number(raw) * 1e3;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A fee / gas env value (`CHAIN_GAS_PRICE`, `CREATE_*_TX_FEE`), parsed identically on leader and follower:
|
|
119
|
+
* unset or empty -> undefined (the caller's default / no overlay); otherwise a plain non-negative decimal
|
|
120
|
+
* (`integer`: digits only). Whitespace, NaN, negatives, exponents and hex fail startup instead of becoming `0`.
|
|
121
|
+
*/
|
|
122
|
+
function parseNonNegativeNumberEnv(env, name, { integer = false } = {}) {
|
|
123
|
+
const raw = env[name];
|
|
124
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
125
|
+
const re = integer ? /^(?:0|[1-9]\d*)$/ : /^(?:0|[1-9]\d*)(?:\.\d+)?$/;
|
|
126
|
+
const value = Number(raw);
|
|
127
|
+
if (!re.test(raw) || !Number.isFinite(value) || integer && !Number.isSafeInteger(value)) throw new Error(`Invalid ${name}="${raw}": expected a non-negative ${integer ? "integer" : "number"} (or leave it empty)`);
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
/** Default clock skew a replayed entry's timestamp may be ahead of the local clock (#1961; #1965 owns the value). */
|
|
131
|
+
const DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS = 300;
|
|
132
|
+
/**
|
|
133
|
+
* `LEDGER_FUTURE_TIMESTAMP_FROM_SEQ` (positive integer; unset = guard disabled, today's behavior) and
|
|
134
|
+
* `LEDGER_FUTURE_TIMESTAMP_SKEW_SEC` (non-negative integer seconds, default 300; ignored while the guard is off).
|
|
135
|
+
*/
|
|
136
|
+
function resolveFutureTimestampGuardFromEnv(env = process.env) {
|
|
137
|
+
const rawSeq = String(env.LEDGER_FUTURE_TIMESTAMP_FROM_SEQ ?? "").trim();
|
|
138
|
+
if (!rawSeq) return void 0;
|
|
139
|
+
if (!/^[1-9]\d*$/.test(rawSeq) || !Number.isSafeInteger(Number(rawSeq))) throw new Error(`Invalid LEDGER_FUTURE_TIMESTAMP_FROM_SEQ="${env.LEDGER_FUTURE_TIMESTAMP_FROM_SEQ}": expected a positive integer`);
|
|
140
|
+
const rawSkew = String(env.LEDGER_FUTURE_TIMESTAMP_SKEW_SEC ?? "").trim();
|
|
141
|
+
let skewSeconds = DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS;
|
|
142
|
+
if (rawSkew) {
|
|
143
|
+
if (!/^(?:0|[1-9]\d*)$/.test(rawSkew) || !Number.isSafeInteger(Number(rawSkew) * 1e3)) throw new Error(`Invalid LEDGER_FUTURE_TIMESTAMP_SKEW_SEC="${env.LEDGER_FUTURE_TIMESTAMP_SKEW_SEC}": expected a non-negative integer`);
|
|
144
|
+
skewSeconds = Number(rawSkew);
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
activationSequence: Number(rawSeq),
|
|
148
|
+
maxSkewMs: skewSeconds * 1e3
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
exports.BLOCKLET_ENV_CHAIN_FALLBACKS = BLOCKLET_ENV_CHAIN_FALLBACKS;
|
|
154
|
+
exports.DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS = DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS;
|
|
155
|
+
exports.DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS = DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS;
|
|
156
|
+
exports.STANDALONE_ENV_MARKERS = STANDALONE_ENV_MARKERS;
|
|
157
|
+
exports.TRANSACTION_SWITCH_ENV = TRANSACTION_SWITCH_ENV;
|
|
158
|
+
exports.findBlockletEnvLeftovers = findBlockletEnvLeftovers;
|
|
159
|
+
exports.formatBlockletEnvLeftoversWarning = formatBlockletEnvLeftoversWarning;
|
|
160
|
+
exports.parseNonNegativeNumberEnv = parseNonNegativeNumberEnv;
|
|
161
|
+
exports.resolveConfigCheckModeFromEnv = resolveConfigCheckModeFromEnv;
|
|
162
|
+
exports.resolveConfigCheckTimeoutMsFromEnv = resolveConfigCheckTimeoutMsFromEnv;
|
|
163
|
+
exports.resolveFutureTimestampGuardFromEnv = resolveFutureTimestampGuardFromEnv;
|
|
164
|
+
exports.resolveTransactionSwitchesFromEnv = resolveTransactionSwitchesFromEnv;
|
|
165
|
+
exports.resolveTrustedSubject = resolveTrustedSubject;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//#region src/standalone-env.d.ts
|
|
2
|
+
type Env = Record<string, string | undefined>;
|
|
3
|
+
/**
|
|
4
|
+
* Standalone replacement for the Blocklet Server app DID that seeds the trusted-storage wallet.
|
|
5
|
+
* Returns '' when unset/blank so callers fall back to BLOCKLET_APP_PID / BLOCKLET_APP_ID / moderator exactly as
|
|
6
|
+
* before. The subject is hashed as a raw string by `fromAppDid`, so a `did:abt:` prefix or a typo would silently
|
|
7
|
+
* yield a different trusted key: only a bare, valid DID address is accepted.
|
|
8
|
+
*/
|
|
9
|
+
declare function resolveTrustedSubject(env?: Env): string;
|
|
10
|
+
/**
|
|
11
|
+
* Standalone-only replacements for Blocklet Server variables. Blocklet Server sets none of them on beta or main
|
|
12
|
+
* (checked against both live process envs), so seeing one means the operator runs (or migrates to) a standalone
|
|
13
|
+
* env file. `CHAIN_VAULT_PSK` is deliberately not a marker: main's blocklet.yml declares it, so it is present there.
|
|
14
|
+
*/
|
|
15
|
+
declare const STANDALONE_ENV_MARKERS: readonly string[];
|
|
16
|
+
/** Blocklet Server variables both chain apps still read as fallbacks behind a CHAIN_* variable. */
|
|
17
|
+
declare const BLOCKLET_ENV_CHAIN_FALLBACKS: ReadonlySet<string>;
|
|
18
|
+
interface BlockletEnvLeftovers {
|
|
19
|
+
standaloneMarkers: string[];
|
|
20
|
+
leftovers: string[];
|
|
21
|
+
readByChain: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Detect a standalone env that still carries Blocklet Server variables, so two key sources are never mixed
|
|
25
|
+
* silently. Returns null under Blocklet Server (no standalone marker) and for a clean standalone env.
|
|
26
|
+
* Only variable names are returned, never values.
|
|
27
|
+
*/
|
|
28
|
+
declare function findBlockletEnvLeftovers(env?: Env, {
|
|
29
|
+
readByChain
|
|
30
|
+
}?: {
|
|
31
|
+
readByChain?: Iterable<string>;
|
|
32
|
+
}): BlockletEnvLeftovers | null;
|
|
33
|
+
declare function formatBlockletEnvLeftoversWarning({
|
|
34
|
+
standaloneMarkers,
|
|
35
|
+
leftovers,
|
|
36
|
+
readByChain
|
|
37
|
+
}: BlockletEnvLeftovers): string;
|
|
38
|
+
/** Env names of the `transaction.*` master switches a chain app maps into its chain config. */
|
|
39
|
+
declare const TRANSACTION_SWITCH_ENV: {
|
|
40
|
+
readonly bridge: "CHAIN_TX_BRIDGE_ENABLED";
|
|
41
|
+
readonly rollupV1: "CHAIN_TX_ROLLUP_V1_ENABLED";
|
|
42
|
+
};
|
|
43
|
+
interface TransactionSwitches {
|
|
44
|
+
bridge?: {
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
};
|
|
47
|
+
rollupV1?: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `transaction.bridge` / `transaction.rollupV1` from env. Only explicitly set switches are returned, so an env
|
|
53
|
+
* without them leaves the chain config exactly as before (bridge absent = disabled, rollupV1 absent = enabled).
|
|
54
|
+
*/
|
|
55
|
+
declare function resolveTransactionSwitchesFromEnv(env?: Env): TransactionSwitches;
|
|
56
|
+
type TChainConfigCheckMode = 'off' | 'warn' | 'enforce';
|
|
57
|
+
/**
|
|
58
|
+
* `CHAIN_CONFIG_CHECK`: what a follower does with the startup comparison of its consensus config against the
|
|
59
|
+
* upstream leader's `getConfig` (`off` default: no request at all; `warn`: log differences and start; `enforce`:
|
|
60
|
+
* refuse to start on any difference or when the upstream cannot be asked).
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveConfigCheckModeFromEnv(env?: Env): TChainConfigCheckMode;
|
|
63
|
+
declare const DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS = 60;
|
|
64
|
+
/**
|
|
65
|
+
* `CHAIN_CONFIG_CHECK_TIMEOUT_SEC` (non-negative integer seconds, default 60): how long `enforce` keeps retrying an
|
|
66
|
+
* unreachable / bad upstream before it decides (start with a warning on existing local state, refuse when fresh).
|
|
67
|
+
*/
|
|
68
|
+
declare function resolveConfigCheckTimeoutMsFromEnv(env?: Env): number;
|
|
69
|
+
/**
|
|
70
|
+
* A fee / gas env value (`CHAIN_GAS_PRICE`, `CREATE_*_TX_FEE`), parsed identically on leader and follower:
|
|
71
|
+
* unset or empty -> undefined (the caller's default / no overlay); otherwise a plain non-negative decimal
|
|
72
|
+
* (`integer`: digits only). Whitespace, NaN, negatives, exponents and hex fail startup instead of becoming `0`.
|
|
73
|
+
*/
|
|
74
|
+
declare function parseNonNegativeNumberEnv(env: Env, name: string, {
|
|
75
|
+
integer
|
|
76
|
+
}?: {
|
|
77
|
+
integer?: boolean;
|
|
78
|
+
}): number | undefined;
|
|
79
|
+
/** Default clock skew a replayed entry's timestamp may be ahead of the local clock (#1961; #1965 owns the value). */
|
|
80
|
+
declare const DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS = 300;
|
|
81
|
+
interface FutureTimestampGuardConfig {
|
|
82
|
+
/** Entries with `sequence >= activationSequence` are checked; earlier history is always accepted. */
|
|
83
|
+
activationSequence: number;
|
|
84
|
+
maxSkewMs: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* `LEDGER_FUTURE_TIMESTAMP_FROM_SEQ` (positive integer; unset = guard disabled, today's behavior) and
|
|
88
|
+
* `LEDGER_FUTURE_TIMESTAMP_SKEW_SEC` (non-negative integer seconds, default 300; ignored while the guard is off).
|
|
89
|
+
*/
|
|
90
|
+
declare function resolveFutureTimestampGuardFromEnv(env?: Env): FutureTimestampGuardConfig | undefined;
|
|
91
|
+
//#endregion
|
|
92
|
+
export { BLOCKLET_ENV_CHAIN_FALLBACKS, BlockletEnvLeftovers, DEFAULT_CONFIG_CHECK_TIMEOUT_SECONDS, DEFAULT_FUTURE_TIMESTAMP_SKEW_SECONDS, FutureTimestampGuardConfig, STANDALONE_ENV_MARKERS, TChainConfigCheckMode, TRANSACTION_SWITCH_ENV, TransactionSwitches, findBlockletEnvLeftovers, formatBlockletEnvLeftoversWarning, parseNonNegativeNumberEnv, resolveConfigCheckModeFromEnv, resolveConfigCheckTimeoutMsFromEnv, resolveFutureTimestampGuardFromEnv, resolveTransactionSwitchesFromEnv, resolveTrustedSubject };
|