@ancientpantheon/khronoton-core 0.9.0 → 0.11.0
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 +29 -0
- package/README.md +8 -0
- package/dist/blockchain/stoachain.d.ts +1 -22
- package/dist/blockchain/stoachain.js +44 -3
- package/dist/{chunk-5LYT7ZLA.js → chunk-GNQ2IVXA.js} +60 -10
- package/dist/{chunk-5OB5NQ4S.js → chunk-LX6T2BDL.js} +1 -1
- package/dist/{context-Cv3H82B5.d.ts → context-89YS4xT3.d.ts} +2 -2
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +2 -2
- package/dist/provider/index.d.ts +4 -4
- package/dist/provider/index.js +2 -2
- package/dist/{seams-CPj31tJJ.d.ts → seams-DUtxDw_U.d.ts} +29 -1
- package/dist/server/executor.d.ts +28 -8
- package/dist/server/executor.js +106 -20
- package/dist/server/seams.d.ts +29 -1
- package/dist/server/store/cronoton.js +6 -1
- package/dist/server/store/index.d.ts +1 -1
- package/dist/server/store/index.js +1 -1
- package/dist/server/store/mappers.d.ts +13 -0
- package/dist/server/store/mappers.js +20 -1
- package/dist/server/types.d.ts +15 -1
- package/dist/{types-u_nUX1Bg.d.ts → types-DnFB1Yz-.d.ts} +15 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +244 -54
- package/package.json +1 -1
package/dist/server/executor.js
CHANGED
|
@@ -13,26 +13,69 @@
|
|
|
13
13
|
* - fire NEVER throws (F-002) — every failure returns a structured result;
|
|
14
14
|
* - the dirty-read pre-flight gate (F-001) — a failing pre-flight never submits;
|
|
15
15
|
* - AUTO-gas calibrate — build at the ceiling, rebuild + re-sign at the
|
|
16
|
-
*
|
|
16
|
+
* preflight-derived limit;
|
|
17
17
|
* - the 504/derived-request-key recovery (REQ-23) — the request key is derived
|
|
18
18
|
* from the signed command hash UP FRONT so a lost submit response or a listen
|
|
19
19
|
* timeout never discards a tx that may already be on-chain.
|
|
20
|
+
*
|
|
21
|
+
* Auto self-calibrating gas (khronoton-auto-gas) adds three more:
|
|
22
|
+
* - AUTO-gas calibration sources its measurement from `ChainClient.preflightRead`
|
|
23
|
+
* (the TRUE gas, including the transaction-size charge) instead of the plain
|
|
24
|
+
* `dirtyRead` (execution gas only) — the executor HARD THROWS when
|
|
25
|
+
* `autoGasLimit` is true and `preflightRead` is absent from the injected
|
|
26
|
+
* runtime, mirroring the `gasMeta` hard-throw precedent above. A MANUAL-gas
|
|
27
|
+
* fire never needs this and stays on `dirtyRead`, unaffected by its absence;
|
|
28
|
+
* - the simulate/fire ceiling is resolved live via `resolveCeiling`: an
|
|
29
|
+
* explicit `config.autoGasCeiling` override wins outright, else a
|
|
30
|
+
* best-effort `client.getBlockGasLimit()` read, else the static
|
|
31
|
+
* `AUTO_GAS_CEILING` fallback;
|
|
32
|
+
* - refuse-unmineable — a transaction whose measured gas exceeds the resolved
|
|
33
|
+
* ceiling is refused with a structured `{ ok: false, error }` (never a
|
|
34
|
+
* throw, matching F-002) BEFORE any calibration/rebuild or submit, for both
|
|
35
|
+
* AUTO and MANUAL fires.
|
|
20
36
|
*/
|
|
21
37
|
import { LISTEN_TIMEOUT_MS, AUTO_GAS_CEILING } from "./seams.js";
|
|
22
38
|
import { parseCapabilityLine, computeTerminalIntent } from "./pure/capability.js";
|
|
23
39
|
import { effectiveSigners, deriveSenderAccount } from "./executor-signers.js";
|
|
24
40
|
/** Listen (confirmation) timeout default: 5 minutes. Overridable via `ctx.config.listenTimeoutMs`. */
|
|
25
41
|
export { LISTEN_TIMEOUT_MS } from "./seams.js";
|
|
42
|
+
/** A ceiling value is only trusted if it's a genuine positive number — `NaN`
|
|
43
|
+
* passes `typeof === "number"` but every `gasUsed > ceiling` comparison
|
|
44
|
+
* against it is `false`, which would silently defeat the refuse-unmineable
|
|
45
|
+
* check below rather than falling back as documented. Applied uniformly to
|
|
46
|
+
* BOTH the config override and the live-fetched value: `ChainClient` is an
|
|
47
|
+
* injectable, chain-polyglot seam (per `seams.ts`'s own "BEST-EFFORT" doc on
|
|
48
|
+
* `getBlockGasLimit`), so the executor must not trust an adapter — any
|
|
49
|
+
* adapter, not just the one shipped in `blockchain/stoachain.ts` — to hand
|
|
50
|
+
* back a sane number unchecked. */
|
|
51
|
+
function isSaneCeiling(v) {
|
|
52
|
+
return typeof v === "number" && Number.isFinite(v) && v > 0;
|
|
53
|
+
}
|
|
54
|
+
/** Resolves the effective simulate/fire ceiling: an explicit config override
|
|
55
|
+
* wins outright (no network call); else a best-effort live fetch off the
|
|
56
|
+
* ALREADY-CONSTRUCTED client for this fire's own chain; else the static
|
|
57
|
+
* fallback. Never throws — `getBlockGasLimit` failures are absorbed by the
|
|
58
|
+
* adapter itself (see `blockchain/stoachain.ts`), and an out-of-range value
|
|
59
|
+
* from EITHER source falls back to `AUTO_GAS_CEILING` rather than being
|
|
60
|
+
* trusted verbatim. */
|
|
61
|
+
async function resolveCeiling(ctx, client) {
|
|
62
|
+
if (isSaneCeiling(ctx.config?.autoGasCeiling))
|
|
63
|
+
return ctx.config.autoGasCeiling;
|
|
64
|
+
const live = await client.getBlockGasLimit?.();
|
|
65
|
+
return isSaneCeiling(live) ? live : AUTO_GAS_CEILING;
|
|
66
|
+
}
|
|
26
67
|
/**
|
|
27
68
|
* Build a Pact transaction from the definition:
|
|
28
69
|
* `Pact.builder.execution().setMeta().setNetworkId()` + an `addData` loop over
|
|
29
70
|
* the payload + pure-vs-scoped `addSigner`. Throws if no signers, and throws if
|
|
30
71
|
* the injected runtime cannot supply gas meta (see {@link ChainRuntime.gasMeta}).
|
|
31
72
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
73
|
+
* Every fire prices at the chain's live network floor plus
|
|
74
|
+
* `config.gasPriceBufferAnu` (default 0, ANU above the floor). `floorAnu` is
|
|
75
|
+
* always passed as `0` — there is no more stored absolute value to raise to a
|
|
76
|
+
* floor; the deprecated `config.gasPrice` is never read here at all. This is
|
|
77
|
+
* what lets a cronoton stored years ago at the genesis default still fire
|
|
78
|
+
* today with no database migration.
|
|
36
79
|
*/
|
|
37
80
|
function buildTransaction(runtime, definition, signers, gasLimitOverride) {
|
|
38
81
|
if (signers.length === 0) {
|
|
@@ -52,7 +95,7 @@ function buildTransaction(runtime, definition, signers, gasLimitOverride) {
|
|
|
52
95
|
"the chain's rising minimum as a cronoton ages and gets the fire rejected. " +
|
|
53
96
|
"Upgrade the injected runtime adapter (see blockchain/stoachain.ts).");
|
|
54
97
|
}
|
|
55
|
-
const { creationTime, gasPrice } = runtime.gasMeta(definition.config.
|
|
98
|
+
const { creationTime, gasPrice } = runtime.gasMeta(0, definition.config.gasPriceBufferAnu ?? 0);
|
|
56
99
|
builder
|
|
57
100
|
.setMeta({
|
|
58
101
|
senderAccount,
|
|
@@ -138,12 +181,22 @@ async function listenWithTimeout(listen, descriptor, timeoutMs) {
|
|
|
138
181
|
}
|
|
139
182
|
async function runSimulate(ctx, definition, signers) {
|
|
140
183
|
const { runtime, resolver } = ctx;
|
|
141
|
-
const ceiling = ctx.config?.autoGasCeiling ?? AUTO_GAS_CEILING;
|
|
142
184
|
const { autoGasLimit } = definition.config;
|
|
185
|
+
const client = runtime.createClient(runtime.getPactUrl(definition.config.chainId));
|
|
186
|
+
const ceiling = await resolveCeiling(ctx, client);
|
|
143
187
|
const tx = buildTransaction(runtime, definition, signers, autoGasLimit ? ceiling : undefined);
|
|
144
188
|
const signed = await signTransaction(runtime, resolver, signers, tx);
|
|
145
|
-
|
|
146
|
-
|
|
189
|
+
if (autoGasLimit && !client.preflightRead) {
|
|
190
|
+
throw new Error("ChainRuntime.preflightRead is required to auto-size gas for an AUTO-gas " +
|
|
191
|
+
"transaction: without it the calibration would use dirtyRead's execution-" +
|
|
192
|
+
"only gas figure, which omits the transaction-size charge and reproduces " +
|
|
193
|
+
"the exact over-reservation bug this capability exists to fix. Upgrade the " +
|
|
194
|
+
"injected runtime adapter (see blockchain/stoachain.ts), or switch this " +
|
|
195
|
+
"cronoton to manual gas.");
|
|
196
|
+
}
|
|
197
|
+
const simulation = autoGasLimit
|
|
198
|
+
? await client.preflightRead(signed)
|
|
199
|
+
: await client.dirtyRead(signed);
|
|
147
200
|
if (simulation.result.status === "failure") {
|
|
148
201
|
return {
|
|
149
202
|
ok: false,
|
|
@@ -154,9 +207,17 @@ async function runSimulate(ctx, definition, signers) {
|
|
|
154
207
|
};
|
|
155
208
|
}
|
|
156
209
|
const gasUsed = simulation.gas || 0;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
210
|
+
if (gasUsed > ceiling) {
|
|
211
|
+
return {
|
|
212
|
+
ok: false,
|
|
213
|
+
mode: "simulate",
|
|
214
|
+
gasUsed,
|
|
215
|
+
error: `Transaction needs ${gasUsed} gas, over the block limit of ${ceiling} — no gas setting can mine it. Reduce the transaction's size or complexity.`,
|
|
216
|
+
rawResult: simulation.result,
|
|
217
|
+
terminalIntent: null,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const calibratedGasLimit = autoGasLimit && gasUsed > 0 ? runtime.calculateAutoGasLimit(gasUsed) : undefined;
|
|
160
221
|
return {
|
|
161
222
|
ok: true,
|
|
162
223
|
mode: "simulate",
|
|
@@ -168,16 +229,27 @@ async function runSimulate(ctx, definition, signers) {
|
|
|
168
229
|
}
|
|
169
230
|
async function runFire(ctx, definition, signers) {
|
|
170
231
|
const { runtime, resolver } = ctx;
|
|
171
|
-
const ceiling = ctx.config?.autoGasCeiling ?? AUTO_GAS_CEILING;
|
|
172
232
|
const listenMs = ctx.config?.listenTimeoutMs ?? LISTEN_TIMEOUT_MS;
|
|
173
233
|
const { chainId, autoGasLimit } = definition.config;
|
|
174
234
|
const client = runtime.createClient(runtime.getPactUrl(chainId));
|
|
175
|
-
|
|
235
|
+
const ceiling = await resolveCeiling(ctx, client);
|
|
236
|
+
// Build + sign for the pre-flight read.
|
|
176
237
|
let tx = buildTransaction(runtime, definition, signers, autoGasLimit ? ceiling : undefined);
|
|
177
238
|
let signed = await signTransaction(runtime, resolver, signers, tx);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
239
|
+
if (autoGasLimit && !client.preflightRead) {
|
|
240
|
+
throw new Error("ChainRuntime.preflightRead is required to auto-size gas for an AUTO-gas " +
|
|
241
|
+
"transaction: without it the calibration would use dirtyRead's execution-" +
|
|
242
|
+
"only gas figure, which omits the transaction-size charge and reproduces " +
|
|
243
|
+
"the exact over-reservation bug this capability exists to fix. Upgrade the " +
|
|
244
|
+
"injected runtime adapter (see blockchain/stoachain.ts), or switch this " +
|
|
245
|
+
"cronoton to manual gas.");
|
|
246
|
+
}
|
|
247
|
+
// (F-001) Pre-submit pre-flight — never submit a tx a pre-flight would
|
|
248
|
+
// catch (saves a one-time terminal fire + gas). AUTO-gas fires source this
|
|
249
|
+
// from the accurate `preflightRead`; MANUAL-gas fires stay on `dirtyRead`.
|
|
250
|
+
const preflight = autoGasLimit
|
|
251
|
+
? await client.preflightRead(signed)
|
|
252
|
+
: await client.dirtyRead(signed);
|
|
181
253
|
if (preflight.result.status === "failure") {
|
|
182
254
|
return {
|
|
183
255
|
ok: false,
|
|
@@ -188,9 +260,23 @@ async function runFire(ctx, definition, signers) {
|
|
|
188
260
|
terminalIntent: computeTerminalIntent(definition.scheduleKind, "fire", false),
|
|
189
261
|
};
|
|
190
262
|
}
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
|
|
263
|
+
// Refuse the unmineable case BEFORE any rebuild/resubmit — a transaction
|
|
264
|
+
// whose measured gas exceeds the resolved block ceiling can never mine, for
|
|
265
|
+
// either an AUTO-gas or a manually-set-limit fire.
|
|
266
|
+
const gasUsed = preflight.gas || 0;
|
|
267
|
+
if (gasUsed > ceiling) {
|
|
268
|
+
return {
|
|
269
|
+
ok: false,
|
|
270
|
+
mode: "fire",
|
|
271
|
+
chainId,
|
|
272
|
+
error: `Transaction needs ${gasUsed} gas, over the block limit of ${ceiling} — no gas setting can mine it. Reduce the transaction's size or complexity.`,
|
|
273
|
+
rawResult: preflight.result,
|
|
274
|
+
terminalIntent: computeTerminalIntent(definition.scheduleKind, "fire", false),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
// Auto-gas: rebuild + re-sign with the calibrated limit from the pre-flight read.
|
|
278
|
+
if (autoGasLimit && gasUsed > 0) {
|
|
279
|
+
const calibrated = runtime.calculateAutoGasLimit(gasUsed);
|
|
194
280
|
tx = buildTransaction(runtime, definition, signers, calibrated);
|
|
195
281
|
signed = await signTransaction(runtime, resolver, signers, tx);
|
|
196
282
|
}
|
package/dist/server/seams.d.ts
CHANGED
|
@@ -97,6 +97,26 @@ export interface ListenResult {
|
|
|
97
97
|
/** A network client bound to a single Pact endpoint URL. */
|
|
98
98
|
export interface ChainClient {
|
|
99
99
|
dirtyRead(tx: unknown): Promise<DirtyReadResult>;
|
|
100
|
+
/**
|
|
101
|
+
* `local` with `{ preflight: true, signatureVerification: false }` — measures
|
|
102
|
+
* the TRUE gas a transaction will consume, including the transaction-size
|
|
103
|
+
* charge that a plain `dirtyRead` (execution gas only) omits. Optional so the
|
|
104
|
+
* package stays non-breaking for any custom `ChainClient`; the executor HARD
|
|
105
|
+
* THROWS when it's absent on an AUTO-gas fire — a silent fallback to the
|
|
106
|
+
* inaccurate `dirtyRead` measurement would ship the exact over-reservation bug
|
|
107
|
+
* this capability exists to fix (mirrors `ChainRuntime.gasMeta`'s precedent).
|
|
108
|
+
* A MANUAL-gas fire never needs this and is unaffected by its absence.
|
|
109
|
+
*/
|
|
110
|
+
preflightRead?(tx: unknown): Promise<DirtyReadResult>;
|
|
111
|
+
/**
|
|
112
|
+
* The live block gas limit, read from the node. Optional and BEST-EFFORT —
|
|
113
|
+
* unlike `preflightRead`, a stale/failed read here only degrades the
|
|
114
|
+
* simulate-at-ceiling sizing and the refuse-unmineable threshold, since the
|
|
115
|
+
* real chainweb node is still the authoritative validator of what actually
|
|
116
|
+
* fits; the executor falls back to `Config.autoGasCeiling`/`AUTO_GAS_CEILING`
|
|
117
|
+
* on any failure or absence, matching OuronetUI's own documented choice here.
|
|
118
|
+
*/
|
|
119
|
+
getBlockGasLimit?(): Promise<number>;
|
|
100
120
|
submit(tx: unknown): Promise<{
|
|
101
121
|
requestKey: string;
|
|
102
122
|
}>;
|
|
@@ -144,6 +164,14 @@ export interface StoaGasMeta {
|
|
|
144
164
|
* transaction below it. Implementations return
|
|
145
165
|
* `max(floorAnu, liveFloor(creationTime))`, converted to chain units.
|
|
146
166
|
* See `blockchain/stoachain.ts` for the StoaChain implementation.
|
|
167
|
+
*
|
|
168
|
+
* `bufferAnu` (default 0) is added to `floorAnu` **in ANU**, before the
|
|
169
|
+
* implementation's one `anuToStoaNumber` conversion — summing two
|
|
170
|
+
* independently-converted STOA numbers instead produces a different
|
|
171
|
+
* serialized value in roughly 1 in 5 floor/buffer pairs (verified:
|
|
172
|
+
* `anuToStoaNumber(11569) + anuToStoaNumber(500)` !== `anuToStoaNumber(12069)`
|
|
173
|
+
* as JSON strings), which is exactly the class of bug `anuToStoaNumber`
|
|
174
|
+
* exists to prevent.
|
|
147
175
|
*/
|
|
148
176
|
export interface ChainRuntime {
|
|
149
177
|
Pact: {
|
|
@@ -156,7 +184,7 @@ export interface ChainRuntime {
|
|
|
156
184
|
universalSignTransaction(tx: IUnsignedCommand, keypairs: UniversalKeypair[]): Promise<unknown>;
|
|
157
185
|
calculateAutoGasLimit(gas: number): number;
|
|
158
186
|
anuToStoa(anu: number): number;
|
|
159
|
-
gasMeta?(floorAnu: number): StoaGasMeta;
|
|
187
|
+
gasMeta?(floorAnu: number, bufferAnu?: number): StoaGasMeta;
|
|
160
188
|
getPactUrl(chainId: string): string;
|
|
161
189
|
networkId: string;
|
|
162
190
|
namespace: string;
|
|
@@ -20,7 +20,7 @@ import { computeNextFire, InvalidScheduleConfigError, } from "../../schedule.js"
|
|
|
20
20
|
import { runtimeArgKeysCollide } from "../pure/runtime-args.js";
|
|
21
21
|
import { getServerResolver } from "../resolvers.js";
|
|
22
22
|
import { CodexCronotonValidationError, TerminalCronotonError } from "./errors.js";
|
|
23
|
-
import { assertAutoGasGate, rowExternalFireable, rowRuntimeArgKeys, } from "./mappers.js";
|
|
23
|
+
import { assertAutoGasGate, assertGasPriceBufferAnu, rowExternalFireable, rowRuntimeArgKeys, } from "./mappers.js";
|
|
24
24
|
/** Compute the first next-fire, mapping engine errors to a typed reject. */
|
|
25
25
|
function computeNextOrReject(mode, config, now) {
|
|
26
26
|
let next;
|
|
@@ -48,6 +48,10 @@ export function commitCodexCronoton(input, opts) {
|
|
|
48
48
|
if (!input.config || typeof input.config.chainId !== "string") {
|
|
49
49
|
throw new CodexCronotonValidationError("config.chainId must be a string");
|
|
50
50
|
}
|
|
51
|
+
// See `assertGasPriceBufferAnu`'s doc: rejected here, not just in the
|
|
52
|
+
// Builder UI's `validateConfig`, so a caller reaching this store directly
|
|
53
|
+
// can't persist a row that silently underprices every future fire.
|
|
54
|
+
assertGasPriceBufferAnu(input.config);
|
|
51
55
|
if (!Array.isArray(input.signers)) {
|
|
52
56
|
throw new CodexCronotonValidationError("signers must be an array");
|
|
53
57
|
}
|
|
@@ -188,6 +192,7 @@ export function editCodexCronoton(id, patch, opts) {
|
|
|
188
192
|
changedFields.push("pactCode");
|
|
189
193
|
}
|
|
190
194
|
if (patch.config) {
|
|
195
|
+
assertGasPriceBufferAnu(patch.config);
|
|
191
196
|
assertAutoGasGate(patch.config);
|
|
192
197
|
nextConfigJson = JSON.stringify(patch.config);
|
|
193
198
|
changedFields.push("config");
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* public source for those constants.
|
|
16
16
|
*/
|
|
17
17
|
export { CodexCronotonValidationError, AutoGasGateError, TerminalCronotonError, ManualBatchActiveError, } from "./errors.js";
|
|
18
|
-
export { rowToDefinition, rowExternalFireable, rowRuntimeArgKeys, assertAutoGasGate, manualBatchView, } from "./mappers.js";
|
|
18
|
+
export { rowToDefinition, rowExternalFireable, rowRuntimeArgKeys, assertAutoGasGate, assertGasPriceBufferAnu, manualBatchView, } from "./mappers.js";
|
|
19
19
|
export { fetchDueCodexCronotons, claimDueCodexCronoton, applyTerminalIntent, advanceRecurring, } from "./claim.js";
|
|
20
20
|
export { recordFire, createRunningFire, setFireJobId, appendFireTxKeys, finalizeFire, listFires, recoverFire, } from "./fires.js";
|
|
21
21
|
export type { RecordFireInput, FireDep } from "./fires.js";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// ── Typed errors (classes — values, not types) ───────────────────────────────
|
|
18
18
|
export { CodexCronotonValidationError, AutoGasGateError, TerminalCronotonError, ManualBatchActiveError, } from "./errors.js";
|
|
19
19
|
// ── Pure mappers / gates ─────────────────────────────────────────────────────
|
|
20
|
-
export { rowToDefinition, rowExternalFireable, rowRuntimeArgKeys, assertAutoGasGate, manualBatchView, } from "./mappers.js";
|
|
20
|
+
export { rowToDefinition, rowExternalFireable, rowRuntimeArgKeys, assertAutoGasGate, assertGasPriceBufferAnu, manualBatchView, } from "./mappers.js";
|
|
21
21
|
// ── Atomic claim + due selection + terminal/advance writes ───────────────────
|
|
22
22
|
export { fetchDueCodexCronotons, claimDueCodexCronoton, applyTerminalIntent, advanceRecurring, } from "./claim.js";
|
|
23
23
|
// ── Fires: record / running / append / finalize / list / recover ─────────────
|
|
@@ -17,5 +17,18 @@ export declare function rowRuntimeArgKeys(row: CodexCronotonRow): string[];
|
|
|
17
17
|
* autonomous fire always has one (the tick never has a human to calibrate).
|
|
18
18
|
*/
|
|
19
19
|
export declare function assertAutoGasGate(config: CodexTxConfig): void;
|
|
20
|
+
/**
|
|
21
|
+
* `gasPriceBufferAnu` is a PREMIUM above the live network floor, never a
|
|
22
|
+
* discount — a negative or non-finite value would let a fire underprice
|
|
23
|
+
* below the floor (the guarantee the whole buffer redesign exists to
|
|
24
|
+
* provide). Called identically at commit and edit time, same as
|
|
25
|
+
* {@link assertAutoGasGate}, so a caller reaching the store directly
|
|
26
|
+
* (bypassing the Builder UI's own `validateConfig`) can't persist a row that
|
|
27
|
+
* silently underprices every future fire. `blockchain/stoachain.ts`'s
|
|
28
|
+
* `gasMeta` seam also clamps defensively as a second line of defense for any
|
|
29
|
+
* `CodexTxDefinition` built outside this store. Absent is fine — only a
|
|
30
|
+
* present-and-invalid value is rejected.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assertGasPriceBufferAnu(config: CodexTxConfig): void;
|
|
20
33
|
/** Project a raw batch row onto the client-facing view (clamping remaining). */
|
|
21
34
|
export declare function manualBatchView(row: CodexManualBatchRow): ManualBatchView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseRuntimeArgKeys } from '../pure/runtime-args.js';
|
|
2
|
-
import { AutoGasGateError } from './errors.js';
|
|
2
|
+
import { AutoGasGateError, CodexCronotonValidationError } from './errors.js';
|
|
3
3
|
function parseJson(json, fallback) {
|
|
4
4
|
if (json == null)
|
|
5
5
|
return fallback;
|
|
@@ -45,6 +45,25 @@ export function assertAutoGasGate(config) {
|
|
|
45
45
|
throw new AutoGasGateError();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* `gasPriceBufferAnu` is a PREMIUM above the live network floor, never a
|
|
50
|
+
* discount — a negative or non-finite value would let a fire underprice
|
|
51
|
+
* below the floor (the guarantee the whole buffer redesign exists to
|
|
52
|
+
* provide). Called identically at commit and edit time, same as
|
|
53
|
+
* {@link assertAutoGasGate}, so a caller reaching the store directly
|
|
54
|
+
* (bypassing the Builder UI's own `validateConfig`) can't persist a row that
|
|
55
|
+
* silently underprices every future fire. `blockchain/stoachain.ts`'s
|
|
56
|
+
* `gasMeta` seam also clamps defensively as a second line of defense for any
|
|
57
|
+
* `CodexTxDefinition` built outside this store. Absent is fine — only a
|
|
58
|
+
* present-and-invalid value is rejected.
|
|
59
|
+
*/
|
|
60
|
+
export function assertGasPriceBufferAnu(config) {
|
|
61
|
+
if (config.gasPriceBufferAnu == null)
|
|
62
|
+
return;
|
|
63
|
+
if (!Number.isFinite(config.gasPriceBufferAnu) || config.gasPriceBufferAnu < 0) {
|
|
64
|
+
throw new CodexCronotonValidationError('config.gasPriceBufferAnu must be a non-negative finite number');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
48
67
|
/** Project a raw batch row onto the client-facing view (clamping remaining). */
|
|
49
68
|
export function manualBatchView(row) {
|
|
50
69
|
return {
|
package/dist/server/types.d.ts
CHANGED
|
@@ -48,8 +48,22 @@ export interface CodexGasPayer {
|
|
|
48
48
|
/** Transaction config — chain, gas, ttl. `gasPrice` is in ANU. */
|
|
49
49
|
export interface CodexTxConfig {
|
|
50
50
|
readonly chainId: string;
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Superseded by `gasPriceBufferAnu`. Kept only so historical rows'
|
|
53
|
+
* `config_json` still parses; no longer used to price new fires — see
|
|
54
|
+
* `server/executor.ts`'s `buildTransaction`, which always prices from the live
|
|
55
|
+
* network floor plus `gasPriceBufferAnu`.
|
|
56
|
+
*/
|
|
52
57
|
readonly gasPrice: number;
|
|
58
|
+
/**
|
|
59
|
+
* ANU to pay ABOVE the live network floor at fire time. 0 (default, and the
|
|
60
|
+
* value used when absent — e.g. every pre-migration row) = exactly the floor.
|
|
61
|
+
* The only gas-price knob an operator sets — never an absolute price, since
|
|
62
|
+
* the floor rises roughly every 3h and any absolute number set today is
|
|
63
|
+
* guaranteed to go stale. Absence self-heals a historical row with no DB
|
|
64
|
+
* migration.
|
|
65
|
+
*/
|
|
66
|
+
readonly gasPriceBufferAnu?: number;
|
|
53
67
|
readonly gasLimit: number;
|
|
54
68
|
/** When true, the executor calibrates the gas limit from a dirty-read. */
|
|
55
69
|
readonly autoGasLimit: boolean;
|
|
@@ -125,8 +125,22 @@ interface CodexGasPayer {
|
|
|
125
125
|
/** Transaction config — chain, gas, ttl. `gasPrice` is in ANU. */
|
|
126
126
|
interface CodexTxConfig {
|
|
127
127
|
readonly chainId: string;
|
|
128
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated Superseded by `gasPriceBufferAnu`. Kept only so historical rows'
|
|
130
|
+
* `config_json` still parses; no longer used to price new fires — see
|
|
131
|
+
* `server/executor.ts`'s `buildTransaction`, which always prices from the live
|
|
132
|
+
* network floor plus `gasPriceBufferAnu`.
|
|
133
|
+
*/
|
|
129
134
|
readonly gasPrice: number;
|
|
135
|
+
/**
|
|
136
|
+
* ANU to pay ABOVE the live network floor at fire time. 0 (default, and the
|
|
137
|
+
* value used when absent — e.g. every pre-migration row) = exactly the floor.
|
|
138
|
+
* The only gas-price knob an operator sets — never an absolute price, since
|
|
139
|
+
* the floor rises roughly every 3h and any absolute number set today is
|
|
140
|
+
* guaranteed to go stale. Absence self-heals a historical row with no DB
|
|
141
|
+
* migration.
|
|
142
|
+
*/
|
|
143
|
+
readonly gasPriceBufferAnu?: number;
|
|
130
144
|
readonly gasLimit: number;
|
|
131
145
|
/** When true, the executor calibrates the gas limit from a dirty-read. */
|
|
132
146
|
readonly autoGasLimit: boolean;
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { a as CodexCronotonFireRow, C as CodexCronotonRow, f as CodexFireMode } from '../types-
|
|
2
|
+
import { a as CodexCronotonFireRow, C as CodexCronotonRow, f as CodexFireMode } from '../types-DnFB1Yz-.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The theming boundary. Every Khronoton UI surface renders inside a
|
|
@@ -166,7 +166,7 @@ interface BuilderProps {
|
|
|
166
166
|
* header + five-tab bar full-width below it, feeding every tab the shared state
|
|
167
167
|
* and folding its `onChange` back in.
|
|
168
168
|
*/
|
|
169
|
-
declare function Builder({ editId, access
|
|
169
|
+
declare function Builder({ editId, access, onDone, robots, }: BuilderProps): ReactNode;
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* `<Public>` — the read-only public transparency wrapper over `<Detail>`.
|