Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8d33886
feat: stop looking up the pegout index after the federations pending …
julianlen Oct 21, 2026
ae7a207
feat: stop looking up the pegout index after the federations pending …
julianlen Oct 21, 2026
f111535
test: cover releases created for vetiver registered within and after …
julianlen Oct 21, 2026
3a504d1
refactor: register svp test transactions after the grace period when …
julianlen Oct 21, 2026
5d08155
test: cover svp fund tx created for vetiver registered within and aft…
julianlen Oct 21, 2026
8205bd3
refactor: build grace period release transactions with the pegout and…
julianlen Oct 22, 2026
95878f4
refactor: test the federations pending btc utxos grace period through…
julianlen Oct 22, 2026
79338aa
refactor: reuse the svp fund transaction created for vetiver arrange …
julianlen Oct 22, 2026
f0ede5e
refactor: check every input when asserting a rejected release is not …
julianlen Oct 22, 2026
e4d9e20
test: cover releases not in the pegout index for vetiver and within t…
julianlen Oct 22, 2026
63b2bcd
refactor: share the rejected and refunded release assertion between r…
julianlen Oct 22, 2026
e7ae24c
test: cover pre-RSKIP643 pegout with change below minimum pegin value…
julianlen Oct 22, 2026
a576b2a
feat: added isIdentifiedByPegoutIndex
julianlen Oct 22, 2026
67fcdd3
fix: deleeted duplicated tests
julianlen Oct 22, 2026
19e7e70
fix: use the whole input value in the vetiver pegout without change t…
julianlen Oct 22, 2026
b3f37b0
fix: format
julianlen Oct 22, 2026
d463e72
refactor: made isIdentifiedByPegoutIndex simpler
julianlen Oct 22, 2026
51398c3
fix: use registerReleaseTransaction instead
julianlen Oct 22, 2026
a8dea24
changed BTC_BLOCK_WITH_RELEASE_WITHIN_GRACE_PERIOD_HEIGHT to HEIGHT_W…
julianlen Oct 22, 2026
1409e06
test: add forVetiver cases for pegout txs
julianlen Oct 22, 2026
8b41f7c
refactor: remove RSKIP643 pegout index grace period
julianlen Oct 23, 2026
7beb02e
refactor: remove btcHeightWhenFederationsPendingBtcUTXOsActivates bri…
julianlen Oct 23, 2026
3377eb2
fix: deleted unused imports
julianlen Oct 23, 2026
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
14 changes: 1 addition & 13 deletions rskj-core/src/main/java/co/rsk/peg/PegUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static PegTxType getTransactionTypeUsingPegoutIndex(
List<TransactionOutput> liveFederationOutputs = btcTransaction.getWalletOutputs(liveFederationsWallet);

Optional<Sha256Hash> inputSigHash = BitcoinUtils.getSigHashForPegoutIndex(btcTransaction);
if (inputSigHash.isPresent() && provider.hasPegoutTxSigHash(inputSigHash.get())){
if (inputSigHash.isPresent() && provider.hasPegoutTxSigHash(inputSigHash.get())) {
return PegTxType.PEGOUT_OR_MIGRATION;
} else if (!liveFederationOutputs.isEmpty()){
return PegTxType.PEGIN;
Expand Down Expand Up @@ -143,18 +143,6 @@ private static boolean isPegoutTxIndexEnabled(
btcTransactionHeight >= heightAtWhichToStartUsingPegoutIndex;
}

private static boolean isFederationsPendingBtcUTXOsEnabled(
BridgeConstants bridgeConstants,
ActivationConfig.ForBlock activations,
long btcTransactionHeight
) {
int btcHeightWhenFederationsPendingBtcUTXOsActivates = bridgeConstants.getBtcHeightWhenFederationsPendingBtcUTXOsActivates();
int gracePeriodInBtcBlocks = bridgeConstants.getPegoutTxIndexGracePeriodInBtcBlocks();
int heightAtWhichToStartUsingFederationsPendingBtcUTXOs = btcHeightWhenFederationsPendingBtcUTXOsActivates + gracePeriodInBtcBlocks;
return activations.isActive(ConsensusRule.RSKIP643) &&
btcTransactionHeight >= heightAtWhichToStartUsingFederationsPendingBtcUTXOs;
}

private static boolean isTheSvpFundTransaction(
BridgeStorageProvider provider,
ActivationConfig.ForBlock activations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public abstract class BridgeConstants {

protected int btcHeightWhenPegoutTxIndexActivates;
protected int pegoutTxIndexGracePeriodInBtcBlocks;
protected int btcHeightWhenFederationsPendingBtcUTXOsActivates;
protected int blockWithTooMuchChainWorkHeight;

public NetworkParameters getBtcParams() {
Expand Down Expand Up @@ -154,9 +153,5 @@ public int getPegoutTxIndexGracePeriodInBtcBlocks() {
return pegoutTxIndexGracePeriodInBtcBlocks;
}

public int getBtcHeightWhenFederationsPendingBtcUTXOsActivates() {
return btcHeightWhenFederationsPendingBtcUTXOsActivates;
}

public int getBlockWithTooMuchChainWorkHeight() { return blockWithTooMuchChainWorkHeight; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ private BridgeMainNetConstants() {

btcHeightWhenPegoutTxIndexActivates = 837_589; // Estimated date Wed, 03 Apr 2024 15:00:00 GMT. 832,430 was the block number at time of calculation
pegoutTxIndexGracePeriodInBtcBlocks = THIRTY_DAYS_IN_BTC_BLOCKS;
// TODO: estimate the BTC height for the RSKIP643 activation date once it is scheduled
btcHeightWhenFederationsPendingBtcUTXOsActivates = 10_000_000;

blockWithTooMuchChainWorkHeight = 849_138;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public BridgeRegTestConstants(List<BtcECKey> federationPublicKeys) {

btcHeightWhenPegoutTxIndexActivates = 250;
pegoutTxIndexGracePeriodInBtcBlocks = 100;
// TODO: estimate the BTC height for the RSKIP643 activation date once it is scheduled
btcHeightWhenFederationsPendingBtcUTXOsActivates = btcHeightWhenPegoutTxIndexActivates + 10;

blockWithTooMuchChainWorkHeight = Integer.MAX_VALUE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public class BridgeTestNet2Constants extends BridgeConstants {
// Pegout tx index active since genesis
btcHeightWhenPegoutTxIndexActivates = 0;
pegoutTxIndexGracePeriodInBtcBlocks = 0;
// TODO: estimate the BTC height for the RSKIP643 activation date once it is scheduled
btcHeightWhenFederationsPendingBtcUTXOsActivates = 10_000_000;

blockWithTooMuchChainWorkHeight = Integer.MAX_VALUE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ public class BridgeTestNetConstants extends BridgeConstants {

btcHeightWhenPegoutTxIndexActivates = 2_589_553; // Estimated date Wed, 20 Mar 2024 15:00:00 GMT. 2,579,823 was the block number at time of calculation
pegoutTxIndexGracePeriodInBtcBlocks = 1_440; // 10 days in BTC blocks (considering 1 block every 10 minutes)
// TODO: estimate the BTC height for the RSKIP643 activation date once it is scheduled
btcHeightWhenFederationsPendingBtcUTXOsActivates = 10_000_000;

blockWithTooMuchChainWorkHeight = Integer.MAX_VALUE;
}
Expand Down

Large diffs are not rendered by default.

183 changes: 72 additions & 111 deletions rskj-core/src/test/java/co/rsk/peg/BridgeSupportSvpTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import co.rsk.peg.federation.constants.FederationConstants;
import co.rsk.peg.storage.InMemoryStorage;
import co.rsk.peg.storage.StorageAccessor;
import co.rsk.test.builders.MigrationTransactionBuilder;
import co.rsk.test.builders.PegoutTransactionBuilder;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
Expand Down
Loading
Loading