You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since beacon objects are immutable, message signing is typically performed with the following steps:
1 construct an object with empty signature
2 sign the object (construct an appropriate signature)
3 re-construct the object with the signature
The re-construction of object introduces code duplication, which can lead to a bug (the second object re-constructed with a different value). And reduces readability.
A better solution is to add an updateSignature (or withSignature) method, which will encapsulate copying re-construction of the source object with the signature field updated.
public DepositData updateSignature(BLSSignature signature) {
return new DepositData(getPubKey(), getWithdrawalCredentials(), getAmount(), signature);
}
Or even encapsulate signing procedure in a helper function, e.g.
Since beacon objects are immutable, message signing is typically performed with the following steps:
1 construct an object with empty signature
2 sign the object (construct an appropriate signature)
3 re-construct the object with the signature
For example,
beacon-chain-java/consensus/src/test/java/org/ethereum/beacon/consensus/TestUtils.java
Line 42 in aa452ce
The re-construction of object introduces code duplication, which can lead to a bug (the second object re-constructed with a different value). And reduces readability.
A better solution is to add an updateSignature (or withSignature) method, which will encapsulate copying re-construction of the source object with the signature field updated.
Or even encapsulate signing procedure in a helper function, e.g.
The text was updated successfully, but these errors were encountered: