-
Notifications
You must be signed in to change notification settings - Fork 286
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(connector-corda): support corda 5 RC via TS/HTTP (no JVM) #2814
Conversation
get: async () => ({ | ||
isProtected: true, | ||
requiredRoles: [], | ||
httpsAgent: new https.Agent({ rejectUnauthorized: false }), |
Check failure
Code scanning / CodeQL
Disabling certificate validation High
|
||
const customHttpsAgent = new https.Agent({ | ||
// Configure your custom settings here | ||
rejectUnauthorized: false, // Example: Allow self-signed certificates (use with caution) |
Check failure
Code scanning / CodeQL
Disabling certificate validation High test
84236a3
to
5a30cba
Compare
Fixes hyperledger-cacti#1480 Signed-off-by: adrian.batuto <[email protected]>
5a30cba
to
3cee879
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrianbatuto Preliminary change requests (I'll do a more thorough review after these initial points are addressed):
- Please migrate the test case onto Jest instead of tape (and also remove the tape imports).
- Please rename the test file corda-v5-flow-test.ts to end with
.test.ts
instead of-test.ts
because that way VSCode will detect it as a test case instead of a code file that contains shippable code. - When I ran the test file locally, it failed on the last test case, could you please verify if this works on your machine and if yes please attach the exact command you used to run it and the complete log output of the test case as a file attachment.
- Question: Does this change retain the v4 support in the connector or does it erase it? E.g., if we merged this diff, would it still be able to support v4.8 Corda ledgers as well as v5 ones or only v5?
Hi @petermetz , I'll work on your requested changes for 1-2.
The endpoints that I pushed here in this PR is using the corda connector. Our expectation is that the test would pass after the connector has been published.
|
curl -u earthling:password --insecure https://localhost:12112/api/v1/nodestatus/getnetworkreadinessstatus | ||
curl -u plutonian:password --insecure https://localhost:12119/api/v1/nodestatus/getnetworkreadinessstatus | ||
#Need to change since token is needed to check health status | ||
#curl -u admin:admin --insecure https://localhost:8888/api/v1/swagger# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a better healthcheck here?
For example, running the listVNodes
gradle task will list all the 5 nodes (4 nodes and notary server) and then parsing the output till it shows those 5 nodes up and running
fi | ||
sleep 5; | ||
done | ||
touch 5vNodeSetupdone.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required I suppose (I added it as I was testing the next part of the script i.e. deploying the cordapps)
cd /CSDE-cordapp-template-kotlin/ | ||
while true; do | ||
echo "Waiting for startCorda to execute..." | ||
if ./gradlew listVnodes | grep "X500"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is listVNodes
(not sure if gradle tasks are case sensitive or not)
"copy-yarn-lock": "cp -af ../../yarn.lock ./dist/yarn.lock", | ||
"generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected" | ||
"generate-sdk": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected", | ||
"copy-sql": "cp -r ./src/main/sql ./dist/lib/main/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this and the below copy-yarn-lock scripts?
cwd, | ||
); | ||
|
||
function extractShortHash(name: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have this function defined within the corda-v5-test-ledger.ts
file? And then maybe return the shortHash of all the entities as a list (so that one can later write an equivalent function for production grade scenarios)
t.ok(startflow.status, "startFlowParameters endpoint OK"); | ||
|
||
await waitProcess(5); | ||
await waitForStatusChange(shortHashCharlie, "test-1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have this function also defined within the test ledgers (This helps in creating similar utilities for the production environment. For example, if the production environment is lets say Kubernetes, one can setup the corda network there and can simply look into our test-ledger class to create equivalent utilities for the kubernetes environment.)
@@ -0,0 +1,348 @@ | |||
import test, { Test } from "tape-promise/tape"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need additional code & test cases on deploying the cordapps itself (and if possible, such functions should be independent of the environment where the network is setup which in this case is docker. This helps in re-usability of same functions for production environments)
@@ -232,6 +253,35 @@ export class PluginLedgerConnectorCorda | |||
endpoints.push(endpoint); | |||
} | |||
|
|||
{ | |||
const opts: IListCPIEndpointV1Options = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will also need to enable/disable these endpoints based on the version specified by CordaVersion
var type
|
||
try { | ||
if (this.apiUrl === undefined) throw "apiUrl option is necessary"; | ||
const body = await this.callInternalContainer(req.body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have connector class functions instead of calling internal container as all the nodes are exposed to the host network for now and then a single unified function within the connector class can handle GET/POST calls for all the flow related calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same goes for all the endpoints for v5 and thus their implementation in the test case
}; | ||
const endpoint = new FlowStatusResponseEndpointV1(opts); | ||
endpoints.push(endpoint); | ||
} | ||
this.log.info(`Instantiated endpoints of ${pkgName}`); | ||
return endpoints; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should have the function to call all the flow rpc calls GET/POST.. (instead of having another server client layer for the same)
@adrianbatuto How is this one going? Do you have an ETA? |
Hi @petermetz, as I mentioned in the meeting earlier, I am done with the review points you have provided. I am now in progress with Jag's review points. I also think that there might be additional changes required since currently we are only able to run the test successfully using the endpoints that corda have provided, however when using the endpoints with the corda connector I am getting a 404 error. I am also expecting further review points since the reviews so far are only preliminary. |
@adrianbatuto Thank you for the updates! |
Closing this PR for now. As per discussions with @jagpreetsinghsasan there will be some significant changes to the code. Will reopen this PR or create a new one once those changes are ready for review. |
Fixes #1480
Pull Request Requirements
upstream/main
branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.-s
flag when usinggit commit
command. You may refer to this link for more information.Character Limit
A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.