From f2f2f65d2d4799dc0d3b477ad436b23a09aa4b52 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 14:45:30 +0100 Subject: [PATCH 1/7] Ensure logs persist --- v8-data-migration/constants.js | 1 + v8-data-migration/logger.js | 10 ++++++++-- v8-data-migration/run-data-migration.sh | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/v8-data-migration/constants.js b/v8-data-migration/constants.js index ffd86a908..43ec2aacc 100644 --- a/v8-data-migration/constants.js +++ b/v8-data-migration/constants.js @@ -22,6 +22,7 @@ export const BATCH_SIZE = 50; export const DEFAULT_CONFIG_PATH = '/root/ot-node/current/config/config.json'; export const NODERC_CONFIG_PATH = '/root/ot-node/.origintrail_noderc'; export const DATA_MIGRATION_DIR = '/root/ot-node/data/data-migration'; +export const LOG_DIR = '/root/ot-node/data/data-migration/logs'; export const ENV_PATH = '/root/ot-node/current/.env'; export const MIGRATION_PROGRESS_FILE = '/root/ot-node/data/migrations/v8DataMigration'; export const DB_URLS = { diff --git a/v8-data-migration/logger.js b/v8-data-migration/logger.js index 0c1540d20..10a1e07d3 100644 --- a/v8-data-migration/logger.js +++ b/v8-data-migration/logger.js @@ -1,10 +1,16 @@ import pino from 'pino'; import fs from 'fs'; +import { LOG_DIR } from './constants.js'; // Ensure logs directory exists -const LOG_DIR = './logs'; if (!fs.existsSync(LOG_DIR)) { - fs.mkdirSync(LOG_DIR); + fs.mkdirSync(LOG_DIR, { recursive: true }); + + if (!fs.existsSync(LOG_DIR)) { + throw new Error( + `Something went wrong. Directory: ${LOG_DIR} does not exist after creation.`, + ); + } } const timers = new Map(); diff --git a/v8-data-migration/run-data-migration.sh b/v8-data-migration/run-data-migration.sh index 19947505e..fdd7a3275 100644 --- a/v8-data-migration/run-data-migration.sh +++ b/v8-data-migration/run-data-migration.sh @@ -1,3 +1,3 @@ cd /root/ot-node/current/v8-data-migration/ && npm rebuild sqlite3 && -nohup node v8-data-migration.js > /root/ot-node/current/v8-data-migration/nohup.out 2>&1 & \ No newline at end of file +nohup node v8-data-migration.js > /root/ot-node/data/data-migration/logs/nohup.out 2>&1 & \ No newline at end of file From afea029b2e0948a020adf222a32669cf9785856f Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 15:10:30 +0100 Subject: [PATCH 2/7] Update nohup.out dir and progress file dir creation --- v8-data-migration/constants.js | 5 +++- v8-data-migration/run-data-migration.sh | 2 +- v8-data-migration/v8-data-migration-utils.js | 29 ++++++++++++++------ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/v8-data-migration/constants.js b/v8-data-migration/constants.js index 43ec2aacc..d1feb2efd 100644 --- a/v8-data-migration/constants.js +++ b/v8-data-migration/constants.js @@ -19,12 +19,15 @@ export const VISIBILITY = { PRIVATE: 'private', }; export const BATCH_SIZE = 50; + export const DEFAULT_CONFIG_PATH = '/root/ot-node/current/config/config.json'; export const NODERC_CONFIG_PATH = '/root/ot-node/.origintrail_noderc'; export const DATA_MIGRATION_DIR = '/root/ot-node/data/data-migration'; export const LOG_DIR = '/root/ot-node/data/data-migration/logs'; export const ENV_PATH = '/root/ot-node/current/.env'; -export const MIGRATION_PROGRESS_FILE = '/root/ot-node/data/migrations/v8DataMigration'; +export const MIGRATION_DIR = '/root/ot-node/data/migrations/'; +export const MIGRATION_PROGRESS_FILE = 'v8DataMigration'; + export const DB_URLS = { testnet: 'https://hosting.origin-trail.network/csv/testnet.db', mainnet: '', diff --git a/v8-data-migration/run-data-migration.sh b/v8-data-migration/run-data-migration.sh index fdd7a3275..3b8d1c243 100644 --- a/v8-data-migration/run-data-migration.sh +++ b/v8-data-migration/run-data-migration.sh @@ -1,3 +1,3 @@ cd /root/ot-node/current/v8-data-migration/ && npm rebuild sqlite3 && -nohup node v8-data-migration.js > /root/ot-node/data/data-migration/logs/nohup.out 2>&1 & \ No newline at end of file +nohup node v8-data-migration.js > /root/ot-node/data/nohup.out 2>&1 & \ No newline at end of file diff --git a/v8-data-migration/v8-data-migration-utils.js b/v8-data-migration/v8-data-migration-utils.js index ab05f3451..f436d3214 100644 --- a/v8-data-migration/v8-data-migration-utils.js +++ b/v8-data-migration/v8-data-migration-utils.js @@ -1,6 +1,11 @@ import fs from 'fs'; import path from 'path'; -import { NODERC_CONFIG_PATH, MIGRATION_PROGRESS_FILE, DEFAULT_CONFIG_PATH } from './constants.js'; +import { + NODERC_CONFIG_PATH, + MIGRATION_PROGRESS_FILE, + DEFAULT_CONFIG_PATH, + MIGRATION_DIR, +} from './constants.js'; import { validateConfig } from './validation.js'; import logger from './logger.js'; @@ -32,18 +37,21 @@ export function ensureDirectoryExists(dirPath) { } export function ensureMigrationProgressFileExists() { - if (!fs.existsSync(MIGRATION_PROGRESS_FILE)) { - fs.writeFileSync(MIGRATION_PROGRESS_FILE, ''); - logger.info(`Created migration progress file: ${MIGRATION_PROGRESS_FILE}`); - if (!fs.existsSync(MIGRATION_PROGRESS_FILE)) { + ensureDirectoryExists(MIGRATION_DIR); + const migrationProgressFilePath = path.join(MIGRATION_DIR, MIGRATION_PROGRESS_FILE); + + if (!fs.existsSync(migrationProgressFilePath)) { + fs.writeFileSync(migrationProgressFilePath, ''); + logger.info(`Created migration progress file: ${migrationProgressFilePath}`); + if (!fs.existsSync(migrationProgressFilePath)) { throw new Error( - `Something went wrong. Progress file: ${MIGRATION_PROGRESS_FILE} does not exist after creation.`, + `Something went wrong. Progress file: ${migrationProgressFilePath} does not exist after creation.`, ); } } else { - logger.info(`Migration progress file already exists: ${MIGRATION_PROGRESS_FILE}.`); + logger.info(`Migration progress file already exists: ${migrationProgressFilePath}.`); logger.info('Checking if migration is already successful...'); - const fileContent = fs.readFileSync(MIGRATION_PROGRESS_FILE, 'utf8'); + const fileContent = fs.readFileSync(migrationProgressFilePath, 'utf8'); if (fileContent === 'MIGRATED') { logger.info('Migration is already successful. Exiting...'); process.exit(0); @@ -52,8 +60,11 @@ export function ensureMigrationProgressFileExists() { } export function markMigrationAsSuccessfull() { + // Construct the full path to the migration progress file + const migrationProgressFilePath = path.join(MIGRATION_DIR, MIGRATION_PROGRESS_FILE); + // open file - const file = fs.openSync(MIGRATION_PROGRESS_FILE, 'w'); + const file = fs.openSync(migrationProgressFilePath, 'w'); // write MIGRATED fs.writeSync(file, 'MIGRATED'); From b426964ef647ee077add45d4c348fcaeb934b481 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 15:33:12 +0100 Subject: [PATCH 3/7] Change throw Error for logger.error --- v8-data-migration/sqlite-utils.js | 9 ++- v8-data-migration/v8-data-migration-utils.js | 3 +- v8-data-migration/v8-data-migration.js | 61 ++++++++++++-------- v8-data-migration/validation.js | 17 ++++-- 4 files changed, 57 insertions(+), 33 deletions(-) diff --git a/v8-data-migration/sqlite-utils.js b/v8-data-migration/sqlite-utils.js index 1a3aa8cbd..3bc682fb2 100644 --- a/v8-data-migration/sqlite-utils.js +++ b/v8-data-migration/sqlite-utils.js @@ -22,7 +22,8 @@ export class SqliteDatabase { }); if (!this.db) { - throw new Error('Failed to initialize SQLite database'); + logger.error('Failed to initialize SQLite database'); + process.exit(1); } } @@ -124,13 +125,15 @@ export class SqliteDatabase { _validateConnection() { if (!this.db) { - throw new Error('Database not initialized. Call initialize() first.'); + logger.error('Database not initialized. Call initialize() first.'); + process.exit(1); } } _validateBlockchainName(blockchainName) { if (!blockchainName) { - throw new Error('Blockchain name is required'); + logger.error('Blockchain name is required'); + process.exit(1); } } } diff --git a/v8-data-migration/v8-data-migration-utils.js b/v8-data-migration/v8-data-migration-utils.js index f436d3214..2a8f1731c 100644 --- a/v8-data-migration/v8-data-migration-utils.js +++ b/v8-data-migration/v8-data-migration-utils.js @@ -29,9 +29,10 @@ export function ensureDirectoryExists(dirPath) { logger.info(`Created directory: ${dirPath}`); if (!fs.existsSync(dirPath)) { - throw new Error( + logger.error( `Something went wrong. Directory: ${dirPath} does not exist after creation.`, ); + process.exit(1); } } } diff --git a/v8-data-migration/v8-data-migration.js b/v8-data-migration/v8-data-migration.js index 4b6e22f76..b846bfd6e 100644 --- a/v8-data-migration/v8-data-migration.js +++ b/v8-data-migration/v8-data-migration.js @@ -279,7 +279,8 @@ async function main() { // Initialize blockchain config const blockchainConfig = config.modules.blockchain; if (!blockchainConfig || !blockchainConfig.implementation) { - throw new Error('Invalid configuration for blockchain.'); + logger.error('Invalid configuration for blockchain.'); + process.exit(1); } logger.info('TRIPLE STORE INITIALIZATION START'); @@ -287,7 +288,8 @@ async function main() { // Initialize triple store config const tripleStoreConfig = config.modules.tripleStore; if (!tripleStoreConfig || !tripleStoreConfig.implementation) { - throw new Error('Invalid configuration for triple store.'); + logger.error('Invalid configuration for triple store.'); + process.exit(1); } const tripleStoreData = getTripleStoreData(tripleStoreConfig); @@ -297,11 +299,12 @@ async function main() { let tripleStoreRepositories = tripleStoreData.tripleStoreRepositories; if (Object.keys(tripleStoreRepositories).length !== 3) { - throw new Error( + logger.error( `Triple store repositories are not initialized correctly. Expected 3 repositories, got: ${ Object.keys(tripleStoreRepositories).length }`, ); + process.exit(1); } // Initialize repositories @@ -339,24 +342,32 @@ async function main() { // Pipe the response stream to the file response.data.pipe(writer); // Wait for the file to finish downloading - await new Promise((resolve, reject) => { - let downloadComplete = false; + try { + await new Promise((resolve, reject) => { + let downloadComplete = false; - response.data.on('end', () => { - downloadComplete = true; - }); + response.data.on('end', () => { + downloadComplete = true; + }); - writer.on('finish', resolve); - writer.on('error', (err) => reject(new Error(`Write stream error: ${err.message}`))); - response.data.on('error', (err) => - reject(new Error(`Download stream error: ${err.message}`)), - ); - response.data.on('close', () => { - if (!downloadComplete) { - reject(new Error('Download stream closed before completing')); - } + writer.on('finish', resolve); + writer.on('error', (err) => + reject(new Error(`Write stream error: ${err.message}`)), + ); + response.data.on('error', (err) => + reject(new Error(`Download stream error: ${err.message}`)), + ); + response.data.on('close', () => { + if (!downloadComplete) { + reject(new Error('Download stream closed before completing')); + } + }); }); - }); + } catch (error) { + logger.error(`Critical error during download: ${error.message}`); + logger.error('Terminating process to prevent data corruption'); + process.exit(1); + } logger.timeEnd(`Database file downloading time`); if (!fs.existsSync(dbFilePath)) { @@ -383,7 +394,8 @@ async function main() { : defaultConfig[process.env.NODE_ENV].modules.blockchain.implementation[blockchain] .config.rpcEndpoints; if (!Array.isArray(rpcEndpoints) || rpcEndpoints.length === 0) { - throw new Error(`RPC endpoints are not defined for blockchain ${blockchain}.`); + logger.error(`RPC endpoints are not defined for blockchain ${blockchain}.`); + process.exit(1); } let blockchainName; @@ -397,24 +409,25 @@ async function main() { } if (!blockchainName) { - throw new Error( + logger.error( `Blockchain ${blockchain} not found. Make sure you have the correct blockchain ID and correct NODE_ENV in .env file.`, ); + process.exit(1); } const tableExists = await sqliteDb.getTableExists(blockchainName); if (!tableExists) { - throw new Error( - `Required table "${blockchainName}" does not exist in the database`, - ); + logger.error(`Required table "${blockchainName}" does not exist in the database`); + process.exit(1); } const highestTokenId = await sqliteDb.getHighestTokenId(blockchainName); if (!highestTokenId) { - throw new Error( + logger.error( `Something went wrong. Could not fetch highest tokenId for ${blockchainName}.`, ); + process.exit(1); } logger.info(`Total amount of tokenIds: ${highestTokenId}`); diff --git a/v8-data-migration/validation.js b/v8-data-migration/validation.js index ca79472c2..a8c470ed3 100644 --- a/v8-data-migration/validation.js +++ b/v8-data-migration/validation.js @@ -1,8 +1,11 @@ +import logger from './logger.js'; + export function validateConfig(config) { if (!config || typeof config !== 'object') { - throw new Error( + logger.error( `[VALIDATION ERROR] Config is not defined or it is not an object. Config: ${config}`, ); + process.exit(1); } } @@ -45,33 +48,37 @@ export function validateUal(ual) { export function validateTripleStoreRepositories(tripleStoreRepositories) { if (!tripleStoreRepositories || typeof tripleStoreRepositories !== 'object') { - throw new Error( + logger.error( `[VALIDATION ERROR] Triple store repositories is not defined or it is not an object. Triple store repositories: ${tripleStoreRepositories}`, ); + process.exit(1); } } export function validateTripleStoreImplementation(tripleStoreImplementation) { if (!tripleStoreImplementation || typeof tripleStoreImplementation !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Triple store implementation is not defined or it is not a string. Triple store implementation: ${tripleStoreImplementation}`, ); + process.exit(1); } } export function validateTripleStoreConfig(tripleStoreConfig) { if (!tripleStoreConfig || typeof tripleStoreConfig !== 'object') { - throw new Error( + logger.error( `[VALIDATION ERROR] Triple store config is not defined or it is not an object. Triple store config: ${tripleStoreConfig}`, ); + process.exit(1); } } export function validateRepository(repository) { if (!repository || typeof repository !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Repository is not defined or it is not a string. Repository: ${repository}`, ); + process.exit(1); } } From d0cf06773cde234909b07cb1eb94e888282a5727 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 15:35:48 +0100 Subject: [PATCH 4/7] Add 0.5s delay between batches --- v8-data-migration/v8-data-migration.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/v8-data-migration/v8-data-migration.js b/v8-data-migration/v8-data-migration.js index b846bfd6e..779a7a237 100644 --- a/v8-data-migration/v8-data-migration.js +++ b/v8-data-migration/v8-data-migration.js @@ -495,6 +495,9 @@ async function main() { 100 ).toFixed(2)}%. Total processed: ${processed}/${tokenIdsToProcessCount}`, ); + + // Pause for 500ms to deload the triple store + await setTimeout(500); } catch (error) { logger.error(`Error processing batch: ${error}. Pausing for 5 seconds...`); await setTimeout(5000); From e20b8ea85e16cab27da95be58ff4840ad941a464 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 15:56:36 +0100 Subject: [PATCH 5/7] Change throw Error for logger.error --- v8-data-migration/blockchain-utils.js | 6 +++-- v8-data-migration/triple-store-utils.js | 8 +++--- v8-data-migration/v8-data-migration.js | 5 ++-- v8-data-migration/validation.js | 36 ++++++++++++++++--------- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/v8-data-migration/blockchain-utils.js b/v8-data-migration/blockchain-utils.js index 84a96fe0f..fdc81cf1a 100644 --- a/v8-data-migration/blockchain-utils.js +++ b/v8-data-migration/blockchain-utils.js @@ -25,9 +25,10 @@ function maskRpcUrl(url) { export async function initializeRpc(rpcEndpoint) { // Validation if (!rpcEndpoint || typeof rpcEndpoint !== 'string') { - throw new Error( + logger.error( `RPC endpoint is not defined or it is not a string. RPC endpoint: ${rpcEndpoint}`, ); + process.exit(1); } // initialize all possible providers const Provider = ethers.providers.JsonRpcProvider; @@ -39,7 +40,8 @@ export async function initializeRpc(rpcEndpoint) { logger.info(`Connected to the blockchain RPC: ${maskRpcUrl(rpcEndpoint)}.`); return provider; } catch (e) { - throw new Error(`Unable to connect to the blockchain RPC: ${maskRpcUrl(rpcEndpoint)}.`); + logger.error(`Unable to connect to the blockchain RPC: ${maskRpcUrl(rpcEndpoint)}.`); + process.exit(1); } } diff --git a/v8-data-migration/triple-store-utils.js b/v8-data-migration/triple-store-utils.js index d22196ba2..8e68989bd 100644 --- a/v8-data-migration/triple-store-utils.js +++ b/v8-data-migration/triple-store-utils.js @@ -283,7 +283,8 @@ export async function _executeQuery( validateQuery(query); if (!mediaType) { - throw new Error(`[VALIDATION ERROR] Media type is not defined. Media type: ${mediaType}`); + logger.error(`[VALIDATION ERROR] Media type is not defined. Media type: ${mediaType}`); + process.exit(1); } const response = await axios.post( @@ -396,9 +397,10 @@ export async function getAssertionFromV6TripleStore( !ualAssertionIdData.assertionId || !ualAssertionIdData.ual ) { - throw new Error( + logger.error( `[VALIDATION ERROR] Ual assertion ID data is not properly defined or it is not an object. Ual assertion ID data: ${ualAssertionIdData}`, ); + process.exit(1); } const { assertionId, ual } = ualAssertionIdData; @@ -423,7 +425,7 @@ export async function getAssertionFromV6TripleStore( // Extract the private assertionId from the publicAssertion if it exists const privateAssertionId = extractPrivateAssertionId(publicAssertion); if (!privateAssertionId) { - logger.error( + logger.warn( `There was a problem while extracting the private assertionId from public assertion: ${publicAssertion}. Extracted privateAssertionId: ${privateAssertionId}`, ); success = false; diff --git a/v8-data-migration/v8-data-migration.js b/v8-data-migration/v8-data-migration.js index 779a7a237..7dd0b5f2b 100644 --- a/v8-data-migration/v8-data-migration.js +++ b/v8-data-migration/v8-data-migration.js @@ -236,9 +236,8 @@ async function getAssertionsInBatch( ) { // Validation if (!batchKeys || !Array.isArray(batchKeys)) { - throw new Error( - `Batch keys is not defined or it is not an array. Batch keys: ${batchKeys}`, - ); + logger.error(`Batch keys is not defined or it is not an array. Batch keys: ${batchKeys}`); + process.exit(1); } validateBatchData(batchData); validateTripleStoreRepositories(tripleStoreRepositories); diff --git a/v8-data-migration/validation.js b/v8-data-migration/validation.js index a8c470ed3..42b14e2b9 100644 --- a/v8-data-migration/validation.js +++ b/v8-data-migration/validation.js @@ -11,9 +11,10 @@ export function validateConfig(config) { export function validateBlockchainName(blockchainName) { if (!blockchainName || typeof blockchainName !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Blockchain name is defined or it is not a string. Blockchain name: ${blockchainName}`, ); + process.exit(1); } } @@ -26,23 +27,26 @@ export function validateBlockchainDetails(blockchainDetails) { !Object.keys(blockchainDetails).includes('NAME') || !Object.keys(blockchainDetails).includes('CONTENT_ASSET_STORAGE_CONTRACT_ADDRESS') ) { - throw new Error( + logger.error( `[VALIDATION ERROR] Blockchain details is defined or it is not an object. Blockchain details: ${blockchainDetails}`, ); + process.exit(1); } } export function validateTokenId(tokenId) { if (typeof tokenId !== 'string' && typeof tokenId !== 'number') { - throw new Error( + logger.error( `[VALIDATION ERROR] Token ID is not a string or number. Token ID: ${tokenId}. Type: ${typeof tokenId}`, ); + process.exit(1); } } export function validateUal(ual) { if (!ual.startsWith('did:dkg:') || typeof ual !== 'string') { - throw new Error(`[VALIDATION ERROR] UAL is not a valid UAL. UAL: ${ual}`); + logger.error(`[VALIDATION ERROR] UAL is not a valid UAL. UAL: ${ual}`); + process.exit(1); } } @@ -84,65 +88,73 @@ export function validateRepository(repository) { export function validateQuery(query) { if (!query || typeof query !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Query is not defined or it is not a string. Query: ${query}`, ); + process.exit(1); } } export function validateAssertionId(assertionId) { if (!assertionId || typeof assertionId !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Assertion ID is not defined or it is not a string. Assertion ID: ${assertionId}`, ); + process.exit(1); } } export function validateAssertion(assertion) { if (!assertion || typeof assertion !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Assertion is not defined or it is not a string. Assertion: ${assertion}`, ); + process.exit(1); } } // BLOCKCHAIN export function validateProvider(provider) { if (!provider || typeof provider !== 'object') { - throw new Error( + logger.error( `[VALIDATION ERROR] Provider is not defined or it is not an object. Provider: ${provider}`, ); + process.exit(1); } } export function validateStorageContractAddress(storageContractAddress) { if (!storageContractAddress || typeof storageContractAddress !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Storage contract address is not defined or it is not a string. Storage contract address: ${storageContractAddress}`, ); + process.exit(1); } } export function validateStorageContractName(storageContractName) { if (!storageContractName || typeof storageContractName !== 'string') { - throw new Error( + logger.error( `[VALIDATION ERROR] Storage contract name is not defined or it is not a string. Storage contract name: ${storageContractName}`, ); + process.exit(1); } } export function validateStorageContractAbi(storageContractAbi) { if (!storageContractAbi || typeof storageContractAbi !== 'object') { - throw new Error( + logger.error( `[VALIDATION ERROR] Storage contract ABI is not defined or it is not an object. Storage contract ABI: ${storageContractAbi}`, ); + process.exit(1); } } export function validateBatchData(batchData) { if (!batchData || typeof batchData !== 'object') { - throw new Error( + logger.error( `[VALIDATION ERROR] Batch data is not defined or it is not an object. Batch data: ${batchData}`, ); + process.exit(1); } } From ab12104d86aa971dd1448ed6c31438d4dfbbc469 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 15:58:50 +0100 Subject: [PATCH 6/7] Add mainnet.db link --- v8-data-migration/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v8-data-migration/constants.js b/v8-data-migration/constants.js index d1feb2efd..b467e701d 100644 --- a/v8-data-migration/constants.js +++ b/v8-data-migration/constants.js @@ -30,7 +30,7 @@ export const MIGRATION_PROGRESS_FILE = 'v8DataMigration'; export const DB_URLS = { testnet: 'https://hosting.origin-trail.network/csv/testnet.db', - mainnet: '', + mainnet: 'https://hosting.origin-trail.network/csv/mainnet.db', }; const require = createRequire(import.meta.url); From cdde735801c9f68e874e6c5df9a6465f6e9e54d6 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 24 Dec 2024 16:14:56 +0100 Subject: [PATCH 7/7] Add always the same blockchain processing order --- v8-data-migration/v8-data-migration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/v8-data-migration/v8-data-migration.js b/v8-data-migration/v8-data-migration.js index 7dd0b5f2b..4eb43361c 100644 --- a/v8-data-migration/v8-data-migration.js +++ b/v8-data-migration/v8-data-migration.js @@ -379,8 +379,10 @@ async function main() { await sqliteDb.initialize(); try { + // make sure blockchains are always migrated in this order - base, gnosis, neuroweb + const sortedBlockchains = Object.keys(blockchainConfig.implementation).sort(); // Iterate through all chains - for (const blockchain in blockchainConfig.implementation) { + for (const blockchain of sortedBlockchains) { logger.time(`PROCESSING TIME FOR ${blockchain}`); let processed = 0; const blockchainImplementation = blockchainConfig.implementation[blockchain];