Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(weaver-corda): support array of remote views, consequent user fl… #2638

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/test_weaver-data-sharing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ jobs:
TOTAL=8

# CORDA-CORDA2
./clients/build/install/clients/bin/clients request-state localhost:9081 relay-corda2:9082/Corda_Network2/corda_network2_partya_1:10003#com.cordaSimpleApplication.flow.GetStateByKey:H 1> tmp.out
./clients/build/install/clients/bin/clients request-state --wkey=H localhost:9081 relay-corda2:9082/Corda_Network2/corda_network2_partya_1:10003#com.cordaSimpleApplication.flow.GetStateByKey:H 1> tmp.out
cat tmp.out | grep "SimpleState(key=H, value=\[SimpleState(key=H, value=1" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand All @@ -629,7 +629,7 @@ jobs:

# CORDA2-CORDA

NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state localhost:9082 relay-corda:9081/Corda_Network/corda_partya_1:10003#com.cordaSimpleApplication.flow.GetStateByKey:C 1> tmp.out
NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state --wkey=C localhost:9082 relay-corda:9081/Corda_Network/corda_partya_1:10003#com.cordaSimpleApplication.flow.GetStateByKey:C 1> tmp.out
cat tmp.out | grep "SimpleState(key=C, value=\[SimpleState(key=C, value=20" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand All @@ -638,7 +638,7 @@ jobs:
cat tmp.out

# CORDA - FABRIC1
./clients/build/install/clients/bin/clients request-state localhost:9081 relay-network1:9080/network1/mychannel:simplestate:Read:a 1> tmp.out
./clients/build/install/clients/bin/clients request-state --wkey=a localhost:9081 relay-network1:9080/network1/mychannel:simplestate:Read:a 1> tmp.out
cat tmp.out | grep "SimpleState(key=a, value=Arcturus" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand All @@ -647,7 +647,7 @@ jobs:
cat tmp.out

# CORDA - FABRIC2
./clients/build/install/clients/bin/clients request-state localhost:9081 relay-network2:9083/network2/mychannel:simplestate:Read:Arcturus 1> tmp.out
./clients/build/install/clients/bin/clients request-state --wkey=Arcturus localhost:9081 relay-network2:9083/network2/mychannel:simplestate:Read:Arcturus 1> tmp.out
cat tmp.out | grep "SimpleState(key=Arcturus, value=17.671" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand Down Expand Up @@ -1029,7 +1029,7 @@ jobs:
TOTAL=8

# CORDA-CORDA2
./clients/build/install/clients/bin/clients request-state localhost:9081 localhost:9082/Corda_Network2/localhost:30006#com.cordaSimpleApplication.flow.GetStateByKey:H 1> tmp.out
./clients/build/install/clients/bin/clients request-state --wkey=H localhost:9081 localhost:9082/Corda_Network2/localhost:30006#com.cordaSimpleApplication.flow.GetStateByKey:H 1> tmp.out
cat tmp.out | grep "SimpleState(key=H, value=\[SimpleState(key=H, value=1" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand All @@ -1039,7 +1039,7 @@ jobs:

# CORDA2-CORDA

NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state localhost:9082 localhost:9081/Corda_Network/localhost:10006#com.cordaSimpleApplication.flow.GetStateByKey:C 1> tmp.out
NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state --wkey=C localhost:9082 localhost:9081/Corda_Network/localhost:10006#com.cordaSimpleApplication.flow.GetStateByKey:C 1> tmp.out
cat tmp.out | grep "SimpleState(key=C, value=\[SimpleState(key=C, value=20" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand All @@ -1048,7 +1048,7 @@ jobs:
cat tmp.out

# CORDA - FABRIC1
./clients/build/install/clients/bin/clients request-state localhost:9081 localhost:9080/network1/mychannel:simplestate:Read:a 1> tmp.out
./clients/build/install/clients/bin/clients request-state --wkey=a localhost:9081 localhost:9080/network1/mychannel:simplestate:Read:a 1> tmp.out
cat tmp.out | grep "SimpleState(key=a, value=Arcturus" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand All @@ -1057,7 +1057,7 @@ jobs:
cat tmp.out

# CORDA - FABRIC2
./clients/build/install/clients/bin/clients request-state localhost:9081 localhost:9083/network2/mychannel:simplestate:Read:Arcturus 1> tmp.out
./clients/build/install/clients/bin/clients request-state --wkey=Arcturus localhost:9081 localhost:9083/network2/mychannel:simplestate:Read:Arcturus 1> tmp.out
cat tmp.out | grep "SimpleState(key=Arcturus, value=17.671" && COUNT=$(( COUNT + 1 )) && echo "PASS"
cat tmp.out

Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/weaver_deploy_go-pkgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
tag_name: ${{ env.MODULE_TAG }}/${{ env.VERSION }}
release_name: ${{ env.VERSION }} - ${{ env.MODULE_DESC }} - ${{ env.RELEASE_DATE }}
body: |
- Go Module: `github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/${{ env.MODULE_TAG }}`
- Go Module: `github.com/${{ github.repository_owner }}/cacti/${{ env.MODULE_TAG }}`
- Release: ${{ env.VERSION }}
- Readme: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
- Readme: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
draft: false
prerelease: false

Expand Down Expand Up @@ -124,10 +124,10 @@ jobs:
tag_name: ${{ env.MODULE_TAG }}/${{ env.VERSION }}
release_name: ${{ env.VERSION }} - ${{ env.MODULE_DESC }} - ${{ env.RELEASE_DATE }}
body: |
- Go Module: `github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/${{ env.MODULE_TAG }}`
- Go Module: `github.com/${{ github.repository_owner }}/cacti/${{ env.MODULE_TAG }}`
- Release: ${{ env.VERSION }}
- Readme: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
- Readme: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
draft: false
prerelease: false

Expand Down Expand Up @@ -190,10 +190,10 @@ jobs:
tag_name: ${{ env.MODULE_TAG }}/${{ env.VERSION }}
release_name: ${{ env.VERSION }} - ${{ env.MODULE_DESC }} - ${{ env.RELEASE_DATE }}
body: |
- Go Module: `github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/${{ env.MODULE_TAG }}`
- Go Module: `github.com/${{ github.repository_owner }}/cacti/${{ env.MODULE_TAG }}`
- Release: ${{ env.VERSION }}
- Readme: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
- Readme: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
draft: false
prerelease: false

Expand Down Expand Up @@ -256,10 +256,10 @@ jobs:
tag_name: ${{ env.MODULE_TAG }}/${{ env.VERSION }}
release_name: ${{ env.VERSION }} - ${{ env.MODULE_DESC }} - ${{ env.RELEASE_DATE }}
body: |
- Go Module: `github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/${{ env.MODULE_TAG }}`
- Go Module: `github.com/${{ github.repository_owner }}/cacti/${{ env.MODULE_TAG }}`
- Release: ${{ env.VERSION }}
- Readme: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
- Readme: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
draft: false
prerelease: false

Expand Down Expand Up @@ -322,10 +322,10 @@ jobs:
tag_name: ${{ env.MODULE_TAG }}/${{ env.VERSION }}
release_name: ${{ env.VERSION }} - ${{ env.MODULE_DESC }} - ${{ env.RELEASE_DATE }}
body: |
- Go Module: `github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/${{ env.MODULE_TAG }}`
- Go Module: `github.com/${{ github.repository_owner }}/cacti/${{ env.MODULE_TAG }}`
- Release: ${{ env.VERSION }}
- Readme: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
- Readme: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
draft: false
prerelease: false

Expand Down Expand Up @@ -388,10 +388,10 @@ jobs:
tag_name: ${{ env.MODULE_TAG }}/${{ env.VERSION }}
release_name: ${{ env.VERSION }} - ${{ env.MODULE_DESC }} - ${{ env.RELEASE_DATE }}
body: |
- Go Module: `github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/${{ env.MODULE_TAG }}`
- Go Module: `github.com/${{ github.repository_owner }}/cacti/${{ env.MODULE_TAG }}`
- Release: ${{ env.VERSION }}
- Readme: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/weaver-dlt-interoperability/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
- Readme: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }}/README.md).
- Source: [Here](https://github.com/${{ github.repository_owner }}/cacti/blob/${{ env.MODULE_TAG }}/${{ env.VERSION }}/${{ env.MODULE_TAG }})
draft: false
prerelease: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import java.util.*

import org.hyperledger.cacti.weaver.imodule.corda.flows.HandleExternalRequest
import org.hyperledger.cacti.weaver.sdk.corda.InteroperableHelper
import org.hyperledger.cacti.weaver.sdk.corda.RelayOptions
import org.hyperledger.cacti.weaver.protos.common.query.QueryOuterClass
import org.hyperledger.cacti.weaver.protos.common.state.State
import org.hyperledger.cacti.weaver.protos.corda.ViewDataOuterClass
Expand Down Expand Up @@ -143,13 +144,16 @@ fun createAggregatedCordaView(views: List<State.View>) : Either<Error, State.Vie
fun createGrpcConnection(address: String) = try {
parseRelayAddress(address).map { relayAddresses ->
// TODO: if the first relay address fails, retry with other relay addresses in the list.
val relayOptions = RelayOptions(
useTlsForRelay = System.getenv("RELAY_TLS")?.toBoolean() ?: false,
relayTlsTrustStorePath = System.getenv("RELAY_TLSCA_TRUST_STORE")?.toString() ?: "",
relayTlsTrustStorePassword = System.getenv("RELAY_TLSCA_TRUST_STORE_PASSWORD")?.toString() ?: "",
tlsCACertPathsForRelay = System.getenv("RELAY_TLSCA_CERT_PATHS")?.toString() ?: ""
)
val channel = InteroperableHelper.getChannelToRelay(
relayAddresses[0].host,
relayAddresses[0].port,
System.getenv("RELAY_TLS")?.toBoolean() ?: false,
System.getenv("RELAY_TLSCA_TRUST_STORE")?.toString() ?: "",
System.getenv("RELAY_TLSCA_TRUST_STORE_PASSWORD")?.toString() ?: "",
System.getenv("RELAY_TLSCA_CERT_PATHS")?.toString() ?: "")
relayOptions)
GrpcClient(channel)
}
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import net.corda.core.contracts.BelongsToContract
import net.corda.core.contracts.LinearState
import net.corda.core.contracts.UniqueIdentifier
import net.corda.core.identity.Party
import net.corda.core.serialization.CordaSerializable

/**
* A representation of state and proof retrieved from an external network.
Expand All @@ -27,3 +28,11 @@ data class ExternalState(
override val linearId: UniqueIdentifier = UniqueIdentifier(),
override val participants: List<Party> = listOf()
) : LinearState

@CordaSerializable
data class InvocationSpec(
val disableInvocation: Boolean = true,
val invokeFlowName: String = "",
val invokeFlowArgs: List<Any> = listOf(),
val interopArgsIndex: Int = -1
)
Loading
Loading