mirror of
https://github.com/corda/corda.git
synced 2025-04-29 23:40:15 +00:00
ENT-1906: Publish DJVM artifact with its dependency information. (#3897)
Also migrate enclavelet code into testing:common jar.
This commit is contained in:
parent
9373c0fb8e
commit
e3ece00bea
@ -0,0 +1,21 @@
|
|||||||
|
@file:JvmName("Enclavelet")
|
||||||
|
package net.corda.deterministic.common
|
||||||
|
|
||||||
|
import net.corda.core.serialization.deserialize
|
||||||
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We assume the signatures were already checked outside the sandbox: the purpose of this code
|
||||||
|
* is simply to check the sensitive, app-specific parts of a transaction.
|
||||||
|
*
|
||||||
|
* TODO: Transaction data is meant to be encrypted under an enclave-private key.
|
||||||
|
*/
|
||||||
|
@Throws(Exception::class)
|
||||||
|
fun verifyInEnclave(reqBytes: ByteArray) {
|
||||||
|
deserialize(reqBytes).verify()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun deserialize(reqBytes: ByteArray): LedgerTransaction {
|
||||||
|
return reqBytes.deserialize<TransactionVerificationRequest>()
|
||||||
|
.toLedgerTransaction()
|
||||||
|
}
|
@ -1,11 +1,8 @@
|
|||||||
@file:JvmName("Enclavelet")
|
|
||||||
package net.corda.deterministic.txverify
|
package net.corda.deterministic.txverify
|
||||||
|
|
||||||
import net.corda.core.serialization.deserialize
|
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
|
||||||
import net.corda.deterministic.bytesOfResource
|
import net.corda.deterministic.bytesOfResource
|
||||||
import net.corda.deterministic.common.LocalSerializationRule
|
import net.corda.deterministic.common.LocalSerializationRule
|
||||||
import net.corda.deterministic.common.TransactionVerificationRequest
|
import net.corda.deterministic.common.verifyInEnclave
|
||||||
import net.corda.finance.contracts.asset.Cash.Commands.*
|
import net.corda.finance.contracts.asset.Cash.Commands.*
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.ClassRule
|
import org.junit.ClassRule
|
||||||
@ -30,23 +27,3 @@ class EnclaveletTest {
|
|||||||
assertThat(e).hasMessageContaining("Required ${Move::class.java.canonicalName} command")
|
assertThat(e).hasMessageContaining("Required ${Move::class.java.canonicalName} command")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns either null to indicate success when the transactions are validated, or a string with the
|
|
||||||
* contents of the error. Invoked via JNI in response to an enclave RPC. The argument is a serialised
|
|
||||||
* [TransactionVerificationRequest].
|
|
||||||
*
|
|
||||||
* Note that it is assumed the signatures were already checked outside the sandbox: the purpose of this code
|
|
||||||
* is simply to check the sensitive, app specific parts of a transaction.
|
|
||||||
*
|
|
||||||
* TODO: Transaction data is meant to be encrypted under an enclave-private key.
|
|
||||||
*/
|
|
||||||
@Throws(Exception::class)
|
|
||||||
private fun verifyInEnclave(reqBytes: ByteArray) {
|
|
||||||
deserialize(reqBytes).verify()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun deserialize(reqBytes: ByteArray): LedgerTransaction {
|
|
||||||
return reqBytes.deserialize<TransactionVerificationRequest>()
|
|
||||||
.toLedgerTransaction()
|
|
||||||
}
|
|
||||||
|
@ -11,10 +11,14 @@ ext {
|
|||||||
asm_version = '6.1.1'
|
asm_version = '6.1.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testCompile.extendsFrom shadow
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
shadow "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
shadow "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
compile "org.slf4j:slf4j-api:$slf4j_version"
|
shadow "org.slf4j:slf4j-api:$slf4j_version"
|
||||||
|
|
||||||
// ASM: byte code manipulation library
|
// ASM: byte code manipulation library
|
||||||
compile "org.ow2.asm:asm:$asm_version"
|
compile "org.ow2.asm:asm:$asm_version"
|
||||||
@ -22,7 +26,7 @@ dependencies {
|
|||||||
compile "org.ow2.asm:asm-commons:$asm_version"
|
compile "org.ow2.asm:asm-commons:$asm_version"
|
||||||
|
|
||||||
// Classpath scanner
|
// Classpath scanner
|
||||||
compile "io.github.lukehutch:fast-classpath-scanner:$fast_classpath_scanner_version"
|
shadow "io.github.lukehutch:fast-classpath-scanner:$fast_classpath_scanner_version"
|
||||||
|
|
||||||
// Test utilities
|
// Test utilities
|
||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
@ -35,11 +39,6 @@ jar.enabled = false
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
baseName 'corda-djvm'
|
baseName 'corda-djvm'
|
||||||
classifier ''
|
classifier ''
|
||||||
dependencies {
|
|
||||||
exclude(dependency('org.jetbrains.*:.*:.*'))
|
|
||||||
exclude(dependency('org.slf4j:.*:.*'))
|
|
||||||
exclude(dependency('io.github.lukehutch:.*:.*'))
|
|
||||||
}
|
|
||||||
relocate 'org.objectweb.asm', 'djvm.org.objectweb.asm'
|
relocate 'org.objectweb.asm', 'djvm.org.objectweb.asm'
|
||||||
}
|
}
|
||||||
assemble.dependsOn shadowJar
|
assemble.dependsOn shadowJar
|
||||||
@ -49,6 +48,7 @@ artifacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
publish {
|
publish {
|
||||||
|
dependenciesFrom configurations.shadow
|
||||||
disableDefaultJar true
|
disableDefaultJar true
|
||||||
name shadowJar.baseName
|
name shadowJar.baseName
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ dependencies {
|
|||||||
compile "com.jcabi:jcabi-manifests:$jcabi_manifests_version"
|
compile "com.jcabi:jcabi-manifests:$jcabi_manifests_version"
|
||||||
|
|
||||||
compile "info.picocli:picocli:$picocli_version"
|
compile "info.picocli:picocli:$picocli_version"
|
||||||
compile "io.github.lukehutch:fast-classpath-scanner:$fast_classpath_scanner_version"
|
|
||||||
compile project(path: ":djvm", configuration: "shadow")
|
compile project(path: ":djvm", configuration: "shadow")
|
||||||
|
|
||||||
// Deterministic runtime - used in whitelist generation
|
// Deterministic runtime - used in whitelist generation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user