-
Notifications
You must be signed in to change notification settings - Fork 294
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(quorum): private transaction support #1337
feat(quorum): private transaction support #1337
Conversation
5e57b11
to
fed1aff
Compare
@@ -0,0 +1 @@ | |||
b9a4bd1539c15bcc83fa9078fe89200b6e9e802ae992f13cd83c853f16e8bed4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travis-payne Where are these being used? (meaning the whole network-files directory)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As below, not all the files are being used, but figured I'd leave them all there in case someone wants to expand on functionality that I might not foresee right now. Can remove if it useless though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travis-payne Only saw this by accident just now, please tag me otherwise it doesn't show up on my mentions feed.
I'd throw everything out that's not being used because we don't know when that future date will come and if these files will be outdated by then which would also lead to some additional confusion.
Codecov Report
@@ Coverage Diff @@
## main #1337 +/- ##
==========================================
+ Coverage 71.33% 71.35% +0.02%
==========================================
Files 308 309 +1
Lines 11264 11371 +107
Branches 1383 1400 +17
==========================================
+ Hits 8035 8114 +79
- Misses 2475 2490 +15
- Partials 754 767 +13
Continue to review full report at Codecov.
|
7d61bff
to
493e20d
Compare
.../cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts
Outdated
Show resolved
Hide resolved
...es/cactus-plugin-ledger-connector-quorum/src/test/resources/network-files/member1/accountkey
Outdated
Show resolved
Hide resolved
...gin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-private.test.ts
Outdated
Show resolved
Hide resolved
...gin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-private.test.ts
Outdated
Show resolved
Hide resolved
...gin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-private.test.ts
Outdated
Show resolved
Hide resolved
); | ||
|
||
t.comment("member3 should not be able to call contract"); | ||
t.throws(await member3Contract.methods.getName().call()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travis-payne Does this still works if you switch from throws
to rejects
?
throws
is for sync functions and I suspect the only thing it does here is asserting that a promise was returned without throwing, but it does not check if said promise would reject or resolve (even with the await
keyword baked in there - could be wrong though so I'm just asking to double check)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws
works here but running rejects
seems to crash out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws
works here but runningrejects
seems to crash out.
@travis-payne Please attach the logs that it crashes with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# member3 should not be able to call contract
not ok 14 member3Contract.methods.getName().call() throws exception
---
operator: throws
expected: undefined
actual: undefined
at: <anonymous> (/home/travispayne/cactus-fork/node_modules/tape-promise/index.compiled.js:43:12)
stack: |-
Error: member3Contract.methods.getName().call() throws exception
at Test.assert [as _assert] (/home/travispayne/cactus-fork/node_modules/tape/lib/test.js:311:54)
at Test.bound [as _assert] (/home/travispayne/cactus-fork/node_modules/tape/lib/test.js:96:32)
at Test.throws (/home/travispayne/cactus-fork/node_modules/tape/lib/test.js:676:10)
at Test.bound [as throws] (/home/travispayne/cactus-fork/node_modules/tape/lib/test.js:96:32)
at /home/travispayne/cactus-fork/node_modules/tape-promise/index.compiled.js:43:12
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async /home/travispayne/cactus-fork/packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-private.test.ts:292:3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petermetz sorry its a little delayed, but logs attached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travis-payne The logs you attached look like they were generated by throws
not rejects
(based on the call stack) could you please double check if these are the logs for rejects
crashing for sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petermetz yup, the following code chucks the same error:
const promise = member3Contract.methods.getName().call();
await t.rejects(promise,"member3 should not be able to call contract");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travis-payne Alright, I'll debug it on my machine then.
Please push a version of the code where it reproduces after a yarn configure && yarn ts-node packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-private.test.ts
and then ping me here and I'll take a peek.
packages/cactus-test-tooling/src/main/typescript/quorum/quorum-mp-test-ledger.ts
Outdated
Show resolved
Hide resolved
70f6042
to
af28daa
Compare
af28daa
to
220c2c0
Compare
fixes hyperledger-cacti#951 Signed-off-by: Travis Payne <[email protected]> Signed-off-by: Peter Somogyvari <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
220c2c0
to
3a31e5d
Compare
Signed-off-by: Peter Somogyvari <[email protected]>
Signed-off-by: johnhomantaring <[email protected]>
@petermetz can you assign me to this |
b049089
to
39b0133
Compare
fixes hyperledger-cacti#951 Signed-off-by: johnhomantaring <[email protected]>
39b0133
to
3844682
Compare
@petermetz all changes has been merged and to give context on the changes done. 1.) Issue on multiple nonce error has been resolved.
2.) Typings for web3js-quorum has been changed as well based on the latest update. Although this is not yet available in their latest release but available on their github repo. I modified some parts as well because there are some discrepancies on the examples and documentations. 3.) Modified the last part of the test script because Node3 is getting some error due to contracts deployed only in Node1 and Node2. Instead of truthy modified it to expect error. |
fixes hyperledger-cacti#951 Signed-off-by: john.h.o.mantaring-at-475704139995 <[email protected]>
|
GitGuardian id | Secret | Commit | Filename | |
---|---|---|---|---|
- | Elliptic Curve Private Key | 3f43cef | contribs/Fujitsu-ConnectionChain/connection-chain/environment/base/cc_env/servers/cooperation/coreSide/ec1_adapter/CA/adapter.priv | View secret |
- | Elliptic Curve Private Key | 3f43cef | contribs/Fujitsu-ConnectionChain/connection-chain/environment/base/cc_env/servers/cooperation/coreSide/ec2_adapter/CA/adapter.priv | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some crypto material like pub/priv keys in the code.
Can we not generate them within the code itself ?
Also, can you squash merge the commits?
will do.. I'm not the original owner of the PR so I'm unable to put it in draft.. Currently working on the changes |
@petermetz can we not simply close this PR and let @johnhomantaring create a fresh one? |
@jagpreetsinghsasan All good ideas! |
@jagpreetsinghsasan Usually I'd not do that because then the work @travis-payne had put in would appear on the other PR, but what we can do is add him as an author to the commit that will end up being in that new PR. So yeah, @johnhomantaring Please just start a new PR so that permissions are not a problem but do make sure that @travis-payne gets credit in the commit for the contributions as well not just yourself. |
Signed-off-by: john.h.o.mantaring-at-475704139995 <[email protected]>
created a new branch related to this PR based from the latest code base and added the fixes done.. Will put credit to @travis-payne on the new PR once done with testing |
Signed-off-by: john.h.o.mantaring-at-475704139995 <[email protected]>
Hi @petermetz , @johnhomantaring These are few major issues with the code
We can definitely re-use many of the code pieces from the PR, but as the refactoring needs to happen from the openapi.json level, almost all the newly generated interfaces, classes etc etc will be very different and thus a re-do is required. |
@jagpreetsinghsasan Fair enough. If that's the case then a re-work can be done on it eventually but first I really want to see the tests passing with a minimal set of fixes to the original work and then work our way backwards from there. Otherwise we'll fight the war on 2 fronts (one is trying to make the tests work to begin with and the second one is refactoring everything at the same time). |
@petermetz The issue of txCount reoccur again because of the same issue of trying to do the old flow of private txn.. I'm also checking how besu is doing the private txn and their code is more simplier without excessive codes. I think it would be best to do the recode like what @jagpreetsinghsasan mentioned since we could based it more with "web3js-quorum" rather than the old "web3js-eea". |
Signed-off-by: john.h.o.mantaring-at-475704139995 <[email protected]>
@johnhomantaring I have found out the issue (removed the previous messages as this is my final finding). This wasnt the case with Besu, as by default I tried our code and it works perfectly fine with the above change, the only challenge is with the typescript code of this (The js version works fine for me). |
I made it work using the (Maybe we need the validator priv key for web3js-quorum as well, but currently facing technical challenges with the initialisation itself, as mentioned above) |
Good Day @petermetz and @jagpreetsinghsasan. I would like to work on this one and @johnhomantaring assigned this to me to continue working on this issue |
Hi there! |
Hi @aldousalvarez |
@jagpreetsinghsasan After using some of your codes and minor modifications on my end of the private transaction is already passing with web3jsQuorum. Do you have any remaining tests on your end that I should include because I will be cleaning up the codes to start the PR and commit my changes. |
Cool @aldousalvarez . The current tests included in the |
Hi @aldousalvarez |
Hello @jagpreetsinghsasan currently working with the merging and clean up. As of now I am encountering issue with some conflicts on merging of previous commits. Targeting to complete the cleanup by Jan 27 or earlier and will commit once done with my testing. |
Thankyou for the update! |
Hi @aldousalvarez |
@johnhomantaring @jagpreetsinghsasan @aldousalvarez Closing this so that the discussion is moved over to the new PR at #2293 @travis-payne We'll credit you for that one as well, thanks for putting in the initial work on this one. |
Fixes #951