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(cactus-api-client): common verifier-factory #1879

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

outSH
Copy link
Contributor

@outSH outSH commented Feb 23, 2022

  • Adjust SocketIOApiClient and common Verifier behavior to previous one in cmd-socketio, fix related tests.
  • Extract Verifier interfaces to common location to ensure interface compatibility between old and new verifier / verifier factory (both should implement same interface).
  • Create new package cactus-verifier-client for common verifier related stuff, to prevent circular dependencies.
  • Add verifier-factory to create verifiers by supplying it's ID only, based on initial configuration. Configuration is set in ctor, but can be read from a file as in cmd-socketio scenarious. VerifierFactory config should be compatible with existing ledgerPluginInfo.

Signed-off-by: Michal Bajer michal.bajer@fujitsu.com

@outSH
Copy link
Contributor Author

outSH commented Feb 23, 2022

@petermetz
As described in #1878, we need to include common "VerifierFactory" for release 1.0. I'm very sorry for such a short notice for feature like that, but it turned out to be needed just recently.

I'm still working on this task, but the core design proposal is complete, so please review in spare time and let me know what to clarify or improve :)

The interesting parts are:

I will add more tests and do some more improvements tomorrow.

@outSH
Copy link
Contributor Author

outSH commented Feb 28, 2022

There's another branch where I've adjusted electricity-trade to use new verifier factory (sort of sanity test). It breaks dockerization though, so it's not included here (need a simpler way to use local cactus packages, without pushing them to npm first). To start the sample just follow the readme as usual, open another shell, cp config/* /etc/cactus/ and node ./dist/www.js to start BLP in this shell.

Branch - https://github.com/outSH/cactus/tree/electricity_trade_common_verifier

@outSH outSH marked this pull request as ready for review February 28, 2022 17:17
@outSH outSH requested a review from petermetz February 28, 2022 17:17
@outSH
Copy link
Contributor Author

outSH commented Feb 28, 2022

@izuru0 @takeutak Please review

@petermetz petermetz requested review from izuru0 and takeutak and removed request for jonathan-m-hamilton February 28, 2022 18:18
@petermetz petermetz added the Besu label Feb 28, 2022
@outSH outSH force-pushed the common_verifier branch 3 times, most recently from 2b57f69 to 534099f Compare March 2, 2022 09:45
@outSH outSH requested a review from petermetz March 2, 2022 12:20
@outSH outSH requested a review from petermetz March 2, 2022 23:54
@petermetz
Copy link
Contributor

@petermetz Once again, this is not an interface for legacy-socketio (-socketio connectors), but in the end to all the connectors, including openapi ones. This is the verifier component documented in the whitepaper, but modified to support all connectors / validators.

@outSH OK, cool.

The following is a not a change request, just something to ponder: Making a package that is intended to re-export literally every connector package (of which the number is to grow infinitely by design) will have a bundle size trending to infinity as well. This is especially important for browser based applications where the end user experience depends heavily on bundle size.

@outSH
Copy link
Contributor Author

outSH commented Mar 3, 2022

Making a package that is intended to re-export literally every connector package (of which the number is to grow infinitely by design) will have a bundle size trending to infinity as well. This is especially important for browser based applications where the end user experience depends heavily on bundle size.

@petermetz Yes, that was my concern few messages above as well, but it's a requirement from one of the teams already using verifier interface. In the follow up PR I want to investigate possibility of importing apiclient modules dynamically, but this is not critical now when we only import 2 or 3 clients.

@outSH outSH force-pushed the common_verifier branch from 534099f to af0b9de Compare March 3, 2022 09:57
@outSH outSH requested a review from petermetz March 3, 2022 09:58
Copy link
Contributor

@izuru0 izuru0 left a comment

Choose a reason for hiding this comment

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

LGTM

@petermetz
Copy link
Contributor

Making a package that is intended to re-export literally every connector package (of which the number is to grow infinitely by design) will have a bundle size trending to infinity as well. This is especially important for browser based applications where the end user experience depends heavily on bundle size.

@petermetz Yes, that was my concern few messages above as well, but it's a requirement from one of the teams already using verifier interface. In the follow up PR I want to investigate possibility of importing apiclient modules dynamically, but this is not critical now when we only import 2 or 3 clients.

@outSH I guess in an ideal situation they would understand that using pre-1.0.0 software means that there will be breaking changes, but I know that's not how you roll over there so that's totally fair.

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.

@outSH LGTM, thank you for the updates and putting up with my nit-picking as usual!

Adjust SocketIOApiClient and common Verifier behavior to previous one in
cmd-socketio, fix related tests. Extract Verifier interfaces to common
location to ensure interface compatibility between old and new verifier
/ verifier factory (both should implement same interface). Create new
package cactus-verifier-client for common verifier related stuff, to
prevent circular dependencies. Add verifier-factory to create verifiers
by supplying it's ID only, based on initial configuration. Configuration
is set in ctor, but can be read from a file as in cmd-socketio
scenarious. VerifierFactory config should be compatible with existing
ledgerPluginInfo.

Closes: hyperledger-cacti#1878
Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
@petermetz petermetz merged commit 2f70a64 into hyperledger-cacti:main Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants