Skip to content

Commit

Permalink
upstream merge (#25)
Browse files Browse the repository at this point in the history
* Plugin error stack traces (hyperledger#369)

Because of how the Log4J2 api works exception stack traces were not
being printed.  Update to use the explicit "throwable" overloaded
methods.

Signed-off-by: Danno Ferrin <[email protected]>

* VM Trace fixes (hyperledger#372)

* correct refund addresses
* correct returned memory from static precompiled calls.
* update integration test
* precompiles sometimes get plain old CALLs

Signed-off-by: Danno Ferrin <[email protected]>

* Validate private transaction before sending to enclave (hyperledger#356)

Signed-off-by: Jason Frame <[email protected]>

* Trace API fixes (hyperledger#377)

- Correct Reporting of reverts in nested call
- correct reporting and handling of value transfer in nested calls
- correct handling of precompiles via DELEGATECALL & CALLCODE
- Addition of precompiled contract gas costs
- Re-work handling of storage writes
- Initial handling of gas refunds
- fix bug in DELEGATECALL tests, we don't need gas in the stack
  * this has a cascading effect on balances in diff tests
- rework depth detection in flat trace
- two new tests blocks

Signed-off-by: Danno Ferrin <[email protected]>

* [BOUNTY-2] Add NAT Docker Support  (hyperledger#368)

* add docker detection

Signed-off-by: Karim TAAM <[email protected]>

* add port mapping detection

Signed-off-by: Karim TAAM <[email protected]>

* add tests and refactor ip detection

Signed-off-by: Karim TAAM <[email protected]>

* clean RunnerBuilder

Signed-off-by: Karim TAAM <[email protected]>

* clean useless modification

Signed-off-by: Karim TAAM <[email protected]>

* spotless

Signed-off-by: Karim TAAM <[email protected]>

* resolve tests issues

Signed-off-by: Karim TAAM <[email protected]>

* streamline auto detection

Signed-off-by: Ratan Rai Sur <[email protected]>

Co-authored-by: Abdelhamid Bakhta <[email protected]>
Co-authored-by: Ratan Rai Sur <[email protected]>

* [PIE-1798] Priv RPC acceptance tests with stub enclave. (hyperledger#330)

* [PIE-1798] Added some Privacy RPC ATs with a stub enclave.

Signed-off-by: Mark Terry <[email protected]>

* More specific task metrics names (hyperledger#389)

A prior refactoring had accidentally removed the specific task names
from the metrics labels.

Signed-off-by: Danno Ferrin <[email protected]>

* More trace fixes (hyperledger#386)

* pop flat trace context when handling halts
* Better detection of precompiled and non-executed contracts
* correct from address when calling in init code
* fix some exotic nesting cases
* correct from field for init code calls at depth >1
* correct cost on a non-call
* changelog and notes

Signed-off-by: Danno Ferrin <[email protected]>

* adding the plugin-api javadoc jar at the root level (hyperledger#378)

Signed-off-by: Joshua Fernandes <[email protected]>

* BESU-56: remove erroneous links to errorprone checks (hyperledger#385)

Signed-off-by: Antoine Toulme <[email protected]>

* Changelog entry for multi-tenancy feature (hyperledger#394)

Signed-off-by: Edward Evans <[email protected]>
Signed-off-by: Jason Frame <[email protected]>

* 1.5 RC Changelog (hyperledger#395)

* 1.5 RC changelog additions

Signed-off-by: Sally MacFarlane <[email protected]>

* Fixed link (hyperledger#393)

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

Co-authored-by: Edward <[email protected]>

* docker changelog (hyperledger#391)

* docker changelog

Signed-off-by: Ratan Rai Sur <[email protected]>

* address comments

Signed-off-by: Ratan Rai Sur <[email protected]>

Co-authored-by: MadelineMurray <[email protected]>

* Added known bug to changelog  (hyperledger#388)

* Added known bug

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

* Added another known bug

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

* updating version to 1.4.0-rc1 (hyperledger#397)

Signed-off-by: Joshua Fernandes <[email protected]>

* updating verion to 1.4.1-snapshot (hyperledger#398)

Signed-off-by: Joshua Fernandes <[email protected]>

* [BESU-169] cache logs bloom filters automatically. (hyperledger#367)

* First iteration. Draft PR.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* fix SPDX header

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Use block broadcaster to index log bloom.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Remove useless toString method

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* spotless apply

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* cacheLogsBloomForBlockHeader

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* spotless apply

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* ensurePreviousSegmentsArePresent

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Added CLI flag to enable / disable automatic logs bloom indexing.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Create cache directory and cache file if not exist.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Fix acceptance test

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Write cache for block only if block is new canonical head.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Handling of chain reorg.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* fix

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* sportless apply

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Address PR comments.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Remove unused constant.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* spotless apply

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* [BESU-25] Use Devp2p Ping packets at v5 (hyperledger#392)

Broadcast that we support snappy compression

Signed-off-by: Danno Ferrin <[email protected]>

* Rename logs bloom indexer to log bloom cache to match CLI flag. (hyperledger#401)

Changes class names, variables, and CLI flags as needed.

Signed-off-by: Danno Ferrin <[email protected]>

* [PIE-1798] Fail cases for multitenancy ATs (hyperledger#400)

Signed-off-by: Mark Terry <[email protected]>

* Private state update metadata and migration (hyperledger#404)

(backport from release-1.4)
Private state update metadata and migration

Signed-off-by: Lucas Saldanha <[email protected]>

* [PIE-2303] Automatic log bloom caching - Remove usage of pending file. (hyperledger#407)

* Don't use pending file.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Don't use pending file.

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Create a custom error when plugin is not found. (hyperledger#409)

Signed-off-by: Abdelhamid Bakhta <[email protected]>

* Rename method (hyperledger#412)

* rename the method isPersistingState to isPersistingPrivateState because that is what it is used for

Signed-off-by: Stefan Pingel <[email protected]>

* rename the method isPersistingState to isPersistingPrivateState because that is what it is used for

Signed-off-by: Stefan Pingel <[email protected]>

* rename the method isPersistingState to isPersistingPrivateState because that is what it is used for

Signed-off-by: Stefan Pingel <[email protected]>

* [BOUNTY-4] Add NAT Kubernetes Support (hyperledger#410)

* add kubernetes support

Signed-off-by: Karim TAAM <[email protected]>

* fix review issues

Signed-off-by: Karim TAAM <[email protected]>

* LogBloomCache - make sure the current segment is filled (hyperledger#411)

Make sure we cache the current cache segment with all of the data from
the beginning of the segment.  Use a flip file approach since it will be
 a partial file until done.

Signed-off-by: Danno Ferrin <[email protected]>

Co-authored-by: Abdelhamid Bakhta <[email protected]>

* Reduce recaching in Transaction Log Bloom Filter Cache (hyperledger#415)

Do a cursory cache check at start up (file is present and correct size)
instead of re-generating the cache at startup.

Signed-off-by: Danno Ferrin <[email protected]>

* fix order of nat detector (hyperledger#414)

Signed-off-by: Karim TAAM <[email protected]>

* Update SLOAD_GAS cost to 200 in Aztlan Gas Calculator (#23) (hyperledger#382)

* Update SLOAD_GAS cost to 200 in Aztlan Gas Calculator

Change SLOAD_GAS cost in Aztlan Gas Calculator from 800 to 200 and
update functions that use SLOAD_GAS.

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

* Update SLOAD_GAS cost to 200 in Aztlan Gas Calculator

Change SLOAD_GAS cost in Aztlan Gas Calculator from 800 to 200 and
update functions that use SLOAD_GAS.

Signed-off-by: edwardmack <[email protected]>
Signed-off-by: Edward Mack <[email protected]>

* remove overrides

removed overrides of calculateStorageCost and
calculateStorageRefundAmount in AztlanGasCalculator because these were
causing aztlan fork not to sync with kotti testnet.

Signed-off-by: Edward Mack <[email protected]>

* merge

Signed-off-by: Edward Mack <[email protected]>

* Remove unused ExecutorService init/termination (hyperledger#419)

Signed-off-by: Horacio Mijail Anton Quiles <[email protected]>

Co-authored-by: CJ Hare <[email protected]>

* Implement Eth/64 (hyperledger#425)

Wire in the fork identifier into the status messages as Eth64.

Signed-off-by: Danno Ferrin <[email protected]>

* Adds priv_getcode (hyperledger#428)

* Adds priv_getcode

Signed-off-by: Joshua Richardson <[email protected]>

* BESU-146 - check if success and return errorResponse otherwise (hyperledger#424)

Signed-off-by: Anthony Buckle <[email protected]>

Co-authored-by: CJ Hare <[email protected]>

* fixed typos (hyperledger#429)

Signed-off-by: Sally MacFarlane <[email protected]>

Co-authored-by: CJ Hare <[email protected]>

* roll back on ALL-CAPS.md files for TSC proposal (hyperledger#376)

Signed-off-by: Felipe Faraggi <[email protected]>

* updating the changelog with 1.4.0 details (hyperledger#431)

Signed-off-by: Joshua Fernandes <[email protected]>

* [BESU-194] Remove max pivot block resets during fast sync (hyperledger#427)

* remove max pivot block resets during fast sync

* increase max retry number and fix test

* change logs in the handleFailure method

* change logs related to suspicious number of retries
Signed-off-by: Karim TAAM <[email protected]>

Co-authored-by: Danno Ferrin <[email protected]>
Co-authored-by: Jason Frame <[email protected]>
Co-authored-by: Karim T. <[email protected]>
Co-authored-by: Abdelhamid Bakhta <[email protected]>
Co-authored-by: Ratan Rai Sur <[email protected]>
Co-authored-by: mark-terry <[email protected]>
Co-authored-by: Joshua Fernandes <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Co-authored-by: MadelineMurray <[email protected]>
Co-authored-by: Edward <[email protected]>
Co-authored-by: Lucas Saldanha <[email protected]>
Co-authored-by: pinges <[email protected]>
Co-authored-by: Horacio Mijail Antón Quiles <[email protected]>
Co-authored-by: CJ Hare <[email protected]>
Co-authored-by: anthonybuckle <[email protected]>
Co-authored-by: Felipe Faraggi <[email protected]>
  • Loading branch information
18 people authored Feb 27, 2020
1 parent 350352d commit 28f7a47
Show file tree
Hide file tree
Showing 243 changed files with 13,601 additions and 2,871 deletions.
2,021 changes: 1,070 additions & 951 deletions CHANGELOG.md

Large diffs are not rendered by default.

Empty file added CODEOWNERS.md
Empty file.
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [[email protected]]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[Contributor Covenant]: https://www.contributor-covenant.org
[[email protected]]: mailto:[email protected]
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Welcome to the Besu repository! The following links are a set of guidelines for
### LF / Jira Accounts

Having the following accounts is necessary for contributing code/issues to Besu.
* If you want to contribute code, you can make a [Linux Foundation (LF) account] here.
* If you want to contribute code, you can make a [github account here](https://github.com).
* If you want to raise an issue, you can login to your [Atlassian account here](https://id.atlassian.com/).
* Our Rocket Chat also requires a [Linux Foundation (LF) account].
* Our Rocket Chat requires a [Linux Foundation (LF) account].

### Useful contributing links

Expand Down
Empty file added ISSUE_TEMPLATE.md
Empty file.
Empty file added NOTICE.md
Empty file.
39 changes: 39 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Status
**READY/IN DEVELOPMENT/HOLD**

## Description
A few sentences describing the overall goals of the pull request's commits.

## Related PRs
List related PRs against other branches:

branch | PR
------ | ------
other_pr_production | [link]()
other_pr_master | [link]()


## Todos
- [ ] Tests
- [ ] Documentation


## Deploy Notes
Notes regarding deployment the contained body of work. These should note any
db migrations, etc.

## Steps to Test or Reproduce
Outline the steps to test or reproduce the PR here.

```sh
git pull --prune
git checkout <feature_branch>
bundle; script/server
```

1.

## Impacted Areas in Application
List general components of the application that this PR will affect:

*
66 changes: 66 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Roadmap
This document represents the current working roadmap for Besu. It is a living document, which will
evolve and change over time. In particular the features in later versions are likely to be refined and change.

We use the approach of `#now`, `#next`, `#later` [used by foursquare](https://medium.com/@noah_weiss/now-next-later-roadmaps-without-the-drudgery-1cfe65656645), with a slightly different time horizon.
Our `#now` scale is about 3 months, `#next` about 6 months, and `+later` is 12+ months.

## Now (up to v1.3)
Our key areas for now are:
* Making Besu a First Class Client
* Istanbul Support
* State Pruning
* Disaster recovery

### Making Besu a First Class Client

First and foremost, we want Besu to be a first class client for usage on both mainnet and permissioned networks.
This entails maintaining compatibility with mainnet, providing permissioning features and constantly improving Besu's performance.
Some recent additions to the client have been [UPnP Support](https://docs.besu.pegasys.tech/en/latest/Configuring-Besu/Networking/Using-UPnP/)
and a [GraphQL interface](https://docs.besu.pegasys.tech/en/latest/Besu-API/GraphQL/).

### Istanbul Support

Besu will support the upcoming Istanbul network upgrade and implement all required EIPs as per the [Hardfork Meta: Istanbul EIP](https://eips.ethereum.org/EIPS/eip-1679).

### State Pruning

State pruning will be implemented. State pruning reduces the disk space required for the Besu database by discarding outdated world state data.

### Disaster Recovery

Support key-value storage in relational databases to solidify a robust Disaster Recovery process. Note: Orion to support Oracle and Postgres in 1.3.

## Next (v1.4)
The key areas for next are:
* Tracing APIs
* Enhancing key management capabilities
* Migration tools
* Ethereum 1.x

### Tracing APIs

Additional tracing APIs to be added.

### Enhancing Key Management

Enhancing key management capabilities by supporting secure storage of keys.

### Migration Tools

Adding tools to enable migration across consensus algorithms.

### Ethereum 1.x

The Besu team will help spearhead the Ethereum 1.x initiative by contributing to EIPs, community discussions, roadmap specificaton and eventually implementing the resulting features from the initiative. More information on the 1.x initiative can be found [here](https://docs.ethhub.io/ethereum-roadmap/ethereum-1.x/).

## Future (v1.5+)
In addition to making incremental improvements to the above features, there will be some bigger pieces of work.
These are deliberately kept vague at this time, and will be elaborated upon when they move up to the now and next levels of work.

* Ethereum 2.0
* Alternate Consensus Mechanisms
* Sidechains
* Privacy group consensus
* Cross privacy group communication
* On-chain privacy
11 changes: 11 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Hyperledger Security Policy

## Reporting a Security Bug

If you think you have discovered a security issue in any of the Hyperledger projects, we'd love to hear from you. We will take all security bugs seriously and if confirmed upon investigation we will patch it within a reasonable amount of time and release a public security bulletin discussing the impact and credit the discoverer.

There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at hyperledger dot org](mailto:[email protected]).

The other way is to file a confidential security bug in our [JIRA bug tracking system](https://jira.hyperledger.org). Be sure to set the “Security Level” to “Security issue”.

The process by which the Hyperledger Security Team handles security bugs is documented further in our [Defect Response page](https://wiki.hyperledger.org/display/HYP/Defect+Response) on our [wiki](https://wiki.hyperledger.org).
24 changes: 24 additions & 0 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Hyperledger Besu Support

Welcome to the Besu repository! The following links are a set of guidelines for contributing to this repo and its packages. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request. Contributions come in the form of code submissions, writing documentation, raising issues, helping others in chat, and any other actions that help develop Besu.

### LF / Jira Accounts

Having the following accounts is necessary for obtaining support for Besu.
* If you want to raise an issue, you can login to your [Atlassian account here](https://id.atlassian.com/).
* Our Rocket Chat requires a [Linux Foundation (LF) account].
* The Hyperlegder wiki also requires a [Linux Foundation (LF) account] in order to edit pages.

### Useful support links

* [Besu User Documentation]
* [RocketChat]
* [I just have a quick question](https://wiki.hyperledger.org/display/BESU/I+just+have+a+quick+question)
* [Did you find a bug?](https://wiki.hyperledger.org/display/BESU/Reporting+Bugs)
* [Issues](https://wiki.hyperledger.org/display/BESU/Issues)
* [Contributing Guidelines]


[Besu User Documentation]: https://besu.hyperledger.org
[RocketChat]: https://chat.hyperledger.org/
[Contributing Guidelines]: CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.hyperledger.besu.tests.acceptance.dsl.condition.login.LoginConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.perm.PermissioningConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.priv.PrivConditions;
import org.hyperledger.besu.tests.acceptance.dsl.condition.web3.Web3Conditions;
import org.hyperledger.besu.tests.acceptance.dsl.contract.ContractVerifier;
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster;
Expand All @@ -37,6 +38,7 @@
import org.hyperledger.besu.tests.acceptance.dsl.transaction.miner.MinerTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.net.NetTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.web3.Web3Transactions;

import org.junit.After;
Expand Down Expand Up @@ -65,6 +67,8 @@ public class AcceptanceTestBase {
protected final PermissioningTransactions permissioningTransactions;
protected final MinerTransactions minerTransactions;
protected final Web3Conditions web3;
protected final PrivConditions priv;
protected final PrivacyTransactions privacyTransactions;

protected AcceptanceTestBase() {
ethTransactions = new EthTransactions();
Expand All @@ -74,6 +78,7 @@ protected AcceptanceTestBase() {
ibftTwoTransactions = new Ibft2Transactions();
accountTransactions = new AccountTransactions(accounts);
permissioningTransactions = new PermissioningTransactions();
privacyTransactions = new PrivacyTransactions();
contractTransactions = new ContractTransactions();
minerTransactions = new MinerTransactions();

Expand All @@ -85,6 +90,7 @@ protected AcceptanceTestBase() {
net = new NetConditions(new NetTransactions());
cluster = new Cluster(net);
perm = new PermissioningConditions(permissioningTransactions);
priv = new PrivConditions(privacyTransactions);
admin = new AdminConditions(adminTransactions);
web3 = new Web3Conditions(new Web3Transactions());
besu = new BesuNodeFactory();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.tests.acceptance.dsl.condition.priv;

import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;

import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.EeaSendRawTransactionTransaction;

public class EeaSendRawTransactionSuccess implements Condition {

private final EeaSendRawTransactionTransaction sendRawTransactionTransaction;

public EeaSendRawTransactionSuccess(
final EeaSendRawTransactionTransaction sendRawTransactionTransaction) {
this.sendRawTransactionTransaction = sendRawTransactionTransaction;
}

@Override
public void verify(final Node node) {
final Hash transactionHash = node.execute(sendRawTransactionTransaction);
assertThat(transactionHash).isNotNull();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.tests.acceptance.dsl.condition.priv;

import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;

import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction;

import org.assertj.core.api.Assertions;
import org.web3j.protocol.exceptions.ClientConnectionException;

public class ExpectJsonRpcError implements Condition {

private final Transaction<?> transaction;
private final JsonRpcError error;

public ExpectJsonRpcError(final Transaction<?> transaction, final JsonRpcError error) {
this.transaction = transaction;
this.error = error;
}

@Override
public void verify(final Node node) {
try {
node.execute(transaction);
failBecauseExceptionWasNotThrown(ClientConnectionException.class);
} catch (final Exception e) {
Assertions.assertThat(e)
.isInstanceOf(ClientConnectionException.class)
.hasMessageContaining("400")
.hasMessageContaining(error.getMessage());
}
}
}
Loading

0 comments on commit 28f7a47

Please sign in to comment.