RSKIP559: Fix pegouts ordering#559
Open
wlaclaw wants to merge 1 commit into
Open
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Manifest Files |
There was a problem hiding this comment.
Pull request overview
Adds a new RSKIP document (RSKIP-559) describing a deterministic pegout-selection ordering fix, and registers it in the repository index and author list.
Changes:
- Added
IPs/RSKIP559.md(Draft) describing the proposed deterministic ordering rule forgetNextPegoutWithEnoughConfirmations. - Updated
README.mdto list RSKIP-559 and add author initialsVZto the Author Index.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| README.md | Registers RSKIP-559 in the main RSKIP list and adds the new author initials entry. |
| IPs/RSKIP559.md | Introduces the Draft RSKIP text and metadata for the pegouts ordering determinism change. |
Comments suppressed due to low confidence (1)
IPs/RSKIP559.md:52
- The document currently ends without the standard
## Referencesand### Copyrightsections present in the RSKIP template (IPs/RSKIP0_TEMPLATE.md) and recent RSKIPs (e.g.IPs/RSKIP551.md). This is needed for completeness and licensing clarity.
Considering that testnet 3 is near EOL it is unreasonable to introduce additional complexity
with state mutation for historical pegouts while it is not required for the mainnet.
I suggest to do not harcode conflicting pegouts and leave old sorting code until testnet 3 will be dismissed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | 551 |[Deprecate RSKIP459](IPs/RSKIP551.md)| 18-MAR-26 | MI | Usa | Core | 1 | Adopted | | ||
| | 552 |[Improve Blake2F Input Validation](IPs/RSKIP552.md)| 16-MAR-2026 | FML | Sec | Core | 1 | Adopted | | ||
| | 553 |[Network Upgrade: Vetiver](IPs/RSKIP553.md)| 23-MAR-2026 | AE | Usa, Sca, Sec | Core | 2 | Adopted | | ||
| | 559 |[Fix waiting pegouts ordering](IPs/RSKIP559.md)| 16-APR-2026 | VZ | Sec | Core | 2 | Draft | |
Comment on lines
+2
to
+10
| rskip: 559 | ||
| title: Deterministic next pegout selection fix | ||
| description: Introduce a clear solution for selecting the next pegout with enough confirmations | ||
| status: Draft | ||
| purpose: Sec | ||
| author: VZ | ||
| layer: Core | ||
| complexity: 2 | ||
| created: 16-APR-26 |
Comment on lines
+58
to
+66
| ## Testnet v3 additional logic | ||
|
|
||
| `PegoutsWaitingForConfirmation` storage is mutable, | ||
| it updates after processing of the output taken from `getNextPegoutWithEnoughConfirmations` is finished. | ||
| On the testnet there are several blocks where the next pegout is requested multiple times per block. | ||
|
|
||
| Considering this additional logic is required to search for the hardcoded pegout. | ||
| Also, for historical blocks, a sequence of pegouts should be saved for such cases. | ||
|
|
Comment on lines
+53
to
+54
| No logic branching is required - hardcoded pegouts exist only before the hard fork, | ||
| this covers all cases where the new selection logic differs from the historical one. |
Comment on lines
+17
to
+24
| It was determined that the output of `getNextPegoutWithEnoughConfirmations` is almost non-deterministic. | ||
| We return the first valid match from a collection whose iteration order depends on the JDK's internal implementation. | ||
| This is why we had issues when switching to Java 21. | ||
|
|
||
| Such behavior is very hard to predict and it effectively binds nodes to a specific set of JDK versions. | ||
| Replicating this behavior in any other programming language is extremely hard. | ||
|
|
||
| Elements ordering algorithm must be clear and easy to understand. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related PR to RSKJ is here: rsksmart/rskj#3507