diff --git a/bouncer/commands/submit_runtime_upgrade.ts b/bouncer/commands/submit_runtime_upgrade.ts index 9f298feed5..e2a4f012b8 100755 --- a/bouncer/commands/submit_runtime_upgrade.ts +++ b/bouncer/commands/submit_runtime_upgrade.ts @@ -13,19 +13,19 @@ import { submitRuntimeUpgrade } from '../shared/submit_runtime_upgrade'; import { runWithTimeout } from '../shared/utils'; async function main() { - const wasmPath = process.argv[2]; + const wasmPath = process.argv[2]; - const arg3 = process.argv[3].trim(); - const semverRestriction = arg3 ? JSON.parse(arg3) : undefined; + const arg3 = process.argv[3].trim(); + const semverRestriction = arg3 ? JSON.parse(arg3) : undefined; - const arg4 = process.argv[4].trim(); - const percentNodesUpgraded = arg4 ? Number(arg4) : undefined; + const arg4 = process.argv[4].trim(); + const percentNodesUpgraded = arg4 ? Number(arg4) : undefined; - await submitRuntimeUpgrade(wasmPath, semverRestriction, percentNodesUpgraded); - process.exit(0); + await submitRuntimeUpgrade(wasmPath, semverRestriction, percentNodesUpgraded); + process.exit(0); } runWithTimeout(main(), 20000).catch((error) => { - console.error(error); - process.exit(-1); + console.error(error); + process.exit(-1); }); diff --git a/bouncer/shared/submit_runtime_upgrade.ts b/bouncer/shared/submit_runtime_upgrade.ts index cdd326e8cd..c23a928efa 100755 --- a/bouncer/shared/submit_runtime_upgrade.ts +++ b/bouncer/shared/submit_runtime_upgrade.ts @@ -3,27 +3,31 @@ import { promises as fs } from 'fs'; import { submitGovernanceExtrinsic } from './cf_governance'; import { getChainflipApi } from '../shared/utils'; - async function readRuntimeWasmFromFile(filePath: string): Promise { return compactAddLength(new Uint8Array(await fs.readFile(filePath))); } // By default we don't want to restrict that any of the nodes need to be upgraded. -export async function submitRuntimeUpgrade(wasmPath: string, semverRestriction?: Record, percentNodesUpgraded = 0) { - +export async function submitRuntimeUpgrade( + wasmPath: string, + semverRestriction?: Record, + percentNodesUpgraded = 0, +) { const runtimeWasm = await readRuntimeWasmFromFile(wasmPath); - console.log("Submitting runtime upgrade.") + console.log('Submitting runtime upgrade.'); const chainflip = await getChainflipApi(); let versionPercentRestriction; if (semverRestriction && percentNodesUpgraded) { - versionPercentRestriction = [semverRestriction, percentNodesUpgraded] + versionPercentRestriction = [semverRestriction, percentNodesUpgraded]; } else { versionPercentRestriction = undefined; } - await submitGovernanceExtrinsic(chainflip.tx.governance.chainflipRuntimeUpgrade(versionPercentRestriction, runtimeWasm)); + await submitGovernanceExtrinsic( + chainflip.tx.governance.chainflipRuntimeUpgrade(versionPercentRestriction, runtimeWasm), + ); - console.log("Runtime upgrade completed."); -} \ No newline at end of file + console.log('Runtime upgrade completed.'); +}