mirror of
https://github.com/corda/corda.git
synced 2025-01-16 01:40:17 +00:00
Fix serialization on network map startup (#598)
Fix serialization on network-management startup Minor documentation fixes
This commit is contained in:
parent
a723472651
commit
a888d78b42
@ -245,7 +245,7 @@ Run the following SQL script to archive the node info table (change the timestam
|
|||||||
The initial network parameters can be subsequently changed through an update process. However, these changes must first
|
The initial network parameters can be subsequently changed through an update process. However, these changes must first
|
||||||
be advertised to the entire network to allow nodes time to agree to the changes.
|
be advertised to the entire network to allow nodes time to agree to the changes.
|
||||||
|
|
||||||
The server needs to be shutdown and started with the same `set-network-parameters` as before but this time the network
|
The server needs to be shutdown and started with the same `set-network-parameters` flag as before but this time the network
|
||||||
parameters file must have `parametersUpdate` config block:
|
parameters file must have `parametersUpdate` config block:
|
||||||
|
|
||||||
parametersUpdate {
|
parametersUpdate {
|
||||||
@ -268,10 +268,18 @@ When the time for switching the parameters comes, doorman should be restarted ag
|
|||||||
java -jar doorman-<version>.jar --flag-day
|
java -jar doorman-<version>.jar --flag-day
|
||||||
```
|
```
|
||||||
|
|
||||||
This will switch the parameters that were previously advertised as an update to be the current ones in the network map.
|
This will switch the parameters that were previously advertised as an update to be the current ones in the network map,
|
||||||
|
however the new network parameters won't be active until the new network map is signed (either by HSM or by local signer).
|
||||||
All nodes in the network need to restart to apply the new parameters. Any node which has not accepted the new parameters
|
All nodes in the network need to restart to apply the new parameters. Any node which has not accepted the new parameters
|
||||||
will fail to start.
|
will fail to start.
|
||||||
|
|
||||||
|
It is possible to cancel the previously scheduled updated. To do so simply run:
|
||||||
|
```
|
||||||
|
java -jar doorman-<version>.jar --cancel-update
|
||||||
|
```
|
||||||
|
|
||||||
|
The network map will continue to advertise the cancelled update until the new network map is signed.
|
||||||
|
|
||||||
# Private Network Map
|
# Private Network Map
|
||||||
The private network is a tactical solution to provide temporary privacy to the initial network map.
|
The private network is a tactical solution to provide temporary privacy to the initial network map.
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class DoormanArgsParser {
|
|||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.withValuesConvertedBy(PathConverter(PathProperties.FILE_EXISTING))
|
.withValuesConvertedBy(PathConverter(PathProperties.FILE_EXISTING))
|
||||||
private val flagDayArg = optionParser.accepts("flag-day", "Roll over the scheduled network parameters to be the current.")
|
private val flagDayArg = optionParser.accepts("flag-day", "Roll over the scheduled network parameters to be the current.")
|
||||||
private val cancelUpdateArg = optionParser.accepts("cancel-network-parameters-update", "Cancel the scheduled update of the network parameters.")
|
private val cancelUpdateArg = optionParser.accepts("cancel-update", "Cancel the scheduled update of the network parameters.")
|
||||||
private val trustStorePasswordArg = optionParser
|
private val trustStorePasswordArg = optionParser
|
||||||
.accepts("trust-store-password", "Password for the generated network root trust store. Only applicable when operating in ${Mode.ROOT_KEYGEN} mode.")
|
.accepts("trust-store-password", "Password for the generated network root trust store. Only applicable when operating in ${Mode.ROOT_KEYGEN} mode.")
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
|
@ -26,6 +26,7 @@ fun main(args: Array<String>) {
|
|||||||
println("Version: ${Manifests.read("Doorman-Version")}")
|
println("Version: ${Manifests.read("Doorman-Version")}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialiseSerialization()
|
||||||
val cmdLineOptions = try {
|
val cmdLineOptions = try {
|
||||||
DoormanArgsParser().parse(*args)
|
DoormanArgsParser().parse(*args)
|
||||||
} catch (e: ShowHelpException) {
|
} catch (e: ShowHelpException) {
|
||||||
@ -81,8 +82,6 @@ private fun caKeyGenMode(config: NetworkManagementServerConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun doormanMode(cmdLineOptions: DoormanCmdLineOptions, config: NetworkManagementServerConfig) {
|
private fun doormanMode(cmdLineOptions: DoormanCmdLineOptions, config: NetworkManagementServerConfig) {
|
||||||
initialiseSerialization()
|
|
||||||
|
|
||||||
val networkManagementServer = NetworkManagementServer(config.dataSourceProperties, config.database)
|
val networkManagementServer = NetworkManagementServer(config.dataSourceProperties, config.database)
|
||||||
|
|
||||||
if (cmdLineOptions.networkParametersCmd == null) {
|
if (cmdLineOptions.networkParametersCmd == null) {
|
||||||
|
@ -58,7 +58,7 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
|
|||||||
val localNetworkMapSigner = signer?.let { NetworkMapSigner(networkMapStorage, it) }
|
val localNetworkMapSigner = signer?.let { NetworkMapSigner(networkMapStorage, it) }
|
||||||
val latestParameters = networkMapStorage.getLatestNetworkParameters()?.networkParameters ?:
|
val latestParameters = networkMapStorage.getLatestNetworkParameters()?.networkParameters ?:
|
||||||
throw IllegalStateException("No network parameters were found. Please upload new network parameters before starting network map service")
|
throw IllegalStateException("No network parameters were found. Please upload new network parameters before starting network map service")
|
||||||
logger.info("Starting network map service with network parameters: $latestParameters")
|
logger.info("Starting network map service with latest network parameters: $latestParameters")
|
||||||
localNetworkMapSigner?.signAndPersistNetworkParameters(latestParameters)
|
localNetworkMapSigner?.signAndPersistNetworkParameters(latestParameters)
|
||||||
|
|
||||||
if (localNetworkMapSigner != null) {
|
if (localNetworkMapSigner != null) {
|
||||||
@ -204,6 +204,7 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
|
|||||||
val initialNetParams = setNetParams.toNetworkParameters(modifiedTime = Instant.now(), epoch = 1)
|
val initialNetParams = setNetParams.toNetworkParameters(modifiedTime = Instant.now(), epoch = 1)
|
||||||
logger.info("Saving initial network parameters to be signed:\n$initialNetParams")
|
logger.info("Saving initial network parameters to be signed:\n$initialNetParams")
|
||||||
networkMapStorage.saveNetworkParameters(initialNetParams, null)
|
networkMapStorage.saveNetworkParameters(initialNetParams, null)
|
||||||
|
println("Saved initial network parameters to be signed:\n$initialNetParams")
|
||||||
} else {
|
} else {
|
||||||
val parametersUpdate = requireNotNull(setNetParams.parametersUpdate) {
|
val parametersUpdate = requireNotNull(setNetParams.parametersUpdate) {
|
||||||
"'parametersUpdate' not specified in network parameters file but there is already an active set of network parameters"
|
"'parametersUpdate' not specified in network parameters file but there is already an active set of network parameters"
|
||||||
@ -228,6 +229,7 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
|
|||||||
networkMapStorage.saveNewParametersUpdate(newNetParams, parametersUpdate.description, parametersUpdate.updateDeadline)
|
networkMapStorage.saveNewParametersUpdate(newNetParams, parametersUpdate.description, parametersUpdate.updateDeadline)
|
||||||
|
|
||||||
logger.info("Update enabled")
|
logger.info("Update enabled")
|
||||||
|
println("Enabled update to network parameters:\n$newNetParams\n$parametersUpdate")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,6 +256,7 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
|
|||||||
logger.info("Flag day has occurred, however the new network parameters won't be active until the new network map is signed.\n" +
|
logger.info("Flag day has occurred, however the new network parameters won't be active until the new network map is signed.\n" +
|
||||||
"Switching from: $activeNetParams\nTo: ${latestNetParamsEntity.networkParameters}")
|
"Switching from: $activeNetParams\nTo: ${latestNetParamsEntity.networkParameters}")
|
||||||
networkMapStorage.setFlagDay(SecureHash.parse(parametersUpdate.networkParameters.hash))
|
networkMapStorage.setFlagDay(SecureHash.parse(parametersUpdate.networkParameters.hash))
|
||||||
|
println("Set the flag day")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleCancelUpdate() {
|
private fun handleCancelUpdate() {
|
||||||
@ -265,5 +268,6 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
|
|||||||
// We leave parameters from that update in the database, for auditing reasons
|
// We leave parameters from that update in the database, for auditing reasons
|
||||||
networkMapStorage.clearParametersUpdates()
|
networkMapStorage.clearParametersUpdates()
|
||||||
}
|
}
|
||||||
|
println("Done with cancel update")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user