Skip to content

Commit

Permalink
Replace tbd600 references for arrowhead600 in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-iov committed Dec 11, 2023
1 parent 71d1029 commit edda853
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class BridgeSupportRegisterBtcTransactionTest {
private static final NetworkParameters btcMainnetParams = bridgeMainnetConstants.getBtcParams();

private static final ActivationConfig.ForBlock fingerrootActivations = ActivationConfigsForTest.fingerroot500().forBlock(0);
private static final ActivationConfig.ForBlock tbd600Activations = ActivationConfigsForTest.arrowhead600().forBlock(0);
private static final ActivationConfig.ForBlock arrowhead600Activations = ActivationConfigsForTest.arrowhead600().forBlock(0);

private static final Coin minimumPeginTxValue = bridgeMainnetConstants.getMinimumPeginTxValue(ActivationConfigsForTest.all().forBlock(0));
private static final Coin belowMinimumPeginTxValue = minimumPeginTxValue.minus(Coin.SATOSHI);
Expand Down Expand Up @@ -147,7 +147,7 @@ private void assertUnknownTxIsProcessedAsPegin(RskAddress expectedRskAddressToBe
Assertions.assertTrue(retiringFederationUtxos.isEmpty());
}

// After tbd600Activations but before grace period
// After arrowhead600Activations but before grace period
private void assertUnknownTxIsRejectedWithInvalidAmountReason(BtcTransaction btcTransaction) throws IOException {
verify(bridgeEventLogger, times(1)).logRejectedPegin(btcTransaction, INVALID_AMOUNT);
verify(bridgeEventLogger, times(1)).logUnrefundablePegin(btcTransaction, UnrefundablePeginReason.INVALID_AMOUNT);
Expand All @@ -157,7 +157,7 @@ private void assertUnknownTxIsRejectedWithInvalidAmountReason(BtcTransaction btc
Assertions.assertTrue(retiringFederationUtxos.isEmpty());
}

// After tbd600Activations and grace period
// After arrowhead600Activations and grace period
private void assertUnknownTxIsIgnored() throws IOException {
verify(bridgeEventLogger, never()).logRejectedPegin(any(), any());
verify(bridgeEventLogger, never()).logUnrefundablePegin(any(), any());
Expand All @@ -181,7 +181,7 @@ private void assertLegacyMultisigPeginIsRejectedAndRefunded(BtcTransaction btcTr
Assertions.assertEquals(1, pegoutsWaitingForConfirmations.getEntries().size());
}

// Before tbd600Activations is activated
// Before arrowhead600Activations is activated
private void assertLegacyUndeterminedSenderPeginIsRejectedAsPeginV1InvalidPayloadBeforeRSKIP379(BtcTransaction btcTransaction) throws IOException {
verify(bridgeEventLogger, times(1)).logRejectedPegin(
btcTransaction, PEGIN_V1_INVALID_PAYLOAD
Expand All @@ -202,7 +202,7 @@ private void assertLegacyUndeterminedSenderPeginIsRejectedAsPeginV1InvalidPayloa
Assertions.assertTrue(pegoutsWaitingForConfirmations.getEntries().isEmpty());
}

// After tbd600Activations is activated
// After arrowhead600Activations is activated
private void assertLegacyUndeterminedSenderPeginIsRejected(BtcTransaction btcTransaction) throws IOException {
verify(bridgeEventLogger, times(1)).logRejectedPegin(
btcTransaction, RejectedPeginReason.LEGACY_PEGIN_UNDETERMINED_SENDER
Expand Down Expand Up @@ -237,24 +237,24 @@ private static Stream<Arguments> common_args() {

// after RSKIP379 activation but before blockNumber to start using Pegout Index
Arguments.of(
tbd600Activations,
arrowhead600Activations,
false,
false
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
false,
true
),

// after RSKIP379 activation and after blockNumber to start using Pegout Index
Arguments.of(
tbd600Activations,
arrowhead600Activations,
true,
false
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
true,
true
)
Expand All @@ -270,12 +270,12 @@ private static Stream<Arguments> pre_and_post_rskip379_args() {
),
// after RSKIP379 activation but before blockNumber to start using Pegout Index
Arguments.of(
tbd600Activations,
arrowhead600Activations,
false
),
// after RSKIP379 activation and after blockNumber to start using Pegout Index
Arguments.of(
tbd600Activations,
arrowhead600Activations,
true
)
);
Expand Down Expand Up @@ -311,50 +311,50 @@ private static Stream<Arguments> btc_transaction_sending_funds_to_unknown_addres


Arguments.of(
tbd600Activations,
arrowhead600Activations,
false,
false,
false
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
false,
true,
false
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
false,
true,
true
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
false,
false,
true
),

Arguments.of(
tbd600Activations,
arrowhead600Activations,
true,
false,
false
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
true,
true,
false
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
true,
true,
true
),
Arguments.of(
tbd600Activations,
arrowhead600Activations,
true,
false,
true
Expand Down Expand Up @@ -385,7 +385,7 @@ void init() throws IOException {
bridgeMainnetConstants.getBtcParams(),
bridgeMainnetConstants.getErpFedPubKeysList(),
bridgeMainnetConstants.getErpFedActivationDelay(),
tbd600Activations
arrowhead600Activations
);

activeFedSigners = BitcoinTestUtils.getBtcEcKeysFromSeeds(
Expand All @@ -399,7 +399,7 @@ void init() throws IOException {
bridgeMainnetConstants.getBtcParams(),
bridgeMainnetConstants.getErpFedPubKeysList(),
bridgeMainnetConstants.getErpFedActivationDelay(),
tbd600Activations
arrowhead600Activations
);

mockFactory = mock(BtcBlockStoreWithCache.Factory.class);
Expand Down Expand Up @@ -429,7 +429,7 @@ void init() throws IOException {

// Set executionBlock right after the migration should start
long blockNumber = activeFederation.getCreationBlockNumber() +
bridgeMainnetConstants.getFederationActivationAge(tbd600Activations) +
bridgeMainnetConstants.getFederationActivationAge(arrowhead600Activations) +
bridgeMainnetConstants.getFundsMigrationAgeSinceActivationBegin() +
1;
rskExecutionBlock = mock(Block.class);
Expand Down Expand Up @@ -560,11 +560,11 @@ void registering_btc_transaction_sending_funds_to_unknown_address(
if (activations == fingerrootActivations) {
assertUnknownTxIsProcessedAsPegin(rskAddress, btcTransaction, 0);
}
// tbd600Activations but before grace period - unknown tx should be rejected
else if (activations == tbd600Activations && !shouldUsePegoutTxIndex) {
// arrowhead600Activations but before grace period - unknown tx should be rejected
else if (activations == arrowhead600Activations && !shouldUsePegoutTxIndex) {
assertUnknownTxIsRejectedWithInvalidAmountReason(btcTransaction);
}
// tbd600Activations and after grace period - unknown tx are just ignored
// arrowhead600Activations and after grace period - unknown tx are just ignored
else {
assertUnknownTxIsIgnored();
}
Expand Down Expand Up @@ -620,11 +620,11 @@ void registering_btc_v1_transaction_sending_funds_to_unknown_address(
if (activations == fingerrootActivations) {
assertUnknownTxIsProcessedAsPegin(rskAddress, btcTransaction, 1);
}
// tbd600Activations but before grace period - unknown tx should be rejected
else if (activations == tbd600Activations && !shouldUsePegoutTxIndex) {
// arrowhead600Activations but before grace period - unknown tx should be rejected
else if (activations == arrowhead600Activations && !shouldUsePegoutTxIndex) {
assertUnknownTxIsRejectedWithInvalidAmountReason(btcTransaction);
}
// tbd600Activations and after grace period - unknown tx are just ignored
// arrowhead600Activations and after grace period - unknown tx are just ignored
else {
assertUnknownTxIsIgnored();
}
Expand Down Expand Up @@ -677,11 +677,11 @@ void registering_btc_transaction_many_outputs_to_unknown_addresses(
if (activations == fingerrootActivations) {
assertUnknownTxIsProcessedAsPegin(rskAddress, btcTransaction, 0);
}
// tbd600Activations but before grace period - unknown tx should be rejected
else if (activations == tbd600Activations && !shouldUsePegoutTxIndex) {
// arrowhead600Activations but before grace period - unknown tx should be rejected
else if (activations == arrowhead600Activations && !shouldUsePegoutTxIndex) {
assertUnknownTxIsRejectedWithInvalidAmountReason(btcTransaction);
}
// tbd600Activations and after grace period - unknown tx are just ignored
// arrowhead600Activations and after grace period - unknown tx are just ignored
else {
assertUnknownTxIsIgnored();
}
Expand Down Expand Up @@ -1395,7 +1395,7 @@ void pegin_to_retiring_fed_cannot_be_processed(
);

// assert
if (activations == tbd600Activations){
if (activations == arrowhead600Activations){
assertLegacyUndeterminedSenderPeginIsRejected(btcTransaction);
} else {
assertLegacyUndeterminedSenderPeginIsRejectedAsPeginV1InvalidPayloadBeforeRSKIP379(btcTransaction);
Expand Down Expand Up @@ -1449,7 +1449,7 @@ void pegin_legacy_from_segwit_to_active_fed_cannot_be_processed(
// assert

// SINCE RSKIP379 ONLY TRANSACTIONS THAT REALLY ARE PROCESSED, REFUNDS OR REGISTER WILL BE MARK AS PROCESSED.
if (activations == tbd600Activations){
if (activations == arrowhead600Activations){
assertLegacyUndeterminedSenderPeginIsRejected(btcTransaction);
} else {
assertLegacyUndeterminedSenderPeginIsRejectedAsPeginV1InvalidPayloadBeforeRSKIP379(btcTransaction);
Expand Down Expand Up @@ -1498,7 +1498,7 @@ void invalid_pegin_v1_from_multisig_to_active_fed_cannot_be_processed(
);

// assert
if (activations == tbd600Activations){
if (activations == arrowhead600Activations){

} else {
assertLegacyUndeterminedSenderPeginIsRejectedAsPeginV1InvalidPayloadBeforeRSKIP379(btcTransaction);
Expand Down Expand Up @@ -1582,7 +1582,7 @@ void pegout_sighash_no_exists_in_provider() throws BlockStoreException, BridgeIl
when(provider.getOldFederation()).thenReturn(retiringFederation);

// act
BridgeSupport bridgeSupport = buildBridgeSupport(tbd600Activations);
BridgeSupport bridgeSupport = buildBridgeSupport(arrowhead600Activations);
bridgeSupport.registerBtcTransaction(
rskTx,
btcTransaction.bitcoinSerialize(),
Expand Down Expand Up @@ -1905,7 +1905,7 @@ void migration_sighash_no_exists_in_provider() throws BlockStoreException, Bridg
when(provider.getOldFederation()).thenReturn(retiringFederation);

// act
BridgeSupport bridgeSupport = buildBridgeSupport(tbd600Activations);
BridgeSupport bridgeSupport = buildBridgeSupport(arrowhead600Activations);
bridgeSupport.registerBtcTransaction(
rskTx,
btcTransaction.bitcoinSerialize(),
Expand Down Expand Up @@ -2173,11 +2173,11 @@ void flyover_pegin(
if (activations == fingerrootActivations) {
assertUnknownTxIsProcessedAsPegin(rskAddress, btcTransaction, 0);
}
// tbd600Activations but before grace period - unknown tx should be rejected
else if (activations == tbd600Activations && !shouldUsePegoutTxIndex) {
// arrowhead600Activations but before grace period - unknown tx should be rejected
else if (activations == arrowhead600Activations && !shouldUsePegoutTxIndex) {
assertUnknownTxIsRejectedWithInvalidAmountReason(btcTransaction);
}
// tbd600Activations and after grace period - unknown tx are just ignored
// arrowhead600Activations and after grace period - unknown tx are just ignored
else {
assertUnknownTxIsIgnored();
}
Expand Down Expand Up @@ -2246,11 +2246,11 @@ void flyover_segwit_pegin(
if (activations == fingerrootActivations) {
assertUnknownTxIsProcessedAsPegin(rskAddress, btcTransaction, 0);
}
// tbd600Activations but before grace period - unknown tx should be rejected
else if (activations == tbd600Activations && !shouldUsePegoutTxIndex) {
// arrowhead600Activations but before grace period - unknown tx should be rejected
else if (activations == arrowhead600Activations && !shouldUsePegoutTxIndex) {
assertUnknownTxIsRejectedWithInvalidAmountReason(btcTransaction);
}
// tbd600Activations and after grace period - unknown tx are just ignored
// arrowhead600Activations and after grace period - unknown tx are just ignored
else {
assertUnknownTxIsIgnored();
}
Expand Down
Loading

0 comments on commit edda853

Please sign in to comment.