Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch staging CN #3933

Merged
merged 7 commits into from
Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions creator-node/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,19 @@ 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,
Expand Down
16 changes: 15 additions & 1 deletion creator-node/src/services/URSMRegistrationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class URSMRegistrationManager {
this.delegateOwnerWallet = nodeConfig.get('delegateOwnerWallet')
this.delegatePrivateKey = nodeConfig.get('delegatePrivateKey')
this.spOwnerWallet = nodeConfig.get('spOwnerWallet')
this.oldDelegateOwnerWallet = this.nodeConfig.get('oldDelegateOwnerWallet')
this.oldDelegatePrivateKey = this.nodeConfig.get('oldDelegatePrivateKey')

if (
!this.audiusLibs ||
Expand Down Expand Up @@ -119,7 +121,14 @@ class URSMRegistrationManager {
/**
* 2-a. Short-circuit if L2 record for node already matches L1 record (i.e. delegateOwnerWallets match)
*/
if (delegateOwnerWalletFromSPFactory === delegateOwnerWalletFromURSM) {
const activeDelegateOwnerWallet =
this.oldDelegateOwnerWallet || this.delegateOwnerWallet
this.logError(
`activeDelegateOwnerWallet: ${activeDelegateOwnerWallet.toLowerCase()} // delegateOwnerWalletFromURSM: ${delegateOwnerWalletFromURSM}`
)
if (
activeDelegateOwnerWallet.toLowerCase() === delegateOwnerWalletFromURSM
) {
// Update config
this.nodeConfig.set('isRegisteredOnURSM', true)

Expand All @@ -129,6 +138,11 @@ 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
Expand Down
3 changes: 2 additions & 1 deletion creator-node/src/services/initAudiusLibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = async ({
const dataRegistryAddress = config.get('dataRegistryAddress')
const dataProviderUrl = config.get('dataProviderUrl')
const delegatePrivateKey = config.get('delegatePrivateKey')
const oldDelegatePrivateKey = config.get('oldDelegatePrivateKey')
const creatorNodeIsDebug = config.get('creatorNodeIsDebug')

const discoveryProviderWhitelist = discoveryProviderWhitelistConfig
Expand Down Expand Up @@ -72,7 +73,7 @@ module.exports = async ({
// pass as array
[dataProviderUrl],
// TODO - formatting this private key here is not ideal
delegatePrivateKey.replace('0x', '')
(oldDelegatePrivateKey || delegatePrivateKey).replace('0x', '')
)
: null,
discoveryProviderConfig: enableDiscovery
Expand Down