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

[WIP] Experimental integration test runner using microfab #1465

Closed
wants to merge 1 commit into from

Conversation

CaptainIRS
Copy link
Contributor

@CaptainIRS CaptainIRS commented Oct 26, 2022

Some issues/notes as of now:

@CaptainIRS CaptainIRS requested a review from a team October 26, 2022 10:48
@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #1465 (35873cf) into main (943ab2a) will not change coverage.
The diff coverage is n/a.

❗ Current head 35873cf differs from pull request most recent head fffa938. Consider uploading reports for the commit fffa938 to get more accurate results

@@           Coverage Diff           @@
##             main    #1465   +/-   ##
=======================================
  Coverage   55.89%   55.89%           
=======================================
  Files         105      105           
  Lines        4507     4507           
  Branches      688      688           
=======================================
  Hits         2519     2519           
  Misses       1435     1435           
  Partials      553      553           
Flag Coverage Δ
caliper-core 44.98% <ø> (ø)
caliper-fabric 80.46% <ø> (ø)
generator-caliper 83.62% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@davidkel
Copy link
Contributor

@CaptainIRS

  1. TLS is the default for most fabrics (except microfab) and we would need to be able to test the option where we declare the peer information in a network config file
  2. Can you elaborate on selecting the correct endorsing peers. microfab only has 1 peer per org and the SDKs should use discovery to determine the peer to select based on the cc endorsement policy so I would not expect a problem here from microfab (unless it doesn't set up anchor peers correctly)
  3. microfab docker image used to include a set of external builders, so it used to work and we shouldn't need to resort to CCAAS can you provide some more info on what you saw

Copy link
Contributor Author

@CaptainIRS CaptainIRS left a comment

Choose a reason for hiding this comment

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

@davidkel

Can you elaborate on selecting the correct endorsing peers.

The following error occurs randomly and can be observed in the GitHub Action logs:

2022-10-26T18:56:56.449Z - error: [TransactionEventStrategy]: constructor: No peers for strategy
2022.10.26-18:56:56.450 +0000 error [connectors/v2/FabricGateway] Failed to perform submit transaction [initMarble] using arguments [marbles_phase_4_0_0_0,red,10,Alice],  with error: Error: No peers for strategy
    at new TransactionEventStrategy (/tmp/sut/cached/v2.2.14/node_modules/fabric-network/lib/impl/event/transactioneventstrategy.js:49:19)
    at new AnyForTxStrategy (/tmp/sut/cached/v2.2.14/node_modules/fabric-network/lib/impl/event/anyfortxstrategy.js:41:1)
    at Transaction.MSPID_SCOPE_ANYFORTX [as eventHandlerStrategyFactory] (/tmp/sut/cached/v2.2.14/node_modules/fabric-network/lib/impl/event/defaulteventhandlerstrategies.js:60:27)
    at Transaction.submit (/tmp/sut/cached/v2.2.14/node_modules/fabric-network/lib/transaction.js:257:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async V2FabricGateway._submitOrEvaluateTransaction (/home/runner/work/caliper/caliper/packages/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:375:26)
    at async V2FabricGateway._sendSingleRequest (/home/runner/work/caliper/caliper/packages/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:168:16)
    at async V2FabricGateway.sendRequests (/home/runner/work/caliper/caliper/packages/caliper-core/lib/common/core/connector-base.js:83:26)
    at async MarblesInitWorkload.submitTransaction (/home/runner/work/caliper/caliper/packages/caliper-tests-integration/fabric_tests/init.js:72:9)

On trying to debug by setting a breakpoint:

image

Here, network.channel.endorsers has only one peer, belonging to Org2, whereas the requested mspId is of Org1, thus leading to no endorsing peers. This however happens only with SDKs <= v2.2 and doesn't appear with the Fabric Gateway APIs in v2.4. I'm not really sure about the root cause of this issue though.

we shouldn't need to resort to CCAAS can you provide some more info on what you saw

Sorry, I must've had some incorrect configuration when I tested earlier, but now it works and I have updated the PR to use the normal chaincode packaging method.

@davidkel
Copy link
Contributor

@CaptainIRS the errors are very odd and the fact they happen in both 1.4 and 2.2 node sdks only with microfab. Not surprised with the fabric-gateway as it does event handing differently. I'll see if I can get someone to look at it too.

@mbwhite
Copy link

mbwhite commented Oct 27, 2022

Hello @CaptainIRS ... I've been trying to recreate this problem with Microfab, without much success I'm afraid.
I believe that (logically) there are 2 processes, each running an application sending transactions. Is each just doing one org are does it swap?

I've got two apps here that are using the 2.2 NodeSDK submitting transactions to microfab; it seems completely stable.

Chaincode Signature Policy is --signature-policy "OR('org1MSP.peer','org2MSP.peer')"
Microfab config

        "endorsing_organizations":[
            {
                "name": "org1"
            },
            {
                "name": "org2"
            }
        ],
        "channels":[
            {
                "name": "mychannel",
                "endorsing_organizations":[
                    "org1","org2"
                ]
            }

        ],
        "capability_level":"V2_0"
    }'

Copy link
Contributor Author

@CaptainIRS CaptainIRS left a comment

Choose a reason for hiding this comment

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

Hi @mbwhite I have tried using just one channel in CaptainIRS#3, but the same error seems to occur even in this case. (GitHub Action logs: here and here)

@mbwhite
Copy link

mbwhite commented Oct 28, 2022

@CaptainIRS found the problem!!

For microfab the asLocalhost setting must be false. Irrespective of the fact it is local... it needs the full hostnames.

caliper:
    fabric:
       gateway:
         localhost: false

Added that to my local caliper configuration caliper.yaml and all is well.

@davidkel
Copy link
Contributor

Thank you @mbwhite for investigating. @CaptainIRS Best way is to add

--caliper-fabric-gateway-localhost false

when launching caliper eg

${CALL_METHOD} launch manager --caliper-workspace phase4 --caliper-flow-only-test --caliper-fabric-gateway-localhost false

It's interesting that microfab appears to work using the legacy sdks when localhost is set to true for a lot of the time so definitely something that microfab should document. I thought it used hostname for routing and as the endpoint urls get translated to localhost:8080 I wasn't expecting that to work at all. The problem was that the endorsers were being discovered and the endpoints were being translated to the same endpoint of localhost:8080 from org1peer-api.127-0-0-1.nip.io:8080 and org2peer-api.127-0-0-1.nip.io:8080 and thus you could only have one at that endpoint so in some cases was being loaded with the wrong peer for the mspid of the identity. I also suspect that if the chaincode had an AND endorsement policy it would have failed for all submissions as it wouldn't be able to get all endorsements as there would only be 1 endorser in the channel object.

@CaptainIRS CaptainIRS force-pushed the microfab branch 2 times, most recently from 84beca2 to 2616702 Compare October 28, 2022 13:01
Copy link
Contributor Author

@CaptainIRS CaptainIRS left a comment

Choose a reason for hiding this comment

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

It works after adding the CLI flag for localhost=false. Thanks @mbwhite for the help.

I also suspect that if the chaincode had an AND endorsement policy it would have failed for all submissions

@davidkel, I have tested this earlier and it indeed fails for all submissions.

@CaptainIRS CaptainIRS force-pushed the microfab branch 13 times, most recently from ad828e7 to 945af2f Compare February 14, 2023 13:21
@CaptainIRS CaptainIRS force-pushed the microfab branch 13 times, most recently from 237d5f8 to 35873cf Compare February 21, 2023 12:39
@CaptainIRS CaptainIRS force-pushed the microfab branch 3 times, most recently from 0cf6abf to bec4ae1 Compare February 22, 2023 03:20
@CaptainIRS CaptainIRS force-pushed the microfab branch 5 times, most recently from 7053286 to 151dddf Compare February 22, 2023 13:45
@stale
Copy link

stale bot commented Jun 8, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 8, 2023
@davidkel
Copy link
Contributor

Closing this pull request because microfab is has gone dormant with the maintainers now not involved in hyperledger fabric anymore and it's unlikely to be maintained in the future.

@davidkel davidkel closed this Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants