Mtmu integration#3608
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
| ReleaseTransactionBuilder.BuildResult migrationTransactionResult = createMigrationTransaction(retiringFederationWallet, activeFederationAddress); | ||
| ReleaseTransactionBuilder.BuildResult migrationTransactionResult = activations.isActive(RSKIP455) ? | ||
| createMigrationTransaction(retiringFederationWallet, activeFederationAddress) : | ||
| createMigrationTransactionLegacy(retiringFederationWallet, activeFederationAddress); |
| } | ||
|
|
||
| // Add outputs | ||
| Address randomAddress = PegTestUtils.createRandomP2PKHBtcAddress(networkParameters); |
ce13402 to
989935a
Compare
b52c887 to
a79e94b
Compare
1eedb55 to
d58b15d
Compare
03393f5 to
c2504c4
Compare
c71b9cb to
0d3b18d
Compare
9050b84 to
d23c27b
Compare
There was a problem hiding this comment.
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
BridgeSupportto 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. |
| 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") |
|
e3e4abe to
24f209e
Compare
…Age can decide when to clear retiring federation
…fed tests in BridgeSupportProcessFundsMigrationTest
…calling assertReleaseWasSettled and now checking assertMigrationTxCountx within a bigger assertion
e18fe97 to
11a3f4d
Compare
There was a problem hiding this comment.
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 leavesmigrationTransactionCreatedfalse, 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);
4bc5737 to
37edc01
Compare
37edc01 to
f684b69
Compare



Description
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: