Fix serialization on network map startup (#598)

Fix serialization on network-management startup

Minor documentation fixes
This commit is contained in:
Katarzyna Streich 2018-03-23 17:01:46 +00:00 committed by GitHub
parent a723472651
commit a888d78b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 6 deletions

View File

@ -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
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:
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
```
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
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
The private network is a tactical solution to provide temporary privacy to the initial network map.

View File

@ -32,7 +32,7 @@ class DoormanArgsParser {
.withRequiredArg()
.withValuesConvertedBy(PathConverter(PathProperties.FILE_EXISTING))
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
.accepts("trust-store-password", "Password for the generated network root trust store. Only applicable when operating in ${Mode.ROOT_KEYGEN} mode.")
.withRequiredArg()

View File

@ -26,6 +26,7 @@ fun main(args: Array<String>) {
println("Version: ${Manifests.read("Doorman-Version")}")
}
initialiseSerialization()
val cmdLineOptions = try {
DoormanArgsParser().parse(*args)
} catch (e: ShowHelpException) {
@ -81,8 +82,6 @@ private fun caKeyGenMode(config: NetworkManagementServerConfig) {
}
private fun doormanMode(cmdLineOptions: DoormanCmdLineOptions, config: NetworkManagementServerConfig) {
initialiseSerialization()
val networkManagementServer = NetworkManagementServer(config.dataSourceProperties, config.database)
if (cmdLineOptions.networkParametersCmd == null) {

View File

@ -58,7 +58,7 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
val localNetworkMapSigner = signer?.let { NetworkMapSigner(networkMapStorage, it) }
val latestParameters = networkMapStorage.getLatestNetworkParameters()?.networkParameters ?:
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)
if (localNetworkMapSigner != null) {
@ -204,6 +204,7 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
val initialNetParams = setNetParams.toNetworkParameters(modifiedTime = Instant.now(), epoch = 1)
logger.info("Saving initial network parameters to be signed:\n$initialNetParams")
networkMapStorage.saveNetworkParameters(initialNetParams, null)
println("Saved initial network parameters to be signed:\n$initialNetParams")
} else {
val parametersUpdate = requireNotNull(setNetParams.parametersUpdate) {
"'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)
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" +
"Switching from: $activeNetParams\nTo: ${latestNetParamsEntity.networkParameters}")
networkMapStorage.setFlagDay(SecureHash.parse(parametersUpdate.networkParameters.hash))
println("Set the flag day")
}
private fun handleCancelUpdate() {
@ -265,5 +268,6 @@ class NetworkManagementServer(dataSourceProperties: Properties, databaseConfig:
// We leave parameters from that update in the database, for auditing reasons
networkMapStorage.clearParametersUpdates()
}
println("Done with cancel update")
}
}