Skip to content

Commit

Permalink
fix: runtime check (#102)
Browse files Browse the repository at this point in the history
fix: perform runtime and version check before runtime set config
  • Loading branch information
troykessler authored Nov 27, 2023
1 parent e59d9af commit 74de592
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
13 changes: 0 additions & 13 deletions common/protocol/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,6 @@ export class Validator {
await this.setupSDK();
await this.syncPoolState(true);

// perform validation checks
if (!this.isValidRuntime()) {
process.exit(1);
}

if (!this.isValidVersion()) {
process.exit(1);
}

if (await this.isStorageBalanceZero()) {
process.exit(1);
}
Expand All @@ -326,10 +317,6 @@ export class Validator {
await sleep(IDLE_TIME);
}

if (!(await this.isDataAvailable())) {
process.exit(1);
}

await this.setupValidator();
await this.setupCacheProvider();

Expand Down
9 changes: 0 additions & 9 deletions common/protocol/src/methods/main/runNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ export async function runNode(this: Validator): Promise<void> {
await this.syncPoolState();
await this.getBalancesForMetrics();

// perform basic validation checks, if one fails exit
if (!this.isValidRuntime()) {
process.exit(1);
}

if (!this.isValidVersion()) {
process.exit(1);
}

if (!this.isNodeValidator()) {
process.exit(1);
}
Expand Down
10 changes: 9 additions & 1 deletion common/protocol/src/methods/queries/syncPoolState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ export async function syncPoolState(
id: this.poolId.toString(),
});
this.pool = pool!;

this.m.query_pool_successful.inc();

// perform validation checks
if (!this.isValidRuntime()) {
process.exit(1);
}

if (!this.isValidVersion()) {
process.exit(1);
}

// if config link has changed sync the config
if (prevConfig !== this.pool.data!.config) {
try {
Expand Down

0 comments on commit 74de592

Please sign in to comment.