Skip to content

Commit

Permalink
NET-1188: Update node start logs for v1.0 (#2103)
Browse files Browse the repository at this point in the history
## Summary

I update copy and remove mentions of the Network Explorer.
  • Loading branch information
mondoreale authored Dec 8, 2023
1 parent 6e81e14 commit 892e04e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/docs/guides/how-to-run-streamr-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ If you're running a node to become an Operator, then you could now jump to [Step
- Run `streamr-broker` to start the node! You should start to see logging similar to this:

```
INFO [2023-10-31T17:42:30.897] (broker ): Start broker version ...
INFO [2023-10-31T17:42:30.897] (broker ): Start Streamr node version ...
INFO [2023-10-31T17:42:32.660] (StreamrNode ): Starting new StreamrNode with id 251cdad515544d7e863602413a5d91b2
INFO [2023-10-31T17:42:33.131] (OperatorPlugin ): Fetched redundancy factor {"redundancyFactor":1}
INFO [2023-10-31T17:42:33.152] (MaintainTopologyHelp): Starting
Expand Down
5 changes: 2 additions & 3 deletions packages/broker/src/broker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const createBroker = async (configWithoutDefaults: Config): Promise<Broke
return streamrClient
},
start: async () => {
logger.info(`Start broker version ${CURRENT_VERSION}`)
logger.info(`Start Streamr node version ${CURRENT_VERSION}`)
await Promise.all(plugins.map((plugin) => plugin.start(streamrClient)))
const httpServerEndpoints = plugins.flatMap((plugin: Plugin<any>) => {
return plugin.getHttpServerEndpoints().map((endpoint: HttpServerEndpoint) => {
Expand All @@ -48,9 +48,8 @@ export const createBroker = async (configWithoutDefaults: Config): Promise<Broke
const mnemonic = generateMnemonicFromAddress(toEthereumAddress(brokerAddress))

logger.info(`Welcome to the Streamr Network. Your node's generated name is ${mnemonic}.`)
logger.info(`View your node in the Network Explorer: https://streamr.network/network-explorer/nodes/${encodeURIComponent(nodeId)}`)
logger.info(`Network node ${nodeId} running`)
logger.info(`Ethereum address ${brokerAddress}`)
logger.info(`Node address ${brokerAddress}`)

logger.info(`Plugins: ${JSON.stringify(plugins.map((p) => p.name))}`)

Expand Down
18 changes: 3 additions & 15 deletions packages/broker/src/config/ConfigWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,8 @@ export const getPrivateKey = (answers: PrivateKeyAnswers): string => {
return (answers.generateOrImportPrivateKey === PRIVATE_KEY_SOURCE_IMPORT) ? answers.importPrivateKey! : Wallet.createRandom().privateKey
}

export const getNodeIdentity = (privateKey: string): {
mnemonic: string
networkExplorerUrl: string
} => {
const nodeAddress = new Wallet(privateKey).address
const mnemonic = generateMnemonicFromAddress(toEthereumAddress(nodeAddress))
const networkExplorerUrl = `https://streamr.network/network-explorer/nodes/${nodeAddress}`
return {
mnemonic,
networkExplorerUrl
}
export const getNodeMnemonic = (privateKey: string): string => {
return generateMnemonicFromAddress(toEthereumAddress(new Wallet(privateKey).address))
}

export const start = async (
Expand All @@ -254,10 +245,7 @@ export const start = async (
const storageAnswers = await getStorageAnswers()
const storagePath = createStorageFile(config, storageAnswers)
logger.info('Welcome to the Streamr Network')
const { mnemonic, networkExplorerUrl } = getNodeIdentity(privateKey)
logger.info(`Your node's generated name is ${mnemonic}.`)
logger.info('View your node in the Network Explorer:')
logger.info(networkExplorerUrl)
logger.info(`Your node's generated name is ${getNodeMnemonic(privateKey)}.`)
logger.info('You can start the broker now with')
logger.info(`streamr-broker ${storagePath}`)
} catch (e: any) {
Expand Down
9 changes: 3 additions & 6 deletions packages/broker/test/unit/ConfigWizard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createStorageFile,
getConfig,
getPrivateKey,
getNodeIdentity,
getNodeMnemonic,
start,
PluginAnswers,
PrivateKeyAnswers,
Expand Down Expand Up @@ -185,9 +185,8 @@ describe('ConfigWizard', () => {
describe('identity', () => {
it('happy path', () => {
const privateKey = '0x9a2f3b058b9b457f9f954e62ea9fd2cefe2978736ffb3ef2c1782ccfad9c411d'
const identity = getNodeIdentity(privateKey)
expect(identity.mnemonic).toBe('Mountain Until Gun')
expect(identity.networkExplorerUrl).toBe('https://streamr.network/network-explorer/nodes/0x909DC59FF7A3b23126bc6F86ad44dD808fd424Dc')
const mnemonic = getNodeMnemonic(privateKey)
expect(mnemonic).toBe('Mountain Until Gun')
})
})

Expand All @@ -212,8 +211,6 @@ describe('ConfigWizard', () => {
expect(logger.messages).toEqual([
'Welcome to the Streamr Network',
'Your node\'s generated name is Company Session Mix.',
'View your node in the Network Explorer:',
'https://streamr.network/network-explorer/nodes/0x2e988A386a799F506693793c6A5AF6B54dfAaBfB',
'You can start the broker now with',
`streamr-broker ${storageAnswers.storagePath}`,
])
Expand Down

0 comments on commit 892e04e

Please sign in to comment.