Skip to content

feat(ledger/babbage): Integer underflow issue in babbage.UtxoValidateCollateralEqBalance #1024

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

arepala-uml
Copy link
Contributor

  1. Fixed an uint underflow in UtxoValidateCollateralEqBalance by skipping validation when no valid collateral UTxOs are found.
  2. Added a unit test to ensure collateral return subtraction is skipped when collBalance is zero, avoiding invalid balance validation.

Closes #1000

…ralEqBalance when collateral UTxOs are missing

Signed-off-by: Akhil Repala <[email protected]>
@arepala-uml arepala-uml marked this pull request as ready for review June 2, 2025 23:33
@arepala-uml arepala-uml requested a review from a team as a code owner June 2, 2025 23:33
@arepala-uml arepala-uml requested review from wolf31o2 and agaffney June 2, 2025 23:33
collBalance -= collReturn.Amount()
returnAmt := collReturn.Amount()
if collBalance < returnAmt {
return errors.New("collateral return amount exceeds collateral input balance")
Copy link
Contributor

Choose a reason for hiding this comment

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

We only want to return the specific errors defined in the ledger for each era, and generally only at the end of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the changes and please review it once

…ructured errors and return at function end

Signed-off-by: Akhil Repala <[email protected]>
@arepala-uml arepala-uml requested a review from agaffney June 3, 2025 05:33
@arepala-uml arepala-uml merged commit 6d06a54 into main Jun 4, 2025
9 checks passed
@arepala-uml arepala-uml deleted the babbage_utxo branch June 4, 2025 03:41
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.

Integer underflow issue in babbage.UtxoValidateCollateralEqBalance
2 participants