mirror of
https://github.com/corda/corda.git
synced 2025-01-18 02:39:51 +00:00
[EG-503] Spent state audit tool (#6107)
* [EG-503] Spent state audit tool Fixes * Refinements to notary query interfaces. Feature complete. * EG-503: Introduce optional `notaryService` in `ServiceHubCoreInternal` * Remove redundant logic following change to use extensions API Co-authored-by: Viktor Kolomeyko <viktor.kolomeyko@r3.com>
This commit is contained in:
parent
27ea570fbb
commit
6a07284324
@ -2,6 +2,7 @@ package net.corda.core.internal
|
|||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import net.corda.core.DeleteForDJVM
|
import net.corda.core.DeleteForDJVM
|
||||||
|
import net.corda.core.internal.notary.NotaryService
|
||||||
import net.corda.core.node.ServiceHub
|
import net.corda.core.node.ServiceHub
|
||||||
import net.corda.core.node.StatesToRecord
|
import net.corda.core.node.StatesToRecord
|
||||||
import java.util.concurrent.ExecutorService
|
import java.util.concurrent.ExecutorService
|
||||||
@ -14,6 +15,11 @@ interface ServiceHubCoreInternal : ServiceHub {
|
|||||||
|
|
||||||
val attachmentTrustCalculator: AttachmentTrustCalculator
|
val attachmentTrustCalculator: AttachmentTrustCalculator
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional `NotaryService` which will be `null` for all non-Notary nodes.
|
||||||
|
*/
|
||||||
|
val notaryService: NotaryService?
|
||||||
|
|
||||||
fun createTransactionsResolver(flow: ResolveTransactionsFlow): TransactionsResolver
|
fun createTransactionsResolver(flow: ResolveTransactionsFlow): TransactionsResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,19 @@ abstract class NotaryService : SingletonSerializeAsToken() {
|
|||||||
abstract val services: ServiceHub
|
abstract val services: ServiceHub
|
||||||
abstract val notaryIdentityKey: PublicKey
|
abstract val notaryIdentityKey: PublicKey
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interfaces for the request and result formats of queries supported by notary services. To
|
||||||
|
* implement a new query, you must:
|
||||||
|
*
|
||||||
|
* - Define data classes which implement the [Query.Request] and [Query.Result] interfaces
|
||||||
|
* - Add corresponding handling for the new classes within the notary service implementations
|
||||||
|
* that you want to support the query.
|
||||||
|
*/
|
||||||
|
interface Query {
|
||||||
|
interface Request
|
||||||
|
interface Result
|
||||||
|
}
|
||||||
|
|
||||||
abstract fun start()
|
abstract fun start()
|
||||||
abstract fun stop()
|
abstract fun stop()
|
||||||
|
|
||||||
@ -22,4 +35,18 @@ abstract class NotaryService : SingletonSerializeAsToken() {
|
|||||||
* @param otherPartySession client [Party] making the request
|
* @param otherPartySession client [Party] making the request
|
||||||
*/
|
*/
|
||||||
abstract fun createServiceFlow(otherPartySession: FlowSession): FlowLogic<Void?>
|
abstract fun createServiceFlow(otherPartySession: FlowSession): FlowLogic<Void?>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes a [Query.Request] and returns a [Query.Result].
|
||||||
|
*
|
||||||
|
* Note that this always throws an [UnsupportedOperationException] to handle notary
|
||||||
|
* implementations that do not support this functionality. This must be overridden by
|
||||||
|
* notary implementations wishing to support query functionality.
|
||||||
|
*
|
||||||
|
* Overrides of this function may themselves still throw an [UnsupportedOperationException],
|
||||||
|
* if they do not support specific query implementations
|
||||||
|
*/
|
||||||
|
open fun processQuery(query: Query.Request): Query.Result {
|
||||||
|
throw UnsupportedOperationException("Notary has not implemented query support")
|
||||||
|
}
|
||||||
}
|
}
|
@ -367,6 +367,8 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
|||||||
|
|
||||||
private val checkpointDumper = CheckpointDumperImpl(checkpointStorage, database, services, services.configuration.baseDirectory)
|
private val checkpointDumper = CheckpointDumperImpl(checkpointStorage, database, services, services.configuration.baseDirectory)
|
||||||
|
|
||||||
|
private var notaryService: NotaryService? = null
|
||||||
|
|
||||||
private val nodeServicesContext = object : NodeServicesContext {
|
private val nodeServicesContext = object : NodeServicesContext {
|
||||||
override val platformVersion = versionInfo.platformVersion
|
override val platformVersion = versionInfo.platformVersion
|
||||||
override val configurationWithOptions = configuration.configurationWithOptions
|
override val configurationWithOptions = configuration.configurationWithOptions
|
||||||
@ -524,7 +526,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
|||||||
// the KMS is meant for derived temporary keys used in transactions, and we're not supposed to sign things with
|
// the KMS is meant for derived temporary keys used in transactions, and we're not supposed to sign things with
|
||||||
// the identity key. But the infrastructure to make that easy isn't here yet.
|
// the identity key. But the infrastructure to make that easy isn't here yet.
|
||||||
keyManagementService.start(keyPairs)
|
keyManagementService.start(keyPairs)
|
||||||
val notaryService = maybeStartNotaryService(myNotaryIdentity)
|
notaryService = maybeStartNotaryService(myNotaryIdentity)
|
||||||
installCordaServices()
|
installCordaServices()
|
||||||
contractUpgradeService.start()
|
contractUpgradeService.start()
|
||||||
vaultService.start()
|
vaultService.start()
|
||||||
@ -1160,6 +1162,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
|||||||
override val attachmentTrustCalculator: AttachmentTrustCalculator get() = this@AbstractNode.attachmentTrustCalculator
|
override val attachmentTrustCalculator: AttachmentTrustCalculator get() = this@AbstractNode.attachmentTrustCalculator
|
||||||
override val diagnosticsService: DiagnosticsService get() = this@AbstractNode.diagnosticsService
|
override val diagnosticsService: DiagnosticsService get() = this@AbstractNode.diagnosticsService
|
||||||
override val externalOperationExecutor: ExecutorService get() = this@AbstractNode.externalOperationExecutor
|
override val externalOperationExecutor: ExecutorService get() = this@AbstractNode.externalOperationExecutor
|
||||||
|
override val notaryService: NotaryService? get() = this@AbstractNode.notaryService
|
||||||
|
|
||||||
private lateinit var _myInfo: NodeInfo
|
private lateinit var _myInfo: NodeInfo
|
||||||
override val myInfo: NodeInfo get() = _myInfo
|
override val myInfo: NodeInfo get() = _myInfo
|
||||||
|
@ -9,6 +9,7 @@ import net.corda.core.crypto.SecureHash
|
|||||||
import net.corda.core.flows.FlowException
|
import net.corda.core.flows.FlowException
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.*
|
import net.corda.core.internal.*
|
||||||
|
import net.corda.core.internal.notary.NotaryService
|
||||||
import net.corda.core.node.ServiceHub
|
import net.corda.core.node.ServiceHub
|
||||||
import net.corda.core.node.ServicesForResolution
|
import net.corda.core.node.ServicesForResolution
|
||||||
import net.corda.core.node.services.AttachmentId
|
import net.corda.core.node.services.AttachmentId
|
||||||
@ -127,6 +128,8 @@ data class TestTransactionDSLInterpreter private constructor(
|
|||||||
|
|
||||||
override val cordappProvider: CordappProvider =
|
override val cordappProvider: CordappProvider =
|
||||||
ledgerInterpreter.services.cordappProvider
|
ledgerInterpreter.services.cordappProvider
|
||||||
|
|
||||||
|
override val notaryService: NotaryService? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copy(): TestTransactionDSLInterpreter =
|
private fun copy(): TestTransactionDSLInterpreter =
|
||||||
|
Loading…
Reference in New Issue
Block a user