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

Show what do not match #3012

Merged
merged 4 commits into from
Nov 5, 2021
Merged

Show what do not match #3012

merged 4 commits into from
Nov 5, 2021

Conversation

gqqnbig
Copy link
Contributor

@gqqnbig gqqnbig commented Nov 2, 2021

Signed-off-by: gqqnbig gqqnb2005@gmail.com

Type of change

  • Improvement (improvement to code, performance, etc)

Description

When peer chaincode invoke submits a request, if chaincode has bugs, it may return different responses on different nodes.

Before, the error message is like

Error: could not assemble transaction: ProposalResponsePayloads do not match - proposal response: version:1 response:<status:200 payload:"true" > payload:"\n \265\277\020\265\226D\035\361\001n\371K\013\274\021F\227\002?\261\204\370\327\363r\347\010\221\313\214\031\230\022\213\001\no\0227\n\n_lifecycle\022)\n'..." endorsement:<endorser:"\n\007Org2MSP\022\252\006-----BEGIN CERTIFICATE-----\nMIICKDCCAc+gA..." signature:"0D\002 J\\300\307~\350\236\026\245H\003\337\2732\020\312\n\017Fa\306~\367x\356\347K\225..." >

That is it. Developers have no idea what mismatch what.

Now, with this PR, the error message is like

Error: could not assemble transaction: ProposalResponsePayloads do not match with version:1 response:<status:200 payload:"true" > payload:"\n \265\277\020\265\226D\035\361\001n\371K\013\274\021F\227\002?\261\204\370\327\363r\347\010\221\313\214\031\230\022\230\001\n|\0227\n\n_lifecycle\022)\n'\n..." endorsement:<endorser:"\n\007Org1MSP\022\252\006-----BEGIN CERTIFICATE-----\nMIICKDCCAc6gAwIBAgIQEO..." signature:"0E\002!\000\331p\034A\353t\261{\026#\177\211\371g\232\213\331\323..." >
- proposal response: version:1 response:<status:200 payload:"true" > payload:"\n \265\277\020\265\226D\035\361\001n\371K\013\274\021F\227\002?\261\204\370\327\363r\347\010\221\313\214\031\230\022\213\001\no\0227\n\n_lifecycle\022)\n'..." endorsement:<endorser:"\n\007Org2MSP\022\252\006-----BEGIN CERTIFICATE-----\nMIICKDCCAc+gA..." signature:"0D\002 J\\300\307~\350\236\026\245H\003\337\2732\020\312\n\017Fa\306~\367x\356\347K\225..." >

With this error message, developers can use text comparison tools to find out where the two responses start to differ, and they may get some cues.

Technically, only the payload part needs to be displayed, but I don't know how to format bytes as the toString method of ProposalResponse does.

Signed-off-by: gqqnbig <gqqnb2005@gmail.com>
@gqqnbig gqqnbig marked this pull request as ready for review November 2, 2021 13:08
@gqqnbig gqqnbig requested a review from a team as a code owner November 2, 2021 13:08
@gqqnbig
Copy link
Contributor Author

gqqnbig commented Nov 2, 2021

Let me know if you like the idea.

I know unit tests are failing. If the change is ok, I will spend more time on fixing the tests.

Signed-off-by: gqqnbig <gqqnb2005@gmail.com>
@gqqnbig
Copy link
Contributor Author

gqqnbig commented Nov 3, 2021

@yacovm I've revised to print base64.

protoutil/txutils.go Outdated Show resolved Hide resolved
Signed-off-by: gqqnbig <gqqnb2005@gmail.com>
@gqqnbig
Copy link
Contributor Author

gqqnbig commented Nov 4, 2021

@yacovm I find TestWithStaticDeliverClientLeader failed. Can you help with that?

@yacovm yacovm enabled auto-merge (squash) November 4, 2021 18:20
Copy link
Contributor

@yacovm yacovm left a comment

Choose a reason for hiding this comment

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

--- FAIL: TestEndorse (0.10s)
    --- FAIL: TestEndorse/non-matching_responses (0.00s)
        api_test.go:1768: 
            	Error Trace:	api_test.go:1768
            	            				api_test.go:833
            	Error:      	Error message not equal:
            	            	expected: "rpc error: code = Aborted desc = failed to assemble transaction: ProposalResponsePayloads do not match (base64):"
            	            	actual  : "rpc error: code = Aborted desc = failed to assemble transaction: ProposalResponsePayloads do not match (base64): 'EhQaEgjIARoNbW9ja19yZXNwb25zZQ==' vs 'EhkaFwjIARoSZGlmZmVyZW50X3Jlc3BvbnNl'"

Signed-off-by: gqqnbig <gqqnb2005@gmail.com>
auto-merge was automatically disabled November 5, 2021 04:34

Head branch was pushed to by a user without write access

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.

None yet

2 participants