From 5415463a33c3a662b118b19948a89fbb333da963 Mon Sep 17 00:00:00 2001 From: Gabriel-Trintinalia Date: Fri, 24 May 2024 04:55:51 +1000 Subject: [PATCH] Rename methods and variables to match json (#7134) Signed-off-by: Gabriel-Trintinalia --- .../parameters/WithdrawalRequestParameter.java | 4 ++-- .../besu/ethereum/core/WithdrawalRequest.java | 18 +++++++++--------- .../encoding/WithdrawalRequestEncoder.java | 2 +- .../WithdrawalRequestContractHelper.java | 4 ++-- .../WithdrawalRequestContractHelperTest.java | 5 +++-- plugin-api/build.gradle | 2 +- .../besu/plugin/data/WithdrawalRequest.java | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/WithdrawalRequestParameter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/WithdrawalRequestParameter.java index d4786e1807..79c0251e83 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/WithdrawalRequestParameter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/WithdrawalRequestParameter.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='" diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/WithdrawalRequest.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/WithdrawalRequest.java index c9dbd0df67..decdf22c73 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/WithdrawalRequest.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/WithdrawalRequest.java @@ -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); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/WithdrawalRequestEncoder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/WithdrawalRequestEncoder.java index 2a8fbb6eee..26be22d488 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/WithdrawalRequestEncoder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/WithdrawalRequestEncoder.java @@ -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(); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelper.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelper.java index 5ef0a69989..3cbe952d00 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelper.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelper.java @@ -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; diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelperTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelperTest.java index 1c0485b598..6d21744e7b 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelperTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/WithdrawalRequestContractHelperTest.java @@ -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")))); } diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index e38237d7c3..a25774205b 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -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') diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/WithdrawalRequest.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/WithdrawalRequest.java index 7f9f5d15e0..eeadd80418 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/WithdrawalRequest.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/WithdrawalRequest.java @@ -38,7 +38,7 @@ public interface WithdrawalRequest { * * @return public key of validator */ - PublicKey getValidatorPubKey(); + PublicKey getValidatorPublicKey(); /** * The amount for withdrawal