Skip to content

Mtmu integration#3608

Open
julianlen wants to merge 171 commits into
feat/add-max-tx-size-integrationfrom
mtmu-integration
Open

Mtmu integration#3608
julianlen wants to merge 171 commits into
feat/add-max-tx-size-integrationfrom
mtmu-integration

Conversation

@julianlen

Copy link
Copy Markdown
Contributor

Description

Motivation and Context

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)
  • Other information:

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@julianlen
julianlen changed the base branch from feat/calculate-tx-size-more-accurate to master July 1, 2026 21:16
ReleaseTransactionBuilder.BuildResult migrationTransactionResult = createMigrationTransaction(retiringFederationWallet, activeFederationAddress);
ReleaseTransactionBuilder.BuildResult migrationTransactionResult = activations.isActive(RSKIP455) ?
createMigrationTransaction(retiringFederationWallet, activeFederationAddress) :
createMigrationTransactionLegacy(retiringFederationWallet, activeFederationAddress);
Comment thread rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java Dismissed
Comment thread rskj-core/src/test/java/co/rsk/peg/BridgeUtilsLegacyTest.java Dismissed
Comment thread rskj-core/src/test/java/co/rsk/peg/BridgeUtilsLegacyTest.java Dismissed
Comment thread rskj-core/src/test/java/co/rsk/peg/BridgeUtilsLegacyTest.java Dismissed
}

// Add outputs
Address randomAddress = PegTestUtils.createRandomP2PKHBtcAddress(networkParameters);
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

RSKj Core Automated Tests

rskj node built from mtmu-integration.

Suite Result Branch tested Run
JSON-RPC ✅ success main run
Hardhat ✅ success main run
K6 ✅ success main run

@julianlen
julianlen changed the base branch from master to feat/calculate-tx-size-more-accurate July 2, 2026 21:04
@julia-zack
julia-zack force-pushed the feat/calculate-tx-size-more-accurate branch from ce13402 to 989935a Compare July 3, 2026 14:47
Base automatically changed from feat/calculate-tx-size-more-accurate to feat/add-max-tx-size-integration July 7, 2026 12:48
@julia-zack
julia-zack force-pushed the feat/add-max-tx-size-integration branch from 1eedb55 to d58b15d Compare July 7, 2026 13:23
@marcos-iov
marcos-iov force-pushed the feat/add-max-tx-size-integration branch from c71b9cb to 0d3b18d Compare July 10, 2026 12:21
@marcos-iov
marcos-iov requested a review from Copilot July 10, 2026 12:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates “MTMU” behavior for federation funds migration by introducing RSKIP455 and updating the bridge migration flow to support migration transactions with multiple outputs (and updated max inputs), including new constants, activation wiring, and extensive test coverage updates across peg/migration scenarios.

Changes:

  • Added RSKIP455 to consensus rules and activation configuration templates (reference.conf/expected.conf) and updated activation test fixtures.
  • Updated bridge constants to include migration-specific limits/thresholds (max inputs/outputs and per-output migration value) and added output-splitting logic in BridgeUtils.
  • Refactored migration processing in BridgeSupport to build multi-output migration transactions post-RSKIP455, and updated/expanded tests to validate new behavior.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java Refactors migration processing flow; switches to legacy vs post-RSKIP455 builder paths and updates clearing behavior.
rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java Adds calculation of migration output values (single vs fixed-value vs evenly distributed outputs).
rskj-core/src/main/java/co/rsk/peg/ReleaseTransactionBuilder.java Changes migration tx builder to accept a list of output values (multi-output support).
rskj-core/src/main/java/co/rsk/peg/constants/BridgeConstants.java Introduces migration-related constants (max inputs/outputs, per-output value) and activation-based max-input selection.
rskj-core/src/main/java/co/rsk/peg/constants/BridgeMainNetConstants.java Sets new migration constants for mainnet.
rskj-core/src/main/java/co/rsk/peg/constants/BridgeTestNetConstants.java Sets new migration constants for testnet.
rskj-core/src/main/java/co/rsk/peg/constants/BridgeRegTestConstants.java Sets new migration constants for regtest.
rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java Adds RSKIP455 consensus rule identifier.
rskj-core/src/main/resources/reference.conf Wires rskip455 to the tbd1000 upgrade in the reference configuration.
rskj-core/src/main/resources/expected.conf Adds rskip455 placeholder entry for config generation expectations.
rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java Updates activation config parsing expectations to include rskip455.
rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigsForTest.java Adds RSKIP455 to the tbd1000 activation set used by tests.
rskj-core/src/test/java/co/rsk/peg/ReleaseTransactionAssertions.java Adds assertions for multi-output migration transactions and tx-size checks.
rskj-core/src/test/java/co/rsk/peg/ReleaseTransactionBuilderTest.java Updates migration tx tests to pass lists and adds multi-output migration coverage.
rskj-core/src/test/java/co/rsk/peg/BridgeUtilsTest.java Adds dedicated tests for calculateMigrationTransactionOutputsValues across thresholds and boundaries.
rskj-core/src/test/java/co/rsk/peg/BridgeSupportTestUtil.java Adds helper for inserting multiple flyover UTXOs into storage.
rskj-core/src/test/java/co/rsk/peg/BridgeSupportProcessFundsMigrationTest.java Large expansion/refactor of migration tests to validate RSKIP455 behavior across many UTXO/value cases.
rskj-core/src/test/java/co/rsk/peg/federation/FederationChangeIT.java Updates integration test to account for post-RSKIP455 “migrate then clear” two-call behavior.
rskj-core/src/test/java/co/rsk/peg/constants/BridgeConstantsTest.java Adds tests for new migration constants and removes redundant @ParameterizedTest() parentheses.

Comment on lines +1296 to 1300
logger.error(
"[processFundsMigration] Unable to complete retiring federation migration. Balance left: {} in {}",
retiringFederationWallet.getBalance().toFriendlyString(),
retiringFederationWallet.getWatchedAddresses()
);
* In the future, we are performing tests to see whether any migration transactions ever hit
* that federation's balance <= feePerKb/2. If not, this guard can be removed entirely.
*/
@Deprecated(since="TBD1000")
/**
* @deprecated Use {@link #createMigrationTransaction(Wallet, Address)} instead.
*/
@Deprecated(since="TBD1000")
@sonarqubecloud

Copy link
Copy Markdown

@marcos-iov
marcos-iov force-pushed the feat/add-max-tx-size-integration branch 2 times, most recently from e3e4abe to 24f209e Compare July 21, 2026 17:12
julianlen and others added 22 commits July 21, 2026 16:12
…Age can decide when to clear retiring federation
…fed tests in BridgeSupportProcessFundsMigrationTest
…calling assertReleaseWasSettled and now checking assertMigrationTxCountx within a bigger assertion
@marcos-iov
marcos-iov marked this pull request as ready for review July 21, 2026 19:13
@marcos-iov
marcos-iov requested a review from a team as a code owner July 21, 2026 19:13
Copilot AI review requested due to automatic review settings July 21, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java:1293

  • In processFundsMigrationPastMigrationAge, a failed or thrown migration build leaves migrationTransactionCreated false, which causes the retiring federation to be cleared post-RSKIP455 even when the failure could be transient (e.g., INSUFFICIENT_MONEY / EXCEED_MAX_TRANSACTION_SIZE / COULD_NOT_ADJUST_DOWNWARDS), and also clears on exceptions without logging the stacktrace. This risks stopping further migration attempts while funds may still be present. Consider: (1) log the exception, (2) don’t clear on exceptions, and (3) post-RSKIP455 only clear when the builder response is definitively non-recoverable (e.g., DUSTY_SEND_REQUESTED).
        try {
            ReleaseTransactionBuilder.BuildResult migrationTransactionResult = buildMigrationTransaction(rskTxHash, retiringFederationWallet);
            migrationTransactionCreated = isMigrationTransactionCreated(migrationTransactionResult);
            if (migrationTransactionCreated) {
                settleMigrationTransaction(migrationTransactionResult, rskTxHash, availableUTXOs);

@marcos-iov
marcos-iov force-pushed the feat/add-max-tx-size-integration branch from 4bc5737 to 37edc01 Compare July 21, 2026 19:24
@fmacleal
fmacleal force-pushed the feat/add-max-tx-size-integration branch from 37edc01 to f684b69 Compare July 21, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants