ENT-11975: Fixed up merge issues.

This commit is contained in:
Adel El-Beik 2024-10-17 14:21:52 +01:00
parent 14f966ccd3
commit 8e6c4b3b87
5 changed files with 3 additions and 51 deletions

View File

@ -1,8 +1,5 @@
package net.corda.coretests.contracts
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.whenever
import net.corda.core.contracts.AlwaysAcceptAttachmentConstraint
import net.corda.core.contracts.AutomaticPlaceholderConstraint
import net.corda.core.contracts.BelongsToContract
@ -53,6 +50,9 @@ import org.junit.BeforeClass
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.whenever
import java.security.PublicKey
import java.util.jar.Attributes
import kotlin.test.assertFailsWith

View File

@ -1,31 +1,16 @@
package net.corda.coretests.contracts
import net.corda.core.contracts.CordaRotatedKeys
import net.corda.core.contracts.RotatedKeys
import net.corda.core.crypto.CompositeKey
import net.corda.core.crypto.sha256
import net.corda.core.identity.CordaX500Name
import net.corda.core.internal.hash
import net.corda.core.internal.retrieveRotatedKeys
import net.corda.core.node.ServiceHub
import net.corda.testing.core.TestIdentity
import net.corda.testing.core.internal.JarSignatureTestUtils.generateKey
import net.corda.testing.core.internal.SelfCleaningDir
import net.corda.testing.node.MockServices
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
class RotatedKeysTest {
@Test(timeout = 300_000)
fun validateDefaultRotatedKeysAreRetrievableFromMockServices() {
val services: ServiceHub = MockServices(TestIdentity(CordaX500Name("MegaCorp", "London", "GB")))
val rotatedKeys = services.retrieveRotatedKeys()
assertEquals( CordaRotatedKeys.keys.rotatedSigningKeys, rotatedKeys.rotatedSigningKeys)
}
@Test(timeout = 300_000)
fun `when input and output keys are the same canBeTransitioned returns true`() {
SelfCleaningDir().use { file ->

View File

@ -28,7 +28,6 @@ import net.corda.core.crypto.algorithm
import net.corda.core.crypto.internal.DigestAlgorithmFactory
import net.corda.core.flows.FlowLogic
import net.corda.core.identity.Party
import net.corda.core.node.ServiceHub
import net.corda.core.node.ServicesForResolution
import net.corda.core.serialization.MissingAttachmentsException
import net.corda.core.serialization.MissingAttachmentsRuntimeException
@ -45,27 +44,10 @@ import net.corda.core.transactions.FullTransaction
import net.corda.core.transactions.NotaryChangeWireTransaction
import net.corda.core.transactions.SignedTransaction
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.contextLogger
import java.io.ByteArrayOutputStream
import java.security.PublicKey
import kotlin.reflect.KClass
fun ServiceHub.retrieveRotatedKeys(): RotatedKeys {
if (this is ServiceHubCoreInternal) {
return this.rotatedKeys
}
var clazz: Class<*> = javaClass
while (true) {
if (clazz.name == "net.corda.testing.node.MockServices") {
return clazz.getDeclaredMethod("getRotatedKeys").apply { isAccessible = true }.invoke(this) as RotatedKeys
}
clazz = clazz.superclass ?: return CordaRotatedKeys.keys.also {
this.contextLogger().warn("${javaClass.name} is not a MockServices instance - returning default rotated keys")
}
}
}
/** Constructs a [NotaryChangeWireTransaction]. */
class NotaryChangeTransactionBuilder(val inputs: List<StateRef>,
val notary: Party,

View File

@ -222,13 +222,6 @@ data class FlowTimeoutConfiguration(
val backoffBase: Double
)
/**
* Represents a list of rotated CorDapp attachment signing keys.
*
* @param rotatedKeys This is a list of public key hashes (SHA-256) in uppercase hexidecimal, that are all equivalent.
*/
data class RotatedCorDappSignerKeyConfiguration(val rotatedKeys: List<String>)
data class TelemetryConfiguration(
val openTelemetryEnabled: Boolean,
val simpleLogTelemetryEnabled: Boolean,

View File

@ -214,14 +214,6 @@ internal object FlowTimeoutConfigurationSpec : Configuration.Specification<FlowT
}
}
internal object RotatedSignerKeySpec : Configuration.Specification<RotatedCorDappSignerKeyConfiguration>("RotatedCorDappSignerKeyConfiguration") {
private val rotatedKeys by string().listOrEmpty()
override fun parseValid(configuration: Config, options: Configuration.Options): Valid<RotatedCorDappSignerKeyConfiguration> {
val config = configuration.withOptions(options)
return valid(RotatedCorDappSignerKeyConfiguration(config[rotatedKeys]))
}
}
internal object TelemetryConfigurationSpec : Configuration.Specification<TelemetryConfiguration>("TelemetryConfiguration") {
private val openTelemetryEnabled by boolean()
private val simpleLogTelemetryEnabled by boolean()