mirror of
https://github.com/corda/corda.git
synced 2025-02-05 10:39:13 +00:00
Allow the node to cache sandboxed Corda byte-code for reuse.
This commit is contained in:
parent
d0ec1f060a
commit
e570f1f423
@ -29,7 +29,7 @@ snakeYamlVersion=1.19
|
|||||||
caffeineVersion=2.7.0
|
caffeineVersion=2.7.0
|
||||||
metricsVersion=4.1.0
|
metricsVersion=4.1.0
|
||||||
metricsNewRelicVersion=1.1.1
|
metricsNewRelicVersion=1.1.1
|
||||||
djvmVersion=5.0-SNAPSHOT
|
djvmVersion=1.0-SNAPSHOT
|
||||||
openSourceBranch=https://github.com/corda/corda/blob/master
|
openSourceBranch=https://github.com/corda/corda/blob/master
|
||||||
openSourceSamplesBranch=https://github.com/corda/samples/blob/master
|
openSourceSamplesBranch=https://github.com/corda/samples/blob/master
|
||||||
jolokiaAgentVersion=1.6.1
|
jolokiaAgentVersion=1.6.1
|
||||||
|
@ -180,15 +180,15 @@ dependencies {
|
|||||||
compile "com.typesafe:config:$typesafe_config_version"
|
compile "com.typesafe:config:$typesafe_config_version"
|
||||||
|
|
||||||
// Sandbox for deterministic contract verification
|
// Sandbox for deterministic contract verification
|
||||||
compile "net.corda:corda-djvm:$djvm_version"
|
compile "net.corda.djvm:corda-djvm:$djvm_version"
|
||||||
compile "net.corda:corda-djvm-serialization:$djvm_version"
|
compile "net.corda.djvm:corda-djvm-serialization:$djvm_version"
|
||||||
compile(project(':node:djvm')) {
|
compile(project(':node:djvm')) {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
jdkRt "net.corda:deterministic-rt:latest.integration"
|
jdkRt "net.corda:deterministic-rt:latest.integration"
|
||||||
deterministic project(path: ':core-deterministic', configuration: 'deterministicArtifacts')
|
deterministic project(path: ':core-deterministic', configuration: 'deterministicArtifacts')
|
||||||
deterministic project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
|
deterministic project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
|
||||||
deterministic("net.corda:corda-djvm-deserializers:$djvm_version") {
|
deterministic("net.corda.djvm:corda-djvm-deserializers:$djvm_version") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
deterministic(project(':node:djvm')) {
|
deterministic(project(':node:djvm')) {
|
||||||
|
@ -9,7 +9,6 @@ import net.corda.core.internal.*
|
|||||||
import net.corda.core.serialization.serialize
|
import net.corda.core.serialization.serialize
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
import net.corda.djvm.SandboxConfiguration
|
import net.corda.djvm.SandboxConfiguration
|
||||||
import net.corda.djvm.analysis.AnalysisConfiguration
|
|
||||||
import net.corda.djvm.execution.*
|
import net.corda.djvm.execution.*
|
||||||
import net.corda.djvm.messages.Message
|
import net.corda.djvm.messages.Message
|
||||||
import net.corda.djvm.source.ClassSource
|
import net.corda.djvm.source.ClassSource
|
||||||
@ -18,17 +17,11 @@ import net.corda.node.djvm.LtxFactory
|
|||||||
class DeterministicVerifier(
|
class DeterministicVerifier(
|
||||||
ltx: LedgerTransaction,
|
ltx: LedgerTransaction,
|
||||||
transactionClassLoader: ClassLoader,
|
transactionClassLoader: ClassLoader,
|
||||||
private val analysisConfiguration: AnalysisConfiguration
|
private val sandboxConfiguration: SandboxConfiguration
|
||||||
) : Verifier(ltx, transactionClassLoader) {
|
) : Verifier(ltx, transactionClassLoader) {
|
||||||
|
|
||||||
override fun verifyContracts() {
|
override fun verifyContracts() {
|
||||||
val configuration = SandboxConfiguration.createFor(
|
val result = IsolatedTask(ltx.id.toString(), sandboxConfiguration).run {
|
||||||
analysisConfiguration = analysisConfiguration,
|
|
||||||
profile = ExecutionProfile.DEFAULT,
|
|
||||||
enableTracing = false
|
|
||||||
)
|
|
||||||
|
|
||||||
val result = IsolatedTask(ltx.id.toString(), configuration).run {
|
|
||||||
val taskFactory = classLoader.createRawTaskFactory()
|
val taskFactory = classLoader.createRawTaskFactory()
|
||||||
val sandboxBasicInput = classLoader.createBasicInput()
|
val sandboxBasicInput = classLoader.createBasicInput()
|
||||||
|
|
||||||
@ -98,7 +91,6 @@ class DeterministicVerifier(
|
|||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun close() {
|
override fun close() {
|
||||||
// analysisConfiguration.closeAll()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,10 @@ import net.corda.core.serialization.CordaSerializable
|
|||||||
import net.corda.core.serialization.DeprecatedConstructorForDeserialization
|
import net.corda.core.serialization.DeprecatedConstructorForDeserialization
|
||||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
|
import net.corda.djvm.SandboxConfiguration
|
||||||
import net.corda.djvm.analysis.AnalysisConfiguration
|
import net.corda.djvm.analysis.AnalysisConfiguration
|
||||||
import net.corda.djvm.analysis.Whitelist
|
import net.corda.djvm.analysis.Whitelist
|
||||||
|
import net.corda.djvm.execution.ExecutionProfile
|
||||||
import net.corda.djvm.source.ApiSource
|
import net.corda.djvm.source.ApiSource
|
||||||
import net.corda.djvm.source.UserPathSource
|
import net.corda.djvm.source.UserPathSource
|
||||||
import net.corda.djvm.source.UserSource
|
import net.corda.djvm.source.UserSource
|
||||||
@ -20,15 +22,10 @@ class DeterministicVerifierFactoryService(
|
|||||||
private val bootstrapSource: ApiSource,
|
private val bootstrapSource: ApiSource,
|
||||||
private val cordaSource: UserSource?
|
private val cordaSource: UserSource?
|
||||||
) : SingletonSerializeAsToken(), AutoCloseable {
|
) : SingletonSerializeAsToken(), AutoCloseable {
|
||||||
|
private val baseSandboxConfiguration: SandboxConfiguration
|
||||||
|
|
||||||
fun specialise(ltx: LedgerTransaction, classLoader: ClassLoader): Verifier {
|
init {
|
||||||
return (classLoader as? URLClassLoader)?.run {
|
val baseAnalysisConfiguration = AnalysisConfiguration.createRoot(
|
||||||
DeterministicVerifier(ltx, classLoader, createSandbox(classLoader.urLs))
|
|
||||||
} ?: BasicVerifier(ltx, classLoader)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createSandbox(userSource: Array<URL>): AnalysisConfiguration {
|
|
||||||
return AnalysisConfiguration.createRoot(
|
|
||||||
userSource = cordaSource!!,
|
userSource = cordaSource!!,
|
||||||
whitelist = Whitelist.MINIMAL,
|
whitelist = Whitelist.MINIMAL,
|
||||||
visibleAnnotations = setOf(
|
visibleAnnotations = setOf(
|
||||||
@ -37,11 +34,23 @@ class DeterministicVerifierFactoryService(
|
|||||||
DeprecatedConstructorForDeserialization::class.java
|
DeprecatedConstructorForDeserialization::class.java
|
||||||
),
|
),
|
||||||
bootstrapSource = bootstrapSource
|
bootstrapSource = bootstrapSource
|
||||||
).createChild(
|
|
||||||
userSource = UserPathSource(userSource),
|
|
||||||
newMinimumSeverityLevel = null,
|
|
||||||
visibleAnnotations = emptySet()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
baseSandboxConfiguration = SandboxConfiguration.createFor(
|
||||||
|
analysisConfiguration = baseAnalysisConfiguration,
|
||||||
|
profile = ExecutionProfile.DEFAULT,
|
||||||
|
enableTracing = false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun specialise(ltx: LedgerTransaction, classLoader: ClassLoader): Verifier {
|
||||||
|
return (classLoader as? URLClassLoader)?.run {
|
||||||
|
DeterministicVerifier(ltx, classLoader, createSandbox(classLoader.urLs))
|
||||||
|
} ?: BasicVerifier(ltx, classLoader)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createSandbox(userSource: Array<URL>): SandboxConfiguration {
|
||||||
|
return baseSandboxConfiguration.createChild(UserPathSource(userSource))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user