diff --git a/creator-node/package-lock.json b/creator-node/package-lock.json index 8148a5f55d0..b495da2dc72 100644 --- a/creator-node/package-lock.json +++ b/creator-node/package-lock.json @@ -10725,7 +10725,7 @@ "lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dev": true }, "log-driver": { diff --git a/creator-node/src/config.js b/creator-node/src/config.js index efdd01ee953..f365caf1d64 100644 --- a/creator-node/src/config.js +++ b/creator-node/src/config.js @@ -306,19 +306,6 @@ const config = convict({ env: 'delegatePrivateKey', default: null }, - // wallet information - oldDelegateOwnerWallet: { - doc: 'wallet address', - format: String, - env: 'oldDelegateOwnerWallet', - default: '' - }, - oldDelegatePrivateKey: { - doc: 'private key string', - format: String, - env: 'oldDelegatePrivateKey', - default: '' - }, solDelegatePrivateKeyBase64: { doc: 'Base64-encoded Solana private key created using delegatePrivateKey as the seed (auto-generated -- any input here will be overwritten)', format: String, diff --git a/creator-node/src/services/URSMRegistrationManager.js b/creator-node/src/services/URSMRegistrationManager.js index ce2565d5dcc..18e323bc5c1 100644 --- a/creator-node/src/services/URSMRegistrationManager.js +++ b/creator-node/src/services/URSMRegistrationManager.js @@ -25,11 +25,11 @@ class URSMRegistrationManager { this.nodeConfig = nodeConfig this.audiusLibs = audiusLibs - this.delegateOwnerWallet = nodeConfig.get('delegateOwnerWallet') + this.delegateOwnerWallet = nodeConfig + .get('delegateOwnerWallet') + .toLowerCase() this.delegatePrivateKey = nodeConfig.get('delegatePrivateKey') this.spOwnerWallet = nodeConfig.get('spOwnerWallet') - this.oldDelegateOwnerWallet = this.nodeConfig.get('oldDelegateOwnerWallet') - this.oldDelegatePrivateKey = this.nodeConfig.get('oldDelegatePrivateKey') this.entityManagerReplicaSetEnabled = this.nodeConfig.get( 'entityManagerReplicaSetEnabled' ) @@ -69,6 +69,15 @@ class URSMRegistrationManager { * 5. Submit registration transaction to URSM with signatures */ async run() { + if (this.entityManagerReplicaSetEnabled) { + // Update config + this.nodeConfig.set('isRegisteredOnURSM', true) + + this.logInfo(`When EntityManager is enabled, URSM is not applicable`) + + return + } + this.logInfo('Beginning URSM registration process') /** @@ -112,6 +121,12 @@ class URSMRegistrationManager { throw new Error('Failed to find valid L1 record for node') } + if (this.delegateOwnerWallet !== delegateOwnerWalletFromSPFactory) { + throw new Error( + `Local delegateOwnerWallet config (${this.delegateOwnerWallet}) doesn't match delegateOwnerWalletFromSPFactory (${delegateOwnerWalletFromSPFactory}) for spID ${spID}` + ) + } + /** * 2. Fetch node record from L2 UserReplicaSetManager for spID */ @@ -124,15 +139,7 @@ class URSMRegistrationManager { /** * 2-a. Short-circuit if L2 record for node already matches L1 record (i.e. delegateOwnerWallets match) */ - const activeDelegateOwnerWallet = - this.oldDelegateOwnerWallet || this.delegateOwnerWallet - this.logError( - `activeDelegateOwnerWallet: ${activeDelegateOwnerWallet.toLowerCase()} // delegateOwnerWalletFromURSM: ${delegateOwnerWalletFromURSM}` - ) - if ( - !this.entityManagerReplicaSetEnabled && - activeDelegateOwnerWallet.toLowerCase() === delegateOwnerWalletFromURSM - ) { + if (this.delegateOwnerWallet === delegateOwnerWalletFromURSM) { // Update config this.nodeConfig.set('isRegisteredOnURSM', true) @@ -142,11 +149,6 @@ class URSMRegistrationManager { return } - if (this.oldDelegateOwnerWallet) { - // New node registration is disabled if using oldDelegateOwnerWallet and above URSM check failed - throw new Error('Something went wrong if we got here') - } - /** * 3. Fetch list of all nodes registered on URSM, in order to submit requests for proposal * a. Randomize list to minimize bias diff --git a/creator-node/src/services/initAudiusLibs.js b/creator-node/src/services/initAudiusLibs.js index 6038c282b26..ce60c573f59 100644 --- a/creator-node/src/services/initAudiusLibs.js +++ b/creator-node/src/services/initAudiusLibs.js @@ -34,7 +34,7 @@ module.exports = async ({ const entityManagerAddress = config.get('entityManagerAddress') const dataProviderUrl = config.get('dataProviderUrl') const delegatePrivateKey = config.get('delegatePrivateKey') - const oldDelegatePrivateKey = config.get('oldDelegatePrivateKey') + const creatorNodeIsDebug = config.get('creatorNodeIsDebug') const discoveryProviderWhitelist = discoveryProviderWhitelistConfig @@ -74,7 +74,7 @@ module.exports = async ({ // pass as array [dataProviderUrl], // TODO - formatting this private key here is not ideal - (oldDelegatePrivateKey || delegatePrivateKey).replace('0x', ''), + delegatePrivateKey.replace('0x', ''), entityManagerAddress ) : null, diff --git a/mad-dog/src/tests/test_integration.js b/mad-dog/src/tests/test_integration.js index 6060d49f522..ca37f612c75 100644 --- a/mad-dog/src/tests/test_integration.js +++ b/mad-dog/src/tests/test_integration.js @@ -76,31 +76,6 @@ module.exports = coreIntegration = async ({ }) => { // Begin: Test Setup - // If running with UserReplicaSetManager deployed, wait until all Content Nodes are registered on it - const URSMClient = await executeOne(0, libs => libs.libsInstance.contracts.UserReplicaSetManagerClient) - if (URSMClient) { - let retryCount = 0 - const retryLimit = 10 - const retryIntervalMs = 10000 // 10sec - while (true) { - console.log(`Ensuring correct URSM state with interval ${retryIntervalMs} || attempt #${retryCount} ...`) - - const URSMContentNodes = await executeOne(0, libs => getURSMContentNodes(libs)) - - if (URSMContentNodes.length === numCreatorNodes) { - break - } - - if (retryCount >= retryLimit) { - return { error: `URSM state not correctly initialized after ${retryIntervalMs * retryLimit}ms` } - } - - retryCount++ - - await delay(retryIntervalMs) - } - } - // create tmp storage dir await fs.ensureDir(TEMP_STORAGE_PATH) await fs.ensureDir(TEMP_IMG_STORAGE_PATH)