Removing deprecated hash variable which was used to cache the transaction (#3110)

* Removing deprecated code

Signed-off-by: Mohit Saxena <mohit.saxena@knoldus.com>

* Updating changelog and changing hash

Signed-off-by: Mohit Saxena <mohit.saxena@knoldus.com>

* updated plugin-api hash

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

* make breaking change more explicit in changelog

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
pull/3232/head
Mohit Saxena 3 years ago committed by GitHub
parent 97bad4a7b7
commit 09fdc3df07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivateTransactionGroupResponse.java
  3. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivGetTransactionReceipt.java
  4. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/privacy/PrivateTransactionGroupResult.java
  5. 8
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/privacy/PrivateTransactionReceiptResult.java
  6. 7
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/privacy/PrivateTransactionResult.java
  7. 1
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivGetTransactionReceiptTest.java
  8. 22
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivateTransaction.java
  9. 2
      plugin-api/build.gradle
  10. 7
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/PrivateTransaction.java

@ -2,6 +2,9 @@
## 22.1.0-RC2
### 22.1.0-RC2 Breaking Changes
- Removed deprecated hash variable `protected volatile Hash hash;` which was used for private transactions [#3110](https://github.com/hyperledger/besu/pull/3110)
### Additions and Improvements
- Re-order external services (e.g JsonRpcHttpService) to start before blocks start processing [#3118](https://github.com/hyperledger/besu/pull/3118)
- Stream JSON RPC responses to avoid creating big JSON strings in memory [#3076] (https://github.com/hyperledger/besu/pull/3076)

@ -21,7 +21,6 @@ public class PrivateTransactionGroupResponse {
private final String from;
private final String gas;
private final String gasPrice;
private final String hash;
private final String input;
private final String nonce;
private final String to;
@ -52,7 +51,6 @@ public class PrivateTransactionGroupResponse {
this.from = from;
this.gas = gas;
this.gasPrice = gasPrice;
this.hash = hash;
this.input = input;
this.nonce = nonce;
this.to = to;
@ -77,10 +75,6 @@ public class PrivateTransactionGroupResponse {
return gasPrice;
}
public String getHash() {
return hash;
}
public String getInput() {
return input;
}

@ -125,7 +125,6 @@ public class PrivGetTransactionReceipt implements JsonRpcMethod {
privateTransaction.getBlockNumber(),
privateTransaction.getPmtIndex(),
privateTransaction.getPmtHash(),
privateTransaction.getHash(),
privateTransaction.getPrivateFrom(),
privateTransaction.getPrivateFor().orElse(null),
privateTransaction.getPrivacyGroupId().orElse(null),

@ -23,7 +23,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"from",
"gas",
"gasPrice",
"hash",
"input",
"nonce",
"to",

@ -56,7 +56,6 @@ public class PrivateTransactionReceiptResult {
private final String from;
private final List<TransactionReceiptLogResult> logs;
private final String to;
private final String transactionHash;
private final String transactionIndex;
private final String revertReason;
private final String output;
@ -77,7 +76,6 @@ public class PrivateTransactionReceiptResult {
final long blockNumber,
final int txIndex,
final Hash commitmentHash,
final Hash transactionHash,
final Bytes privateFrom,
final List<Bytes> privateFor,
final Bytes privacyGroupId,
@ -88,7 +86,6 @@ public class PrivateTransactionReceiptResult {
this.to = to;
this.output = output.toString();
this.commitmentHash = commitmentHash.toString();
this.transactionHash = transactionHash.toString();
this.privateFrom = privateFrom != null ? privateFrom.toBase64String() : null;
this.privateFor =
privateFor != null
@ -139,11 +136,6 @@ public class PrivateTransactionReceiptResult {
return commitmentHash;
}
@JsonGetter("transactionHash")
public String getTransactionHash() {
return transactionHash;
}
@JsonGetter("privateFrom")
public String getPrivateFrom() {
return privateFrom;

@ -26,7 +26,6 @@ public abstract class PrivateTransactionResult {
private final String from;
private final String gas;
private final String gasPrice;
private final String hash;
private final String input;
private final String nonce;
private final String to;
@ -41,7 +40,6 @@ public abstract class PrivateTransactionResult {
this.from = tx.getSender().toString();
this.gas = Quantity.create(tx.getGasLimit());
this.gasPrice = Quantity.create(tx.getGasPrice());
this.hash = tx.getHash().toString();
this.input = tx.getPayload().toString();
this.nonce = Quantity.create(tx.getNonce());
this.to = tx.getTo().map(Address::toHexString).orElse(null);
@ -68,11 +66,6 @@ public abstract class PrivateTransactionResult {
return gasPrice;
}
@JsonGetter(value = "hash")
public String getHash() {
return hash;
}
@JsonGetter(value = "input")
public String getInput() {
return input;

@ -210,7 +210,6 @@ public class PrivGetTransactionReceiptTest {
0,
0,
markerTransaction.getHash(),
privateTransaction.getHash(),
privateTransaction.getPrivateFrom(),
privateTransaction.getPrivateFor().isPresent()
? privateTransaction.getPrivateFor().get()

@ -100,11 +100,6 @@ public class PrivateTransaction implements org.hyperledger.besu.plugin.data.Priv
// Caches the transaction sender.
protected volatile Address sender;
// Caches the hash used to uniquely identify the transaction.
// This field will be removed in 1.5.0
@Deprecated(since = "1.4.3")
protected volatile Hash hash;
private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =
Suppliers.memoize(SignatureAlgorithmFactory::getInstance);
@ -508,23 +503,6 @@ public class PrivateTransaction implements org.hyperledger.besu.plugin.data.Priv
return v;
}
/**
* Returns the transaction hash.
*
* @deprecated All private transactions should be identified by their corresponding PMT hash.
* @return the transaction hash
*/
// This field will be removed in 1.5.0
@Deprecated(since = "1.4.3")
@Override
public Hash getHash() {
if (hash == null) {
final Bytes rlp = serialize(this).encoded();
hash = Hash.hash(rlp);
}
return hash;
}
/**
* Returns whether the transaction is a contract creation
*

@ -64,7 +64,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'DhISJBKoARZyoiT387UIA7QfcEwyOcIYm17f/fLsJRM='
knownHash = 'pDLQUs2Gl9hFV1ecKSacbbfwovrjMf/IBPiY1zkOZlI='
}
check.dependsOn('checkAPIChanges')

@ -21,13 +21,6 @@ import java.util.Optional;
import org.apache.tuweni.bytes.Bytes;
public interface PrivateTransaction {
/**
* The Keccak 256-bit hash of this transaction.
*
* @return The Keccak 256-bit hash of this transaction.
*/
Hash getHash();
/**
* A scalar value equal to the number of transactions sent by the sender.
*

Loading…
Cancel
Save