Skip to content

Commit f01a581

Browse files
authored
fix: enable --ensure-no-loss false flag to disable functionality (#187)
* fix: enable --ensure-no-loss false flag to disable functionality - Update option definition to accept [value] parameter in both kysor and protocol - Change default from boolean true to string "true" for proper parsing - Fix kysor.ts logic to properly handle false case by passing --ensure-no-loss false - Add proper type normalization to handle both string and boolean types - Update version numbers in package.json files This completes the fix for ensureNoLoss flag, allowing users to disable the functionality by passing --ensure-no-loss false. * Bump version to 1.4.1 in package.json
1 parent 6d7ce2f commit f01a581

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

common/protocol/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ export class Validator {
330330
"0"
331331
)
332332
.option(
333-
"--ensure-no-loss",
334-
"Ensures that the node only uploads bundles which can be fully rewarded by the protocol.",
335-
true
333+
"--ensure-no-loss [value]",
334+
"Ensures that the node only uploads bundles which can be fully rewarded by the protocol. Set to 'false' to disable [default = true]",
335+
"true"
336336
)
337337
.option(
338338
"--scale-ensure-no-loss <number>",

common/protocol/src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const PROTOCOL_VERSION = "1.5.0";
1+
export const PROTOCOL_VERSION = "1.6.1";

tools/kysor/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
},
2626
"bin": "./dist/src/index.js",
2727
"pkg": {
28-
"scripts": "./dist/index.js",
28+
"scripts": "./dist/src/index.js",
2929
"assets": [
30-
"../../node_modules/classic-level/**/*"
30+
"../../node_modules/classic-level/**/*",
31+
"../../node_modules/axios/**/*"
3132
],
3233
"targets": [
3334
"latest-linux-x64",

tools/kysor/src/commands/start.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ start
2929
"The gas price the node should use to calculate transaction fees, this value will be loaded by default based on the chain id"
3030
)
3131
.option(
32-
"--ensure-no-loss",
33-
"Ensures that the node only uploads bundles which can be fully rewarded by the protocol.",
34-
true
32+
"--ensure-no-loss [value]",
33+
"Ensures that the node only uploads bundles which can be fully rewarded by the protocol. Set to 'false' to disable [default = true]",
34+
"true"
3535
)
3636
.option(
3737
"--scale-ensure-no-loss <number>",

tools/kysor/src/kysor.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,23 @@ export const run = async (options: any) => {
404404
`${versionHome}`,
405405
];
406406

407-
if (JSON.parse(options.ensureNoLoss)) {
407+
// Handle ensure-no-loss option: support --ensure-no-loss false to disable
408+
// Normalize the value to handle both string and boolean types
409+
let ensureNoLossValue: string;
410+
if (options.ensureNoLoss === undefined) {
411+
ensureNoLossValue = "true";
412+
} else if (typeof options.ensureNoLoss === "boolean") {
413+
ensureNoLossValue = options.ensureNoLoss ? "true" : "false";
414+
} else {
415+
ensureNoLossValue = String(options.ensureNoLoss).toLowerCase();
416+
}
417+
418+
if (ensureNoLossValue === "false") {
408419
args.push("--ensure-no-loss");
420+
args.push("false");
409421
} else {
422+
// For true or default case, just pass the flag (defaults to true)
410423
args.push("--ensure-no-loss");
411-
args.push(`${false}`);
412424
}
413425

414426
if (options.scaleEnsureNoLoss > 0) {

0 commit comments

Comments
 (0)