mirror of
https://github.com/corda/corda.git
synced 2025-01-13 16:30:25 +00:00
Merge commit '29ccd4d' into os-merge-050318
This commit is contained in:
commit
596edcc2ae
@ -3054,28 +3054,30 @@ public static final class net.corda.core.serialization.SingletonSerializationTok
|
||||
public String toString()
|
||||
##
|
||||
@net.corda.core.DoNotImplement public final class net.corda.core.transactions.ContractUpgradeLedgerTransaction extends net.corda.core.transactions.FullTransaction implements net.corda.core.transactions.TransactionWithSignatures
|
||||
public <init>(List, net.corda.core.identity.Party, net.corda.core.contracts.ContractAttachment, net.corda.core.contracts.ContractAttachment, net.corda.core.crypto.SecureHash, net.corda.core.contracts.PrivacySalt, List, net.corda.core.node.NetworkParameters)
|
||||
public <init>(List, net.corda.core.identity.Party, net.corda.core.contracts.Attachment, String, net.corda.core.contracts.Attachment, net.corda.core.crypto.SecureHash, net.corda.core.contracts.PrivacySalt, List, net.corda.core.node.NetworkParameters)
|
||||
public void checkSignaturesAreValid()
|
||||
@org.jetbrains.annotations.NotNull public final List component1()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.identity.Party component2()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.ContractAttachment component3()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.ContractAttachment component4()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.crypto.SecureHash component5()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.PrivacySalt component6()
|
||||
@org.jetbrains.annotations.NotNull public final List component7()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.transactions.ContractUpgradeLedgerTransaction copy(List, net.corda.core.identity.Party, net.corda.core.contracts.ContractAttachment, net.corda.core.contracts.ContractAttachment, net.corda.core.crypto.SecureHash, net.corda.core.contracts.PrivacySalt, List, net.corda.core.node.NetworkParameters)
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.Attachment component3()
|
||||
@org.jetbrains.annotations.NotNull public final String component4()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.Attachment component5()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.crypto.SecureHash component6()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.PrivacySalt component7()
|
||||
@org.jetbrains.annotations.NotNull public final List component8()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.transactions.ContractUpgradeLedgerTransaction copy(List, net.corda.core.identity.Party, net.corda.core.contracts.Attachment, String, net.corda.core.contracts.Attachment, net.corda.core.crypto.SecureHash, net.corda.core.contracts.PrivacySalt, List, net.corda.core.node.NetworkParameters)
|
||||
public boolean equals(Object)
|
||||
@org.jetbrains.annotations.NotNull public net.corda.core.crypto.SecureHash getId()
|
||||
@org.jetbrains.annotations.NotNull public List getInputs()
|
||||
@org.jetbrains.annotations.NotNull public List getKeyDescriptions(Set)
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.ContractAttachment getLegacyContractAttachment()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.Attachment getLegacyContractAttachment()
|
||||
@org.jetbrains.annotations.NotNull public Set getMissingSigners()
|
||||
@org.jetbrains.annotations.NotNull public net.corda.core.identity.Party getNotary()
|
||||
@org.jetbrains.annotations.NotNull public List getOutputs()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.PrivacySalt getPrivacySalt()
|
||||
@org.jetbrains.annotations.NotNull public Set getRequiredSigningKeys()
|
||||
@org.jetbrains.annotations.NotNull public List getSigs()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.ContractAttachment getUpgradedContractAttachment()
|
||||
@org.jetbrains.annotations.NotNull public final String getUpgradeContractClassName()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.contracts.Attachment getUpgradedContractAttachment()
|
||||
public int hashCode()
|
||||
public String toString()
|
||||
public void verifyRequiredSignatures()
|
||||
|
4
.idea/compiler.xml
generated
4
.idea/compiler.xml
generated
@ -24,6 +24,8 @@
|
||||
<module name="capsule-hsm-cert-generator_test" target="1.8" />
|
||||
<module name="capsule-hsm_main" target="1.8" />
|
||||
<module name="capsule-hsm_test" target="1.8" />
|
||||
<module name="canonicalizer_main" target="1.8" />
|
||||
<module name="canonicalizer_test" target="1.8" />
|
||||
<module name="client_main" target="1.8" />
|
||||
<module name="client_test" target="1.8" />
|
||||
<module name="confidential-identities_main" target="1.8" />
|
||||
@ -171,4 +173,4 @@
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="-parameters" />
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
|
@ -72,6 +72,7 @@ buildscript {
|
||||
ext.liquibase_version = '3.5.3'
|
||||
ext.shadow_version = '2.0.2'
|
||||
ext.hikari_version = '2.5.1'
|
||||
ext.artifactory_contextUrl = 'https://ci-artifactory.corda.r3cev.com/artifactory'
|
||||
ext.snake_yaml_version = constants.getProperty('snakeYamlVersion')
|
||||
ext.docker_compose_rule_version = '0.33.0'
|
||||
ext.selenium_version = '3.8.1'
|
||||
@ -90,6 +91,9 @@ buildscript {
|
||||
maven {
|
||||
url 'https://dl.bintray.com/kotlin/kotlin-eap/'
|
||||
}
|
||||
maven {
|
||||
url "$artifactory_contextUrl/corda-releases"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
@ -221,6 +225,7 @@ allprojects {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "$artifactory_contextUrl/corda-releases" } // cordform-common
|
||||
maven {
|
||||
// For integrationTest task when running against Oracle database the JDBC driver is in Oracle Maven repository with login access only,
|
||||
// setup an account on https://login.oracle.com/oaam_server/login.do
|
||||
@ -347,7 +352,7 @@ task buildCordappDependenciesZip(type: Zip) {
|
||||
|
||||
artifactory {
|
||||
publish {
|
||||
contextUrl = 'https://ci-artifactory.corda.r3cev.com/artifactory'
|
||||
contextUrl = artifactory_contextUrl
|
||||
repository {
|
||||
repoKey = 'enterprise-dev'
|
||||
username = 'teamcity'
|
||||
|
@ -47,7 +47,6 @@ public class StandaloneCordaRPCJavaClientTest {
|
||||
port.getAndIncrement(),
|
||||
port.getAndIncrement(),
|
||||
port.getAndIncrement(),
|
||||
port.getAndIncrement(),
|
||||
true,
|
||||
Collections.singletonList(rpcUser),
|
||||
true,
|
||||
|
@ -61,7 +61,6 @@ class StandaloneCordaRPClientTest {
|
||||
p2pPort = port.andIncrement,
|
||||
rpcPort = port.andIncrement,
|
||||
rpcAdminPort = port.andIncrement,
|
||||
webPort = port.andIncrement,
|
||||
isNotary = true,
|
||||
users = listOf(user)
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
gradlePluginsVersion=4.0.4
|
||||
gradlePluginsVersion=4.0.5
|
||||
kotlinVersion=1.2.20
|
||||
platformVersion=4
|
||||
guavaVersion=21.0
|
||||
|
@ -48,7 +48,6 @@ data class ContractUpgradeWireTransaction(
|
||||
/** Resolves input states and contract attachments, and builds a ContractUpgradeLedgerTransaction. */
|
||||
fun resolve(services: ServicesForResolution, sigs: List<TransactionSignature>): ContractUpgradeLedgerTransaction {
|
||||
val resolvedInputs = services.loadStates(inputs.toSet()).toList()
|
||||
val legacyContractClassName = resolvedInputs.first().state.contract
|
||||
val legacyContractAttachment = services.attachments.openAttachment(legacyContractAttachmentId)
|
||||
?: throw AttachmentResolutionException(legacyContractAttachmentId)
|
||||
val upgradedContractAttachment = services.attachments.openAttachment(upgradedContractAttachmentId)
|
||||
@ -56,8 +55,9 @@ data class ContractUpgradeWireTransaction(
|
||||
return ContractUpgradeLedgerTransaction(
|
||||
resolvedInputs,
|
||||
notary,
|
||||
ContractAttachment(legacyContractAttachment, legacyContractClassName),
|
||||
ContractAttachment(upgradedContractAttachment, upgradeContractClassName),
|
||||
legacyContractAttachment,
|
||||
upgradeContractClassName,
|
||||
upgradedContractAttachment,
|
||||
id,
|
||||
privacySalt,
|
||||
sigs,
|
||||
@ -102,40 +102,47 @@ data class ContractUpgradeFilteredTransaction(
|
||||
data class ContractUpgradeLedgerTransaction(
|
||||
override val inputs: List<StateAndRef<ContractState>>,
|
||||
override val notary: Party,
|
||||
val legacyContractAttachment: ContractAttachment,
|
||||
val upgradedContractAttachment: ContractAttachment,
|
||||
val legacyContractAttachment: Attachment,
|
||||
val upgradeContractClassName: ContractClassName,
|
||||
val upgradedContractAttachment: Attachment,
|
||||
override val id: SecureHash,
|
||||
val privacySalt: PrivacySalt,
|
||||
override val sigs: List<TransactionSignature>,
|
||||
private val networkParameters: NetworkParameters
|
||||
) : FullTransaction(), TransactionWithSignatures {
|
||||
/** The legacy contract class name is determined by the first input state. */
|
||||
private val legacyContractClassName = inputs.first().state.contract
|
||||
private val upgradedContract: UpgradedContract<ContractState, *> = loadUpgradedContract()
|
||||
|
||||
init {
|
||||
// TODO: relax this constraint once upgrading encumbered states is supported
|
||||
check(inputs.all { it.state.contract == legacyContractAttachment.contract }) {
|
||||
// TODO: relax this constraint once upgrading encumbered states is supported.
|
||||
check(inputs.all { it.state.contract == legacyContractClassName }) {
|
||||
"All input states must point to the legacy contract"
|
||||
}
|
||||
check(inputs.all { it.state.constraint.isSatisfiedBy(legacyContractAttachment) }) {
|
||||
"Legacy contract constraint does not satisfy the constraint of the input states"
|
||||
}
|
||||
verifyLegacyContractConstraint()
|
||||
}
|
||||
|
||||
private fun verifyLegacyContractConstraint() {
|
||||
check(upgradedContract.legacyContract == legacyContractAttachment.contract) {
|
||||
check(upgradedContract.legacyContract == legacyContractClassName) {
|
||||
"Outputs' contract must be an upgraded version of the inputs' contract"
|
||||
}
|
||||
val attachmentWithContext = AttachmentWithContext(
|
||||
legacyContractAttachment,
|
||||
verifyConstraints()
|
||||
}
|
||||
|
||||
private fun verifyConstraints() {
|
||||
val attachmentForConstraintVerification = AttachmentWithContext(
|
||||
legacyContractAttachment as? ContractAttachment
|
||||
?: ContractAttachment(legacyContractAttachment, legacyContractClassName),
|
||||
upgradedContract.legacyContract,
|
||||
networkParameters.whitelistedContractImplementations
|
||||
)
|
||||
|
||||
// TODO: exclude encumbrance states from this check
|
||||
check(inputs.all { it.state.constraint.isSatisfiedBy(attachmentForConstraintVerification) }) {
|
||||
"Legacy contract constraint does not satisfy the constraint of the input states"
|
||||
}
|
||||
|
||||
val constraintCheck = if (upgradedContract is UpgradedContractWithLegacyConstraint) {
|
||||
upgradedContract.legacyContractConstraint.isSatisfiedBy(attachmentWithContext)
|
||||
upgradedContract.legacyContractConstraint.isSatisfiedBy(attachmentForConstraintVerification)
|
||||
} else {
|
||||
// If legacy constraint not specified, defaulting to WhitelistedByZoneAttachmentConstraint
|
||||
WhitelistedByZoneAttachmentConstraint.isSatisfiedBy(attachmentWithContext)
|
||||
WhitelistedByZoneAttachmentConstraint.isSatisfiedBy(attachmentForConstraintVerification)
|
||||
}
|
||||
check(constraintCheck) {
|
||||
"Legacy contract does not satisfy the upgraded contract's constraint"
|
||||
@ -158,7 +165,7 @@ data class ContractUpgradeLedgerTransaction(
|
||||
// TODO: re-map encumbrance pointers
|
||||
input.state.copy(
|
||||
data = upgradedState,
|
||||
contract = upgradedContractAttachment.contract,
|
||||
contract = upgradeContractClassName,
|
||||
constraint = outputConstraint
|
||||
)
|
||||
}
|
||||
@ -175,7 +182,7 @@ data class ContractUpgradeLedgerTransaction(
|
||||
private fun loadUpgradedContract(): UpgradedContract<ContractState, *> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return this::class.java.classLoader
|
||||
.loadClass(upgradedContractAttachment.contract)
|
||||
.loadClass(upgradeContractClassName)
|
||||
.asSubclass(Contract::class.java)
|
||||
.getConstructor()
|
||||
.newInstance() as UpgradedContract<ContractState, *>
|
||||
|
@ -38,7 +38,6 @@ class NodeVersioningTest {
|
||||
p2pPort = port.andIncrement,
|
||||
rpcPort = port.andIncrement,
|
||||
rpcAdminPort = port.andIncrement,
|
||||
webPort = port.andIncrement,
|
||||
isNotary = false,
|
||||
users = listOf(user)
|
||||
)
|
||||
|
@ -34,7 +34,6 @@ class CordappSmokeTest {
|
||||
p2pPort = port.andIncrement,
|
||||
rpcPort = port.andIncrement,
|
||||
rpcAdminPort = port.andIncrement,
|
||||
webPort = port.andIncrement,
|
||||
isNotary = false,
|
||||
users = listOf(user)
|
||||
)
|
||||
|
@ -58,9 +58,10 @@ signed ``NodeInfo`` object that the network map service vends. These are automat
|
||||
be used to supplement or replace the HTTP network map. If the same node is advertised through both mechanisms then the
|
||||
latest one is taken.
|
||||
|
||||
On startup the node generates its own signed node info file, filename of the format ``nodeInfo-${hash}``. To create a simple
|
||||
network without the HTTP network map service then simply place this file in the ``additional-node-infos`` directory
|
||||
of every node that's part of this network. For example, a simple way to do this is to use rsync.
|
||||
On startup the node generates its own signed node info file, filename of the format ``nodeInfo-${hash}``. It can also be
|
||||
generated using the ``--just-generate-node-info`` command line flag without starting the node. To create a simple network
|
||||
without the HTTP network map service simply place this file in the ``additional-node-infos`` directory of every node that's
|
||||
part of this network. For example, a simple way to do this is to use rsync.
|
||||
|
||||
Usually, test networks have a structure that is known ahead of time. For the creation of such networks we provide a
|
||||
``network-bootstrapper`` tool. This tool pre-generates node configuration directories if given the IP addresses/domain
|
||||
@ -98,13 +99,20 @@ The current set of network parameters:
|
||||
|
||||
:minimumPlatformVersion: The minimum platform version that the nodes must be running. Any node which is below this will
|
||||
not start.
|
||||
|
||||
:notaries: List of identity and validation type (either validating or non-validating) of the notaries which are permitted
|
||||
in the compatibility zone.
|
||||
:maxMessageSize: Maximum allowed size in bytes of an individual message sent over the wire. Note that attachments are
|
||||
|
||||
:maxMessageSize: (This is currently ignored. However, it will be wired up in a future release.)
|
||||
|
||||
.. TODO Replace the above with this once wired: Maximum allowed size in bytes of an individual message sent over the wire. Note that attachments are
|
||||
a special case and may be fragmented for streaming transfer, however, an individual transaction or flow message
|
||||
may not be larger than this value.
|
||||
|
||||
:maxTransactionSize: Maximum allowed size in bytes of a transaction. This is the size of the transaction object and its attachments.
|
||||
|
||||
:modifiedTime: The time when the network parameters were last modified by the compatibility zone operator.
|
||||
|
||||
:epoch: Version number of the network parameters. Starting from 1, this will always increment whenever any of the
|
||||
parameters change.
|
||||
:whitelistedContractImplementations: List of whitelisted versions of contract code.
|
||||
|
@ -93,6 +93,9 @@ open class Node(configuration: NodeConfiguration,
|
||||
CordappLoader.createDefaultWithTestPackages(configuration, scanPackages.split(scanPackagesSeparator))
|
||||
} ?: CordappLoader.createDefault(configuration.baseDirectory)
|
||||
}
|
||||
|
||||
// TODO Wire up maxMessageSize
|
||||
const val MAX_FILE_SIZE = 10485760
|
||||
}
|
||||
|
||||
override val log: Logger get() = staticLog
|
||||
@ -166,7 +169,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
startLocalRpcBroker(networkParameters)
|
||||
}
|
||||
val advertisedAddress = info.addresses[0]
|
||||
bridgeControlListener = BridgeControlListener(configuration, serverAddress, networkParameters.maxMessageSize)
|
||||
bridgeControlListener = BridgeControlListener(configuration, serverAddress, /*networkParameters.maxMessageSize*/MAX_FILE_SIZE)
|
||||
|
||||
printBasicNodeInfo("Advertised P2P messaging addresses", info.addresses.joinToString())
|
||||
|
||||
@ -174,10 +177,10 @@ open class Node(configuration: NodeConfiguration,
|
||||
rpcThreadPoolSize = configuration.enterpriseConfiguration.tuning.rpcThreadPoolSize
|
||||
)
|
||||
rpcServerAddresses?.let {
|
||||
rpcMessagingClient = RPCMessagingClient(configuration.rpcOptions.sslConfig, it.admin, networkParameters.maxMessageSize, rpcServerConfiguration)
|
||||
rpcMessagingClient = RPCMessagingClient(configuration.rpcOptions.sslConfig, it.admin, /*networkParameters.maxMessageSize*/MAX_FILE_SIZE, rpcServerConfiguration)
|
||||
}
|
||||
verifierMessagingClient = when (configuration.verifierType) {
|
||||
VerifierType.OutOfProcess -> VerifierMessagingClient(configuration, serverAddress, services.monitoringService.metrics, networkParameters.maxMessageSize)
|
||||
VerifierType.OutOfProcess -> VerifierMessagingClient(configuration, serverAddress, services.monitoringService.metrics, /*networkParameters.maxMessageSize*/MAX_FILE_SIZE)
|
||||
VerifierType.InMemory -> null
|
||||
}
|
||||
require(info.legalIdentities.size in 1..2) { "Currently nodes must have a primary address and optionally one serviced address" }
|
||||
@ -193,7 +196,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
services.networkMapCache,
|
||||
services.monitoringService.metrics,
|
||||
advertisedAddress,
|
||||
networkParameters.maxMessageSize,
|
||||
/*networkParameters.maxMessageSize*/MAX_FILE_SIZE,
|
||||
nodeProperties.flowsDrainingMode::isEnabled,
|
||||
nodeProperties.flowsDrainingMode.values)
|
||||
}
|
||||
@ -205,24 +208,9 @@ open class Node(configuration: NodeConfiguration,
|
||||
val rpcBrokerDirectory: Path = baseDirectory / "brokers" / "rpc"
|
||||
with(rpcOptions) {
|
||||
rpcBroker = if (useSsl) {
|
||||
ArtemisRpcBroker.withSsl(
|
||||
this.address!!,
|
||||
sslConfig,
|
||||
securityManager,
|
||||
certificateChainCheckPolicies,
|
||||
networkParameters.maxMessageSize,
|
||||
jmxMonitoringHttpPort != null,
|
||||
rpcBrokerDirectory)
|
||||
ArtemisRpcBroker.withSsl(this.address!!, sslConfig, securityManager, certificateChainCheckPolicies, /*networkParameters.maxMessageSize*/MAX_FILE_SIZE, jmxMonitoringHttpPort != null, rpcBrokerDirectory)
|
||||
} else {
|
||||
ArtemisRpcBroker.withoutSsl(
|
||||
this.address!!,
|
||||
adminAddress!!,
|
||||
sslConfig,
|
||||
securityManager,
|
||||
certificateChainCheckPolicies,
|
||||
networkParameters.maxMessageSize,
|
||||
jmxMonitoringHttpPort != null,
|
||||
rpcBrokerDirectory)
|
||||
ArtemisRpcBroker.withoutSsl(this.address!!, adminAddress!!, sslConfig, securityManager, certificateChainCheckPolicies, /*networkParameters.maxMessageSize*/MAX_FILE_SIZE, jmxMonitoringHttpPort != null, rpcBrokerDirectory)
|
||||
}
|
||||
}
|
||||
return rpcBroker!!.addresses
|
||||
@ -232,7 +220,7 @@ open class Node(configuration: NodeConfiguration,
|
||||
|
||||
private fun makeLocalMessageBroker(networkParameters: NetworkParameters): NetworkHostAndPort {
|
||||
with(configuration) {
|
||||
messageBroker = ArtemisMessagingServer(this, p2pAddress.port, networkParameters.maxMessageSize)
|
||||
messageBroker = ArtemisMessagingServer(this, p2pAddress.port, /*networkParameters.maxMessageSize*/MAX_FILE_SIZE)
|
||||
return NetworkHostAndPort("localhost", p2pAddress.port)
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ class NodeConfig(
|
||||
val p2pPort: Int,
|
||||
val rpcPort: Int,
|
||||
val rpcAdminPort: Int,
|
||||
val webPort: Int,
|
||||
val isNotary: Boolean,
|
||||
val users: List<User>,
|
||||
val runMigration: Boolean = true,
|
||||
@ -34,7 +33,6 @@ class NodeConfig(
|
||||
val config = empty()
|
||||
.withValue("myLegalName", valueFor(legalName.toString()))
|
||||
.withValue("p2pAddress", addressValueFor(p2pPort))
|
||||
.withValue("webAddress", addressValueFor(webPort))
|
||||
.withValue("rpcSettings", empty()
|
||||
.withValue("address", addressValueFor(rpcPort))
|
||||
.withValue("adminAddress", addressValueFor(rpcAdminPort))
|
||||
|
Loading…
Reference in New Issue
Block a user