Skip to content

Fix (#2095): Stabilize ErgoTransactionSpec by using proper Try pattern matching#2267

Open
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-2095
Open

Fix (#2095): Stabilize ErgoTransactionSpec by using proper Try pattern matching#2267
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-2095

Conversation

@dimension-drifter
Copy link

Problem

Fixes #2095

The ErgoTransactionSpec test was unstable and occasionally failing in CI. The root cause was the use of unsafe .toEither.left.get when checking for expected exceptions in the "context extension with neg id" and "context extension with neg and pos ids" test cases.

###This pattern has a critical flaw:

  • If (txTry) is unexpectedly a Success instead of Failure, calling .left.get on a Right throws NoSuchElementException
  • This causes the test to fail with a confusing error message rather than the actual assertion failure
  • The behavior is non-deterministic if there are race conditions or timing issues in the underlying prover logic

###Solution
Replace the unsafe .toEither.left.get pattern with proper scala.util

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.

ErgoTransactionSpec is unstable

1 participant