Skip to content

Commit

Permalink
feat: corda asset transfer test workflow added and bug fixes
Browse files Browse the repository at this point in the history
    - fix(weaver): corda asset transfer bug fix with decoding interop payload
    - fix(corda-driver): dockerfile build bug
    - fix(corda-sdk): fix bug with logs and error messages
    - fix(weaver): update alice and bob cert for asset transfer
    - fix(corda): simpleapp initialize ledger dynamically based on number of nodes
    - fix(sdk): increase default timeout for interopFlow
    - feat(ci): add debug logs to data sharing and asset transfer
    - chore(testnet): check-in alice and bob certs for fabric networks

Signed-off-by: Sandeep Nishad <[email protected]>
  • Loading branch information
sandeepnRES committed Jun 1, 2023
1 parent 0943531 commit 4b5ee09
Show file tree
Hide file tree
Showing 42 changed files with 982 additions and 300 deletions.
4 changes: 4 additions & 0 deletions .gitguardian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ secret:
- 'doc/*'
- 'LICENSE'
- '**/examples/cactus-example-carbon-accounting-backend/example-config.json'
- 'weaver/samples/**/*'
- 'weaver/tests/**/*'
- 'weaver/core/drivers/fabric-driver/wallet-network1/*.id'
- 'weaver/core/drivers/fabric-driver/wallet-network2/*.id'

# Detectors to ignore.
ignored-detectors: # default: []
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_weaver-asset-exchange-corda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/weaver-dlt-interoperability" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/cacti" >> github.properties
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.main.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger-labs/weaver-dlt-interoperability" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger/cacti" >> github.main.properties
./scripts/get-cordapps.sh || mv github.main.properties github.properties
Expand Down Expand Up @@ -236,12 +236,12 @@ jobs:
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/weaver-dlt-interoperability" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/cacti" >> github.properties
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.main.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger-labs/weaver-dlt-interoperability" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger/cacti" >> github.main.properties
./scripts/get-cordapps.sh || mv github.main.properties github.properties
Expand Down
933 changes: 716 additions & 217 deletions .github/workflows/test_weaver-asset-transfer.yaml

Large diffs are not rendered by default.

124 changes: 122 additions & 2 deletions .github/workflows/test_weaver-data-sharing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ jobs:
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/weaver-dlt-interoperability" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/cacti" >> github.properties
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.main.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger-labs/weaver-dlt-interoperability" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger/cacti" >> github.main.properties
./scripts/get-cordapps.sh || mv github.main.properties github.properties
Expand Down Expand Up @@ -337,6 +337,46 @@ jobs:
exit 1
fi
working-directory: weaver/samples/fabric/fabric-cli

- name: DEBUG Logs - corda partya
if: failure()
run: docker logs corda_partya_1

- name: DEBUG Logs - corda network2 partya
if: failure()
run: docker logs corda_network2_partya_1

- name: DEBUG Logs - fabric n1 relay
if: failure()
run: docker logs relay-network1

- name: DEBUG Logs - fabric n2 relay
if: failure()
run: docker logs relay-network2

- name: DEBUG Logs - corda relay
if: failure()
run: docker logs relay-corda

- name: DEBUG Logs - corda2 relay
if: failure()
run: docker logs relay-corda2

- name: DEBUG Logs - fabric n1 driver
if: failure()
run: docker logs driver-fabric-network1

- name: DEBUG Logs - fabric n2 driver
if: failure()
run: docker logs driver-fabric-network2

- name: DEBUG Logs - corda driver
if: failure()
run: docker logs driver-corda-Corda_Network

- name: DEBUG Logs - corda2 driver
if: failure()
run: docker logs driver-corda-Corda_Network2

data-sharing-docker-local:
# if: ${{ false }}
Expand Down Expand Up @@ -703,6 +743,46 @@ jobs:
exit 1
fi
working-directory: weaver/samples/fabric/fabric-cli

- name: DEBUG Logs - corda partya
if: failure()
run: docker logs corda_partya_1

- name: DEBUG Logs - corda network2 partya
if: failure()
run: docker logs corda_network2_partya_1

- name: DEBUG Logs - fabric n1 relay
if: failure()
run: docker logs relay-network1

- name: DEBUG Logs - fabric n2 relay
if: failure()
run: docker logs relay-network2

- name: DEBUG Logs - corda relay
if: failure()
run: docker logs relay-corda

- name: DEBUG Logs - corda2 relay
if: failure()
run: docker logs relay-corda2

- name: DEBUG Logs - fabric n1 driver
if: failure()
run: docker logs driver-fabric-network1

- name: DEBUG Logs - fabric n2 driver
if: failure()
run: docker logs driver-fabric-network2

- name: DEBUG Logs - corda driver
if: failure()
run: docker logs driver-corda-Corda_Network

- name: DEBUG Logs - corda2 driver
if: failure()
run: docker logs driver-corda-Corda_Network2

data-sharing-local:
# if: ${{ false }}
Expand Down Expand Up @@ -1073,3 +1153,43 @@ jobs:
exit 1
fi
working-directory: weaver/samples/fabric/fabric-cli

- name: DEBUG Logs - corda partya
if: failure()
run: docker logs corda_partya_1

- name: DEBUG Logs - corda network2 partya
if: failure()
run: docker logs corda_network2_partya_1

- name: DEBUG Logs - fabric n1 relay
if: failure()
run: cat weaver/core/relay/relay-n1.out

- name: DEBUG Logs - fabric n2 relay
if: failure()
run: cat weaver/core/relay/relay-n2.out

- name: DEBUG Logs - corda relay
if: failure()
run: cat weaver/core/relay/relay-corda.out

- name: DEBUG Logs - corda2 relay
if: failure()
run: cat weaver/core/relay/relay-corda2.out

- name: DEBUG Logs - fabric n1 driver
if: failure()
run: cat weaver/core/drivers/fabric-driver/fdriver-n1.out

- name: DEBUG Logs - fabric n2 driver
if: failure()
run: cat weaver/core/drivers/fabric-driver/fdriver-n2.out

- name: DEBUG Logs - corda driver
if: failure()
run: cat weaver/core/drivers/corda-driver/corda-driver.out

- name: DEBUG Logs - corda2 driver
if: failure()
run: cat weaver/core/drivers/corda-driver/corda2-driver.out
4 changes: 2 additions & 2 deletions .github/workflows/test_weaver-docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ jobs:
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/weaver-dlt-interoperability" >> github.properties
echo "url=https://maven.pkg.github.com/${GITHUB_ACTOR}/cacti" >> github.properties
echo "Using ${GITHUB_ACTOR} user."
echo "username=${GITHUB_ACTOR}" >> github.main.properties
echo "password=${{ secrets.GITHUB_TOKEN }}" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger-labs/weaver-dlt-interoperability" >> github.main.properties
echo "url=https://maven.pkg.github.com/hyperledger/cacti" >> github.main.properties
make build || mv github.main.properties github.properties
make clean
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/weaver_deploy_node-pkgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ jobs:

- name: Publish
if: ${{ env.PROTOS_JS_PUBLISH == 'true' }}
run: make publish
run: |
export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin"
make publish
working-directory: weaver/common/protos-js

publish-fabric-sdk:
Expand Down
6 changes: 6 additions & 0 deletions weaver/core/drivers/corda-driver/Dockerfile.remote
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
FROM gradle:4.10.3-jdk8 AS builder-remote

USER root

#Update stretch repositories
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list

RUN apt-get update && apt-get install -y maven

WORKDIR /driver/corda
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.hyperledger.cacti.weaver.imodule.corda.states.AssetClaimStatusState
import org.hyperledger.cacti.weaver.imodule.corda.states.NetworkIdState
import org.hyperledger.cacti.weaver.protos.common.asset_transfer.AssetTransfer
import org.hyperledger.cacti.weaver.protos.corda.ViewDataOuterClass
import org.hyperledger.cacti.weaver.protos.common.interop_payload.InteropPayloadOuterClass
import com.google.protobuf.ByteString

import net.corda.core.contracts.ContractState
Expand Down Expand Up @@ -474,7 +475,8 @@ object ReclaimPledgedAsset {

val viewData = subFlow(GetExternalStateByLinearId(claimStatusLinearId))
val externalStateView = ViewDataOuterClass.ViewData.parseFrom(viewData)
val payloadDecoded = Base64.getDecoder().decode(externalStateView.notarizedPayloadsList[0].payload.toByteArray())
val interopPayload = InteropPayloadOuterClass.InteropPayload.parseFrom(externalStateView.notarizedPayloadsList[0].payload)
val payloadDecoded = Base64.getDecoder().decode(interopPayload.payload.toByteArray())
val assetClaimStatus = AssetTransfer.AssetClaimStatus.parseFrom(payloadDecoded)
println("Asset claim status details obtained via interop query: ${assetClaimStatus}")

Expand Down Expand Up @@ -683,7 +685,8 @@ object ClaimRemoteAsset {
// get the asset pledge details fetched earlier via interop query from import to export n/w
val viewData = subFlow(GetExternalStateByLinearId(pledgeStatusLinearId))
val externalStateView = ViewDataOuterClass.ViewData.parseFrom(viewData)
val payloadDecoded = Base64.getDecoder().decode(externalStateView.notarizedPayloadsList[0].payload.toByteArray())
val interopPayload = InteropPayloadOuterClass.InteropPayload.parseFrom(externalStateView.notarizedPayloadsList[0].payload)
val payloadDecoded = Base64.getDecoder().decode(interopPayload.payload.toByteArray())
val assetPledgeStatus = AssetTransfer.AssetPledge.parseFrom(payloadDecoded)
println("Asset pledge status details obtained via interop query: ${assetPledgeStatus}")
println("getAssetAndContractIdFlowName: ${getAssetAndContractIdFlowName} assetIdOrQuantity: ${assetIdOrQuantity}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ fun requestStateFromRemoteNetwork(
config["RELAY_TLSCA_CERT_PATHS"]!!
).fold({
println("Error in Interop Flow: ${it.message}")
exitProcess(1)
}, {
linearId = it.toString()
println("Interop flow successful and external-state was stored with linearId $linearId.\n")
Expand All @@ -632,4 +633,4 @@ fun requestStateFromRemoteNetwork(
}

return linearId
}
}
Loading

0 comments on commit 4b5ee09

Please sign in to comment.