379cb741ed
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
const common = require('./0003-common.js');
|
|
|
|
async function run(_, networkInfo, nodeNames) {
|
|
const apis = await common.getApis(networkInfo, nodeNames);
|
|
|
|
const finalizedHeads = await Promise.all(
|
|
Object.entries(apis).map(async ([nodeName, api]) => {
|
|
const finalizedHead = await api.rpc.beefy.getFinalizedHead();
|
|
return { nodeName, finalizedHead, finalizedHeight: await api.rpc.chain.getHeader(finalizedHead).then((header) => header.number) };
|
|
})
|
|
);
|
|
|
|
// select the node with the highest finalized height
|
|
const highestFinalizedHeight = finalizedHeads.reduce(
|
|
(acc, { nodeName, finalizedHeight }) =>
|
|
finalizedHeight >= acc.finalizedHeight
|
|
? { nodeName, finalizedHeight }
|
|
: acc,
|
|
{ nodeName: 'validator', finalizedHeight: 0 }
|
|
);
|
|
|
|
// get all block hashes up until the highest finalized height
|
|
const blockHashes = [];
|
|
for (let blockNumber = 0; blockNumber <= highestFinalizedHeight.finalizedHeight; blockNumber++) {
|
|
const blockHash = await apis[highestFinalizedHeight.nodeName].rpc.chain.getBlockHash(blockNumber);
|
|
blockHashes.push(blockHash);
|
|
}
|
|
|
|
// verify that height(finalized_head) is at least as high as the bizinikiwi_beefy_best_block test already verified
|
|
return finalizedHeads.every(({ finalizedHead, finalizedHeight }) =>
|
|
finalizedHeight >= 21 && finalizedHead.toHex() === blockHashes[finalizedHeight].toHex()
|
|
)
|
|
}
|
|
|
|
module.exports = { run };
|