Some checks failed
CI/CD Pipeline / Lint and Format (push) Failing after 46s
CI/CD Pipeline / Terraform Validation (push) Failing after 35s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 37s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 1m50s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 2m19s
Validation / validate-genesis (push) Successful in 51s
Validation / validate-terraform (push) Failing after 39s
Validation / validate-kubernetes (push) Failing after 10s
CI/CD Pipeline / Solidity Contracts (push) Failing after 12m56s
Validation / validate-smart-contracts (push) Failing after 12s
CI/CD Pipeline / Security Scanning (push) Failing after 15m52s
Validation / validate-security (push) Failing after 10m59s
Validation / validate-documentation (push) Failing after 17s
Validate Token List / validate (push) Failing after 30s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 26s
Verify Deployment / Verify Deployment (push) Failing after 56s
54 lines
1.7 KiB
JavaScript
Executable File
54 lines
1.7 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
/**
|
|
* Validate hybx-omnl-cross-chain-lines.json: structure, lineId hex, token addresses.
|
|
* Exit 0 on success; exit 1 on validation errors (stderr).
|
|
*/
|
|
import { readFileSync } from 'fs';
|
|
import { resolve } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
|
|
function isAddr(s) {
|
|
return typeof s === 'string' && /^0x[a-fA-F0-9]{40}$/.test(s);
|
|
}
|
|
|
|
const root = resolve(__dirname, '../..');
|
|
const configPath = process.env.OMNL_CROSS_CHAIN_CONFIG || resolve(root, 'config/hybx-omnl-cross-chain-lines.json');
|
|
|
|
function fail(msg) {
|
|
console.error(msg);
|
|
process.exit(1);
|
|
}
|
|
|
|
const raw = readFileSync(configPath, 'utf8');
|
|
let data;
|
|
try {
|
|
data = JSON.parse(raw);
|
|
} catch (e) {
|
|
fail(`Invalid JSON: ${configPath}: ${e}`);
|
|
}
|
|
|
|
if (!data.lines || !Array.isArray(data.lines)) {
|
|
fail('Expected top-level { lines: [...] }');
|
|
}
|
|
|
|
for (let i = 0; i < data.lines.length; i++) {
|
|
const row = data.lines[i];
|
|
const lid = row.lineId;
|
|
if (typeof lid !== 'string' || !/^0x[a-fA-F0-9]{64}$/.test(lid)) {
|
|
fail(`lines[${i}].lineId must be bytes32 hex: ${lid}`);
|
|
}
|
|
if (!row.chains || typeof row.chains !== 'object') {
|
|
fail(`lines[${i}].chains must be an object`);
|
|
}
|
|
for (const [cid, pair] of Object.entries(row.chains)) {
|
|
if (!/^\d+$/.test(cid)) fail(`lines[${i}].chains key must be chain id string: ${cid}`);
|
|
if (!pair || typeof pair !== 'object') fail(`lines[${i}].chains[${cid}] invalid`);
|
|
const p = pair;
|
|
if (!isAddr(p.tokenM0)) fail(`lines[${i}].chains[${cid}].tokenM0 invalid address: ${p.tokenM0}`);
|
|
if (!isAddr(p.tokenM1)) fail(`lines[${i}].chains[${cid}].tokenM1 invalid address: ${p.tokenM1}`);
|
|
}
|
|
}
|
|
|
|
console.log(`OK: ${configPath} (${data.lines.length} line(s))`);
|