mirror of
https://github.com/corda/corda.git
synced 2025-06-13 20:58:19 +00:00
Minor changes made in ENT which should have been ported over (#3932)
This commit is contained in:
@ -14,6 +14,7 @@ import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo
|
|||||||
import org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter
|
import org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
||||||
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider
|
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider
|
||||||
|
import java.security.SecureRandom
|
||||||
import java.security.Security
|
import java.security.Security
|
||||||
|
|
||||||
internal val cordaSecurityProvider = CordaSecurityProvider().also {
|
internal val cordaSecurityProvider = CordaSecurityProvider().also {
|
||||||
@ -46,4 +47,4 @@ internal val bouncyCastlePQCProvider = BouncyCastlePQCProvider().apply {
|
|||||||
internal val providerMap = listOf(cordaBouncyCastleProvider, cordaSecurityProvider, bouncyCastlePQCProvider).map { it.name to it }.toMap()
|
internal val providerMap = listOf(cordaBouncyCastleProvider, cordaSecurityProvider, bouncyCastlePQCProvider).map { it.name to it }.toMap()
|
||||||
|
|
||||||
@DeleteForDJVM
|
@DeleteForDJVM
|
||||||
internal fun platformSecureRandomFactory() = platformSecureRandom() // To minimise diff of CryptoUtils against open-source.
|
internal fun platformSecureRandomFactory(): SecureRandom = platformSecureRandom() // To minimise diff of CryptoUtils against open-source.
|
||||||
|
@ -17,6 +17,7 @@ import net.corda.core.serialization.SerializeAsTokenContext
|
|||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.utilities.NonEmptySet
|
import net.corda.core.utilities.NonEmptySet
|
||||||
import net.corda.core.utilities.UntrustworthyData
|
import net.corda.core.utilities.UntrustworthyData
|
||||||
|
import net.corda.core.utilities.debug
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import java.nio.file.FileAlreadyExistsException
|
import java.nio.file.FileAlreadyExistsException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -75,7 +76,7 @@ sealed class FetchDataFlow<T : NamedByHash, in W : Any>(
|
|||||||
return if (toFetch.isEmpty()) {
|
return if (toFetch.isEmpty()) {
|
||||||
Result(fromDisk, emptyList())
|
Result(fromDisk, emptyList())
|
||||||
} else {
|
} else {
|
||||||
logger.info("Requesting ${toFetch.size} dependency(s) for verification from ${otherSideSession.counterparty.name}")
|
logger.debug { "Requesting ${toFetch.size} dependency(s) for verification from ${otherSideSession.counterparty.name}" }
|
||||||
|
|
||||||
// TODO: Support "large message" response streaming so response sizes are not limited by RAM.
|
// TODO: Support "large message" response streaming so response sizes are not limited by RAM.
|
||||||
// We can then switch to requesting items in large batches to minimise the latency penalty.
|
// We can then switch to requesting items in large batches to minimise the latency penalty.
|
||||||
@ -93,7 +94,7 @@ sealed class FetchDataFlow<T : NamedByHash, in W : Any>(
|
|||||||
}
|
}
|
||||||
// Check for a buggy/malicious peer answering with something that we didn't ask for.
|
// Check for a buggy/malicious peer answering with something that we didn't ask for.
|
||||||
val downloaded = validateFetchResponse(UntrustworthyData(maybeItems), toFetch)
|
val downloaded = validateFetchResponse(UntrustworthyData(maybeItems), toFetch)
|
||||||
logger.info("Fetched ${downloaded.size} elements from ${otherSideSession.counterparty.name}")
|
logger.debug { "Fetched ${downloaded.size} elements from ${otherSideSession.counterparty.name}" }
|
||||||
maybeWriteToDisk(downloaded)
|
maybeWriteToDisk(downloaded)
|
||||||
Result(fromDisk, downloaded)
|
Result(fromDisk, downloaded)
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,4 @@ abstract class TrustedAuthorityNotaryService : NotaryService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Sign multiple transactions at once by building their Merkle tree and then signing over its root.
|
// TODO: Sign multiple transactions at once by building their Merkle tree and then signing over its root.
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,8 @@ data class StateMachineInfo @JvmOverloads constructor(
|
|||||||
* An object representing information about the initiator of the flow. Note that this field is
|
* An object representing information about the initiator of the flow. Note that this field is
|
||||||
* superseded by the [invocationContext] property, which has more detail.
|
* superseded by the [invocationContext] property, which has more detail.
|
||||||
*/
|
*/
|
||||||
@Deprecated("There is more info available using 'context'") val initiator: FlowInitiator,
|
@Deprecated("There is more info available using 'invocationContext'")
|
||||||
|
val initiator: FlowInitiator,
|
||||||
/** A [DataFeed] of the current progress step as a human readable string, and updates to that string. */
|
/** A [DataFeed] of the current progress step as a human readable string, and updates to that string. */
|
||||||
val progressTrackerStepAndUpdates: DataFeed<String, String>?,
|
val progressTrackerStepAndUpdates: DataFeed<String, String>?,
|
||||||
/** An [InvocationContext] describing why and by whom the flow was started. */
|
/** An [InvocationContext] describing why and by whom the flow was started. */
|
||||||
|
@ -33,9 +33,10 @@ sealed class ByteSequence(private val _bytes: ByteArray, val offset: Int, val si
|
|||||||
fun open() = ByteArrayInputStream(_bytes, offset, size)
|
fun open() = ByteArrayInputStream(_bytes, offset, size)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a sub-sequence, that may be backed by a new byte array.
|
* Create a sub-sequence of this sequence. A copy of the underlying array may be made, if a subclass overrides
|
||||||
|
* [bytes] to do so, as [OpaqueBytes] does.
|
||||||
*
|
*
|
||||||
* @param offset The offset within this sequence to start the new sequence. Note: not the offset within the backing array.
|
* @param offset The offset within this sequence to start the new sequence. Note: not the offset within the backing array.
|
||||||
* @param size The size of the intended sub sequence.
|
* @param size The size of the intended sub sequence.
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
@ -43,7 +44,7 @@ sealed class ByteSequence(private val _bytes: ByteArray, val offset: Int, val si
|
|||||||
require(offset >= 0)
|
require(offset >= 0)
|
||||||
require(offset + size <= this.size)
|
require(offset + size <= this.size)
|
||||||
// Intentionally use bytes rather than _bytes, to mirror the copy-or-not behaviour of that property.
|
// Intentionally use bytes rather than _bytes, to mirror the copy-or-not behaviour of that property.
|
||||||
return if (offset == 0 && size == this.size) this else OpaqueBytesSubSequence(bytes, this.offset + offset, size)
|
return if (offset == 0 && size == this.size) this else of(bytes, this.offset + offset, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -106,7 +106,7 @@ class CordappSmokeTest {
|
|||||||
class SendBackInitiatorFlowContext(private val otherPartySession: FlowSession) : FlowLogic<Unit>() {
|
class SendBackInitiatorFlowContext(private val otherPartySession: FlowSession) : FlowLogic<Unit>() {
|
||||||
@Suspendable
|
@Suspendable
|
||||||
override fun call() {
|
override fun call() {
|
||||||
// An initiated flow calling getFlowContext on its initiator will get the context from the session-init
|
// An initiated flow calling getFlowInfo on its initiator will get the context from the session-init
|
||||||
val sessionInitContext = otherPartySession.getCounterpartyFlowInfo()
|
val sessionInitContext = otherPartySession.getCounterpartyFlowInfo()
|
||||||
otherPartySession.send(sessionInitContext)
|
otherPartySession.send(sessionInitContext)
|
||||||
}
|
}
|
||||||
|
@ -4,20 +4,11 @@ import net.corda.core.contracts.Amount
|
|||||||
import net.corda.core.contracts.ContractState
|
import net.corda.core.contracts.ContractState
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.node.services.queryBy
|
import net.corda.core.node.services.queryBy
|
||||||
import net.corda.core.node.services.vault.DEFAULT_PAGE_NUM
|
import net.corda.core.node.services.vault.*
|
||||||
import net.corda.core.node.services.vault.DEFAULT_PAGE_SIZE
|
|
||||||
import net.corda.core.node.services.vault.PageSpecification
|
|
||||||
import net.corda.core.node.services.vault.QueryCriteria
|
|
||||||
import net.corda.core.node.services.vault.builder
|
|
||||||
import net.corda.core.utilities.OpaqueBytes
|
import net.corda.core.utilities.OpaqueBytes
|
||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.docs.java.tutorial.helloworld.IOUFlow
|
import net.corda.docs.java.tutorial.helloworld.IOUFlow
|
||||||
import net.corda.finance.CHF
|
import net.corda.finance.*
|
||||||
import net.corda.finance.DOLLARS
|
|
||||||
import net.corda.finance.GBP
|
|
||||||
import net.corda.finance.POUNDS
|
|
||||||
import net.corda.finance.SWISS_FRANCS
|
|
||||||
import net.corda.finance.USD
|
|
||||||
import net.corda.finance.contracts.getCashBalances
|
import net.corda.finance.contracts.getCashBalances
|
||||||
import net.corda.finance.flows.CashIssueFlow
|
import net.corda.finance.flows.CashIssueFlow
|
||||||
import net.corda.node.services.vault.VaultSchemaV1
|
import net.corda.node.services.vault.VaultSchemaV1
|
||||||
@ -112,4 +103,4 @@ class CustomVaultQueryTest {
|
|||||||
|
|
||||||
return Pair(balancesNodesA, balancesNodesB)
|
return Pair(balancesNodesA, balancesNodesB)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ object CashSchema
|
|||||||
object CashSchemaV1 : MappedSchema(schemaFamily = CashSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCashState::class.java)) {
|
object CashSchemaV1 : MappedSchema(schemaFamily = CashSchema.javaClass, version = 1, mappedTypes = listOf(PersistentCashState::class.java)) {
|
||||||
|
|
||||||
override val migrationResource = "cash.changelog-master"
|
override val migrationResource = "cash.changelog-master"
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "contract_cash_states", indexes = [Index(name = "ccy_code_idx", columnList = "ccy_code"), Index(name = "pennies_idx", columnList = "pennies")])
|
@Table(name = "contract_cash_states", indexes = [Index(name = "ccy_code_idx", columnList = "ccy_code"), Index(name = "pennies_idx", columnList = "pennies")])
|
||||||
class PersistentCashState(
|
class PersistentCashState(
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd" >
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd" >
|
||||||
|
|
||||||
<include file="migration/cash.changelog-init.xml"/>
|
<include file="migration/cash.changelog-init.xml"/>
|
||||||
<include file="migration/cash.changelog-v1.xml"/>
|
<include file="migration/cash.changelog-v1.xml"/>
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
|
||||||
|
|
||||||
<include file="migration/commercial-paper.changelog-init.xml"/>
|
<include file="migration/commercial-paper.changelog-init.xml"/>
|
||||||
<include file="migration/commercial-paper.changelog-v1.xml"/>
|
<include file="migration/commercial-paper.changelog-v1.xml"/>
|
||||||
|
@ -248,7 +248,7 @@ class CommercialPaperTestsGeneric {
|
|||||||
val notaryServices = MockServices(listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"), dummyNotary)
|
val notaryServices = MockServices(listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"), dummyNotary)
|
||||||
val issuerServices = MockServices(listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"), dummyCashIssuer, dummyNotary)
|
val issuerServices = MockServices(listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"), dummyCashIssuer, dummyNotary)
|
||||||
val (aliceDatabase, aliceServices) = makeTestDatabaseAndMockServices(
|
val (aliceDatabase, aliceServices) = makeTestDatabaseAndMockServices(
|
||||||
listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"),
|
listOf("net.corda.finance.contracts", "net.corda.finance.schemas"),
|
||||||
makeTestIdentityService(*allIdentities),
|
makeTestIdentityService(*allIdentities),
|
||||||
alice
|
alice
|
||||||
)
|
)
|
||||||
@ -257,7 +257,7 @@ class CommercialPaperTestsGeneric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val (megaCorpDatabase, megaCorpServices) = makeTestDatabaseAndMockServices(
|
val (megaCorpDatabase, megaCorpServices) = makeTestDatabaseAndMockServices(
|
||||||
listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"),
|
listOf("net.corda.finance.contracts", "net.corda.finance.schemas"),
|
||||||
makeTestIdentityService(*allIdentities),
|
makeTestIdentityService(*allIdentities),
|
||||||
megaCorp
|
megaCorp
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,9 @@ class CashIssueFlowTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun start() {
|
fun start() {
|
||||||
mockNet = MockNetwork(servicePeerAllocationStrategy = RoundRobin(), cordappPackages = listOf("net.corda.finance.contracts", "net.corda.finance.contracts.asset", "net.corda.finance.schemas"))
|
mockNet = MockNetwork(
|
||||||
|
servicePeerAllocationStrategy = RoundRobin(),
|
||||||
|
cordappPackages = listOf("net.corda.finance.contracts", "net.corda.finance.schemas"))
|
||||||
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
bankOfCordaNode = mockNet.createPartyNode(BOC_NAME)
|
||||||
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
bankOfCorda = bankOfCordaNode.info.identityFromX500Name(BOC_NAME)
|
||||||
notary = mockNet.defaultNotaryIdentity
|
notary = mockNet.defaultNotaryIdentity
|
||||||
|
@ -10,6 +10,8 @@ import net.corda.core.utilities.ProgressTracker
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.node.services.Permissions
|
import net.corda.node.services.Permissions
|
||||||
|
import net.corda.testing.core.ALICE_NAME
|
||||||
|
import net.corda.testing.core.BOB_NAME
|
||||||
import net.corda.testing.core.singleIdentity
|
import net.corda.testing.core.singleIdentity
|
||||||
import net.corda.testing.driver.DriverParameters
|
import net.corda.testing.driver.DriverParameters
|
||||||
import net.corda.testing.driver.driver
|
import net.corda.testing.driver.driver
|
||||||
@ -38,8 +40,8 @@ class FlowRetryTest {
|
|||||||
startNodesInProcess = isQuasarAgentSpecified(),
|
startNodesInProcess = isQuasarAgentSpecified(),
|
||||||
notarySpecs = emptyList()
|
notarySpecs = emptyList()
|
||||||
)) {
|
)) {
|
||||||
val nodeAHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
|
val nodeAHandle = startNode(providedName = ALICE_NAME, rpcUsers = listOf(user)).getOrThrow()
|
||||||
val nodeBHandle = startNode(rpcUsers = listOf(user)).getOrThrow()
|
val nodeBHandle = startNode(providedName = BOB_NAME, rpcUsers = listOf(user)).getOrThrow()
|
||||||
|
|
||||||
val result = CordaRPCClient(nodeAHandle.rpcAddress).start(user.username, user.password).use {
|
val result = CordaRPCClient(nodeAHandle.rpcAddress).start(user.username, user.password).use {
|
||||||
it.proxy.startFlow(::InitiatorFlow, numSessions, numIterations, nodeBHandle.nodeInfo.singleIdentity()).returnValue.getOrThrow()
|
it.proxy.startFlow(::InitiatorFlow, numSessions, numIterations, nodeBHandle.nodeInfo.singleIdentity()).returnValue.getOrThrow()
|
||||||
@ -66,7 +68,7 @@ class InitiatorFlow(private val sessionsCount: Int, private val iterationsCount:
|
|||||||
|
|
||||||
fun tracker() = ProgressTracker(FIRST_STEP)
|
fun tracker() = ProgressTracker(FIRST_STEP)
|
||||||
|
|
||||||
val seen = Collections.synchronizedSet(HashSet<Visited>())
|
val seen: MutableSet<Visited> = Collections.synchronizedSet(HashSet<Visited>())
|
||||||
|
|
||||||
fun visit(sessionNum: Int, iterationNum: Int, step: Step) {
|
fun visit(sessionNum: Int, iterationNum: Int, step: Step) {
|
||||||
val visited = Visited(sessionNum, iterationNum, step)
|
val visited = Visited(sessionNum, iterationNum, step)
|
||||||
@ -117,7 +119,7 @@ class InitiatedFlow(val session: FlowSession) : FlowLogic<Any>() {
|
|||||||
|
|
||||||
fun tracker() = ProgressTracker(FIRST_STEP)
|
fun tracker() = ProgressTracker(FIRST_STEP)
|
||||||
|
|
||||||
val seen = Collections.synchronizedSet(HashSet<Visited>())
|
val seen: MutableSet<Visited> = Collections.synchronizedSet(HashSet<Visited>())
|
||||||
|
|
||||||
fun visit(sessionNum: Int, iterationNum: Int, step: Step) {
|
fun visit(sessionNum: Int, iterationNum: Int, step: Step) {
|
||||||
val visited = Visited(sessionNum, iterationNum, step)
|
val visited = Visited(sessionNum, iterationNum, step)
|
||||||
@ -154,4 +156,4 @@ data class SessionInfo(val sessionNum: Int, val iterationsCount: Int)
|
|||||||
|
|
||||||
enum class Step { First, BeforeInitiate, AfterInitiate, AfterInitiateSendReceive, BeforeSend, AfterSend, BeforeReceive, AfterReceive }
|
enum class Step { First, BeforeInitiate, AfterInitiate, AfterInitiateSendReceive, BeforeSend, AfterSend, BeforeReceive, AfterReceive }
|
||||||
|
|
||||||
data class Visited(val sessionNum: Int, val iterationNum: Int, val step: Step)
|
data class Visited(val sessionNum: Int, val iterationNum: Int, val step: Step)
|
||||||
|
@ -6,8 +6,8 @@ import net.corda.core.flows.*
|
|||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.internal.concurrent.map
|
import net.corda.core.internal.concurrent.map
|
||||||
import net.corda.core.messaging.startFlow
|
import net.corda.core.messaging.startFlow
|
||||||
|
import net.corda.core.utilities.contextLogger
|
||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.core.utilities.loggerFor
|
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.node.services.Permissions
|
import net.corda.node.services.Permissions
|
||||||
import net.corda.testing.core.ALICE_NAME
|
import net.corda.testing.core.ALICE_NAME
|
||||||
@ -29,6 +29,9 @@ import java.util.concurrent.TimeUnit
|
|||||||
import kotlin.test.fail
|
import kotlin.test.fail
|
||||||
|
|
||||||
class P2PFlowsDrainingModeTest {
|
class P2PFlowsDrainingModeTest {
|
||||||
|
companion object {
|
||||||
|
private val logger = contextLogger()
|
||||||
|
}
|
||||||
|
|
||||||
private val portAllocation = PortAllocation.Incremental(10000)
|
private val portAllocation = PortAllocation.Incremental(10000)
|
||||||
private val user = User("mark", "dadada", setOf(Permissions.all()))
|
private val user = User("mark", "dadada", setOf(Permissions.all()))
|
||||||
@ -36,10 +39,6 @@ class P2PFlowsDrainingModeTest {
|
|||||||
|
|
||||||
private var executor: ScheduledExecutorService? = null
|
private var executor: ScheduledExecutorService? = null
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val logger = loggerFor<P2PFlowsDrainingModeTest>()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
executor = Executors.newSingleThreadScheduledExecutor()
|
executor = Executors.newSingleThreadScheduledExecutor()
|
||||||
|
@ -116,4 +116,4 @@ class ScheduledFlowIntegrationTests {
|
|||||||
assertEquals(aliceSpentStates.count(), bobSpentStates.count())
|
assertEquals(aliceSpentStates.count(), bobSpentStates.count())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,10 @@ import kotlin.concurrent.thread
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class HardRestartTest {
|
class HardRestartTest {
|
||||||
|
companion object {
|
||||||
|
val logConfigFile = ProjectStructure.projectRootDir / "config" / "dev" / "log4j2.xml"
|
||||||
|
}
|
||||||
|
|
||||||
@StartableByRPC
|
@StartableByRPC
|
||||||
@InitiatingFlow
|
@InitiatingFlow
|
||||||
class Ping(private val pongParty: Party, val times: Int) : FlowLogic<Unit>() {
|
class Ping(private val pongParty: Party, val times: Int) : FlowLogic<Unit>() {
|
||||||
@ -54,10 +58,6 @@ class HardRestartTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
val logConfigFile = ProjectStructure.projectRootDir / "config" / "dev" / "log4j2.xml"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun restartShortPingPongFlowRandomly() {
|
fun restartShortPingPongFlowRandomly() {
|
||||||
val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all()))
|
val demoUser = User("demo", "demo", setOf(Permissions.startFlow<Ping>(), Permissions.all()))
|
||||||
@ -257,4 +257,4 @@ class HardRestartTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,10 @@ class P2PMessagingTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun startDriverWithDistributedService(dsl: DriverDSL.(List<InProcess>) -> Unit) {
|
private fun startDriverWithDistributedService(dsl: DriverDSL.(List<InProcess>) -> Unit) {
|
||||||
driver(DriverParameters(startNodesInProcess = true, notarySpecs = listOf(NotarySpec(DISTRIBUTED_SERVICE_NAME, cluster = ClusterSpec.Raft(clusterSize = 2))))) {
|
driver(DriverParameters(
|
||||||
|
startNodesInProcess = true,
|
||||||
|
notarySpecs = listOf(NotarySpec(DISTRIBUTED_SERVICE_NAME, cluster = ClusterSpec.Raft(clusterSize = 2)))
|
||||||
|
)) {
|
||||||
dsl(defaultNotaryHandle.nodeHandles.getOrThrow().map { (it as InProcess) })
|
dsl(defaultNotaryHandle.nodeHandles.getOrThrow().map { (it as InProcess) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,4 @@ fun main(args: Array<String>) {
|
|||||||
// It will exit the process in case of startup failure and is not intended to be used by embedders. If you want
|
// It will exit the process in case of startup failure and is not intended to be used by embedders. If you want
|
||||||
// to embed Node in your own container, instantiate it directly and set up the configuration objects yourself.
|
// to embed Node in your own container, instantiate it directly and set up the configuration objects yourself.
|
||||||
NodeStartup().start(args)
|
NodeStartup().start(args)
|
||||||
}
|
}
|
||||||
|
@ -12,4 +12,3 @@ sealed class InitiatedFlowFactory<out F : FlowLogic<*>> {
|
|||||||
val appName: String,
|
val appName: String,
|
||||||
override val factory: (FlowSession) -> F) : InitiatedFlowFactory<F>()
|
override val factory: (FlowSession) -> F) : InitiatedFlowFactory<F>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ class PersistentKeyManagementService(val identityService: PersistentIdentityServ
|
|||||||
@Entity
|
@Entity
|
||||||
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}our_key_pairs")
|
@javax.persistence.Table(name = "${NODE_DATABASE_PREFIX}our_key_pairs")
|
||||||
class PersistentKey(
|
class PersistentKey(
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "public_key_hash", length = MAX_HASH_HEX_SIZE, nullable = false)
|
@Column(name = "public_key_hash", length = MAX_HASH_HEX_SIZE, nullable = false)
|
||||||
var publicKeyHash: String,
|
var publicKeyHash: String,
|
||||||
@ -51,8 +50,7 @@ class PersistentKeyManagementService(val identityService: PersistentIdentityServ
|
|||||||
return AppendOnlyPersistentMap(
|
return AppendOnlyPersistentMap(
|
||||||
"PersistentKeyManagementService_keys",
|
"PersistentKeyManagementService_keys",
|
||||||
toPersistentEntityKey = { it.toStringShort() },
|
toPersistentEntityKey = { it.toStringShort() },
|
||||||
fromPersistentEntity = { Pair(Crypto.decodePublicKey(it.publicKey), Crypto.decodePrivateKey(
|
fromPersistentEntity = { Pair(Crypto.decodePublicKey(it.publicKey), Crypto.decodePrivateKey(it.privateKey)) },
|
||||||
it.privateKey)) },
|
|
||||||
toPersistentEntity = { key: PublicKey, value: PrivateKey ->
|
toPersistentEntity = { key: PublicKey, value: PrivateKey ->
|
||||||
PersistentKey(key, value)
|
PersistentKey(key, value)
|
||||||
},
|
},
|
||||||
|
@ -336,6 +336,7 @@ class RPCServer(
|
|||||||
context.invocation.pushToLoggingContext()
|
context.invocation.pushToLoggingContext()
|
||||||
when (arguments) {
|
when (arguments) {
|
||||||
is Try.Success -> {
|
is Try.Success -> {
|
||||||
|
log.debug { "Arguments: ${arguments.value.toTypedArray().contentDeepToString()}" }
|
||||||
rpcExecutor!!.submit {
|
rpcExecutor!!.submit {
|
||||||
val result = invokeRpc(context, clientToServer.methodName, arguments.value)
|
val result = invokeRpc(context, clientToServer.methodName, arguments.value)
|
||||||
sendReply(clientToServer.replyId, clientToServer.clientAddress, result)
|
sendReply(clientToServer.replyId, clientToServer.clientAddress, result)
|
||||||
|
@ -65,7 +65,7 @@ class DBCheckpointStorage : CheckpointStorage {
|
|||||||
|
|
||||||
override fun getCheckpoint(id: StateMachineRunId): SerializedBytes<Checkpoint>? {
|
override fun getCheckpoint(id: StateMachineRunId): SerializedBytes<Checkpoint>? {
|
||||||
val bytes = currentDBSession().get(DBCheckpoint::class.java, id.uuid.toString())?.checkpoint ?: return null
|
val bytes = currentDBSession().get(DBCheckpoint::class.java, id.uuid.toString())?.checkpoint ?: return null
|
||||||
return SerializedBytes<Checkpoint>(bytes)
|
return SerializedBytes(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAllCheckpoints(): Stream<Pair<StateMachineRunId, SerializedBytes<Checkpoint>>> {
|
override fun getAllCheckpoints(): Stream<Pair<StateMachineRunId, SerializedBytes<Checkpoint>>> {
|
||||||
@ -78,8 +78,8 @@ class DBCheckpointStorage : CheckpointStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCheckpointCount(connection: Connection): Long =
|
override fun getCheckpointCount(connection: Connection): Long {
|
||||||
try {
|
return try {
|
||||||
connection.prepareStatement("select count(*) from node_checkpoints").use { ps ->
|
connection.prepareStatement("select count(*) from node_checkpoints").use { ps ->
|
||||||
ps.executeQuery().use { rs ->
|
ps.executeQuery().use { rs ->
|
||||||
rs.next()
|
rs.next()
|
||||||
@ -90,5 +90,5 @@ class DBCheckpointStorage : CheckpointStorage {
|
|||||||
// Happens when the table was not created yet.
|
// Happens when the table was not created yet.
|
||||||
0L
|
0L
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,4 +366,4 @@ class KryoTests(private val compression: CordaSerializationEncoding?) {
|
|||||||
assertEquals(20222, uncompressedSize)
|
assertEquals(20222, uncompressedSize)
|
||||||
assertEquals(1111, compressedSize)
|
assertEquals(1111, compressedSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package net.corda.node.services.network
|
|||||||
|
|
||||||
import net.corda.core.crypto.generateKeyPair
|
import net.corda.core.crypto.generateKeyPair
|
||||||
import net.corda.core.node.services.NetworkMapCache
|
import net.corda.core.node.services.NetworkMapCache
|
||||||
|
import net.corda.node.services.api.NetworkMapCacheInternal
|
||||||
import net.corda.testing.core.ALICE_NAME
|
import net.corda.testing.core.ALICE_NAME
|
||||||
import net.corda.testing.core.BOB_NAME
|
import net.corda.testing.core.BOB_NAME
|
||||||
import net.corda.node.services.api.NetworkMapCacheInternal
|
|
||||||
import net.corda.testing.core.getTestPartyAndCertificate
|
import net.corda.testing.core.getTestPartyAndCertificate
|
||||||
import net.corda.testing.core.singleIdentity
|
import net.corda.testing.core.singleIdentity
|
||||||
import net.corda.testing.node.internal.InternalMockNetwork
|
import net.corda.testing.node.internal.InternalMockNetwork
|
||||||
|
@ -4,8 +4,8 @@ import net.corda.core.internal.div
|
|||||||
import net.corda.testing.core.DUMMY_BANK_A_NAME
|
import net.corda.testing.core.DUMMY_BANK_A_NAME
|
||||||
import net.corda.testing.core.DUMMY_BANK_B_NAME
|
import net.corda.testing.core.DUMMY_BANK_B_NAME
|
||||||
import net.corda.testing.driver.DriverParameters
|
import net.corda.testing.driver.DriverParameters
|
||||||
import net.corda.testing.node.User
|
|
||||||
import net.corda.testing.driver.driver
|
import net.corda.testing.driver.driver
|
||||||
|
import net.corda.testing.node.User
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
* This file is exclusively for being able to run your nodes through an IDE (as opposed to running deployNodes)
|
||||||
|
@ -8,8 +8,8 @@ import net.corda.testing.core.BOC_NAME
|
|||||||
import net.corda.testing.core.DUMMY_BANK_A_NAME
|
import net.corda.testing.core.DUMMY_BANK_A_NAME
|
||||||
import net.corda.testing.core.DUMMY_BANK_B_NAME
|
import net.corda.testing.core.DUMMY_BANK_B_NAME
|
||||||
import net.corda.testing.driver.DriverParameters
|
import net.corda.testing.driver.DriverParameters
|
||||||
import net.corda.testing.node.User
|
|
||||||
import net.corda.testing.driver.driver
|
import net.corda.testing.driver.driver
|
||||||
|
import net.corda.testing.node.User
|
||||||
import net.corda.traderdemo.flow.CommercialPaperIssueFlow
|
import net.corda.traderdemo.flow.CommercialPaperIssueFlow
|
||||||
import net.corda.traderdemo.flow.SellerFlow
|
import net.corda.traderdemo.flow.SellerFlow
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.corda.serialization.internal.carpenter
|
package net.corda.serialization.internal.carpenter
|
||||||
|
|
||||||
import jdk.internal.org.objectweb.asm.Opcodes.*
|
|
||||||
import net.corda.core.DeleteForDJVM
|
import net.corda.core.DeleteForDJVM
|
||||||
import org.objectweb.asm.ClassWriter
|
import org.objectweb.asm.ClassWriter
|
||||||
import org.objectweb.asm.MethodVisitor
|
import org.objectweb.asm.MethodVisitor
|
||||||
|
import org.objectweb.asm.Opcodes.*
|
||||||
import org.objectweb.asm.Type
|
import org.objectweb.asm.Type
|
||||||
|
|
||||||
abstract class Field(val field: Class<out Any?>) {
|
abstract class Field(val field: Class<out Any?>) {
|
||||||
|
@ -544,11 +544,11 @@ class EvolvabilityTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This test uses a NetworkParameters signed set of bytes generated by R3 Corda and
|
// This test uses a NetworkParameters signed set of bytes generated by Corda Enterprise and
|
||||||
// is here to ensure we can still read them. This test exists because of the break in
|
// is here to ensure we can still read them. This test exists because of the break in
|
||||||
// being able to deserialize an object serialized prior to some fixes to the fingerprinter.
|
// being able to deserialize an object serialized prior to some fixes to the fingerprinter.
|
||||||
//
|
//
|
||||||
// The file itself was generated from R3 Corda at commit
|
// The file itself was generated from Corda Enterprise at commit
|
||||||
// 6a6b6f256 Skip cache invalidation during init() - caches are still null.
|
// 6a6b6f256 Skip cache invalidation during init() - caches are still null.
|
||||||
//
|
//
|
||||||
// To regenerate the file un-ignore the test below this one (regenerate broken network parameters),
|
// To regenerate the file un-ignore the test below this one (regenerate broken network parameters),
|
||||||
@ -565,7 +565,7 @@ class EvolvabilityTests {
|
|||||||
//
|
//
|
||||||
// filename breakdown
|
// filename breakdown
|
||||||
// networkParams - because this is a serialised set of network parameters
|
// networkParams - because this is a serialised set of network parameters
|
||||||
// r3corda - generated by R3 Corda instead of Corda
|
// r3corda - generated by Corda Enterprise instead of Corda
|
||||||
// 6a6b6f256 - Commit sha of the build that generated the file we're testing against
|
// 6a6b6f256 - Commit sha of the build that generated the file we're testing against
|
||||||
//
|
//
|
||||||
val resource = "networkParams.r3corda.6a6b6f256"
|
val resource = "networkParams.r3corda.6a6b6f256"
|
||||||
|
Reference in New Issue
Block a user