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(copm): add Corda COPM implementation #3625

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jenniferlianne
Copy link

Primary change:

Implements COPM primitives for Corda as a cacti plugin. The implementation follows the model of
the Corda ledger connector plugin, where a typescript pass-through implementation is registered on the plugin server, and commands are implemented on a separate grpc server in the Kotlin Spring framework.

Secondary changes:

  • The lock claim protobuf structure was updated to reduce the number of parameters.
  • A no-op endpoint was added, per project specification
  • The format of the inter-network command for requesting the status of a pledge varies by remote network type and asset. Adds a function to the typescript interop configuration interface to supply the appropriate command given the remote network and asset.
  • Adds test package to test combinations of network types
  • Updates CI script to use new testing framework
  • Updates linter ignore to include weaver build directories, allowing yarn lint to pass on a system where weaver libraries have been built. Also excludes docs directory to avoid linting minified js from documentation packages.

Pull Request Requirements

  • Rebased onto 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.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jenniferlianne Looking pretty high quality in general, but as usual I have some requests. On top of the comments I left inline, please make sure to include a test case which verifies the plugin being functional while used through the API server (you'll most likely need a separate package because this one cannot depend on the API server due to circular dependency issues)
If you need examples just let me know.

@jenniferlianne jenniferlianne force-pushed the copm_corda branch 6 times, most recently from e107eb5 to e04747c Compare November 14, 2024 13:21
Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jenniferlianne LGTM, thank you!

@jenniferlianne
Copy link
Author

@jenniferlianne Looking pretty high quality in general, but as usual I have some requests. On top of the comments I left inline, please make sure to include a test case which verifies the plugin being functional while used through the API server (you'll most likely need a separate package because this one cannot depend on the API server due to circular dependency issues) If you need examples just let me know.

As mentioned on the call, the plugin is brought up via the ApiServer in both fabric and corda cases. Please see:
packages/cacti-copm-test/src/main/typescript/corda/copm-tester-corda.ts line 118
packages/cacti-copm-test/src/main/typescript/fabric/copm-tester-fabric.ts line 122

@sandeepnRES
Copy link
Contributor

sandeepnRES commented Nov 19, 2024

@jenniferlianne Thank you for the PR, overall looks good to me. Just some small suggestions above I've shared.

@@ -15,7 +16,8 @@ export type CopmContractNames = {
};

export type RemoteNetworkConfig = {
channelName: string;
channelName: string; // fabric-specific
chaincode: string; // fabric-specific
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this to chaincodeName.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably networkName instead of network in the below line 21?

Copy link
Author

@jenniferlianne jenniferlianne Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After further discussion on the project channel I have removed the chaincode and flowPackage variables from the remote network configuration struct as remote networks may use multiple chaincode packages in both fabric and corda. The network variable has been renamed networkName.

Copy link
Contributor

@sandeepnRES sandeepnRES Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jenniferlianne I'm not sure about the purpose of this type RemoteNetworkConfig, but even the channelName and corda party endpoints could also be different for every remote call for the same network, as there can be multiple channels (as discussed on discord).
I believe you have taken this from fabric-cli which was a tool for testing purpose, but since this is a main package to be used by others, I would recommend to make it as general as possible.

Its okay if you can just open an issue to track this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with @VRamakrishna 2 weeks ago, the naming, which is consistent with a similar structure in the fabric implementation submitted 3 months ago, reflects the data structures in the weaver test network json configuration files. While named 'network', they seem to talk about organizations, not networks. While I may be wrong, I expect this information will not change on the fly for a given organization. Can rename to RemoteOrganizationConfig.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets it be as it is for now, just open an issue to track this, so that we can think about it more later, if we actually need restructuring.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too late - I updated the naming to be RemoteOrganization, as well as using 'organization' instead of 'network' for AssetAccounts in the OpenApi spec. The code is more consistent now. I opened an issue here for revisiting in the future: #3656

@jenniferlianne jenniferlianne force-pushed the copm_corda branch 2 times, most recently from 5b82161 to 9858457 Compare November 27, 2024 19:42
Primary change:

Implements COPM primitives for Corda as a cacti
plugin.  The implementation follows the model of
the Corda ledger connector plugin, where a
typescript pass-through implementation is
registered on the plugin server, and commands are
implemented on a separate grpc server in the
Kotlin Spring framework.

Secondary changes:

- The lock claim protobuf structure was updated
to reduce the number of parameters.
- A no-op endpoint was added, per project
specification
- The format of the inter-network command for
requesting the status of a pledge varies by
remote network type and asset.  Adds a function to
the typescript interop configuration  interface to
supply the appropriate command given
the remote network and asset.
- Adds test package to test combinations of
network types
- Updates CI script to use new testing
framework
- Updates linter ignore to include weaver build
directories, allowing yarn lint to pass on
a system where weaver libraries have been built.
Also excludes docs directory to avoid linting
minified js from documentation packages.

Signed-off-by: Jennifer Bell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants