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

Added deocde flag to get_channel_config_with_orderer #105

Merged
merged 2 commits into from
Aug 25, 2020
Merged

Added deocde flag to get_channel_config_with_orderer #105

merged 2 commits into from
Aug 25, 2020

Conversation

nkalichynskyi
Copy link
Contributor

Added deocde flag to get_channel_config_with_orderer method to have an ability to fetch config without decoding

@nkalichynskyi nkalichynskyi requested a review from a team as a code owner August 13, 2020 06:15
Copy link
Contributor

@nobody4t nobody4t left a comment

Choose a reason for hiding this comment

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

  1. why we need this encoded config? Is there any scenario for this? Perhaps I missed some.
  2. If this function return encoded config, then we do not need to decode it at all. So logic here should be modified. If decoding is unnecceary, do not decode it.

Please verify the first question before moving on.

@nkalichynskyi
Copy link
Contributor Author

@dongwangdw, I've created this PR because of #103, there is an issue with decoding of the config. So at least having an option fo fetch encoded config and decode it later with some other tool is helpful. Decoding was left there because someone might already use it, in addition function get_channel_config has an option to return encoded config so it would make sense for these two functions to have similar functionality.

@@ -974,9 +974,9 @@ async def get_channel_config_with_orderer(self, tx_context, orderer):
block = v.block
break

block = BlockDecoder().decode(block.SerializeToString())
decoded_block = BlockDecoder().decode(block.SerializeToString())
Copy link
Member

Choose a reason for hiding this comment

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

When decode==False, do we still needs to run the decode(...)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this case, it seems like we do, since after that it checks whether the correct block was fetched and fetches another one if needed.

@nobody4t
Copy link
Contributor

@dongwangdw, I've created this PR because of #103, there is an issue with decoding of the config. So at least having an option fo fetch encoded config and decode it later with some other tool is helpful. Decoding was left there because someone might already use it, in addition function get_channel_config has an option to return encoded config so it would make sense for these two functions to have similar functionality.

OK. There is a data missing that you mentioned in #103. I would like to advise to investigate it deep for the root cause. And maybe a fix for it. It is very hard to fix it then let's have an easy workaround here. And your proposal would make more sense. Again I so much appreciated your PR.

@nkalichynskyi
Copy link
Contributor Author

nkalichynskyi commented Aug 17, 2020

@dongwangdw,I've already tried looking into the cause of this issue, but with no luck. This PR was already the last resort. Proto files look almost identical for this python-sdk and https://github.com/hyperledger/fabric-protos, especially for the Block message. Although I'm neither really familiar with the internals of this SDK nor have any experience with protobufs and might be missing something so if someone who is more familiar with SDK could take a look would be great.

…n ability to fetch config without decoding

Signed-off-by: nkalichynskyi <[email protected]>
@dexhunter
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yeasy
Copy link
Member

yeasy commented Aug 24, 2020

CI is not happy, please check the result and fix: https://github.com/hyperledger/fabric-sdk-py/pull/105/checks?check_run_id=1012418829.

@nkalichynskyi
Copy link
Contributor Author

nkalichynskyi commented Aug 25, 2020

CI is not happy, please check the result and fix: https://github.com/hyperledger/fabric-sdk-py/pull/105/checks?check_run_id=1012418829.

@yeasy, Found what's wrong with tests. The latest tag is missing now for fabric-ccenv image, that what caused tests to fail. I've fixed this by setting in the docker compose files same version as in check-env.sh.

Copy link
Contributor

@dexhunter dexhunter left a comment

Choose a reason for hiding this comment

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

lgtm

@dexhunter dexhunter merged commit ac0fea3 into hyperledger:master Aug 25, 2020
RohanShrothrium pushed a commit to RohanShrothrium/fabric-sdk-py that referenced this pull request Aug 26, 2020
* Added deocde flag to get_channel_config_with_orderer method to have an ability to fetch config without decoding

Signed-off-by: nkalichynskyi <[email protected]>

* fixed issue with missing latest tag for fabric-ccenv image

Signed-off-by: nkalichynskyi <[email protected]>
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.

4 participants