Skip to content

fix: DKG share_index is 0-indexed, not 1-indexed #76

Description

@wpank

Summary

The trusted dealer DKG produces 0-indexed share indices (0, 1, 2, 3), but cli.rs assumed 1-indexed and did checked_sub(1). This caused the validator with share_index=0 to crash on startup:

Error: DKG share_index is 0 but must be >= 1 (1-indexed)

The remaining 3 validators started with incorrect validator indices (off by 1), causing wrong leader election.

Status: Fixed

cli.rs: Replaced checked_sub(1) with direct use of share_index plus bounds check.
output.rs: Updated doc comment from "1-indexed" to "0-indexed".

Both trusted dealer and interactive DKG produce 0-indexed shares, so both paths are covered.

Observed Impact

On the remote devnet (4 validators):

  • node2 (share_index=0): crash-looped continuously
  • node0 (share_index=2): ran as validator_index=1 instead of 2
  • node1 (share_index=3): ran as validator_index=2 instead of 3
  • node3 (share_index=1): ran as validator_index=0 instead of 1

See tmp/issues/31-dkg-share-index-zero-indexed.md for full details.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions