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

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

Merged
merged 20 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 21.10.4

### Additions and Improvements
- Removed deprecated hash variable `protected volatile Hash hash;` which was used for private transactions [#3110](https://github.com/hyperledger/besu/pull/3110)
mohitsaxenaknoldus marked this conversation as resolved.
Show resolved Hide resolved

## 21.10.3

### Additions and Improvements
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
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