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

Standardize pubkey and public key naming in deposit #6012

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public class DepositParameter {

private final String publicKey;
private final String pubkey;

private final String withdrawalCredentials;
private final String amount;
Expand All @@ -40,12 +40,12 @@ public class DepositParameter {

@JsonCreator
public DepositParameter(
@JsonProperty("pubkey") final String pubKey,
@JsonProperty("pubkey") final String pubkey,
@JsonProperty("withdrawalCredentials") final String withdrawalCredentials,
@JsonProperty("amount") final String amount,
@JsonProperty("signature") final String signature,
@JsonProperty("index") final String index) {
this.publicKey = pubKey;
this.pubkey = pubkey;
this.withdrawalCredentials = withdrawalCredentials;
this.amount = amount;
this.signature = signature;
Expand All @@ -54,7 +54,7 @@ public DepositParameter(

public static DepositParameter fromDeposit(final Deposit deposit) {
return new DepositParameter(
deposit.getPublicKey().toString(),
deposit.getPubkey().toString(),
deposit.getWithdrawalCredentials().toString(),
deposit.getAmount().toShortHexString(),
deposit.getSignature().toString(),
Expand All @@ -63,7 +63,7 @@ public static DepositParameter fromDeposit(final Deposit deposit) {

public Deposit toDeposit() {
return new Deposit(
BLSPublicKey.fromHexString(publicKey),
BLSPublicKey.fromHexString(pubkey),
Bytes32.fromHexString(withdrawalCredentials),
GWei.fromHexString(amount),
BLSSignature.fromHexString(signature),
Expand All @@ -72,16 +72,16 @@ public Deposit toDeposit() {

public JsonObject asJsonObject() {
return new JsonObject()
.put("pubKey", publicKey)
.put("pubkey", pubkey)
.put("withdrawalCredentials", withdrawalCredentials)
.put("amount", amount)
.put("signature", signature)
.put("index", index);
}

@JsonGetter
public String getPublicKey() {
return publicKey;
public String getPubkey() {
return pubkey;
}

@JsonGetter
Expand Down Expand Up @@ -109,7 +109,7 @@ public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DepositParameter that = (DepositParameter) o;
return Objects.equals(publicKey, that.publicKey)
return Objects.equals(pubkey, that.pubkey)
&& Objects.equals(withdrawalCredentials, that.withdrawalCredentials)
&& Objects.equals(amount, that.amount)
&& Objects.equals(signature, that.signature)
Expand All @@ -118,14 +118,14 @@ public boolean equals(final Object o) {

@Override
public int hashCode() {
return Objects.hash(publicKey, withdrawalCredentials, amount, signature, index);
return Objects.hash(pubkey, withdrawalCredentials, amount, signature, index);
}

@Override
public String toString() {
return "DepositParameter{"
+ "pubKey='"
+ publicKey
+ pubkey
+ '\''
+ ", withdrawalCredentials='"
+ withdrawalCredentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@

public class Deposit implements org.hyperledger.besu.plugin.data.Deposit {

private final BLSPublicKey pubKey;
private final BLSPublicKey pubkey;
private final Bytes32 depositWithdrawalCredentials;
private final GWei amount;
private final BLSSignature signature;
private final UInt64 index;

public Deposit(
final BLSPublicKey pubKey,
final BLSPublicKey pubkey,
final Bytes32 depositWithdrawalCredentials,
final GWei amount,
final BLSSignature signature,
final UInt64 index) {
this.pubKey = pubKey;
this.pubkey = pubkey;
this.depositWithdrawalCredentials = depositWithdrawalCredentials;
this.amount = amount;
this.signature = signature;
Expand All @@ -64,8 +64,8 @@ public void writeTo(final RLPOutput out) {
}

@Override
public PublicKey getPublicKey() {
return pubKey;
public PublicKey getPubkey() {
return pubkey;
}

@Override
Expand All @@ -92,7 +92,7 @@ public UInt64 getIndex() {
public String toString() {
return "Deposit{"
+ "pubKey="
+ pubKey
+ pubkey
+ ", withdrawalCredentials="
+ depositWithdrawalCredentials
+ ", amount="
Expand All @@ -109,7 +109,7 @@ public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Deposit that = (Deposit) o;
return Objects.equals(pubKey, that.pubKey)
return Objects.equals(pubkey, that.pubkey)
&& Objects.equals(depositWithdrawalCredentials, that.depositWithdrawalCredentials)
&& Objects.equals(amount, that.amount)
&& Objects.equals(signature, that.signature)
Expand All @@ -118,6 +118,6 @@ public boolean equals(final Object o) {

@Override
public int hashCode() {
return Objects.hash(pubKey, depositWithdrawalCredentials, amount, signature, index);
return Objects.hash(pubkey, depositWithdrawalCredentials, amount, signature, index);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class DepositEncoder {

public static void encode(final Deposit deposit, final RLPOutput rlpOutput) {
rlpOutput.startList();
rlpOutput.writeBytes(deposit.getPublicKey());
rlpOutput.writeBytes(deposit.getPubkey());
rlpOutput.writeBytes(deposit.getWithdrawalCredentials());
rlpOutput.writeUInt64Scalar(deposit.getAmount());
rlpOutput.writeBytes(deposit.getSignature());
Expand Down
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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 = '5koUOxNHaYeuIFYH2PP/6RdMO1JvCm0ILdl/DyY297Y='
knownHash = 'j6NRklFHlG35Pq/t6t/oJBrT8DbYOyruGq3cJNh4ENw='
}
check.dependsOn('checkAPIChanges')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface Deposit {
*
* @return public key of sender
*/
PublicKey getPublicKey();
PublicKey getPubkey();

/**
* Withdrawal credential that contains info that will be used for verifying the destination of
Expand Down