-
Notifications
You must be signed in to change notification settings - Fork 278
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 fabric COPM implementation #3546
base: main
Are you sure you want to change the base?
Conversation
2342278
to
a8ae134
Compare
@@ -4,8 +4,5 @@ node_modules/ | |||
coverage/ | |||
package-lock.json | |||
old/ | |||
protos/ | |||
protos-js/* |
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.
Any reason for this change?
Also I see there is no protos-js
in SDK, so I guess you figured out building SDK without checking in protos-js
in SDK?
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 was reverted. Yes, turned out not to need the one in interop to build.
|
||
message AssetAccountV1PB { | ||
|
||
string network = 232872497; |
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.
Sorry I don't have context about this structure, but why are these numbers so high?
Usually proto structures start with 1
, 2
and so on...
Same comment for all the below proto files.
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 pb files are generated from openapi, following cactus convention. The openapi desc is here: https://jenniferlianne.github.io/cacti/references/openapi/cacti-copm-core_openapi/,
|
||
message ViewAddressV1PB { | ||
|
||
string contract_id = 512823451; |
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 may need more fields to this, but I'm assuming, we will keep updating this in future with implementations of these services?
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.
Yes. For now I want to see what we can get away with. In Corda, flowpath (for instance) is very similar to a contract specification.
|
||
import "models/view_address_v1_pb.proto"; | ||
|
||
message ViewV1PB { |
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.
View contains response to the remote query right?
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.
No, this is part of the inbound message for the verifyState command. You can see the messages here for more context: https://jenniferlianne.github.io/cacti/references/openapi/cacti-copm-core_openapi/
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.
@jenniferlianne Very high quality PR overall, thank you very much for the contribution! I left a few comments with my usual nit picks but it's definitely looking great already! Congratulations!
"@hyperledger/cacti-weaver-sdk-fabric": "workspace:^", | ||
"@hyperledger/cactus-common": "workspace:^" | ||
}, |
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.
@jenniferlianne Could you please match the current pattern we have for specifying versions for packages within the monorepo depending on other packages also within the monorepo?
Alternatively, if you you think we should migrate to this syntax, I'm not against it, but then let's make that a separate PR which doesn't change anything except the version declaration syntax that we use (and then explain it over there thoroughly what the change is and why).
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.
Addressed.
}, | ||
"devDependencies": { | ||
"@bufbuild/protoc-gen-es": "1.8.0", | ||
"@connectrpc/connect-node": "^1.4.0", |
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.
@jenniferlianne Please make sure to pin the dependencies to exact versions everywhere.
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.
OK.
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "7.7.0" |
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.
@jenniferlianne We currently use 6.6.0 - deviating from that version will cause race conditions in the codegen script which only pre-fetches the jar for v6.6.0 (search for "warmup" in the root package.json to see what I mean).
Similar to my other comment about the dependency declaration syntax, here it is the same idea: We can (and I would love to) upgrade to the newer versions of the Open API generator because the newer templates have fixes and additional features (usually) but if we do it it's safer to do it in a single PR dedicated to it which then upgrades the whole project, otherwise there's additional breakages due to the inconsistencies.
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.
Addressed.
level: logLevel, | ||
}); | ||
|
||
describe("PluginCopmFabric", () => { |
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.
@jenniferlianne I tried to run yarn configure
and then this test case but it crashed with the stack trace below. Could you please take a look? In general the test cases should be operational after the configure script has executed so I'm guessing maybe some part of the build process is not integrated into configure
but that's just an idea.
Here's the exact command I ran and the log it produced:
$ yarn test:jest:all packages/cacti-plugin-copm-fabric/src/test/typescript/integration/test-copm-pledge-claim.test.ts
jest-haste-map: duplicate manual mock found: ConfigUtil
The following files share their name; please delete one of them:
* <rootDir>/examples/cactus-common-example-server/src/main/typescript/routing-interface/util/__mocks__/ConfigUtil.ts
* <rootDir>/examples/cactus-common-example-server/dist/lib/main/typescript/routing-interface/util/__mocks__/ConfigUtil.js
jest-haste-map: duplicate manual mock found: ConfigUtil.d
The following files share their name; please delete one of them:
* <rootDir>/examples/cactus-common-example-server/dist/lib/main/typescript/routing-interface/util/__mocks__/ConfigUtil.d.ts
* <rootDir>/packages/cactus-cmd-socketio-server/dist/lib/main/typescript/routing-interface/util/__mocks__/ConfigUtil.d.ts
jest-haste-map: duplicate manual mock found: ConfigUtil
The following files share their name; please delete one of them:
* <rootDir>/examples/cactus-common-example-server/dist/lib/main/typescript/routing-interface/util/__mocks__/ConfigUtil.js
* <rootDir>/packages/cactus-cmd-socketio-server/dist/lib/main/typescript/routing-interface/util/__mocks__/ConfigUtil.js
FAIL packages/cacti-plugin-copm-fabric/src/test/typescript/integration/test-copm-pledge-claim.test.ts
● Test suite failed to run
Configuration error:
Could not locate module ./build/src/Relay.js mapped as:
$1.
Please check your configuration for these entries:
{
"moduleNameMapper": {
"/^(\.\.?\/.+)\.jsx?$/": "$1"
},
"resolver": undefined
}
13 | // likely due to that module containing multiple classes
14 |
> 15 | module.exports.RelayHelper = require("./build/src/Relay.js");
| ^
16 | module.exports.InteroperableHelper = require("./build/src/InteroperableHelper.js");
17 | module.exports.AssetManager = require("./build/src/AssetManager.js");
18 | module.exports.SatpAssetManager = require("./build/src/SatpAssetManager.js");
at createNoMappedModuleFoundError (node_modules/jest-resolve/build/resolver.js:759:17)
at Object.<anonymous> (weaver/sdks/fabric/interoperation-node-sdk/index.js:15:30)
at Object.<anonymous> (packages/cacti-copm-core/src/main/typescript/validators/common.ts:5:1)
at Object.<anonymous> (packages/cacti-copm-core/src/main/typescript/validators/validate_claim_locked_asset_request.ts:5:1)
at Object.<anonymous> (packages/cacti-copm-core/src/main/typescript/validators.ts:1:1)
at Object.<anonymous> (packages/cacti-copm-core/src/main/typescript/public-api.ts:24:1)
at Object.<anonymous> (packages/cacti-copm-core/src/main/typescript/index.ts:1:1)
at Object.<anonymous> (packages/cacti-plugin-copm-fabric/src/test/typescript/integration/test-copm-pledge-claim.test.ts:18:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 5.807 s
Ran all test suites matching /packages\/cacti-plugin-copm-fabric\/src\/test\/typescript\/integration\/test-copm-pledge-claim.test.ts/i.
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.
More info: I have not tested the other test cases but if they suffer from the same problem then I would also like to request those to be addressed as well (if the solution is somehow unique to each test case for whatever reason)
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.
These tests need a weaver network to run. Following the weaver pattern, the network can either run 'lock' (asset exchange) or 'pledge' (asset transfer) commands. To start a network, in the fabric directory type
make setup; make pledge-network
Then wait 10 min. More here: https://github.com/jenniferlianne/cacti/tree/copm_draft/packages/cacti-plugin-copm-fabric
a8ae134
to
c50865d
Compare
Primary Change: - add connectRPC cactus plugin for copm primitives Secondary Changes: - add common COPM prototypes - add common weaver protos-js directory to enable building under ci.yaml, which requires all local dependencies to be present at build time - remove incorrect 'main' declaration in protos-js package file - add separate tsconfig file to /weaver/sdks/fabric/interoperation-node-sdk to allow it to be built by ci.yaml - update weaver fabric network makefile 'clean' target to continue if some target files were not generated by the make process Signed-off-by: Jennifer Bell <[email protected]>
c50865d
to
48b4e82
Compare
Primary Change:
Secondary Changes:
dependencies to be present at build time
allow it to be built by ci.yaml
were not generated by the make process
Signed-off-by: Jennifer Bell [email protected]
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.