Skip to content

test(dkg): add comprehensive unit tests for DkgOutput type#71

Open
refcell wants to merge 1 commit into
mainfrom
impl-alpha/add-dkg-output-tests
Open

test(dkg): add comprehensive unit tests for DkgOutput type#71
refcell wants to merge 1 commit into
mainfrom
impl-alpha/add-dkg-output-tests

Conversation

@refcell
Copy link
Copy Markdown
Owner

@refcell refcell commented Feb 2, 2026

Summary

  • Adds 15 comprehensive unit tests for DkgOutput type in the kora-dkg crate
  • Tests cover save/load roundtrip, file existence checks, and error handling
  • Tests verify JSON validation, hex encoding/decoding, and edge cases (missing files, invalid JSON, invalid hex, empty participant keys)
  • Adds tempfile dev-dependency for temporary directory testing

Test Coverage

Test Description
test_dkg_output_save_and_load_roundtrip Verifies save/load preserves all fields
test_dkg_output_exists_* Tests exists() with various file states
test_dkg_output_load_* Tests error handling for invalid inputs
test_dkg_output_clone/debug Verifies derive macros
test_serde_json_error_conversion Tests From<serde_json::Error> impl
test_dkg_output_save_creates_pretty_json Verifies pretty-print format

- Add 15 tests covering save/load roundtrip, exists checks, error cases
- Tests verify file persistence, JSON validation, hex encoding/decoding
- Tests edge cases: missing files, invalid JSON, invalid hex, empty keys
- Add tempfile dev-dependency for temporary directory testing
faddat added a commit that referenced this pull request May 30, 2026
* Implement mempool subscriptions

* Emit TxEvicted from TransactionPool::remove()

Address review feedback on PR #71: add a production emission point for
MempoolEvent::TxEvicted when transactions are explicitly removed from
the pool.

- Introduce remove_with_reason() that emits TxEvicted with a caller-
  supplied reason string, then delegate remove() to it with reason
  "removed"
- Add tests verifying TxEvicted is broadcast on remove() and
  remove_with_reason()
- Confirm try_recv() is correct for futures-channel 0.3.32 (try_next()
  is deprecated in this version; try_recv() returns Result<T, _>)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add changelog for PR #71 pending/mempool subscriptions

Detailed changelog documenting the new eth_subscribe and kora_subscribe
WebSocket subscription endpoints, MempoolEvent lifecycle types, and the
broadcast channel architecture wiring RPC, txpool, and reporters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(reporters): include block timestamp in mempool test fixture

Agent-Logs-Url: https://github.com/Nunchi-trade/daeji/sessions/31652c6a-c886-4b8f-8717-beda8779b714

Co-authored-by: faddat <7142025+faddat@users.noreply.github.com>

---------

Co-authored-by: will pankiewicz <will@macbook.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: faddat <7142025+faddat@users.noreply.github.com>
faddat pushed a commit that referenced this pull request May 30, 2026
Resolve merge conflicts from main branch (PRs #69-#78) while preserving
PR #72's txpool eviction, cleanup, and txpool_* RPC namespace features.

Conflict resolutions:
- server.rs: Keep both txpool field/methods (PR #72) and rate limiting,
  subscriptions, connection limits (PRs #71, #74). Merged imports and
  Debug impls to include all fields.
- runner.rs: Keep txpool cleanup spawning (PR #72) alongside configurable
  params, archive recovery, strategy threading, and timestamp support
  from main. Restored Clock import needed for sleep in txpool cleanup.
  Removed unused Sequential import.
- txpool/ordering.rs: Keep PR #72's gas-price-based replacement logic
  for queued transactions, updated to use main's next_pending_nonce()
  method for nonce gap detection.
- txpool/pool.rs: Keep PR #72's ordered_tx_id() for build exclusions
  with main's saturating_add for overflow safety. Fixed test that used
  TxId(hash) directly (main's pattern) to use ordered_tx_id() (PR #72's
  pattern), and differentiated gas prices for cross-sender test data to
  avoid TxId collisions from identical envelope encodings.
- txpool.rs: Fixed v field type from U64 to U256 to match main's updated
  RpcTransaction type definition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
faddat pushed a commit that referenced this pull request May 30, 2026
Resolve conflict in runner.rs: keep pending_tx_broadcast and
mempool_broadcast from PR #71 alongside the genesis-seeded
block_index from this branch. Apply fmt fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
faddat pushed a commit that referenced this pull request May 30, 2026
Resolve conflicts between PR #71 (pending_tx_broadcast/mempool_broadcast
subscriptions) and PR #72 (txpool eviction + RPC). Both feature sets are
retained: server structs carry txpool, pending_tx_broadcast, and
mempool_broadcast fields; the transaction pool gains event broadcasting
alongside eviction logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant