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 support for Besu private transactions #1030

Merged
merged 5 commits into from
Oct 9, 2020

Conversation

lucassaldanha
Copy link
Member

Besu supports private transactions sent to a list of participant nodes. The library web3js-eea supports sending private transactions to Besu.

By expanding the network configuration DSL and adding a few changes to the Ethereum connection, we can support sending private transactions to Besu using Caliper.

Checklist

  • A link to the issue/user story that the pull request relates to
  • How to recreate the problem without the fix
  • Design of the change
  • How to prove that the change works
  • Automated tests that prove the fix keeps on working
  • Documentation - any JSDoc, website, or Stackoverflow answers?

Issue/User story

As a user, I want to have performance metrics of Besu when using private transactions.

Steps to Reproduce

N/A

Existing issues

N/A

Design of the change

The core of the fix was to update ethereum-connector.js to be able to send private transactions. The network config DSL was extended to support some Besu privacy configurations.

In the network configuration, the ethereum object now can have a privacy section, enumerating privacy groups in the network. Also, there is the option of specifying what contracts should be private (and to what privacy group - aka participants - they belong to).

In the Ethereum connection, there are two new methods exclusively used for private transactions: deployPrivateContract and _sendSinglePrivateRequest.

Validation of the change

I added a new step in the Besu integration tests to check the basic flow of public vs private contracts. I have done some manual testing as well to ensure the changes work.

Automated Tests

See Validation of the change

What documentation has been provided for this pull request

I'm not sure if we have specific Besu documentation for Caliper. If we do, we could probably add some info about using Besu with private transactions. Otherwise, the integration tests should be a good start for anyone wanting to use it.

@lgtm-com
Copy link

lgtm-com bot commented Oct 1, 2020

This pull request introduces 3 alerts when merging ba7cb7b into 5938426 - view on LGTM.com

new alerts:

  • 2 for Expression has no effect
  • 1 for Unused variable, import, function or class

Comment on lines 107 to 110
let contract = this.ethereumConfig.contracts[key];
let contractData = require(CaliperUtils.resolvePath(contract.path)); // TODO remove path property
let contractGas = contract.gas;
let estimateGas = contract.estimateGas;
Copy link
Contributor

Choose a reason for hiding this comment

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

These could be const - helps the JIT optimizer

Copy link
Contributor

@benjamincburns benjamincburns left a comment

Choose a reason for hiding this comment

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

LGTM - only one comment that's really inconsequential. Thanks a ton for including the new tests!

@lucassaldanha lucassaldanha force-pushed the besu-privacy branch 2 times, most recently from 21a1463 to 8a74c7d Compare October 2, 2020 01:28
@lgtm-com
Copy link

lgtm-com bot commented Oct 2, 2020

This pull request introduces 4 alerts when merging 8a74c7d into 5938426 - view on LGTM.com

new alerts:

  • 2 for Expression has no effect
  • 1 for Assignment to constant
  • 1 for Syntax error

@lgtm-com
Copy link

lgtm-com bot commented Oct 2, 2020

This pull request introduces 2 alerts when merging c3a5701 into 5938426 - view on LGTM.com

new alerts:

  • 2 for Expression has no effect

@lgtm-com
Copy link

lgtm-com bot commented Oct 2, 2020

This pull request introduces 1 alert when merging fafd1a5 into 5938426 - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@lgtm-com
Copy link

lgtm-com bot commented Oct 2, 2020

This pull request introduces 1 alert when merging b565db9 into 5938426 - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 2, 2020

This pull request introduces 1 alert when merging 99e337c into 5938426 - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@nklincoln
Copy link
Contributor

@lucassaldanha - there's a few LGTM bot warnings present at the moment, which you can view above, and one conflict due to a recent release that will need a quick rebase 👍

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
@nklincoln
Copy link
Contributor

@lucassaldanha - thanks for the update, there is one pending LGTM issue relating to the store.js test file in the constructor (this.contract has no effect) are you able to update that one too please?

@lucassaldanha
Copy link
Member Author

thanks for the update, there is one pending LGTM issue relating to the store.js test file in the constructor (this.contract has no effect) are you able to update that one too please?

@nklincoln I thought I had it fixed might've missed it. Where are you seeing the warning?

@nklincoln
Copy link
Contributor

@lucassaldanha - thanks, I must have been looking at an out of date notification.

I've been looking at the output of the integration test run, and there appears to be a negative send rate being reported. Would you be able to bump the transaction number to a higher number (100 perhaps) so that we can determine if it is something in the private transaction addition, or a bug in caliper for low transaction numbers?

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
@lucassaldanha
Copy link
Member Author

@nklincoln Done! :)

Copy link
Contributor

@nklincoln nklincoln left a comment

Choose a reason for hiding this comment

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

Hi @lucassaldanha , had a deeper look as was seeing a negative send rate ... looks to be a bug in caliper main ... but did notice the flag that might need a change

this.privacyOpts = sutContext.privacy[this.roundArguments.private];
this.privacyOpts['id'] = this.roundArguments.private;
} else {
this.private = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

this.isPrivate = false ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! Because of the way the value was being consumed, it was undefined for public txs and in the end, the logic was working out the same. Lucky! :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed 👍

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
@nklincoln
Copy link
Contributor

@lucassaldanha - Thanks for the contribution 👍

It would be great if you could extend the docs to include details on how to take advantage of the new features added.

If you checkout the gh-pages branch, the file of interest is doc/vNext/EthereumConfiguration.md - any questions, please reach out to us on RC 😄

@nklincoln nklincoln merged commit 161bce5 into hyperledger:master Oct 9, 2020
danielporto pushed a commit to danielporto/caliper that referenced this pull request Nov 3, 2020
* Added support for Besu private transactions

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>

* Fix LGTM warning

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>

* Updated tx count

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>

* Fix variable name

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.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