Rename methods and variables to match json (#7134)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/7143/head
Gabriel-Trintinalia 6 months ago committed by GitHub
parent ebb883075f
commit 5415463a33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/WithdrawalRequestParameter.java
  2. 18
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/WithdrawalRequest.java
  3. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/WithdrawalRequestEncoder.java
  4. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelper.java
  5. 5
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelperTest.java
  6. 2
      plugin-api/build.gradle
  7. 2
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/WithdrawalRequest.java

@ -45,7 +45,7 @@ public class WithdrawalRequestParameter {
final WithdrawalRequest withdrawalRequest) {
return new WithdrawalRequestParameter(
withdrawalRequest.getSourceAddress().toHexString(),
withdrawalRequest.getValidatorPubKey().toHexString(),
withdrawalRequest.getValidatorPublicKey().toHexString(),
withdrawalRequest.getAmount().toShortHexString());
}
@ -92,7 +92,7 @@ public class WithdrawalRequestParameter {
+ "sourceAddress='"
+ sourceAddress
+ '\''
+ ", validatorPubKey='"
+ ", validatorPublicKey='"
+ validatorPublicKey
+ '\''
+ ", amount='"

@ -26,13 +26,13 @@ public class WithdrawalRequest extends Request
implements org.hyperledger.besu.plugin.data.WithdrawalRequest {
private final Address sourceAddress;
private final BLSPublicKey validatorPubKey;
private final BLSPublicKey validatorPublicKey;
private final GWei amount;
public WithdrawalRequest(
final Address sourceAddress, final BLSPublicKey validatorPubKey, final GWei amount) {
final Address sourceAddress, final BLSPublicKey validatorPublicKey, final GWei amount) {
this.sourceAddress = sourceAddress;
this.validatorPubKey = validatorPubKey;
this.validatorPublicKey = validatorPublicKey;
this.amount = amount;
}
@ -47,8 +47,8 @@ public class WithdrawalRequest extends Request
}
@Override
public PublicKey getValidatorPubKey() {
return validatorPubKey;
public PublicKey getValidatorPublicKey() {
return validatorPublicKey;
}
@Override
@ -61,8 +61,8 @@ public class WithdrawalRequest extends Request
return "WithdrawalRequest{"
+ "sourceAddress="
+ sourceAddress
+ " validatorPubKey="
+ validatorPubKey
+ " validatorPublicKey="
+ validatorPublicKey
+ " amount="
+ amount
+ '}';
@ -78,12 +78,12 @@ public class WithdrawalRequest extends Request
}
final WithdrawalRequest that = (WithdrawalRequest) o;
return Objects.equals(sourceAddress, that.sourceAddress)
&& Objects.equals(validatorPubKey, that.validatorPubKey)
&& Objects.equals(validatorPublicKey, that.validatorPublicKey)
&& Objects.equals(amount, that.amount);
}
@Override
public int hashCode() {
return Objects.hash(sourceAddress, validatorPubKey, amount);
return Objects.hash(sourceAddress, validatorPublicKey, amount);
}
}

@ -48,7 +48,7 @@ public class WithdrawalRequestEncoder {
final WithdrawalRequest withdrawalRequest, final RLPOutput rlpOutput) {
rlpOutput.startList();
rlpOutput.writeBytes(withdrawalRequest.getSourceAddress());
rlpOutput.writeBytes(withdrawalRequest.getValidatorPubKey());
rlpOutput.writeBytes(withdrawalRequest.getValidatorPublicKey());
rlpOutput.writeUInt64Scalar(withdrawalRequest.getAmount());
rlpOutput.endList();
}

@ -150,7 +150,7 @@ public class WithdrawalRequestContractHelper {
queueHeadIndex.plus(i).multiply(WITHDRAWAL_REQUEST_STORAGE_SLOT_SIZE));
final Address sourceAddress =
Address.wrap(account.getStorageValue(queueStorageSlot).toBytes().slice(12, 20));
final BLSPublicKey validatorPubKey =
final BLSPublicKey validatorPublicKey =
BLSPublicKey.wrap(
Bytes.concatenate(
account
@ -162,7 +162,7 @@ public class WithdrawalRequestContractHelper {
UInt64.fromBytes(account.getStorageValue(queueStorageSlot.plus(2)).slice(16, 8));
withdrawalRequests.add(
new WithdrawalRequest(sourceAddress, validatorPubKey, GWei.of(amount)));
new WithdrawalRequest(sourceAddress, validatorPublicKey, GWei.of(amount)));
}
return withdrawalRequests;

@ -186,13 +186,14 @@ class WithdrawalRequestContractHelperTest {
Bytes.fromHexString("0x000000000000000000000000"), request.getSourceAddress())));
// validator_pubkey
contract.setStorageValue(
UInt256.valueOf(offset++), UInt256.fromBytes(request.getValidatorPubKey().slice(0, 32)));
UInt256.valueOf(offset++),
UInt256.fromBytes(request.getValidatorPublicKey().slice(0, 32)));
contract.setStorageValue(
// set public key to slot, with 16 bytes padding on the right
UInt256.valueOf(offset++),
UInt256.fromBytes(
Bytes.concatenate(
request.getValidatorPubKey().slice(32, 16),
request.getValidatorPublicKey().slice(32, 16),
request.getAmount().toBytes(), // 8 bytes for amount
Bytes.fromHexString("0x0000000000000000"))));
}

@ -70,7 +70,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 = 'wMhttXj2aWFgpN9msxHz/FwQVovpYRxNysnZEpwZYxg='
knownHash = 'zgPAgf+ZxefbnCE9aYEQ5QoeBVsHySi3u+BlhHNHqn8='
}
check.dependsOn('checkAPIChanges')

@ -38,7 +38,7 @@ public interface WithdrawalRequest {
*
* @return public key of validator
*/
PublicKey getValidatorPubKey();
PublicKey getValidatorPublicKey();
/**
* The amount for withdrawal

Loading…
Cancel
Save