-
Notifications
You must be signed in to change notification settings - Fork 268
Added a test to check what is the maximum number of inputs allowed #3405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mtmu-integration
Are you sure you want to change the base?
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds tests to verify the maximum number of inputs allowed in Bitcoin pegout transactions while staying within the Bitcoin standard transaction size limit. The changes include updates to the PegoutTransactionBuilder to accept custom script signatures, a new utility method for calculating SegWit transaction virtual size, and two test cases that verify transaction sizes with different input counts.
- Added
calculateSignedSegwitBtcTxVirtualSizeutility method for calculating transaction virtual sizes - Updated
PegoutTransactionBuilder.withInputto accept a script parameter instead of hardcoding an empty byte array - Added tests verifying that 150 inputs stay below the limit while 210 inputs exceed it
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rskj-core/src/main/java/co/rsk/peg/BridgeUtils.java | Extracted virtual byte calculation into reusable methods and added public method for calculating SegWit transaction virtual size |
| rskj-core/src/test/java/co/rsk/peg/BridgeUtilsTest.java | Added test case to verify virtual size calculation using a real SegWit transaction |
| rskj-core/src/test/java/co/rsk/peg/ReleaseTransactionBuilderTest.java | Added tests verifying transaction size limits with varying input counts and refactored UTXO generation helper |
| rskj-core/src/test/java/co/rsk/test/builders/PegoutTransactionBuilder.java | Modified withInput method to accept script parameter for more flexible test setup |
| rskj-core/src/test/java/co/rsk/peg/BridgeSupportSvpTest.java | Updated test calls to match new withInput signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rskj-core/src/test/java/co/rsk/peg/ReleaseTransactionBuilderTest.java
Outdated
Show resolved
Hide resolved
rskj-core/src/test/java/co/rsk/peg/ReleaseTransactionBuilderTest.java
Outdated
Show resolved
Hide resolved
1044f07 to
9fbd0d3
Compare
There was a problem hiding this comment.
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 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
As a comment, the method |
| // act | ||
| int actualVirtualBytes = calculateSignedSegwitBtcTxVirtualSize(btcTx); | ||
|
|
||
| //assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| //assert | |
| // assert |
| return baseSize + signingSize; | ||
| } | ||
|
|
||
| public static int calculateSignedSegwitBtcTxVirtualSize(BtcTransaction btcTx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public static int calculateSignedSegwitBtcTxVirtualSize(BtcTransaction btcTx) { | |
| public static int calculateBtcTxVirtualSize(BtcTransaction btcTx) { |
you are not using anywhere the segwit nor the signed part right?
| int actualVirtualBytes = calculateSignedSegwitBtcTxVirtualSize(btcTx); | ||
|
|
||
| //assert | ||
| Assertions.assertEquals(expectedVirtualBytes, actualVirtualBytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very very nice



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