Skip to content

Commit

Permalink
Some cleanup after network map removal (corda#2006)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiastreich authored Nov 7, 2017
1 parent 7944fcd commit deaba28
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 38 deletions.
15 changes: 1 addition & 14 deletions docs/source/node-services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,7 @@ service. Also, this service allows mapping of friendly names, or
``StateMachineManager`` to convert between the ``CompositeKey``, or
``Party`` based addressing used in the flows/contracts and the
physical host and port information required for the physical
``ArtemisMQ`` messaging layer.


PersistentNetworkMapService
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``PersistentNetworkMapService`` keeps track of ``NodeInfo`` and
persists it to the database. It and will include nodes that are not currently active.
The networking layer will persist any messages directed at such inactive
nodes with the expectation that they will be delivered eventually, or
else that the source flow will be terminated by admin intervention.
An ``InMemoryNetworkMapService`` is also available for unit tests
without a database.

``ArtemisMQ`` messaging layer.

Storage and persistence related services
----------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ abstract class ArtemisMessagingComponent : SingletonSerializeAsToken() {
// case is a forward slash
const val NODE_USER = "SystemUsers/Node"
const val PEER_USER = "SystemUsers/Peer"

const val INTERNAL_PREFIX = "internal."
const val PEERS_PREFIX = "${INTERNAL_PREFIX}peers." //TODO Come up with better name for common peers/services queue
const val IP_REQUEST_PREFIX = "ip."
const val P2P_QUEUE = "p2p.inbound"
const val NOTIFICATIONS_ADDRESS = "${INTERNAL_PREFIX}activemq.notifications"
const val NETWORK_MAP_QUEUE = "${INTERNAL_PREFIX}networkmap"
}

interface ArtemisAddress : MessageRecipients {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import net.corda.core.utilities.unwrap
import net.corda.node.internal.Node
import net.corda.node.internal.StartedNode
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.INTERNAL_PREFIX
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NETWORK_MAP_QUEUE
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NOTIFICATIONS_ADDRESS
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.P2P_QUEUE
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.PEERS_PREFIX
Expand Down Expand Up @@ -97,16 +96,6 @@ abstract class MQSecurityTest : NodeBasedTest() {
assertAllQueueCreationAttacksFail(invalidPeerQueue)
}

@Test
fun `consume message from network map queue`() {
assertConsumeAttackFails(NETWORK_MAP_QUEUE)
}

@Test
fun `send message to network map address`() {
assertSendAttackFails(NETWORK_MAP_QUEUE)
}

@Test
fun `consume message from RPC requests queue`() {
assertConsumeAttackFails(RPCApi.RPC_SERVER_QUEUE_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ class ArtemisMessagingServer(override val config: NodeConfiguration,
// by having its password be an unknown securely random 128-bit value.
clusterPassword = BigInteger(128, newSecureRandom()).toString(16)
queueConfigurations = listOf(
queueConfig(NETWORK_MAP_QUEUE, durable = true),
queueConfig(P2P_QUEUE, durable = true),
// Create an RPC queue: this will service locally connected clients only (not via a bridge) and those
// clients must have authenticated. We could use a single consumer for everything and perhaps we should,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
notaryNode: StartedNode<*>,
vararg extraSigningNodes: StartedNode<*>): Map<SecureHash, SignedTransaction> {

val notaryParty = notaryNode.info.legalIdentities[0]
val notaryParty = node.services.getDefaultNotary()
val signed = wtxToSign.map {
val id = it.id
val sigs = mutableListOf<TransactionSignature>()
Expand Down
Empty file.
10 changes: 2 additions & 8 deletions tools/loadtest/src/main/kotlin/net/corda/loadtest/LoadTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ data class LoadTest<T, S>(
if (parameters.clearDatabaseBeforeRun) {
log.info("Clearing databases as clearDatabaseBeforeRun=true")
// We need to clear the network map first so that other nodes register fine
nodes.networkMap.clearDb()
(nodes.simpleNodes + listOf(nodes.notary)).parallelStream().forEach {
it.clearDb()
}
Expand Down Expand Up @@ -152,10 +151,9 @@ data class LoadTest<T, S>(

data class Nodes(
val notary: NodeConnection,
val networkMap: NodeConnection,
val simpleNodes: List<NodeConnection>
) {
val allNodes by lazy { (listOf(notary, networkMap) + simpleNodes).associateBy { it.info }.values }
val allNodes by lazy { (listOf(notary) + simpleNodes).associateBy { it.info }.values }
}

/**
Expand All @@ -172,8 +170,6 @@ fun runLoadTests(configuration: LoadTestConfiguration, tests: List<Pair<LoadTest
}
}

val networkMap = remoteNodes[0].hostname// TODO Should be taken from configs? but also we don't care that much about that, because networkMapService will be gone and no one uses LoadTesting now

connectToNodes(remoteNodes, PortAllocation.Incremental(configuration.localTunnelStartingPort)) { connections ->
log.info("Connected to all nodes!")
val hostNodeMap = ConcurrentHashMap<String, NodeConnection>()
Expand All @@ -193,12 +189,10 @@ fun runLoadTests(configuration: LoadTestConfiguration, tests: List<Pair<LoadTest
hostNodeMap.put(connection.remoteNode.hostname, connection)
}

val networkMapNode = hostNodeMap[networkMap]!!
val notaryIdentity = networkMapNode.proxy.notaryIdentities().single()
val notaryIdentity = hostNodeMap.values.first().proxy.notaryIdentities().single()
val notaryNode = hostNodeMap.values.single { notaryIdentity in it.info.legalIdentities }
val nodes = Nodes(
notary = notaryNode,
networkMap = networkMapNode,
simpleNodes = hostNodeMap.values.filter { it.info.legalIdentitiesAndCerts.size == 1 } // TODO Fix it with network map.
)

Expand Down

0 comments on commit deaba28

Please sign in to comment.