Skip to content

Commit

Permalink
Removing deprecated hash variable which was used to cache the transac…
Browse files Browse the repository at this point in the history
…tion (hyperledger#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>
  • Loading branch information
3 people authored and eum602 committed Nov 3, 2023
1 parent d1c8b49 commit f719697
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 54 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,7 +51,6 @@ public PrivateTransactionGroupResponse(
this.from = from;
this.gas = gas;
this.gasPrice = gasPrice;
this.hash = hash;
this.input = input;
this.nonce = nonce;
this.to = to;
Expand All @@ -77,10 +75,6 @@ public String getGasPrice() {
return gasPrice;
}

public String getHash() {
return hash;
}

public String getInput() {
return input;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ private PrivateTransactionReceiptResult buildPrivateTransactionReceiptResult(
privateTransaction.getBlockNumber(),
privateTransaction.getPmtIndex(),
privateTransaction.getPmtHash(),
privateTransaction.getHash(),
privateTransaction.getPrivateFrom(),
privateTransaction.getPrivateFor().orElse(null),
privateTransaction.getPrivacyGroupId().orElse(null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"from",
"gas",
"gasPrice",
"hash",
"input",
"nonce",
"to",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -77,7 +76,6 @@ public PrivateTransactionReceiptResult(
final long blockNumber,
final int txIndex,
final Hash commitmentHash,
final Hash transactionHash,
final Bytes privateFrom,
final List<Bytes> privateFor,
final Bytes privacyGroupId,
Expand All @@ -88,7 +86,6 @@ public 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
Expand Down Expand Up @@ -139,11 +136,6 @@ public String getCommitmentHash() {
return commitmentHash;
}

@JsonGetter("transactionHash")
public String getTransactionHash() {
return transactionHash;
}

@JsonGetter("privateFrom")
public String getPrivateFrom() {
return privateFrom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,7 +40,6 @@ protected PrivateTransactionResult(final PrivateTransaction tx) {
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);
Expand All @@ -68,11 +66,6 @@ public String getGasPrice() {
return gasPrice;
}

@JsonGetter(value = "hash")
public String getHash() {
return hash;
}

@JsonGetter(value = "input")
public String getInput() {
return input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ private PrivateTransactionReceiptResult privateTransactionReceiptResultFor(
0,
0,
markerTransaction.getHash(),
privateTransaction.getHash(),
privateTransaction.getPrivateFrom(),
privateTransaction.getPrivateFor().isPresent()
? privateTransaction.getPrivateFor().get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -508,23 +503,6 @@ public BigInteger getV() {
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
*
Expand Down
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
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.
*
Expand Down

0 comments on commit f719697

Please sign in to comment.