Skip to content

Deploy strategies use three different exception types for empty-array fault #4732

Closed

Description

@Yicong-Huang

What happened?

Calling next() on a deploy strategy whose available array is empty produces a different exception per strategy:

  • OneOnEach: IndexOutOfBoundsException
  • RoundRobinDeployment: ArithmeticException (divide-by-zero on index = (index + 1) % length)
  • RandomDeployment: IllegalArgumentException (Random.nextInt(0) rejects bound 0)

The shared DeployStrategy trait gives no contract for the empty-array case, but a unified failure mode would make callers easier to write.

How to reproduce?

For each strategy, init with Array.empty[Address] and call next():

OneOnEach().tap(_.initialize(Array.empty)).next()           // IndexOutOfBoundsException
RoundRobinDeployment().tap(_.initialize(Array.empty)).next() // ArithmeticException
RandomDeployment().tap(_.initialize(Array.empty)).next()    // IllegalArgumentException

Version

1.1.0-incubating (Pre-release/Master)

Activity

  1. added theissue type on May 3, 2026
  2. Ma77Ball commented on May 11, 2026

    @Ma77Ball
    Contributor

    /take

  3. added a commit that references this issue on May 19, 2026
    a54518c
  4. added a commit that references this issue on Jun 22, 2026
    18cd6c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions