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-plugin-ledger-connector-fabric): support delegated (offline) signatures #2644

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

outSH
Copy link
Contributor

@outSH outSH commented Aug 29, 2023

  • Add new RunDelegatedSignTransactionEndpointV1 endpoint for delegated / offline signing.
    Takes signerCertificate and signerMspID, uses signCallback on connector to sign messages.
    Sign must be implemented by a user, can contain any logic
    (contacting 3'rd party services, reading from secure sources, etc…).
    Interface is similar to transact. Supports private transactions.
  • Refactor transact endpoint: Use common logic for handling response format. with delegated transact
  • Refactor logic of choosing ednorsers in transact endpoint. Previously both endorsingPeers
    and endorsingParties were selecting organizations in sligly different way under different
    circumstances. Now endorsingPeers selectes peers and endorsingOrgs selects orgs for all
    cases (query, send, privatesend) in both transact and transact with delegated sign.
    This is more consistent and predictable.
  • Add new socketio endpoint SubscribeDelegatedSign for monitoring new blocks with delegated sign.
  • Use common error handling in getblock, transact and transact delgated endpoints.
  • Add functional tests for delegated signing feature.

Depends on #2598

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

outSH added a commit to outSH/cactus that referenced this pull request Aug 29, 2023
…ocketio connector

- Remove cactus-plugin-ledger-connector-fabric-socketio connector.
- Refactor discounted cartrade sample to use openapi fabric connector instead of fabric-socketio.
    Sample app will use delegated signing, similar to offline signing in old connector.
- Remove dead code from cmd-socketio-server
- Update fabric SDK to 2.X in all cacti projects, refactor code that use it where necessary.
    Only exception is fabric persistence plugin which uses fabric SDK as dev dependency (for tests).
    It can be updated in separate PR later on.

Depends on: hyperledger-cacti#2644

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
outSH added a commit to outSH/cactus that referenced this pull request Aug 29, 2023
…ocketio connector

- Remove cactus-plugin-ledger-connector-fabric-socketio connector.
- Refactor discounted cartrade sample to use openapi fabric connector instead of fabric-socketio.
    Sample app will use delegated signing, similar to offline signing in old connector.
- Remove dead code from cmd-socketio-server
- Update fabric SDK to 2.X in all cacti projects, refactor code that use it where necessary.
    Only exception is fabric persistence plugin which uses fabric SDK as dev dependency (for tests).
    It can be updated in separate PR later on.

Depends on: hyperledger-cacti#2644

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
@outSH outSH force-pushed the fabric_delegated_sign_pr branch 2 times, most recently from 2952221 to b95183c Compare August 29, 2023 14:23
@github-actions
Copy link

This PR/issue depends on:

@outSH
Copy link
Contributor Author

outSH commented Sep 19, 2023

@petermetz I'm afraid the VM is running out of space after I've added new tests, any suggestions how we can fix this? :)

See messages before failing tests:

2023-09-18T12:32:09.4642674Z ##[warning]You are running out of disk space. The runner will stop working when the machine runs out of disk space. Free space left: 40 MB

2023-09-18T13:32:01.0022613Z [2023-09-18T13:32:00.902Z] DEBUG (FabricTestLedgerV1): [ghcr.io/hyperledger/cactus-fabric2-all-in-one:2023-08-17-issue2057-pr2135] 'time="2023-09-18T13:32:00.900994274Z" level=error msg="Error writing log message" driver=json-file error="error writing log entry: write /var/lib/docker/containers/91c20802ab2f186b640da0a53d461b665ab24d386f4a9d284eb308686f7f06dd/91c20802ab2f186b640da0a53d461b665ab24d386f4a9d284eb308686f7f06dd-json.log: no space left on device" message=\r\n'

Test affected: plugin-ledger-connector-fabric-0

(btw need to fix cactus-cmd-api-server test as well before merge)

outSH added a commit to outSH/cactus that referenced this pull request Sep 28, 2023
…ocketio connector

- Remove cactus-plugin-ledger-connector-fabric-socketio connector.
- Refactor discounted cartrade sample to use openapi fabric connector instead of fabric-socketio.
    Sample app will use delegated signing, similar to offline signing in old connector.
- Remove dead code from cmd-socketio-server
- Update fabric SDK to 2.X in all cacti projects, refactor code that use it where necessary.
    Only exception is fabric persistence plugin which uses fabric SDK as dev dependency (for tests).
    It can be updated in separate PR later on.

Depends on: hyperledger-cacti#2644

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
@petermetz
Copy link
Contributor

@petermetz I'm afraid the VM is running out of space after I've added new tests, any suggestions how we can fix this? :)

See messages before failing tests:

2023-09-18T12:32:09.4642674Z ##[warning]You are running out of disk space. The runner will stop working when the machine runs out of disk space. Free space left: 40 MB

2023-09-18T13:32:01.0022613Z [2023-09-18T13:32:00.902Z] DEBUG (FabricTestLedgerV1): [ghcr.io/hyperledger/cactus-fabric2-all-in-one:2023-08-17-issue2057-pr2135] 'time="2023-09-18T13:32:00.900994274Z" level=error msg="Error writing log message" driver=json-file error="error writing log entry: write /var/lib/docker/containers/91c20802ab2f186b640da0a53d461b665ab24d386f4a9d284eb308686f7f06dd/91c20802ab2f186b640da0a53d461b665ab24d386f4a9d284eb308686f7f06dd-json.log: no space left on device" message=\r\n'

Test affected: plugin-ledger-connector-fabric-0

(btw need to fix cactus-cmd-api-server test as well before merge)

@outSH Set the env var FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED to false in the job's environment variables and that will free up about 20 gigs of space. This used to be the default for the CI script but it takes minutes to complete so now we only turn it on when necessary.

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!

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 petermetz enabled auto-merge (rebase) October 10, 2023 18:08
…ne) signatures

- Add new `RunDelegatedSignTransactionEndpointV1` endpoint for delegated / offline signing.
    Takes `signerCertificate` and `signerMspID`, uses `signCallback` on connector to sign messages.
    Sign must be implemented by a user, can contain any logic
    (contacting 3'rd party services, reading from secure sources, etc…).
    Interface is similar to transact. Supports private transactions.
- Refactor transact endpoint: Use common logic for handling response format. with delegated transact
- Refactor logic of choosing ednorsers in transact endpoint. Previously both `endorsingPeers`
    and `endorsingParties` were selecting organizations in sligly different way under different
    circumstances. Now `endorsingPeers` selectes peers and `endorsingOrgs` selects orgs for all
    cases (query, send, privatesend) in both transact and transact with delegated sign.
    This is more consistent and predictable.
- Add new socketio endpoint `SubscribeDelegatedSign` for monitoring new blocks with delegated sign.
- Use common error handling in getblock, transact and transact delgated endpoints.
- Add functional tests for delegated signing feature.

Depends on: hyperledger-cacti#2598

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
@petermetz petermetz merged commit e2812f4 into hyperledger-cacti:main Oct 10, 2023
46 of 63 checks passed
outSH added a commit to outSH/cactus that referenced this pull request Oct 12, 2023
…ocketio connector

- Remove cactus-plugin-ledger-connector-fabric-socketio connector.
- Refactor discounted cartrade sample to use openapi fabric connector instead of fabric-socketio.
    Sample app will use delegated signing, similar to offline signing in old connector.
- Remove dead code from cmd-socketio-server
- Update fabric SDK to 2.X in all cacti projects, refactor code that use it where necessary.
    Only exception is fabric persistence plugin which uses fabric SDK as dev dependency (for tests).
    It can be updated in separate PR later on.

Depends on: hyperledger-cacti#2644

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
petermetz pushed a commit that referenced this pull request Oct 12, 2023
…ocketio connector

- Remove cactus-plugin-ledger-connector-fabric-socketio connector.
- Refactor discounted cartrade sample to use openapi fabric connector instead of fabric-socketio.
    Sample app will use delegated signing, similar to offline signing in old connector.
- Remove dead code from cmd-socketio-server
- Update fabric SDK to 2.X in all cacti projects, refactor code that use it where necessary.
    Only exception is fabric persistence plugin which uses fabric SDK as dev dependency (for tests).
    It can be updated in separate PR later on.

Depends on: #2644

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
sandeepnRES pushed a commit to sandeepnRES/cacti that referenced this pull request Dec 21, 2023
…ocketio connector

- Remove cactus-plugin-ledger-connector-fabric-socketio connector.
- Refactor discounted cartrade sample to use openapi fabric connector instead of fabric-socketio.
    Sample app will use delegated signing, similar to offline signing in old connector.
- Remove dead code from cmd-socketio-server
- Update fabric SDK to 2.X in all cacti projects, refactor code that use it where necessary.
    Only exception is fabric persistence plugin which uses fabric SDK as dev dependency (for tests).
    It can be updated in separate PR later on.

Depends on: hyperledger-cacti#2644

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
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.

3 participants