Skip to content

Commit

Permalink
Refactored tests to remove logic that do not include locking cap rski…
Browse files Browse the repository at this point in the history
…p in certain tests
  • Loading branch information
nathanieliov authored and marcos-iov committed Feb 16, 2024
1 parent 171193b commit c8d41fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ public void setPegoutTxSigHash(Sha256Hash sigHash) {
pegoutTxSigHashes.add(sigHash);
}

private void savePegoutTxSigHashes() {
protected void savePegoutTxSigHashes() {
if (!activations.isActive(RSKIP379) || pegoutTxSigHashes == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ void hasPegoutTxSigHash_passing_existing_sigHash() throws IOException {
void setPegoutTxSigHash_null(boolean isRskip379HardForkActive) throws IOException {
// Arrange
ActivationConfig.ForBlock activations = isRskip379HardForkActive ?
getArrowHeadActivationExceptLockingCap() :
getFingerrootActivationsExceptLockingCap();
ActivationConfigsForTest.arrowhead600().forBlock(0) :
ActivationConfigsForTest.fingerroot500().forBlock(0);

Repository repository = mock(Repository.class);

Expand All @@ -301,7 +301,7 @@ void setPegoutTxSigHash_null(boolean isRskip379HardForkActive) throws IOExceptio

// Act
provider.setPegoutTxSigHash(null);
provider.save();
provider.savePegoutTxSigHashes();

// Assert
verify(repository, never()).getStorageBytes(
Expand All @@ -321,8 +321,8 @@ void setPegoutTxSigHash_null(boolean isRskip379HardForkActive) throws IOExceptio
void setPegoutTxSigHash_non_null(boolean isRskip379HardForkActive, Sha256Hash sigHash) throws IOException {
// Arrange
ActivationConfig.ForBlock activations = isRskip379HardForkActive ?
getArrowHeadActivationExceptLockingCap() :
getFingerrootActivationsExceptLockingCap();
ActivationConfigsForTest.arrowhead600().forBlock(0) :
ActivationConfigsForTest.fingerroot500().forBlock(0);

Repository repository = mock(Repository.class);
BridgeStorageProvider provider = new BridgeStorageProvider(
Expand All @@ -334,7 +334,7 @@ void setPegoutTxSigHash_non_null(boolean isRskip379HardForkActive, Sha256Hash si

// Act
provider.setPegoutTxSigHash(sigHash);
provider.save();
provider.savePegoutTxSigHashes();

// Assert
if (isRskip379HardForkActive) {
Expand Down Expand Up @@ -362,14 +362,6 @@ void setPegoutTxSigHash_non_null(boolean isRskip379HardForkActive, Sha256Hash si
}
}

private ActivationConfig.ForBlock getFingerrootActivationsExceptLockingCap() {
return ActivationConfigsForTest.fingerroot500(Collections.singletonList(RSKIP134)).forBlock(0);
}

private ActivationConfig.ForBlock getArrowHeadActivationExceptLockingCap() {
return ActivationConfigsForTest.arrowhead600(Collections.singletonList(RSKIP134)).forBlock(0);
}

@Test
void setPegoutTxSigHash_passing_existing() throws IOException {
// Arrange
Expand Down

0 comments on commit c8d41fe

Please sign in to comment.